Some work on Bins
This commit is contained in:
parent
42fe1f3d69
commit
fe0631844b
5 changed files with 21 additions and 26 deletions
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
BIN
resources/assets/mekanism/textures/blocks/Bin.png
Normal file
BIN
resources/assets/mekanism/textures/blocks/Bin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
resources/assets/mekanism/textures/blocks/BinTop.png
Normal file
BIN
resources/assets/mekanism/textures/blocks/BinTop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in a new issue