Skip to content

Commit 10e07e5

Browse files
try fixing the dupe bug again
1 parent 6e73dc4 commit 10e07e5

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ body:
4343
- 1.21.1-1.2.1
4444
- 1.21.1-1.3.0
4545
- 1.21.1-1.3.1
46+
- 1.21.1-1.3.2
4647
validations:
4748
required: true
4849
- type: input

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Fixes
22

3-
- Fix a dupe issue with the slotted book
3+
- Fix a dupe issue with the slotted book (again)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ org.gradle.configuration-cache=true
66

77
mod.group=com.github.minecraftschurlimods
88
mod.id=bibliocraft
9-
mod.version=1.3.1
9+
mod.version=1.3.2
1010
mod.name=Bibliocraft Legacy
1111
mod.vendor=MinecraftschurliMods
1212
mod.authors=IchHabeHunger54, Minecraftschurli

src/main/java/com/github/minecraftschurlimods/bibliocraft/content/slottedbook/SlottedBookItem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public boolean isFoil(ItemStack stack) {
2323
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand usedHand) {
2424
if (level.isClientSide()) return InteractionResultHolder.success(player.getItemInHand(usedHand));
2525
if (player instanceof ServerPlayer sp) {
26-
sp.openMenu(new SimpleMenuProvider((id, inv, p) -> new SlottedBookMenu(id, inv, p.getItemInHand(usedHand)), getDescription()), buf -> buf.writeEnum(usedHand));
26+
sp.openMenu(new SimpleMenuProvider((id, inv, p) -> new SlottedBookMenu(id, inv, usedHand), getDescription()), buf -> buf.writeEnum(usedHand));
2727
}
2828
return InteractionResultHolder.consume(player.getItemInHand(usedHand));
2929
}

src/main/java/com/github/minecraftschurlimods/bibliocraft/content/slottedbook/SlottedBookMenu.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212
import net.minecraft.world.item.ItemStack;
1313

1414
public class SlottedBookMenu extends AbstractContainerMenu {
15-
public SlottedBookMenu(int id, Inventory inventory, ItemStack stack) {
15+
private final InteractionHand hand;
16+
17+
public SlottedBookMenu(int id, Inventory inventory, InteractionHand hand) {
1618
super(BCMenus.SLOTTED_BOOK.get(), id);
19+
this.hand = hand;
20+
ItemStack stack = inventory.player.getItemInHand(hand);
1721
Container container = new SlottedBookContainer(stack);
1822
addSlot(new SlottedBookSlot(container, 0, 80, 34));
1923
for (int i = 0; i < 3; i++) {
@@ -36,7 +40,7 @@ public SlottedBookMenu(int id, Inventory inventory, ItemStack stack) {
3640
}
3741

3842
public SlottedBookMenu(int id, Inventory inventory, FriendlyByteBuf buf) {
39-
this(id, inventory, inventory.player.getItemInHand(buf.readEnum(InteractionHand.class)));
43+
this(id, inventory, buf.readEnum(InteractionHand.class));
4044
}
4145

4246
@Override
@@ -75,7 +79,7 @@ public ItemStack quickMoveStack(Player player, int index) {
7579

7680
@Override
7781
public boolean stillValid(Player player) {
78-
return true;
82+
return player.getItemInHand(hand).is(BCItems.SLOTTED_BOOK.get());
7983
}
8084

8185
private static class ReadOnlySlot extends Slot {

summary.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Fix a dupe bug
1+
Fix a dupe bug (again)

0 commit comments

Comments
 (0)