Made manipulator output from inventory
This commit is contained in:
parent
addac728e2
commit
4242c45a9f
21 changed files with 288 additions and 108 deletions
Before Width: | Height: | Size: 957 B After Width: | Height: | Size: 957 B |
BIN
resources/assemblyline/textures/manipulator2.png
Normal file
BIN
resources/assemblyline/textures/manipulator2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1 KiB |
|
@ -12,11 +12,11 @@ import universalelectricity.core.UEConfig;
|
|||
import universalelectricity.prefab.network.PacketManager;
|
||||
import assemblyline.belts.BlockConveyorBelt;
|
||||
import assemblyline.belts.TileEntityConveyorBelt;
|
||||
import assemblyline.machines.BlockInteraction;
|
||||
import assemblyline.machines.ItemBlockInteraction;
|
||||
import assemblyline.machines.BlockMulti;
|
||||
import assemblyline.machines.BlockMulti.MachineType;
|
||||
import assemblyline.machines.ItemBlockMulti;
|
||||
import assemblyline.machines.TileEntityManipulator;
|
||||
import assemblyline.machines.TileEntitySorter;
|
||||
import assemblyline.machines.BlockInteraction.MachineType;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
|
@ -52,7 +52,7 @@ public class AssemblyLine
|
|||
|
||||
public static final int BLOCK_ID_PREFIX = 3003;
|
||||
public static final Block blockConveyorBelt = new BlockConveyorBelt(UEConfig.getBlockConfigID(CONFIGURATION, "Conveyor Belt", BLOCK_ID_PREFIX));
|
||||
public static final Block blockInteraction = new BlockInteraction(UEConfig.getBlockConfigID(CONFIGURATION, "Machine", BLOCK_ID_PREFIX+1));
|
||||
public static final Block blockInteraction = new BlockMulti(UEConfig.getBlockConfigID(CONFIGURATION, "Machine", BLOCK_ID_PREFIX+1));
|
||||
|
||||
@PreInit
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
|
@ -60,7 +60,7 @@ public class AssemblyLine
|
|||
instance = this;
|
||||
NetworkRegistry.instance().registerGuiHandler(this, this.proxy);
|
||||
GameRegistry.registerBlock(blockConveyorBelt);
|
||||
GameRegistry.registerBlock(blockInteraction, ItemBlockInteraction.class);
|
||||
GameRegistry.registerBlock(blockInteraction, ItemBlockMulti.class);
|
||||
proxy.preInit();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package assemblyline.belts;
|
|||
import net.minecraft.src.CreativeTabs;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.Material;
|
||||
import net.minecraft.src.MathHelper;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
|
@ -23,11 +22,20 @@ public class BlockConveyorBelt extends BlockMachine
|
|||
this.setBlockBounds(0, 0, 0, 1, 0.3f, 1);
|
||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int x, int y, int z, EntityLiving par5EntityLiving)
|
||||
{
|
||||
int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
par1World.setBlockAndMetadataWithNotify(x, y, z, this.blockID, angle);
|
||||
par1World.setBlockMetadataWithNotify(x, y, z, angle);
|
||||
/*
|
||||
switch (angle)
|
||||
{
|
||||
case 0: par1World.setBlockMetadataWithNotify(x, y, z, 0); break;
|
||||
case 1: par1World.setBlockMetadataWithNotify(x, y, z, 3); break;
|
||||
case 2: par1World.setBlockMetadataWithNotify(x, y, z, 1); break;
|
||||
case 3: par1World.setBlockMetadataWithNotify(x, y, z, 2); break;
|
||||
} */
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,7 +45,7 @@ public class BlockConveyorBelt extends BlockMachine
|
|||
|
||||
if (metadata >= 0 && metadata < 4)
|
||||
{
|
||||
if (metadata == 3)
|
||||
if (metadata >= 3)
|
||||
{
|
||||
par1World.setBlockAndMetadataWithNotify(x, y, z, this.blockID, 0);
|
||||
return true;
|
||||
|
|
|
@ -8,7 +8,6 @@ import net.minecraft.src.Entity;
|
|||
import net.minecraft.src.EntityItem;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.Packet;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraft.src.TileEntity;
|
||||
|
|
|
@ -1,12 +1,19 @@
|
|||
package assemblyline.machines;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
import net.minecraft.src.AxisAlignedBB;
|
||||
import net.minecraft.src.CreativeTabs;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Material;
|
||||
import net.minecraft.src.MathHelper;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.implement.IRedstoneReceptor;
|
||||
import universalelectricity.prefab.BlockMachine;
|
||||
import assemblyline.AssemblyLine;
|
||||
import assemblyline.render.RenderHelper;
|
||||
|
@ -18,7 +25,7 @@ import assemblyline.render.RenderHelper;
|
|||
* @author Darkguardsman, Calclavia
|
||||
*
|
||||
*/
|
||||
public class BlockInteraction extends BlockMachine
|
||||
public class BlockMulti extends BlockMachine
|
||||
{
|
||||
public static enum MachineType
|
||||
{
|
||||
|
@ -91,17 +98,19 @@ public class BlockInteraction extends BlockMachine
|
|||
}
|
||||
}
|
||||
|
||||
public BlockInteraction(int id)
|
||||
public BlockMulti(int id)
|
||||
{
|
||||
super("Interaction Machine", id, Material.iron);
|
||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return MachineType.get(metadata).metadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMachineActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer)
|
||||
{
|
||||
if (!par1World.isRemote)
|
||||
|
@ -113,6 +122,30 @@ public class BlockInteraction extends BlockMachine
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int x, int y, int z, EntityLiving par5EntityLiving)
|
||||
{
|
||||
int metadata = par1World.getBlockMetadata(x, y, z);
|
||||
|
||||
int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
|
||||
switch (angle)
|
||||
{
|
||||
case 0:
|
||||
par1World.setBlockMetadataWithNotify(x, y, z, metadata + 0);
|
||||
break;
|
||||
case 1:
|
||||
par1World.setBlockMetadataWithNotify(x, y, z, metadata + 3);
|
||||
break;
|
||||
case 2:
|
||||
par1World.setBlockMetadataWithNotify(x, y, z, metadata + 1);
|
||||
break;
|
||||
case 3:
|
||||
par1World.setBlockMetadataWithNotify(x, y, z, metadata + 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer)
|
||||
{
|
||||
|
@ -129,9 +162,15 @@ public class BlockInteraction extends BlockMachine
|
|||
|
||||
if (MachineType.get(metadata) == MachineType.MANIPULATOR)
|
||||
{
|
||||
((TileEntityManipulator) par1World.getBlockTileEntity(x, y, z)).isWrenchedToOutput = !((TileEntityManipulator) par1World.getBlockTileEntity(x, y, z)).isWrenchedToOutput;
|
||||
TileEntityManipulator tileEntity = (TileEntityManipulator)par1World.getBlockTileEntity(x, y, z);
|
||||
tileEntity.isOutput = !tileEntity.isOutput;
|
||||
|
||||
if (!par1World.isRemote)
|
||||
par5EntityPlayer.addChatMessage("Manipulator Output: " + ((TileEntityManipulator) par1World.getBlockTileEntity(x, y, z)).isWrenchedToOutput);
|
||||
{
|
||||
par5EntityPlayer.addChatMessage("Manipulator Output: " + tileEntity.isOutput);
|
||||
|
||||
PacketDispatcher.sendPacketToAllPlayers(tileEntity.getDescriptionPacket());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -140,6 +179,22 @@ public class BlockInteraction extends BlockMachine
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World par1World, int x, int y, int z, int side)
|
||||
{
|
||||
super.onNeighborBlockChange(par1World, x, y, z, side);
|
||||
|
||||
TileEntity tileEntity = par1World.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof IRedstoneReceptor)
|
||||
{
|
||||
if (par1World.isBlockIndirectlyGettingPowered(x, y, z))
|
||||
{
|
||||
((IRedstoneReceptor) par1World.getBlockTileEntity(x, y, z)).onPowerOn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bounding box of the wired
|
||||
* rectangular prism to render.
|
||||
|
@ -189,4 +244,16 @@ public class BlockInteraction extends BlockMachine
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (MachineType type : MachineType.values())
|
||||
{
|
||||
if (type.tileEntity != null)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, type.metadata));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package assemblyline.machines;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.CreativeTabs;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemBlock;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.MathHelper;
|
||||
import net.minecraft.src.World;
|
||||
import assemblyline.AssemblyLine;
|
||||
import assemblyline.machines.BlockInteraction.MachineType;
|
||||
|
||||
public class ItemBlockInteraction extends ItemBlock
|
||||
{
|
||||
public ItemBlockInteraction(int par1)
|
||||
{
|
||||
super(par1);
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(CreativeTabs.tabRedstone);
|
||||
}
|
||||
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (MachineType machine : MachineType.values())
|
||||
{
|
||||
par3List.add(new ItemStack(AssemblyLine.blockInteraction, 1, machine.metadata));
|
||||
}
|
||||
}
|
||||
|
||||
public String getItemNameIS(ItemStack itemstack)
|
||||
{
|
||||
return MachineType.get(itemstack.getItemDamage()).name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockID()
|
||||
{
|
||||
return AssemblyLine.blockInteraction.blockID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
int angle = MathHelper.floor_double((player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
if (!world.setBlockAndMetadataWithNotify(x, y, z, this.getBlockID(), stack.getItemDamage() + angle)) { return false; }
|
||||
|
||||
if (world.getBlockId(x, y, z) == this.getBlockID())
|
||||
{
|
||||
Block.blocksList[this.getBlockID()].updateBlockMetadata(world, x, y, z, side, hitX, hitY, hitZ);
|
||||
Block.blocksList[this.getBlockID()].onBlockPlacedBy(world, x, y, z, player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
25
src/common/assemblyline/machines/ItemBlockMulti.java
Normal file
25
src/common/assemblyline/machines/ItemBlockMulti.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package assemblyline.machines;
|
||||
|
||||
import net.minecraft.src.ItemBlock;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import assemblyline.machines.BlockMulti.MachineType;
|
||||
|
||||
public class ItemBlockMulti extends ItemBlock
|
||||
{
|
||||
public ItemBlockMulti(int par1)
|
||||
{
|
||||
super(par1);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public String getItemNameIS(ItemStack itemstack)
|
||||
{
|
||||
return MachineType.get(itemstack.getItemDamage()).name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int par1)
|
||||
{
|
||||
return MachineType.get(par1).metadata;
|
||||
}
|
||||
}
|
|
@ -2,21 +2,31 @@ package assemblyline.machines;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import net.minecraft.src.AxisAlignedBB;
|
||||
import net.minecraft.src.EntityItem;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.Packet;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.TileEntityChest;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
import universalelectricity.core.Vector3;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import universalelectricity.implement.IRedstoneReceptor;
|
||||
import universalelectricity.prefab.TileEntityElectricityReceiver;
|
||||
import assemblyline.machines.BlockInteraction.MachineType;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import assemblyline.AssemblyLine;
|
||||
import assemblyline.machines.BlockMulti.MachineType;
|
||||
|
||||
public class TileEntityManipulator extends TileEntityElectricityReceiver
|
||||
public class TileEntityManipulator extends TileEntityElectricityReceiver implements IRedstoneReceptor, IPacketReceiver
|
||||
{
|
||||
/**
|
||||
* Joules required to run this thing.
|
||||
|
@ -32,7 +42,9 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver
|
|||
* Is the manipulator wrenched to turn into
|
||||
* output mode?
|
||||
*/
|
||||
public boolean isWrenchedToOutput = false;
|
||||
public boolean isOutput = false;
|
||||
|
||||
private boolean isPowered = false;
|
||||
|
||||
@Override
|
||||
public double wattRequest()
|
||||
|
@ -47,9 +59,9 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver
|
|||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
if (!this.isDisabled())
|
||||
if (!this.isDisabled() && this.wattsReceived >= this.JOULES_REQUIRED)
|
||||
{
|
||||
if (!this.isOutput())
|
||||
if (!this.isOutput)
|
||||
{
|
||||
/**
|
||||
* Find items going into the
|
||||
|
@ -88,11 +100,37 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver
|
|||
/**
|
||||
* Finds the connected inventory and outputs the items upon a redstone pulse.
|
||||
*/
|
||||
if(this.isPowered)
|
||||
{
|
||||
this.onPowerOff();
|
||||
|
||||
Vector3 inputPosition = Vector3.get(this);
|
||||
inputPosition.modifyPositionFromSide(this.getBeltDirection().getOpposite());
|
||||
|
||||
Vector3 outputPosition = Vector3.get(this);
|
||||
outputPosition.modifyPositionFromSide(this.getBeltDirection());
|
||||
|
||||
ItemStack itemStack = this.tryGrabFromPosition(inputPosition);
|
||||
|
||||
if(itemStack != null)
|
||||
{
|
||||
if(itemStack.stackSize > 0)
|
||||
{
|
||||
EntityItem entityItem = new EntityItem(worldObj, outputPosition.x + 0.5, outputPosition.y + 0.8, outputPosition.z + 0.5, itemStack);
|
||||
entityItem.motionX = 0;
|
||||
entityItem.motionZ = 0;
|
||||
entityItem.motionY /= 4;
|
||||
worldObj.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.wattsReceived = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to place an itemStack in a specific
|
||||
* position if it is an inventory.
|
||||
|
@ -191,12 +229,87 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver
|
|||
}
|
||||
|
||||
/**
|
||||
* If the manipulator is powered, it will
|
||||
* output items instead of input.
|
||||
* Tries to take a item from a inventory at a specific position.
|
||||
* @param position
|
||||
* @return
|
||||
*/
|
||||
public boolean isOutput()
|
||||
private ItemStack tryGrabFromPosition(Vector3 position)
|
||||
{
|
||||
return this.isWrenchedToOutput;
|
||||
TileEntity tileEntity = position.getTileEntity(this.worldObj);
|
||||
|
||||
if (tileEntity != null)
|
||||
{
|
||||
/**
|
||||
* Try to put items into a chest.
|
||||
*/
|
||||
if (tileEntity instanceof TileEntityChest)
|
||||
{
|
||||
TileEntityChest[] chests =
|
||||
{ (TileEntityChest) tileEntity, null };
|
||||
|
||||
/**
|
||||
* Try to find a double chest.
|
||||
*/
|
||||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
ForgeDirection searchDirection = ForgeDirection.getOrientation(i);
|
||||
Vector3 searchPosition = position.clone();
|
||||
searchPosition.modifyPositionFromSide(searchDirection);
|
||||
|
||||
if (searchPosition.getTileEntity(this.worldObj).getClass() == chests[0].getClass())
|
||||
{
|
||||
chests[1] = (TileEntityChest) searchPosition.getTileEntity(this.worldObj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (TileEntityChest chest : chests)
|
||||
{
|
||||
for (int i = 0; i < chest.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack itemStack = this.removeStackFromInventory(i, chest);
|
||||
if(itemStack != null) return itemStack;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tileEntity instanceof ISidedInventory)
|
||||
{
|
||||
ISidedInventory inventory = (ISidedInventory) tileEntity;
|
||||
|
||||
int startIndex = inventory.getStartInventorySide(this.getBeltDirection());
|
||||
|
||||
for (int i = startIndex; i < inventory.getSizeInventorySide(this.getBeltDirection()); i++)
|
||||
{
|
||||
ItemStack itemStack = this.removeStackFromInventory(i, inventory);
|
||||
if(itemStack != null) return itemStack;
|
||||
}
|
||||
}
|
||||
else if (tileEntity instanceof IInventory)
|
||||
{
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack itemStack = this.removeStackFromInventory(i, inventory);
|
||||
if(itemStack != null) return itemStack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack removeStackFromInventory(int slotIndex, IInventory inventory)
|
||||
{
|
||||
if(inventory.getStackInSlot(slotIndex) != null)
|
||||
{
|
||||
ItemStack itemStack = inventory.getStackInSlot(slotIndex).copy();
|
||||
itemStack.stackSize = 1;
|
||||
inventory.decrStackSize(slotIndex, 1);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ForgeDirection getBeltDirection()
|
||||
|
@ -204,6 +317,12 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver
|
|||
return ForgeDirection.getOrientation(MachineType.getDirection(this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)) + 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return PacketManager.getPacket(AssemblyLine.CHANNEL, this, this.isOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveFromSide(ForgeDirection side)
|
||||
{
|
||||
|
@ -220,7 +339,7 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver
|
|||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
nbt.setBoolean("isWrenchedToOutput", this.isWrenchedToOutput);
|
||||
this.isOutput = nbt.getBoolean("isWrenchedToOutput");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -230,6 +349,31 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver
|
|||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
this.isWrenchedToOutput = nbt.getBoolean("isWrenchedToOutput");
|
||||
nbt.setBoolean("isWrenchedToOutput", this.isOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPowerOn()
|
||||
{
|
||||
this.isPowered = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPowerOff()
|
||||
{
|
||||
this.isPowered = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.isOutput = dataStream.readBoolean();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@ package assemblyline.machines;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import net.minecraft.src.AxisAlignedBB;
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityItem;
|
||||
|
@ -21,6 +19,9 @@ import universalelectricity.prefab.network.IPacketReceiver;
|
|||
import universalelectricity.prefab.network.PacketManager;
|
||||
import assemblyline.TileEntityBase;
|
||||
import assemblyline.belts.TileEntityConveyorBelt;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public class TileEntitySorter extends TileEntityBase implements IElectricityReceiver, IPacketReceiver
|
||||
|
|
|
@ -2,12 +2,9 @@ package assemblyline.machines.crafter;
|
|||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
import universalelectricity.prefab.TileEntityAdvanced;
|
||||
|
||||
import assemblyline.TileEntityBase;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package assemblyline;
|
||||
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import assemblyline.AssemblyLine;
|
||||
import assemblyline.ALCommonProxy;
|
||||
import assemblyline.belts.TileEntityConveyorBelt;
|
||||
import assemblyline.machines.TileEntityManipulator;
|
||||
import assemblyline.machines.TileEntitySorter;
|
||||
import assemblyline.render.RenderSorter;
|
||||
import assemblyline.render.RenderHelper;
|
||||
import assemblyline.render.RenderConveyorBelt;
|
||||
import assemblyline.render.RenderHelper;
|
||||
import assemblyline.render.RenderManipulator;
|
||||
import assemblyline.render.RenderSorter;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.src.World;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import assemblyline.AssemblyLine;
|
||||
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.asm.SideOnly;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package assemblyline.model;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package assemblyline.model;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package assemblyline.model;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
package assemblyline.model;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.ModelBase;
|
||||
import net.minecraft.src.ModelRenderer;
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@ import net.minecraft.src.RenderBlocks;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import assemblyline.AssemblyLine;
|
||||
import assemblyline.machines.BlockInteraction.MachineType;
|
||||
import assemblyline.machines.BlockMulti.MachineType;
|
||||
import assemblyline.model.ModelConveyorBelt;
|
||||
import assemblyline.model.ModelSorter;
|
||||
import assemblyline.model.ModelManipulator;
|
||||
import assemblyline.model.ModelSorter;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
@ -39,7 +39,7 @@ public class RenderHelper implements ISimpleBlockRenderingHandler
|
|||
{
|
||||
if (metadata == MachineType.SORTER.metadata)
|
||||
{
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(AssemblyLine.TEXTURE_PATH + "ejector.png"));
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(AssemblyLine.TEXTURE_PATH + "sorter.png"));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) 0.6F, (float) 1.5F, (float) 0.6F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
|
@ -50,7 +50,7 @@ public class RenderHelper implements ISimpleBlockRenderingHandler
|
|||
}
|
||||
else if (metadata == MachineType.MANIPULATOR.metadata)
|
||||
{
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(AssemblyLine.TEXTURE_PATH + "injector.png"));
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(AssemblyLine.TEXTURE_PATH + "manipulator1.png"));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) 0.6F, (float) 1.5F, (float) 0.6F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
|
|
|
@ -6,7 +6,6 @@ import net.minecraft.src.TileEntitySpecialRenderer;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import assemblyline.AssemblyLine;
|
||||
import assemblyline.belts.TileEntityConveyorBelt;
|
||||
import assemblyline.machines.TileEntityManipulator;
|
||||
import assemblyline.model.ModelManipulator;
|
||||
|
||||
|
@ -16,15 +15,20 @@ public class RenderManipulator extends TileEntitySpecialRenderer
|
|||
|
||||
public void renderAModelAt(TileEntityManipulator tileEntity, double x, double y, double z, float f)
|
||||
{
|
||||
String flip = "";// if(tileEntity.flip){flip
|
||||
// = "F";}
|
||||
int face = tileEntity.getBeltDirection().ordinal();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
|
||||
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "injector.png");
|
||||
if(tileEntity.isOutput)
|
||||
{
|
||||
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "manipulator1.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.bindTextureByName(AssemblyLine.TEXTURE_PATH + "manipulator2.png");
|
||||
}
|
||||
|
||||
if (face == 2)
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ public class RenderSorter extends TileEntitySpecialRenderer
|
|||
{
|
||||
pos = 8;
|
||||
}
|
||||
bindTextureByName(AssemblyLine.TEXTURE_PATH + "ejector.png");
|
||||
bindTextureByName(AssemblyLine.TEXTURE_PATH + "sorter.png");
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
|
|
Loading…
Reference in a new issue