Removed useless tank item renderer

This commit is contained in:
Calclavia 2014-02-28 10:43:26 +08:00
parent 23ee4136e3
commit ff4ac618e3
4 changed files with 26 additions and 72 deletions

View file

@ -2,7 +2,7 @@ dir.development=./
dir.mcp=${dir.development}forge/mcp
version.minecraft=1.6.4
version.forge=9.11.1.964
version.universalelectricity=3.1.0.63
version.universalelectricity=3.1.+
version.calclaviacore=1.1.+
version.cclib=1.0.0.61
version.fmp=1.0.0.244

View file

@ -1,10 +1,9 @@
package resonantinduction.mechanical;
import net.minecraftforge.client.MinecraftForgeClient;
import resonantinduction.mechanical.energy.gear.RenderGear;
import resonantinduction.mechanical.energy.gear.RenderGearShaft;
import resonantinduction.mechanical.fluid.pipe.RenderPipe;
import resonantinduction.mechanical.fluid.tank.ItemTankRenderer;
import resonantinduction.mechanical.fluid.tank.RenderTank;
import calclavia.lib.render.item.GlobalItemRenderer;
public class ClientProxy extends CommonProxy
@ -15,11 +14,6 @@ public class ClientProxy extends CommonProxy
GlobalItemRenderer.register(Mechanical.itemGear.itemID, RenderGear.INSTANCE);
GlobalItemRenderer.register(Mechanical.itemGearShaft.itemID, RenderGearShaft.INSTANCE);
GlobalItemRenderer.register(Mechanical.itemPipe.itemID, RenderPipe.INSTANCE);
}
@Override
public void init()
{
MinecraftForgeClient.registerItemRenderer(Mechanical.blockTank.blockID, new ItemTankRenderer());
GlobalItemRenderer.register(Mechanical.blockTank.blockID, RenderTank.INSTANCE);
}
}

View file

@ -1,62 +0,0 @@
package resonantinduction.mechanical.fluid.tank;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ItemTankRenderer implements IItemRenderer
{
private final TileTank tileTank = new TileTank();
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
GL11.glPushMatrix();
GL11.glScalef(1.0F, 1.0F, 1.0F);
if (type == ItemRenderType.ENTITY)
{
GL11.glTranslatef(0F, 0.2F, 0F);
}
else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
{
GL11.glTranslatef(0.4F, 0.6F, 0.2F);
}
else if (type == ItemRenderType.EQUIPPED)
{
GL11.glTranslatef(0.1F, 0.4F, 1.2F);
}
else
{
GL11.glTranslatef(0.7F, .45F, 0.7F);
}
FluidStack fluid = null;
if (item.getTagCompound() != null && item.getTagCompound().hasKey("fluid"))
{
fluid = FluidStack.loadFluidStackFromNBT(item.getTagCompound().getCompoundTag("fluid"));
}
RenderTank.INSTANCE.renderTank(tileTank, 0, 0, 0, fluid);
GL11.glPopMatrix();
}
}

View file

@ -3,6 +3,7 @@ package resonantinduction.mechanical.fluid.tank;
import java.awt.Color;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidStack;
@ -12,13 +13,15 @@ import resonantinduction.core.ResonantInduction;
import resonantinduction.core.render.RenderFluidHelper;
import resonantinduction.mechanical.Mechanical;
import calclavia.lib.render.RenderUtility;
import calclavia.lib.render.item.ISimpleItemRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderTank extends TileEntitySpecialRenderer
public class RenderTank extends TileEntitySpecialRenderer implements ISimpleItemRenderer
{
public static final RenderTank INSTANCE = new RenderTank();
private final TileTank tileTank = new TileTank();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8)
@ -26,6 +29,24 @@ public class RenderTank extends TileEntitySpecialRenderer
this.renderTank(tileEntity, x, y, z, tileEntity instanceof TileTank ? ((TileTank) tileEntity).getInternalTank().getFluid() : null);
}
@Override
public void renderInventoryItem(ItemStack itemStack)
{
GL11.glPushMatrix();
GL11.glTranslated(0, -0.1, 0);
FluidStack fluid = null;
if (itemStack.getTagCompound() != null && itemStack.getTagCompound().hasKey("fluid"))
{
fluid = FluidStack.loadFluidStackFromNBT(itemStack.getTagCompound().getCompoundTag("fluid"));
}
renderTank(tileTank, 0, 0, 0, fluid);
GL11.glPopMatrix();
}
public void renderTank(TileEntity tileEntity, double x, double y, double z, FluidStack fluid)
{
if (tileEntity instanceof TileTank)
@ -61,4 +82,5 @@ public class RenderTank extends TileEntitySpecialRenderer
}
}
}
}