Skip to content

Commit

Permalink
make recent values more codeclient-y
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeRNG committed Jun 27, 2024
1 parent 3b19336 commit 39476cc
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/main/java/dev/dfonline/codeclient/dev/RecentValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.random.Random;

import java.nio.file.Files;
Expand Down Expand Up @@ -78,9 +79,16 @@ public class RecentValues {
if (!(CodeClient.location instanceof Dev)) return;

ScreenEvents.afterRender(screen).register((screen1, ctx, mouseX, mouseY, tickDelta) -> {
if(recent.isEmpty() && pinned.isEmpty()) return;

int y = (int) (scaledHeight * 0.25);
int xEnd = (int) (scaledWidth * 0.25);

ctx.drawGuiTexture(new Identifier("recipe_book/overlay_recipe"), 5, y - 5,
Math.min(Math.max(pinned.size(), recent.size()),16) * 15 + 10,
(((int) Math.ceil((double) pinned.size() / 16)) + ((int) Math.ceil((double) recent.size() / 16))) * 16 + 10
);

hoveredItem = null;
hoveredOrigin = null;
for (List<ItemStack> group : List.of(pinned, recent)) {
Expand Down Expand Up @@ -112,7 +120,7 @@ public class RecentValues {
CodeClient.MC.getSoundManager().play(new PositionedSoundInstance(
SoundEvents.ENTITY_ITEM_PICKUP,
SoundCategory.PLAYERS,
2, 0.8f, Random.create(),
2, 1f, Random.create(),
CodeClient.MC.player.getBlockPos()
));

Expand All @@ -130,17 +138,17 @@ public class RecentValues {
hoveredOrigin.remove(hoveredItem);
if (hoveredOrigin == pinned) {
CodeClient.MC.getSoundManager().play(new PositionedSoundInstance(
SoundEvents.ENTITY_ARROW_HIT,
SoundEvents.UI_BUTTON_CLICK.value(),
SoundCategory.PLAYERS,
2, 0.8f, Random.create(),
2, 0.5f, Random.create(),
CodeClient.MC.player.getBlockPos()
));
return;
}
CodeClient.MC.getSoundManager().play(new PositionedSoundInstance(
SoundEvents.ENTITY_SHULKER_BULLET_HIT,
SoundEvents.UI_BUTTON_CLICK.value(),
SoundCategory.PLAYERS,
2, 0.8f, Random.create(),
2, 0.6f, Random.create(),
CodeClient.MC.player.getBlockPos()
));
pinned.add(hoveredItem);
Expand Down

0 comments on commit 39476cc

Please sign in to comment.