diff --git a/gradle.properties b/gradle.properties index 0729f42ce..958c46be6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx3G minecraft_base_version=1.12 minecraft_version=1.12.2 -mod_version=5.4.0 +mod_version=5.4.1 chameleon_version=4.1.0 chameleon_max_version=5.0.0 diff --git a/src/com/jaquadro/minecraft/storagedrawers/block/BlockDrawersCustom.java b/src/com/jaquadro/minecraft/storagedrawers/block/BlockDrawersCustom.java index 860f37083..a2db8ee14 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/block/BlockDrawersCustom.java +++ b/src/com/jaquadro/minecraft/storagedrawers/block/BlockDrawersCustom.java @@ -1,8 +1,10 @@ package com.jaquadro.minecraft.storagedrawers.block; import com.jaquadro.minecraft.chameleon.block.properties.UnlistedModelData; +import com.jaquadro.minecraft.storagedrawers.StorageDrawers; import com.jaquadro.minecraft.storagedrawers.api.storage.BlockType; import com.jaquadro.minecraft.storagedrawers.api.storage.EnumBasicDrawer; +import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer; import com.jaquadro.minecraft.storagedrawers.block.modeldata.MaterialModelData; import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers; import com.jaquadro.minecraft.storagedrawers.item.ItemCustomDrawers; @@ -73,7 +75,20 @@ protected ItemStack getMainDrop (IBlockAccess world, BlockPos pos, IBlockState s if (data == null) data = new NBTTagCompound(); - if (tile.isSealed()) { + boolean hasContents = false; + if (StorageDrawers.config.cache.keepContentsOnBreak) { + for (int i = 0; i < tile.getGroup().getDrawerCount(); i++) { + IDrawer drawer = tile.getGroup().getDrawer(i); + if (drawer != null && !drawer.isEmpty()) + hasContents = true; + } + for (int i = 0; i < tile.upgrades().getSlotCount(); i++) { + if (!tile.upgrades().getUpgrade(i).isEmpty()) + hasContents = true; + } + } + + if (tile.isSealed() || (StorageDrawers.config.cache.keepContentsOnBreak && hasContents)) { NBTTagCompound tiledata = new NBTTagCompound(); tile.writeToNBT(tiledata); data.setTag("tile", tiledata); diff --git a/src/com/jaquadro/minecraft/storagedrawers/block/tile/tiledata/FractionalDrawerGroup.java b/src/com/jaquadro/minecraft/storagedrawers/block/tile/tiledata/FractionalDrawerGroup.java index 2c09efae2..f99b3fcf3 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/block/tile/tiledata/FractionalDrawerGroup.java +++ b/src/com/jaquadro/minecraft/storagedrawers/block/tile/tiledata/FractionalDrawerGroup.java @@ -388,7 +388,7 @@ public boolean isEnabled (int slot) { } public boolean canItemBeStored (int slot, @Nonnull ItemStack itemPrototype, Predicate predicate) { - if (protoStack[slot].isEmpty() && !attrs.isItemLocked(LockAttribute.LOCK_EMPTY)) + if (protoStack[slot].isEmpty() && protoStack[0].isEmpty() && !attrs.isItemLocked(LockAttribute.LOCK_EMPTY)) return true; if (predicate == null) diff --git a/src/com/jaquadro/minecraft/storagedrawers/capabilities/DrawerItemHandler.java b/src/com/jaquadro/minecraft/storagedrawers/capabilities/DrawerItemHandler.java index 247519a8a..bcedf9d42 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/capabilities/DrawerItemHandler.java +++ b/src/com/jaquadro/minecraft/storagedrawers/capabilities/DrawerItemHandler.java @@ -92,7 +92,7 @@ private ItemStack insertItemInternal (int slot, @Nonnull ItemStack stack, boolea return stack; if (drawer.isEmpty() && !simulate) - drawer.setStoredItem(stack); + drawer = drawer.setStoredItem(stack); boolean empty = drawer.isEmpty(); int remainder = (simulate) diff --git a/src/com/jaquadro/minecraft/storagedrawers/item/ItemDrawers.java b/src/com/jaquadro/minecraft/storagedrawers/item/ItemDrawers.java index e8b37907b..75495a0c9 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/item/ItemDrawers.java +++ b/src/com/jaquadro/minecraft/storagedrawers/item/ItemDrawers.java @@ -69,6 +69,11 @@ public boolean placeBlockAt (@Nonnull ItemStack stack, EntityPlayer player, Worl return true; } + @Override + public int getItemBurnTime (ItemStack itemStack) { + return 0; + } + @Override @SideOnly(Side.CLIENT) public void addInformation (@Nonnull ItemStack itemStack, @Nullable World world, List list, ITooltipFlag advanced) {