Fixed placer textures

This commit is contained in:
Calclavia 2014-03-21 17:41:30 +08:00
parent 2e3630299c
commit e159f2466b
3 changed files with 212 additions and 217 deletions

View file

@ -1,21 +1,5 @@
package resonantinduction.mechanical.process.edit; package resonantinduction.mechanical.process.edit;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.packet.Packet;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.Icon;
import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
import resonantinduction.core.Reference;
import resonantinduction.core.ResonantInduction;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.content.module.TileRender; import calclavia.lib.content.module.TileRender;
import calclavia.lib.content.module.prefab.TileInventory; import calclavia.lib.content.module.prefab.TileInventory;
import calclavia.lib.network.IPacketReceiver; import calclavia.lib.network.IPacketReceiver;
@ -25,28 +9,35 @@ import calclavia.lib.render.RenderItemOverlayUtility;
import calclavia.lib.utility.LanguageUtility; import calclavia.lib.utility.LanguageUtility;
import calclavia.lib.utility.inventory.InternalInventoryHandler; import calclavia.lib.utility.inventory.InternalInventoryHandler;
import calclavia.lib.utility.inventory.InventoryUtility; import calclavia.lib.utility.inventory.InventoryUtility;
import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.Icon;
import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
import resonantinduction.core.ResonantInduction;
import universalelectricity.api.vector.Vector3;
/** @author tgame14 /**
* @since 18/03/14 */ * @author tgame14
* @since 18/03/14
*/
public class TilePlacer extends TileInventory implements IRotatable, IPacketReceiver public class TilePlacer extends TileInventory implements IRotatable, IPacketReceiver
{ {
@SideOnly(Side.CLIENT)
private static Icon iconFront, iconBack;
private boolean doWork = false; private boolean doWork = false;
private boolean autoPullItems = false; private boolean autoPullItems = false;
private byte place_delay = 0; private byte place_delay = 0;
private InternalInventoryHandler invHandler; private InternalInventoryHandler invHandler;
private ForgeDirection renderItemSide_a; private ForgeDirection renderItemSideA;
private ForgeDirection renderItemSide_b; private ForgeDirection renderItemSideB;
@SideOnly(Side.CLIENT)
private Icon iconFront;
@SideOnly(Side.CLIENT)
private Icon iconBack;
public TilePlacer() public TilePlacer()
{ {
@ -96,7 +87,9 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
if (doWork) if (doWork)
{ {
if (place_delay < Byte.MAX_VALUE) if (place_delay < Byte.MAX_VALUE)
{
place_delay++; place_delay++;
}
if (place_delay >= 5) if (place_delay >= 5)
{//TODO implement block break speed, and a minor delay {//TODO implement block break speed, and a minor delay
@ -173,7 +166,9 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
this.autoPullItems = nbt.getBoolean("autoPull"); this.autoPullItems = nbt.getBoolean("autoPull");
} }
/** Writes a tile entity to NBT. */ /**
* Writes a tile entity to NBT.
*/
@Override @Override
public void writeToNBT(NBTTagCompound nbt) public void writeToNBT(NBTTagCompound nbt)
{ {
@ -195,13 +190,13 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
{ {
case EAST: case EAST:
case WEST: case WEST:
this.renderItemSide_a = ForgeDirection.NORTH; this.renderItemSideA = ForgeDirection.NORTH;
this.renderItemSide_b = ForgeDirection.SOUTH; this.renderItemSideB = ForgeDirection.SOUTH;
break; break;
case NORTH: case NORTH:
case SOUTH: case SOUTH:
this.renderItemSide_a = ForgeDirection.EAST; this.renderItemSideA = ForgeDirection.EAST;
this.renderItemSide_b = ForgeDirection.WEST; this.renderItemSideB = ForgeDirection.WEST;
break; break;
} }
@ -242,12 +237,12 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
{ {
if (!isItem) if (!isItem)
{ {
if (TilePlacer.this.worldObj != null && (TilePlacer.this.renderItemSide_a == null || TilePlacer.this.renderItemSide_b == null)) if (TilePlacer.this.worldObj != null && (TilePlacer.this.renderItemSideA == null || TilePlacer.this.renderItemSideB == null))
{ {
TilePlacer.this.updateDirection(); TilePlacer.this.updateDirection();
} }
GL11.glPushMatrix(); GL11.glPushMatrix();
RenderItemOverlayUtility.renderItemOnSides(TilePlacer.this, getStackInSlot(0), position.x, position.y, position.z, LanguageUtility.getLocal("tooltip.noOutput"), TilePlacer.this.renderItemSide_a, TilePlacer.this.renderItemSide_b); RenderItemOverlayUtility.renderItemOnSides(TilePlacer.this, getStackInSlot(0), position.x, position.y, position.z, LanguageUtility.getLocal("tooltip.noOutput"), TilePlacer.this.renderItemSideA, TilePlacer.this.renderItemSideB);
GL11.glPopMatrix(); GL11.glPopMatrix();
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 550 B

After

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 B

After

Width:  |  Height:  |  Size: 762 B