Skip to content

Commit

Permalink
Fix contents lost breaking framed drawers; fix comp drawers voiding i…
Browse files Browse the repository at this point in the history
…nput items; remove burn time from drawers
  • Loading branch information
jaquadro committed Feb 24, 2020
1 parent 0ab80d4 commit 5e87af4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public boolean isEnabled (int slot) {
}

public boolean canItemBeStored (int slot, @Nonnull ItemStack itemPrototype, Predicate<ItemStack> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> list, ITooltipFlag advanced) {
Expand Down

0 comments on commit 5e87af4

Please sign in to comment.