Skip to content

Commit

Permalink
fix a dupe issue with the slotted book
Browse files Browse the repository at this point in the history
  • Loading branch information
IchHabeHunger54 committed Jan 6, 2025
1 parent 094eb0d commit 9ed5269
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
11 changes: 2 additions & 9 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# Additions
# Fixes

- New fancy clock and grandfather clock blocks
- Sounds for the tape measure
- Config to allow removing the various wooden and colored variants from JEI

# Changes

- Bookcases now have enchantment power depending on the amount of books in them
- Redstone: Volume 1 was renamed to Redstone Book
- Fix a dupe issue with the slotted book
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.0
mod.version=1.3.1
mod.name=Bibliocraft Legacy
mod.vendor=MinecraftschurliMods
mod.authors=IchHabeHunger54, Minecraftschurli
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.minecraftschurlimods.bibliocraft.content.slottedbook;

import com.github.minecraftschurlimods.bibliocraft.init.BCItems;
import com.github.minecraftschurlimods.bibliocraft.init.BCMenus;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.Container;
Expand All @@ -17,11 +18,20 @@ public SlottedBookMenu(int id, Inventory inventory, ItemStack stack) {
addSlot(new SlottedBookSlot(container, 0, 80, 34));
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlot(new Slot(inventory, i * 9 + j + 9, 8 + j * 18, 141 + i * 18));
int slot = i * 9 + j + 9;
if (inventory.getItem(slot).is(BCItems.SLOTTED_BOOK.get())) {
addSlot(new ReadOnlySlot(inventory, slot, 8 + j * 18, 141 + i * 18));
} else {
addSlot(new Slot(inventory, slot, 8 + j * 18, 141 + i * 18));
}
}
}
for (int i = 0; i < 9; i++) {
addSlot(new Slot(inventory, i, 8 + i * 18, 199));
if (inventory.getItem(i).is(BCItems.SLOTTED_BOOK.get())) {
addSlot(new ReadOnlySlot(inventory, i, 8 + i * 18, 199));
} else {
addSlot(new Slot(inventory, i, 8 + i * 18, 199));
}
}
}

Expand Down Expand Up @@ -67,4 +77,20 @@ public ItemStack quickMoveStack(Player player, int index) {
public boolean stillValid(Player player) {
return true;
}

private static class ReadOnlySlot extends Slot {
public ReadOnlySlot(Container container, int slot, int x, int y) {
super(container, slot, x, y);
}

@Override
public boolean mayPickup(Player player) {
return false;
}

@Override
public boolean mayPlace(ItemStack stack) {
return false;
}
}
}
2 changes: 1 addition & 1 deletion summary.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Clocks + some minor changes and additions
Fix a dupe bug

0 comments on commit 9ed5269

Please sign in to comment.