From fe0631844b575fec55c1a2051156c463b103931b Mon Sep 17 00:00:00 2001 From: "Aidan C. Brady" Date: Tue, 12 Nov 2013 16:45:48 -0500 Subject: [PATCH] Some work on Bins --- .../client/render/tileentity/RenderBin.java | 39 ++++++++---------- common/mekanism/common/block/BlockBasic.java | 4 +- .../common/tileentity/TileEntityBin.java | 4 +- .../assets/mekanism/textures/blocks/Bin.png | Bin 0 -> 1432 bytes .../mekanism/textures/blocks/BinTop.png | Bin 0 -> 1971 bytes 5 files changed, 21 insertions(+), 26 deletions(-) create mode 100644 resources/assets/mekanism/textures/blocks/Bin.png create mode 100644 resources/assets/mekanism/textures/blocks/BinTop.png diff --git a/common/mekanism/client/render/tileentity/RenderBin.java b/common/mekanism/client/render/tileentity/RenderBin.java index 9c10dc326..1c9e0b64a 100644 --- a/common/mekanism/client/render/tileentity/RenderBin.java +++ b/common/mekanism/client/render/tileentity/RenderBin.java @@ -24,9 +24,6 @@ import universalelectricity.core.vector.Vector3; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -/* - * Courtesy of MFFS & Assembly Line - */ @SideOnly(Side.CLIENT) public class RenderBin extends TileEntitySpecialRenderer { @@ -44,13 +41,11 @@ public class RenderBin extends TileEntitySpecialRenderer { if(tileEntity instanceof TileEntityBin) { - String itemName = "None"; String amount = ""; ItemStack itemStack = tileEntity.getStack(); if(itemStack != null) { - itemName = itemStack.getDisplayName(); amount = Integer.toString(itemStack.stackSize); } @@ -70,27 +65,29 @@ public class RenderBin extends TileEntitySpecialRenderer { GL11.glPushMatrix(); - switch (side) + switch(side) { case NORTH: - GL11.glTranslated(x + 0.65, y + 0.9, z - 0.01); + GL11.glTranslated(x + 0.73, y + 0.83, z - 0.01); break; case SOUTH: - GL11.glTranslated(x + 0.35, y + 0.9, z + 1.01); + GL11.glTranslated(x + 0.27, y + 0.83, z + 1.01); GL11.glRotatef(180, 0, 1, 0); break; case WEST: - GL11.glTranslated(x - 0.01, y + 0.9, z + 0.35); + GL11.glTranslated(x - 0.01, y + 0.83, z + 0.27); GL11.glRotatef(90, 0, 1, 0); break; case EAST: - GL11.glTranslated(x + 1.01, y + 0.9, z + 0.65); + GL11.glTranslated(x + 1.01, y + 0.83, z + 0.73); GL11.glRotatef(-90, 0, 1, 0); break; } float scale = 0.03125F; - GL11.glScalef(0.6f * scale, 0.6f * scale, 0); + float scaler = 0.9F; + + GL11.glScalef(scale*scaler, scale*scaler, 0); GL11.glRotatef(180, 0, 0, 1); TextureManager renderEngine = Minecraft.getMinecraft().renderEngine; @@ -103,15 +100,12 @@ public class RenderBin extends TileEntitySpecialRenderer } GL11.glEnable(2896); - GL11.glPopMatrix(); } - renderText(itemName, side, 0.02f, x, y - 0.35f, z); - if(amount != "") { - renderText(amount, side, 0.02f, x, y - 0.15f, z); + renderText(amount, side, 0.02F, x, y - 0.31F, z); } } } @@ -124,11 +118,12 @@ public class RenderBin extends TileEntitySpecialRenderer return; } - int br = world.getLightBrightnessForSkyBlocks(obj.xCoord, obj.yCoord, obj.zCoord, 0); - int var11 = br % 65536; - int var12 = br / 65536; + int brightness = world.getLightBrightnessForSkyBlocks(obj.xCoord, obj.yCoord, obj.zCoord, 0); + int lightX = brightness % 65536; + int lightY = brightness / 65536; float scale = 0.6F; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * scale, var12 * scale); + + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightX * scale, lightY * scale); } @SuppressWarnings("incomplete-switch") @@ -175,7 +170,7 @@ public class RenderBin extends TileEntitySpecialRenderer int requiredWidth = Math.max(fontRenderer.getStringWidth(text), 1); int lineHeight = fontRenderer.FONT_HEIGHT + 2; int requiredHeight = lineHeight * 1; - float scaler = 0.8f; + float scaler = 0.4F; float scaleX = (displayWidth / requiredWidth); float scale = scaleX * scaler; @@ -189,8 +184,8 @@ public class RenderBin extends TileEntitySpecialRenderer int offsetX; int offsetY; - int realHeight = (int) Math.floor(displayHeight / scale); - int realWidth = (int) Math.floor(displayWidth / scale); + int realHeight = (int)Math.floor(displayHeight / scale); + int realWidth = (int)Math.floor(displayWidth / scale); offsetX = (realWidth - requiredWidth) / 2; offsetY = (realHeight - requiredHeight) / 2; diff --git a/common/mekanism/common/block/BlockBasic.java b/common/mekanism/common/block/BlockBasic.java index eab09a921..f63ffe435 100644 --- a/common/mekanism/common/block/BlockBasic.java +++ b/common/mekanism/common/block/BlockBasic.java @@ -87,7 +87,7 @@ public class BlockBasic extends Block icons[3] = register.registerIcon("mekanism:CoalBlock"); icons[4] = register.registerIcon("mekanism:RefinedGlowstone"); icons[5] = register.registerIcon("mekanism:SteelBlock"); - icons[6] = register.registerIcon("mekanism:SteelBlock"); //TODO texture + icons[6] = register.registerIcon("mekanism:Bin"); //TODO texture icons[7] = register.registerIcon("mekanism:TeleporterFrame"); icons[8] = register.registerIcon("mekanism:SteelCasing"); icons[9] = register.registerIcon("mekanism:DynamicTank"); @@ -201,7 +201,7 @@ public class BlockBasic extends Block @Override public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) { - return true; + return world.getBlockMetadata(x, y, z) != 10; } private boolean manageInventory(EntityPlayer player, TileEntityDynamicTank tileEntity) diff --git a/common/mekanism/common/tileentity/TileEntityBin.java b/common/mekanism/common/tileentity/TileEntityBin.java index f95ae92eb..c81a5c3a4 100644 --- a/common/mekanism/common/tileentity/TileEntityBin.java +++ b/common/mekanism/common/tileentity/TileEntityBin.java @@ -39,7 +39,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento if(itemCount > 0) { - itemType.writeToNBT(nbtTags); + nbtTags.setCompoundTag("itemType", itemType.writeToNBT(new NBTTagCompound())); } } @@ -52,7 +52,7 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento if(itemCount > 0) { - itemType = ItemStack.loadItemStackFromNBT(nbtTags); + itemType = ItemStack.loadItemStackFromNBT(nbtTags.getCompoundTag("itemType")); } } diff --git a/resources/assets/mekanism/textures/blocks/Bin.png b/resources/assets/mekanism/textures/blocks/Bin.png new file mode 100644 index 0000000000000000000000000000000000000000..2b21badfd60f6349839c4c1805688d0e1cd162b9 GIT binary patch literal 1432 zcmV;J1!ww+P)4Tx05}naRo`#hR1`jmZ&IWdKOk5~hl<6oRa0BJ8yc;~21%2p?MfD<>DVeH z9(p*dx19w`~g7O0}n_%Aq@s%d)fBDv`JHkDym6Hd+5XuAtvnwRpGmK zVkc9?T=n|PIo~X-eVh__(Z?q}P9Z-Dj?gOW6|D%o20XmjW-qs4UjrD(li^iv8@eK9k+ZFm zVRFymFOPAzG5-%Pn|1W;U4vNroTa&AxDScmEA~{ri9gr1^c?U@uwSpaNnw8l_>cP1 zd;)kMQS_;jeRSUEM_*s96y65j1$)tOrwdK{YIQMt92l|D^(E_=$Rjw{b!QT@q!)ni zR`|5oW9X5n$Wv+HVc@|^eX5yXnsHX8PF3UX~a6)MwxDE0HaPjyrlI!;jX{6Kvuh*8ej?;85ekN$?5uuCiS zBTvvVG+XTxAO{m@bvM#Jr)z6J><&E22D|vq?Y?Vkbo_DijopiF$2PET#mZ8eu=y$(ArYkv7@Ex`GL?QCc!_*KFrd&;n1r7 zqW-CFs9&fT)ZaU5gc&=gBz-DaCw(vdOp0__x+47~U6sC(E(JNe@4cTT*n6*E zVH4eoU1-&7pEV~_PRe`a7v+@vy!^5}8?Y3)UmlaER0003mNkl|42Egd10W`j!DX0OxE#me zGE7WJupqItHIgj@i6K#NhBgaMZ1aC{5+0ADDBelL_5$s`@1r2(d7i8QpkCLt6=EDm ztB*UTY2sbcZrgVCKgFo8^A2&YNfqFOV1sbib^BqjewwD%JR<;~^)L+9EEtto8wY>tDk&tV2!!00004Tx05}naRo`#hR1`jmZ&IWdKOk5~hl<6oRa0BJ8yc;~21%2p?MfD<>DVeH z9(p*dx19w`~g7O0}n_%Aq@s%d)fBDv`JHkDym6Hd+5XuAtvnwRpGmK zVkc9?T=n|PIo~X-eVh__(Z?q}P9Z-Dj?gOW6|D%o20X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