Skip to content

Commit 9e9035a

Browse files
committed
Invalidate the cache'd item handler on GooSoil when you change it's binding. Resolves #375
1 parent 6577fdc commit 9e9035a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/main/java/com/direwolf20/justdirethings/common/blockentities/GooSoilBE.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ public IItemHandler getAttachedInventory(ServerLevel serverLevel) {
4141
return attachedInventory.getCapability();
4242
}
4343

44+
public void invalidateHandler() {
45+
attachedInventory = null;
46+
}
47+
4448
@Override
4549
public void saveAdditional(CompoundTag tag, HolderLookup.Provider provider) {
4650
super.saveAdditional(tag, provider);

src/main/java/com/direwolf20/justdirethings/common/items/interfaces/ToggleableTool.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ default boolean bindSoil(UseOnContext pContext) {
530530
BlockEntity blockEntity = pLevel.getBlockEntity(clickedPos);
531531
if (blockEntity instanceof GooSoilBE gooSoilBE) {
532532
gooSoilBE.bindInventory(boundInventory);
533+
gooSoilBE.invalidateHandler();
533534
pContext.getPlayer().displayClientMessage(Component.translatable("justdirethings.boundto", Component.translatable(boundInventory.globalPos().dimension().location().getPath()), "[" + boundInventory.globalPos().pos().toShortString() + "]"), true);
534535
player.playNotifySound(SoundEvents.ENDER_EYE_DEATH, SoundSource.PLAYERS, 1.0F, 1.0F);
535536
Helpers.damageTool(heldItem, player, Ability.DROPTELEPORT);

0 commit comments

Comments
 (0)