<announcer voice> double fix

fix mounted item vaults being openable, in two ways
This commit is contained in:
TropheusJ 2025-02-06 22:48:16 -05:00
parent 5b05644243
commit 75fd5a2a26
2 changed files with 17 additions and 2 deletions

View file

@ -4,6 +4,8 @@ import java.util.List;
import java.util.function.Consumer;
import java.util.function.Predicate;
import org.jetbrains.annotations.Nullable;
import net.minecraft.network.chat.Component;
import net.minecraft.world.Container;
import net.minecraft.world.MenuProvider;
@ -13,9 +15,8 @@ import net.minecraft.world.inventory.ChestMenu;
import net.minecraft.world.inventory.DispenserMenu;
import net.minecraft.world.inventory.MenuConstructor;
import net.minecraft.world.inventory.MenuType;
import net.minecraftforge.items.IItemHandlerModifiable;
import org.jetbrains.annotations.Nullable;
import net.minecraftforge.items.IItemHandlerModifiable;
/**
* Methods for creating generic menus usable by mounted storages.
@ -33,6 +34,10 @@ public class MountedStorageMenus {
if (rows < 1 || rows > 6)
return null;
// make sure rows are full
if (handler.getSlots() % 9 != 0)
return null;
MenuType<?> type = GENERIC_CHEST_MENUS.get(rows - 1);
Container wrapper = new StorageInteractionWrapper(handler, stillValid, onClose);
MenuConstructor constructor = (id, inv, player) -> new ChestMenu(type, id, inv, wrapper, rows);

View file

@ -6,13 +6,17 @@ import com.mojang.serialization.Codec;
import com.simibubi.create.AllMountedStorageTypes;
import com.simibubi.create.api.contraption.storage.item.MountedItemStorageType;
import com.simibubi.create.api.contraption.storage.item.WrapperMountedItemStorage;
import com.simibubi.create.content.contraptions.Contraption;
import com.simibubi.create.foundation.utility.CreateCodecs;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
import net.minecraftforge.items.ItemStackHandler;
public class ItemVaultMountedStorage extends WrapperMountedItemStorage<ItemStackHandler> {
@ -35,6 +39,12 @@ public class ItemVaultMountedStorage extends WrapperMountedItemStorage<ItemStack
}
}
@Override
public boolean handleInteraction(ServerPlayer player, Contraption contraption, StructureBlockInfo info) {
// vaults should never be opened.
return false;
}
@Override
public boolean providesFuel() {
return false;