Fix custom drawers dropping as regular drawers

This commit is contained in:
Justin Aquadro committed 2016-02-20 02:19:33 -05:00
1 parent 27e5f6a624
commit 734888cba7
3 files changed
+21 -5

No files matched your search

@@ -625,7 +625,7 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
@Override
public ArrayList<ItemStack> getDrops (World world, int x, int y, int z, int metadata, int fortune) {
ItemStack dropStack = new ItemStack(Item.getItemFromBlock(this), 1, metadata);
ItemStack dropStack = getMainDrop(world, x, y, z, metadata);
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
drops.add(dropStack);
@@ -637,14 +637,20 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
NBTTagCompound tiledata = new NBTTagCompound();
tile.writeToNBT(tiledata);
NBTTagCompound data = new NBTTagCompound();
data.setTag("tile", tiledata);
NBTTagCompound data = dropStack.getTagCompound();
if (data == null)
data = new NBTTagCompound();
data.setTag("tile", tiledata);
dropStack.setTagCompound(data);
return drops;
}
protected ItemStack getMainDrop (World world, int x, int y, int z, int metadata) {
return new ItemStack(Item.getItemFromBlock(this), 1, metadata);
}
@Override
public TileEntityDrawers createNewTileEntity (World world, int meta) {
return new TileEntityDrawersStandard();
@@ -658,7 +664,7 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
public TileEntityDrawers getTileEntitySafe (World world, int x, int y, int z) {
TileEntityDrawers tile = getTileEntity(world, x, y, z);
if (tile == null) {
tile = (TileEntityDrawers)createNewTileEntity(world, world.getBlockMetadata(x, y, z));
tile = createNewTileEntity(world, world.getBlockMetadata(x, y, z));
world.setTileEntity(x, y, z, tile);
}
@@ -3,6 +3,7 @@ package com.jaquadro.minecraft.storagedrawers.block;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import com.jaquadro.minecraft.storagedrawers.core.ClientProxy;
import com.jaquadro.minecraft.storagedrawers.item.ItemCustomDrawers;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -49,6 +50,15 @@ public class BlockDrawersCustom extends BlockDrawers
return true;
}
@Override
protected ItemStack getMainDrop (World world, int x, int y, int z, int metadata) {
TileEntityDrawers tile = getTileEntity(world, x, y, z);
if (tile == null)
return ItemCustomDrawers.makeItemStack(this, 1, null, null, null);
return ItemCustomDrawers.makeItemStack(this, 1, tile.getMaterialSide(), tile.getMaterialTrim(), tile.getMaterialFront());
}
@Override
public void getSubBlocks (Item item, CreativeTabs creativeTabs, List list) {
if (StorageDrawers.config.cache.addonShowVanilla)
@@ -52,7 +52,7 @@ public class DrawersItemRenderer implements IItemRenderer
GL11.glRotatef(90, 0, 1, 0);
if (renderType == ItemRenderType.ENTITY)
GL11.glRotatef(180, 0, 1, 0);
if (renderType == ItemRenderType.INVENTORY || renderType == ItemRenderType.ENTITY)
GL11.glTranslatef(block.halfDepth ? -.75f : -.5f, -.5f, -.5f);