Skip to content

Commit

Permalink
try fixing the dupe bug again
Browse files Browse the repository at this point in the history
  • Loading branch information
IchHabeHunger54 committed Jan 6, 2025
1 parent 6e73dc4 commit 10e07e5
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ body:
- 1.21.1-1.2.1
- 1.21.1-1.3.0
- 1.21.1-1.3.1
- 1.21.1-1.3.2
validations:
required: true
- type: input
Expand Down
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Fixes

- Fix a dupe issue with the slotted book
- Fix a dupe issue with the slotted book (again)
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ org.gradle.configuration-cache=true

mod.group=com.github.minecraftschurlimods
mod.id=bibliocraft
mod.version=1.3.1
mod.version=1.3.2
mod.name=Bibliocraft Legacy
mod.vendor=MinecraftschurliMods
mod.authors=IchHabeHunger54, Minecraftschurli
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public boolean isFoil(ItemStack stack) {
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand usedHand) {
if (level.isClientSide()) return InteractionResultHolder.success(player.getItemInHand(usedHand));
if (player instanceof ServerPlayer sp) {
sp.openMenu(new SimpleMenuProvider((id, inv, p) -> new SlottedBookMenu(id, inv, p.getItemInHand(usedHand)), getDescription()), buf -> buf.writeEnum(usedHand));
sp.openMenu(new SimpleMenuProvider((id, inv, p) -> new SlottedBookMenu(id, inv, usedHand), getDescription()), buf -> buf.writeEnum(usedHand));
}
return InteractionResultHolder.consume(player.getItemInHand(usedHand));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
import net.minecraft.world.item.ItemStack;

public class SlottedBookMenu extends AbstractContainerMenu {
public SlottedBookMenu(int id, Inventory inventory, ItemStack stack) {
private final InteractionHand hand;

public SlottedBookMenu(int id, Inventory inventory, InteractionHand hand) {
super(BCMenus.SLOTTED_BOOK.get(), id);
this.hand = hand;
ItemStack stack = inventory.player.getItemInHand(hand);
Container container = new SlottedBookContainer(stack);
addSlot(new SlottedBookSlot(container, 0, 80, 34));
for (int i = 0; i < 3; i++) {
Expand All @@ -36,7 +40,7 @@ public SlottedBookMenu(int id, Inventory inventory, ItemStack stack) {
}

public SlottedBookMenu(int id, Inventory inventory, FriendlyByteBuf buf) {
this(id, inventory, inventory.player.getItemInHand(buf.readEnum(InteractionHand.class)));
this(id, inventory, buf.readEnum(InteractionHand.class));
}

@Override
Expand Down Expand Up @@ -75,7 +79,7 @@ public ItemStack quickMoveStack(Player player, int index) {

@Override
public boolean stillValid(Player player) {
return true;
return player.getItemInHand(hand).is(BCItems.SLOTTED_BOOK.get());
}

private static class ReadOnlySlot extends Slot {
Expand Down
2 changes: 1 addition & 1 deletion summary.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Fix a dupe bug
Fix a dupe bug (again)

0 comments on commit 10e07e5

Please sign in to comment.