More fixes

This commit is contained in:
Calclavia 2012-10-28 13:36:34 +08:00
parent e13a214549
commit e8afe5d767
22 changed files with 1357 additions and 251 deletions

1
README.md Normal file
View file

@ -0,0 +1 @@
A mod that brings realistic transportation systems into Minecraft.

View file

@ -3,12 +3,12 @@ package assemblyline;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import asmline.GUIEjectorSettings;
import assemblyline.gui.GuiEjectorSettings;
import assemblyline.interaction.ContainerEjector;
import assemblyline.interaction.TileEntityEjector;
import cpw.mods.fml.common.network.IGuiHandler;
public class ALProxy implements IGuiHandler
public class ALCommonProxy implements IGuiHandler
{
public void preInit()
@ -32,7 +32,7 @@ public class ALProxy implements IGuiHandler
{
switch(ID)
{
case 0: return new GUIEjectorSettings(player.inventory, ((TileEntityEjector)tileEntity));
case 0: return new GuiEjectorSettings(player.inventory, ((TileEntityEjector)tileEntity));
}
}

View file

@ -17,6 +17,7 @@ import assemblyline.interaction.TileEntityEjector;
import assemblyline.interaction.TileEntityMachineInput;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
@ -28,14 +29,20 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "asmLine", name = "Assemble Line", version = "V2.3", dependencies = "after:UniversalElectricity")
@NetworkMod(channels =
{ "asmLine" }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketManager.class)
public class AssembleLine
@Mod(modid = "AssemblyLine", name = "Assembly Line", version = AssemblyLine.VERSION, dependencies = "after:BasicComponents")
@NetworkMod(channels = { AssemblyLine.CHANNEL }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketManager.class)
public class AssemblyLine
{
@SidedProxy(clientSide = "asmline.asmClientProxy", serverSide = "asmline.asmProxy")
public static ALProxy proxy;
public static AssembleLine instance;
@SidedProxy(clientSide = "assemblyline.ALClientProxy", serverSide = "assemblyline.ALCommonProxy")
public static ALCommonProxy proxy;
@Instance("AssemblyLine")
public static AssemblyLine instance;
public static final String VERSION = "0.1.0";
public static final String CHANNEL = "AssemblyLine";
public static final Configuration config = new Configuration(new File(cpw.mods.fml.common.Loader.instance().getConfigDir(), "UniversalElectricity/ConveyorBelts.cfg"));
public static int machineID = configurationProperties();
public static int machine2ID;
@ -83,17 +90,17 @@ public class AssembleLine
@PostInit
public void postInit(FMLPostInitializationEvent event)
{
//Conveyor Belt
// Conveyor Belt
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockConveyorBelt), new Object[]
{ "III", "MCM", 'I', Item.ingotIron, 'M', "motor", 'C', "basicCircuit" }));
//Rejector
// Rejector
GameRegistry.addRecipe(new ItemStack(blockMachine, 1, 0), new Object[]
{ "WPW", "@R@", '@', "plateSteel", 'R', Item.redstone, 'P', Block.pistonBase, 'C', "basicCircuit", 'W', "copperWire"});
{ "WPW", "@R@", '@', "plateSteel", 'R', Item.redstone, 'P', Block.pistonBase, 'C', "basicCircuit", 'W', "copperWire" });
//Retriever
// Retriever
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(blockMachine, 1, 4), new Object[]
{ Block.dispenser, "basicCircuit"}));
{ Block.dispenser, "basicCircuit" }));
proxy.postInit();
}

View file

@ -8,7 +8,7 @@ import net.minecraft.src.MathHelper;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import universalelectricity.prefab.BlockMachine;
import asmline.beltRenders.BeltRenderHelper;
import assemblyline.render.BeltRenderHelper;
/**
* The block for the actual conveyor!

View file

@ -18,7 +18,7 @@ import universalelectricity.implement.IConductor;
import universalelectricity.prefab.TileEntityElectricityReceiver;
import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.network.PacketManager;
import assemblyline.AssembleLine;
import assemblyline.AssemblyLine;
import com.google.common.io.ByteArrayDataInput;
@ -176,7 +176,7 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
e.printStackTrace();
}
if (AssembleLine.animationOn)
if (AssemblyLine.animationOn)
{
if (flip == true)
{

View file

@ -6,8 +6,8 @@ import net.minecraft.src.Material;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import universalelectricity.prefab.BlockMachine;
import asmline.beltRenders.BeltRenderHelper;
import assemblyline.AssembleLine;
import assemblyline.AssemblyLine;
import assemblyline.render.BeltRenderHelper;
public class BlockInteraction extends BlockMachine
{
@ -30,7 +30,7 @@ public class BlockInteraction extends BlockMachine
{
if (!par1World.isRemote)
{
par5EntityPlayer.openGui(AssembleLine.instance, 0, par1World, x, y, z);
par5EntityPlayer.openGui(AssemblyLine.instance, 0, par1World, x, y, z);
return true;
}
return true;

View file

@ -44,52 +44,52 @@ public class ContainerEjector extends Container
* Called to transfer a stack from one inventory to the other eg. when shift clicking.
*/
@Override
public ItemStack transferStackInSlot(int par1)
public ItemStack func_82846_b(EntityPlayer par1EntityPlayer, int par1)
{
ItemStack var2 = null;
Slot var3 = (Slot)this.inventorySlots.get(par1);
ItemStack itemStack3 = null;
Slot itemStack = (Slot)this.inventorySlots.get(par1);
if (var3 != null && var3.getHasStack())
if (itemStack != null && itemStack.getHasStack())
{
ItemStack var4 = var3.getStack();
var2 = var4.copy();
ItemStack itemStack2 = itemStack.getStack();
itemStack3 = itemStack2.copy();
if (par1 != 0)
{
if (var4.itemID == Item.coal.shiftedIndex)
if (itemStack2.itemID == Item.coal.shiftedIndex)
{
if (!this.mergeItemStack(var4, 0, 1, false))
if (!this.mergeItemStack(itemStack2, 0, 1, false))
{
return null;
}
}
else if (par1 >= 30 && par1 < 37 && !this.mergeItemStack(var4, 3, 30, false))
else if (par1 >= 30 && par1 < 37 && !this.mergeItemStack(itemStack2, 3, 30, false))
{
return null;
}
}
else if (!this.mergeItemStack(var4, 3, 37, false))
else if (!this.mergeItemStack(itemStack2, 3, 37, false))
{
return null;
}
if (var4.stackSize == 0)
if (itemStack2.stackSize == 0)
{
var3.putStack((ItemStack)null);
itemStack.putStack((ItemStack)null);
}
else
{
var3.onSlotChanged();
itemStack.onSlotChanged();
}
if (var4.stackSize == var2.stackSize)
if (itemStack2.stackSize == itemStack3.stackSize)
{
return null;
}
var3.onPickupFromSlot(var4);
itemStack.func_82870_a(par1EntityPlayer, itemStack2);
}
return var2;
return itemStack3;
}
}

View file

@ -9,7 +9,7 @@ import net.minecraft.src.ItemBlock;
import net.minecraft.src.ItemStack;
import net.minecraft.src.MathHelper;
import net.minecraft.src.World;
import assemblyline.AssembleLine;
import assemblyline.AssemblyLine;
public class ItemMachine extends ItemBlock {
@ -19,11 +19,11 @@ public class ItemMachine extends ItemBlock {
this.setCreativeTab(CreativeTabs.tabRedstone);
}
private String[] names = new String[] {"Ejector", "ItemScooper", "FB","FB"};
int blockID = AssembleLine.machineID;
int blockID = AssemblyLine.machineID;
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(AssembleLine.blockMachine,1,0));
par3List.add(new ItemStack(AssembleLine.blockMachine,1,4));
par3List.add(new ItemStack(AssemblyLine.blockMachine,1,0));
par3List.add(new ItemStack(AssemblyLine.blockMachine,1,4));
//par3List.add(new ItemStack(AssembleLine.blockMachine,1,8));
//par3List.add(new ItemStack(AssembleLine.blockMachine,1,12));
}
@ -59,7 +59,7 @@ public class ItemMachine extends ItemBlock {
@Override
public int getBlockID()
{
return AssembleLine.machineID;
return AssemblyLine.machineID;
}
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)

View file

@ -2,10 +2,13 @@ package assemblyline.interaction;
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;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.Packet;
@ -18,9 +21,6 @@ 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 TileEntityEjector extends TileEntityBase implements IElectricityReceiver, IPacketReceiver
@ -331,4 +331,40 @@ public class TileEntityEjector extends TileEntityBase implements IElectricityRec
this.wattsReceived += (amps * voltage);
}
@Override
public void onDisable(int duration)
{
}
@Override
public boolean isDisabled()
{
return false;
}
@Override
public boolean canConnect(ForgeDirection side)
{
return true;
}
@Override
public double getVoltage()
{
return 120;
}
@Override
public int getSizeInventory()
{
return 10;
}
@Override
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)
{
}
}

View file

@ -6,6 +6,7 @@ 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.NBTTagList;
@ -18,101 +19,108 @@ import universalelectricity.prefab.network.IPacketReceiver;
import com.google.common.io.ByteArrayDataInput;
public class TileEntityMachineInput extends TileEntityElectricityReceiver implements IPacketReceiver,IInventory {
public class TileEntityMachineInput extends TileEntityElectricityReceiver implements IPacketReceiver, IInventory
{
public float energyReq = .1f;
public float energyMax = 10f;
public float energyStor = 0f;
private ItemStack[] containingItems = new ItemStack[1];
public ForgeDirection dir = ForgeDirection.DOWN;
private int count = 0;
@Override
public double wattRequest() {
return energyMax-energyStor;
public double wattRequest()
{
return energyMax - energyStor;
}
@Override
public void updateEntity()
{
if(count++ >=10){
{
if (count++ >= 10)
{
count = 0;
if(!isDisabled())
if (!isDisabled())
{
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
ForgeDirection searchPosition = ForgeDirection.getOrientation(this.getBeltDirection());
dir = searchPosition;
try
{
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(xCoord+searchPosition.offsetX,yCoord+ searchPosition.offsetY,zCoord+ searchPosition.offsetZ, xCoord+searchPosition.offsetX+1,yCoord+ searchPosition.offsetY+1,zCoord+ searchPosition.offsetZ+1);
TileEntity bEnt = worldObj.getBlockTileEntity(xCoord+searchPosition.getOpposite().offsetX,yCoord+ searchPosition.getOpposite().offsetY,zCoord+ searchPosition.getOpposite().offsetZ);
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(xCoord + searchPosition.offsetX, yCoord + searchPosition.offsetY, zCoord + searchPosition.offsetZ, xCoord + searchPosition.offsetX + 1, yCoord + searchPosition.offsetY + 1, zCoord + searchPosition.offsetZ + 1);
TileEntity bEnt = worldObj.getBlockTileEntity(xCoord + searchPosition.getOpposite().offsetX, yCoord + searchPosition.getOpposite().offsetY, zCoord + searchPosition.getOpposite().offsetZ);
List<EntityItem> itemsBehind = worldObj.getEntitiesWithinAABB(EntityItem.class, bounds);
ItemStack tItem = this.containingItems[0];
if(itemsBehind.size() > 0 && this.energyStor > this.energyReq && bEnt instanceof IInventory)
{ energyStor -= energyReq;
if (itemsBehind.size() > 0 && this.energyStor > this.energyReq && bEnt instanceof IInventory)
{
energyStor -= energyReq;
for(EntityItem entity : itemsBehind)
for (EntityItem entity : itemsBehind)
{
ItemStack eStack = entity.item;
int ite = eStack.stackSize;
if(bEnt instanceof TileEntityChest)
if (bEnt instanceof TileEntityChest)
{
TileEntityChest bEntChest2 = null;
TileEntityChest bEntChest = (TileEntityChest)bEnt;
for(int i = 2; i<6; i++)
TileEntityChest bEntChest = (TileEntityChest) bEnt;
for (int i = 2; i < 6; i++)
{
ForgeDirection si = ForgeDirection.getOrientation(i);
if(worldObj.getBlockTileEntity(xCoord+dir.getOpposite().offsetX+si.offsetX, yCoord+dir.getOpposite().offsetY+si.offsetY, zCoord+dir.getOpposite().offsetZ+si.offsetZ) instanceof TileEntityChest)
if (worldObj.getBlockTileEntity(xCoord + dir.getOpposite().offsetX + si.offsetX, yCoord + dir.getOpposite().offsetY + si.offsetY, zCoord + dir.getOpposite().offsetZ + si.offsetZ) instanceof TileEntityChest)
{
bEntChest2 = (TileEntityChest) worldObj.getBlockTileEntity(xCoord+dir.getOpposite().offsetX+si.offsetX, yCoord+dir.getOpposite().offsetY+si.offsetY, zCoord+dir.getOpposite().offsetZ+si.offsetZ);
bEntChest2 = (TileEntityChest) worldObj.getBlockTileEntity(xCoord + dir.getOpposite().offsetX + si.offsetX, yCoord + dir.getOpposite().offsetY + si.offsetY, zCoord + dir.getOpposite().offsetZ + si.offsetZ);
break;
}
}
if(eStack != null && eStack.stackSize > 0){
for(int i =0; i < bEntChest.getSizeInventory(); i++)
if (eStack != null && eStack.stackSize > 0)
{
for (int i = 0; i < bEntChest.getSizeInventory(); i++)
{
ItemStack stack = bEntChest.getStackInSlot(i);
if(stack == null)
{
bEntChest.setInventorySlotContents(i, eStack);
entity.setDead();
eStack = null;
break;
}else
if(stack.getItem().equals(eStack.getItem()) && stack.getItemDamage() == eStack.getItemDamage())
{
int rej = Math.max((stack.stackSize + eStack.stackSize) - stack.getItem().getItemStackLimit(), 0);
stack.stackSize = Math.min(Math.max((stack.stackSize + eStack.stackSize - rej),0),stack.getItem().getItemStackLimit());
eStack.stackSize = rej;
bEntChest.setInventorySlotContents(i, stack);
if(eStack.stackSize <= 0)
ItemStack stack = bEntChest.getStackInSlot(i);
if (stack == null)
{
bEntChest.setInventorySlotContents(i, eStack);
entity.setDead();
eStack = null;
break;
}
else if (stack.getItem().equals(eStack.getItem()) && stack.getItemDamage() == eStack.getItemDamage())
{
int rej = Math.max((stack.stackSize + eStack.stackSize) - stack.getItem().getItemStackLimit(), 0);
stack.stackSize = Math.min(Math.max((stack.stackSize + eStack.stackSize - rej), 0), stack.getItem().getItemStackLimit());
eStack.stackSize = rej;
bEntChest.setInventorySlotContents(i, stack);
if (eStack.stackSize <= 0)
{
entity.setDead();
eStack = null;
break;
}
}
}
}
}
if(bEntChest2 != null && eStack != null && eStack.stackSize > 0)
if (bEntChest2 != null && eStack != null && eStack.stackSize > 0)
{
for(int i =0; i < bEntChest2.getSizeInventory(); i++)
for (int i = 0; i < bEntChest2.getSizeInventory(); i++)
{
ItemStack stack = bEntChest2.getStackInSlot(i);
if(stack == null)
if (stack == null)
{
bEntChest2.setInventorySlotContents(i, eStack);
entity.setDead();
eStack = null;
break;
}else
if(stack.getItem().equals(eStack.getItem()) && stack.getItemDamage() == eStack.getItemDamage())
}
else if (stack.getItem().equals(eStack.getItem()) && stack.getItemDamage() == eStack.getItemDamage())
{
int rej = Math.max((stack.stackSize + eStack.stackSize) - stack.getItem().getItemStackLimit(), 0);
stack.stackSize = Math.min(Math.max((stack.stackSize + eStack.stackSize - rej),0),stack.getItem().getItemStackLimit());
stack.stackSize = Math.min(Math.max((stack.stackSize + eStack.stackSize - rej), 0), stack.getItem().getItemStackLimit());
eStack.stackSize = rej;
bEntChest2.setInventorySlotContents(i, stack);
if(eStack.stackSize <= 0)
if (eStack.stackSize <= 0)
{
entity.setDead();
eStack = null;
@ -120,188 +128,215 @@ public class TileEntityMachineInput extends TileEntityElectricityReceiver implem
}
}
}
}if(entity != null && eStack != null){
if(eStack != null && eStack.stackSize <= 0)
}
if (entity != null && eStack != null)
{
entity.setDead();
eStack = null;
break;
}else
{
entity.setDead();
EntityItem var23 = new EntityItem(worldObj, entity.posX, entity.posY + 0.1D, entity.posZ, eStack);
worldObj.spawnEntityInWorld(var23);
}}
if (eStack != null && eStack.stackSize <= 0)
{
entity.setDead();
eStack = null;
break;
}
else
{
entity.setDead();
EntityItem var23 = new EntityItem(worldObj, entity.posX, entity.posY + 0.1D, entity.posZ, eStack);
worldObj.spawnEntityInWorld(var23);
}
}
}//end chest trade
//TODO setup for ISideInventory
}// end chest trade
// TODO setup for
// ISideInventory
}
}
}catch(Exception e)
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
}
}
public int getBeltDirection()
{
int meta = worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
if(meta >= 4 && meta < 8)
if (meta >= 4 && meta < 8)
{
switch(meta)
switch (meta)
{
case 4: return 2;
case 5: return 5;
case 6: return 3;
case 7: return 4;
case 4:
return 2;
case 5:
return 5;
case 6:
return 3;
case 7:
return 4;
}
}
return 0;
}
@Override
public boolean canReceiveFromSide(ForgeDirection side) {
if(side == dir ||side == dir.getOpposite())
{
return false;
}
public boolean canReceiveFromSide(ForgeDirection side)
{
if (side == dir || side == dir.getOpposite()) { return false; }
return true;
}
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
this.containingItems = new ItemStack[this.getSizeInventory()];
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
{
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
byte var5 = var4.getByte("Slot");
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readFromNBT(par1NBTTagCompound);
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
this.containingItems = new ItemStack[this.getSizeInventory()];
if (var5 >= 0 && var5 < this.containingItems.length)
{
this.containingItems[var5] = ItemStack.loadItemStackFromNBT(var4);
}
}
}
/**
* Writes a tile entity to NBT.
*/
@Override
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
NBTTagList var2 = new NBTTagList();
for (int var3 = 0; var3 < this.containingItems.length; ++var3)
{
if (this.containingItems[var3] != null)
{
NBTTagCompound var4 = new NBTTagCompound();
var4.setByte("Slot", (byte)var3);
this.containingItems[var3].writeToNBT(var4);
var2.appendTag(var4);
}
}
par1NBTTagCompound.setTag("Items", var2);
}
@Override
public int getSizeInventory()
{
return this.containingItems.length;
}
@Override
public ItemStack getStackInSlot(int par1)
{
return this.containingItems[par1];
}
@Override
public ItemStack decrStackSize(int par1, int par2)
{
if (this.containingItems[par1] != null)
{
ItemStack var3;
if (this.containingItems[par1].stackSize <= par2)
{
var3 = this.containingItems[par1];
this.containingItems[par1] = null;
return var3;
}
else
{
var3 = this.containingItems[par1].splitStack(par2);
if (this.containingItems[par1].stackSize == 0)
{
this.containingItems[par1] = null;
}
return var3;
}
}
else
{
return null;
}
}
@Override
public ItemStack getStackInSlotOnClosing(int par1)
{
if (this.containingItems[par1] != null)
{
ItemStack var2 = this.containingItems[par1];
this.containingItems[par1] = null;
return var2;
}
else
{
return null;
}
}
@Override
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
{
this.containingItems[par1] = par2ItemStack;
if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
{
par2ItemStack.stackSize = this.getInventoryStackLimit();
}
}
@Override
public String getInvName()
{
return "Ejector";
}
@Override
public int getInventoryStackLimit()
{
//TODO change
return 0;
}
@Override
public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)
{
return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D;
}
@Override
public void openChest() { }
@Override
public void closeChest() { }
@Override
public void onReceive(TileEntity sender, double amps, double voltage,
ForgeDirection side) {
this.energyStor+=(amps*voltage);
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
{
NBTTagCompound var4 = (NBTTagCompound) var2.tagAt(var3);
byte var5 = var4.getByte("Slot");
if (var5 >= 0 && var5 < this.containingItems.length)
{
this.containingItems[var5] = ItemStack.loadItemStackFromNBT(var4);
}
}
@Override
public void handlePacketData(NetworkManager network, int packetType,
Packet250CustomPayload packet, EntityPlayer player,
ByteArrayDataInput dataStream) {
}
/**
* Writes a tile entity to NBT.
*/
@Override
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeToNBT(par1NBTTagCompound);
NBTTagList var2 = new NBTTagList();
for (int var3 = 0; var3 < this.containingItems.length; ++var3)
{
if (this.containingItems[var3] != null)
{
NBTTagCompound var4 = new NBTTagCompound();
var4.setByte("Slot", (byte) var3);
this.containingItems[var3].writeToNBT(var4);
var2.appendTag(var4);
}
}
par1NBTTagCompound.setTag("Items", var2);
}
@Override
public int getSizeInventory()
{
return this.containingItems.length;
}
@Override
public ItemStack getStackInSlot(int par1)
{
return this.containingItems[par1];
}
@Override
public ItemStack decrStackSize(int par1, int par2)
{
if (this.containingItems[par1] != null)
{
ItemStack var3;
if (this.containingItems[par1].stackSize <= par2)
{
var3 = this.containingItems[par1];
this.containingItems[par1] = null;
return var3;
}
else
{
var3 = this.containingItems[par1].splitStack(par2);
if (this.containingItems[par1].stackSize == 0)
{
this.containingItems[par1] = null;
}
return var3;
}
}
else
{
return null;
}
}
@Override
public ItemStack getStackInSlotOnClosing(int par1)
{
if (this.containingItems[par1] != null)
{
ItemStack var2 = this.containingItems[par1];
this.containingItems[par1] = null;
return var2;
}
else
{
return null;
}
}
@Override
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
{
this.containingItems[par1] = par2ItemStack;
if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
{
par2ItemStack.stackSize = this.getInventoryStackLimit();
}
}
@Override
public String getInvName()
{
return "Ejector";
}
@Override
public int getInventoryStackLimit()
{
// TODO change
return 0;
}
@Override
public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)
{
return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D;
}
@Override
public void openChest()
{
}
@Override
public void closeChest()
{
}
@Override
public void onReceive(TileEntity sender, double amps, double voltage, ForgeDirection side)
{
this.energyStor += (amps * voltage);
}
@Override
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)
{
}
}

View file

@ -0,0 +1,32 @@
package assemblyline;
import net.minecraftforge.client.MinecraftForgeClient;
import assemblyline.AssemblyLine;
import assemblyline.ALCommonProxy;
import assemblyline.belts.TileEntityConveyorBelt;
import assemblyline.interaction.TileEntityEjector;
import assemblyline.interaction.TileEntityMachineInput;
import assemblyline.render.BeltRenderHelper;
import assemblyline.render.RenderBeltMain;
import assemblyline.render.RenderMachineBelt;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class ALClientProxy extends ALCommonProxy
{
@Override
public void preInit()
{
MinecraftForgeClient.preloadTexture(AssemblyLine.TEXTURE_PATH+"/Items.png");
RenderingRegistry.registerBlockHandler(new BeltRenderHelper());
}
@Override
public void init()
{
//ClientRegistry.registerTileEntity(TileEntityConveyorBelt.class, "belt", new RenderConveyorBelt());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityConveyorBelt.class, new RenderBeltMain());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEjector.class,new RenderEjector());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineInput.class,new RenderMachineBelt());
}
}

View file

@ -0,0 +1,108 @@
package assemblyline;
import net.minecraft.src.Entity;
import net.minecraft.src.ModelBase;
import net.minecraft.src.ModelRenderer;
public class ModelDropBox extends ModelBase
{
// fields
ModelRenderer Left;
ModelRenderer Top;
ModelRenderer Front;
ModelRenderer LeftB;
ModelRenderer Back;
ModelRenderer Right;
ModelRenderer RightB;
ModelRenderer Bottom;
ModelRenderer Back3;
ModelRenderer Back2;
public ModelDropBox()
{
textureWidth = 128;
textureHeight = 128;
Left = new ModelRenderer(this, 33, 43);
Left.addBox(7F, -10F, -8F, 1, 7, 15);
Left.setRotationPoint(0F, 19F, 0F);
Left.setTextureSize(128, 128);
Left.mirror = true;
setRotation(Left, 0F, 0F, 0F);
Top = new ModelRenderer(this, 0, 65);
Top.addBox(-7F, -11F, -7F, 14, 1, 14);
Top.setRotationPoint(0F, 19F, 0F);
Top.setTextureSize(128, 128);
Top.mirror = true;
setRotation(Top, 0F, 0F, 0F);
Front = new ModelRenderer(this, 0, 33);
Front.addBox(-8F, -4F, -7.5F, 16, 5, 1);
Front.setRotationPoint(0F, 19F, 0F);
Front.setTextureSize(128, 128);
Front.mirror = true;
setRotation(Front, 0.5235988F, 0F, 0F);
LeftB = new ModelRenderer(this, 36, 21);
LeftB.addBox(7F, -3F, -6F, 1, 8, 13);
LeftB.setRotationPoint(0F, 19F, 0F);
LeftB.setTextureSize(128, 128);
LeftB.mirror = true;
setRotation(LeftB, 0F, 0F, 0F);
Back = new ModelRenderer(this, 0, 96);
Back.addBox(-5F, -8F, 4F, 10, 10, 4);
Back.setRotationPoint(0F, 19F, 0F);
Back.setTextureSize(128, 128);
Back.mirror = true;
setRotation(Back, 0F, 0F, 0F);
Right = new ModelRenderer(this, 0, 42);
Right.addBox(-8F, -10F, -8F, 1, 7, 15);
Right.setRotationPoint(0F, 19F, 0F);
Right.setTextureSize(128, 128);
Right.mirror = true;
setRotation(Right, 0F, 0F, 0F);
RightB = new ModelRenderer(this, 36, 0);
RightB.addBox(-8F, -3F, -6F, 1, 8, 13);
RightB.setRotationPoint(0F, 19F, 0F);
RightB.setTextureSize(128, 128);
RightB.mirror = true;
setRotation(RightB, 0F, 0F, 0F);
Bottom = new ModelRenderer(this, 0, 81);
Bottom.addBox(-7F, 4F, -6F, 14, 1, 13);
Bottom.setRotationPoint(0F, 19F, 0F);
Bottom.setTextureSize(128, 128);
Bottom.mirror = true;
setRotation(Bottom, 0F, 0F, 0F);
Back3 = new ModelRenderer(this, 0, 23);
Back3.addBox(-7F, -10F, -9F, 14, 8, 1);
Back3.setRotationPoint(0F, 19F, 0F);
Back3.setTextureSize(128, 128);
Back3.mirror = true;
setRotation(Back3, -0.1919862F, 0F, 0F);
Back2 = new ModelRenderer(this, 0, 7);
Back2.addBox(-7F, -10F, 3F, 14, 14, 1);
Back2.setRotationPoint(0F, 19F, 0F);
Back2.setTextureSize(128, 128);
Back2.mirror = true;
setRotation(Back2, 0F, 0F, 0F);
}
public void render(float f5)
{
Left.render(f5);
Top.render(f5);
Front.render(f5);
LeftB.render(f5);
Back.render(f5);
Right.render(f5);
RightB.render(f5);
Bottom.render(f5);
Back.render(f5);
Back.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -0,0 +1,120 @@
// Date: 9/8/2012 7:10:46 PM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package assemblyline;
import net.minecraft.src.Entity;
import net.minecraft.src.ModelBase;
import net.minecraft.src.ModelRenderer;
public class ModelEjector extends ModelBase
{
// fields
ModelRenderer Base;
ModelRenderer Case;
ModelRenderer Piston;
ModelRenderer H1;
ModelRenderer H2;
ModelRenderer Top;
ModelRenderer Case2;
ModelRenderer H3;
ModelRenderer PistonShaft;
ModelRenderer PistonFace;
public ModelEjector()
{
textureWidth = 128;
textureHeight = 128;
Base = new ModelRenderer(this, 64, 0);
Base.addBox(-8F, 0F, -8F, 16, 4, 16);
Base.setRotationPoint(0F, 20F, 0F);
Base.setTextureSize(64, 32);
Base.mirror = true;
setRotation(Base, 0F, 0F, 0F);
Case = new ModelRenderer(this, 0, 38);
Case.addBox(-2F, 0F, 0F, 4, 8, 13);
Case.setRotationPoint(-5F, 12F, -6F);
Case.setTextureSize(64, 32);
Case.mirror = true;
setRotation(Case, 0F, 0F, 0F);
Piston = new ModelRenderer(this, 0, 22);
Piston.addBox(-2F, 0F, 0F, 4, 4, 10);
Piston.setRotationPoint(0F, 15F, -5F);
Piston.setTextureSize(64, 32);
Piston.mirror = true;
setRotation(Piston, 0F, 0F, 0F);
H1 = new ModelRenderer(this, 29, 23);
H1.addBox(-2F, 0F, 0F, 2, 1, 8);
H1.setRotationPoint(1F, 19F, -4F);
H1.setTextureSize(64, 32);
H1.mirror = true;
setRotation(H1, 0F, 0F, 0F);
H2 = new ModelRenderer(this, 54, 23);
H2.addBox(-2F, 0F, 0F, 1, 2, 8);
H2.setRotationPoint(-1F, 16F, -4F);
H2.setTextureSize(64, 32);
H2.mirror = true;
setRotation(H2, 0F, 0F, 0F);
Top = new ModelRenderer(this, 0, 0);
Top.addBox(-8F, 0F, -8F, 16, 4, 16);
Top.setRotationPoint(0F, 8F, 0F);
Top.setTextureSize(64, 32);
Top.mirror = true;
setRotation(Top, 0F, 0F, 0F);
Case2 = new ModelRenderer(this, 0, 38);
Case2.addBox(-2F, 0F, 0F, 4, 8, 13);
Case2.setRotationPoint(5F, 12F, -6F);
Case2.setTextureSize(64, 32);
Case2.mirror = true;
setRotation(Case2, 0F, 0F, 0F);
H3 = new ModelRenderer(this, 54, 23);
H3.addBox(-2F, 0F, 0F, 1, 2, 8);
H3.setRotationPoint(4F, 16F, -4F);
H3.setTextureSize(64, 32);
H3.mirror = true;
setRotation(H3, 0F, 0F, 0F);
PistonShaft = new ModelRenderer(this, 0, 67);
PistonShaft.addBox(-1F, -1F, 0F, 2, 2, 10);
PistonShaft.setRotationPoint(0F, 17F, -6F);
PistonShaft.setTextureSize(64, 32);
PistonShaft.mirror = true;
setRotation(PistonShaft, 0F, 0F, 0F);
PistonFace = new ModelRenderer(this, 0, 62);
PistonFace.addBox(-3F, -1F, -1F, 6, 2, 1);
PistonFace.setRotationPoint(0F, 17F, -6F);
PistonFace.setTextureSize(64, 32);
PistonFace.mirror = true;
setRotation(PistonFace, 0F, 0F, 0F);
}
public void renderMain(float f5)
{
Base.render(f5);
Case.render(f5);
H1.render(f5);
H2.render(f5);
Top.render(f5);
Case2.render(f5);
H3.render(f5);
}
public void renderPiston(float f5, int pos)
{
Piston.render(f5);
PistonShaft.setRotationPoint(0F, 17F, -6F - pos);
PistonFace.setRotationPoint(0F, 17F, -6F - pos);
PistonShaft.render(f5);
PistonFace.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -0,0 +1,38 @@
package assemblyline;
import net.minecraft.src.TileEntity;
import net.minecraft.src.TileEntitySpecialRenderer;
import org.lwjgl.opengl.GL11;
import assemblyline.interaction.TileEntityMachineInput;
public class RenderDropBox extends TileEntitySpecialRenderer
{
private ModelDropBox model = new ModelDropBox();
public void renderAModelAt(TileEntity tileEntity, double x, double y, double z, float f)
{
int face = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
int pos = 0;
bindTextureByName("/textures/DropBox.png");
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
if(face==4){ GL11.glRotatef(180f, 0f, 1f, 0f);}
if(face==6){ GL11.glRotatef(0f, 0f, 1f, 0f);}
if(face==5){ GL11.glRotatef(270f, 0f, 1f, 0f);}
if(face==7){ GL11.glRotatef(90f, 0f, 1f, 0f);}
model.render(0.0625F);
GL11.glPopMatrix();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{
this.renderAModelAt((TileEntityMachineInput)tileEntity, var2, var4, var6, var8);
}
}

View file

@ -0,0 +1,40 @@
package assemblyline;
import net.minecraft.src.TileEntity;
import net.minecraft.src.TileEntitySpecialRenderer;
import org.lwjgl.opengl.GL11;
import assemblyline.interaction.TileEntityEjector;
public class RenderEjector extends TileEntitySpecialRenderer
{
private ModelEjector model = new ModelEjector();
public void renderAModelAt(TileEntityEjector tileEntity, double x, double y, double z, float f)
{
boolean fire = tileEntity.firePiston;
int face = tileEntity.getDirection(tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
int pos = 0;
if(fire){pos = 8;}
bindTextureByName("/textures/Ejector.png");
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
if(face==2){ GL11.glRotatef(180f, 0f, 1f, 0f);}
if(face==3){ GL11.glRotatef(0f, 0f, 1f, 0f);}
if(face==4){ GL11.glRotatef(90f, 0f, 1f, 0f);}
if(face==5){ GL11.glRotatef(270f, 0f, 1f, 0f);}
model.renderMain(0.0625F);
model.renderPiston(0.0625F, pos);
GL11.glPopMatrix();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{
this.renderAModelAt((TileEntityEjector)tileEntity, var2, var4, var6, var8);
}
}

View file

@ -0,0 +1,46 @@
package assemblyline.gui;
import net.minecraft.src.ContainerWorkbench;
import net.minecraft.src.GuiContainer;
import net.minecraft.src.InventoryPlayer;
import net.minecraft.src.StatCollector;
import net.minecraft.src.World;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiCrafting extends GuiContainer
{
public GuiCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
super(new ContainerWorkbench(par1InventoryPlayer, par2World, par3, par4, par5));
//TODO on opening if the user is not the owner they can see the crafting recipes but if
//the machine is locked they can't do anything with it
//Also the need to add a locking button can only be activate by the owner
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
protected void drawGuiContainerForegroundLayer()
{
this.fontRenderer.drawString(StatCollector.translateToLocal("AutoCrafter"), 28, 6, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
int var4 = this.mc.renderEngine.getTexture("/gui/crafting.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(var4);
int var5 = (this.width - this.xSize) / 2;
int var6 = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
}
}

View file

@ -0,0 +1,53 @@
package assemblyline.gui;
import net.minecraft.src.GuiContainer;
import net.minecraft.src.InventoryPlayer;
import net.minecraft.src.StatCollector;
import org.lwjgl.opengl.GL11;
import assemblyline.AssemblyLine;
import assemblyline.interaction.ContainerEjector;
import assemblyline.interaction.TileEntityEjector;
public class GuiEjectorSettings extends GuiContainer
{
private TileEntityEjector tileEntity;
private int containerWidth;
private int containerHeight;
public GuiEjectorSettings(InventoryPlayer par1InventoryPlayer, TileEntityEjector tileEntity)
{
super(new ContainerEjector(par1InventoryPlayer, tileEntity));
this.tileEntity = tileEntity;
}
/**
* Draw the foreground layer for the
* GuiContainer (everything in front of the
* items)
*/
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
this.fontRenderer.drawString("Ejector Settings", 55, 6, 4210752);
this.fontRenderer.drawString("Voltage: " + (int) this.tileEntity.getVoltage(), 95, 60, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
/**
* Draw the background layer for the
* GuiContainer (everything behind the items)
*/
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
int var4 = this.mc.renderEngine.getTexture(AssemblyLine.TEXTURE_PATH + "/GuiEjector.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(var4);
containerWidth = (this.width - this.xSize) / 2;
containerHeight = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize);
}
}

View file

@ -0,0 +1,60 @@
package assemblyline.render;
import net.minecraft.src.Block;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.RenderBlocks;
import org.lwjgl.opengl.GL11;
import assemblyline.AssemblyLine;
import assemblyline.ModelEjector;
import assemblyline.belts.TileEntityConveyorBelt;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class BeltRenderHelper implements ISimpleBlockRenderingHandler {
public static BeltRenderHelper instance = new BeltRenderHelper();
public static int blockRenderId = RenderingRegistry.getNextAvailableRenderId();
private static TileEntityConveyorBelt belt = null;
private ModelConveyorBelt modelBelt = new ModelConveyorBelt();
private ModelEjector modelEj = new ModelEjector();
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
if(block.blockID == assemblyline.AssemblyLine.beltBlockID)
{
//TileEntityRenderer.instance.renderTileEntityAt(belt, -0.5D, 0.0D, -0.5D, 0.0F);
GL11.glPushMatrix();
GL11.glTranslatef((float) 0.0F, (float)1.5F, (float)0.0F);
GL11.glRotatef(180f, 0f, 0f, 1f);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture("/textures/BeltTexture.png"));
//bindTextureByName("/textures/BeltSingle.png");
modelBelt.render(0.0625F,0, false,false,false);
GL11.glPopMatrix();
}
if(block.blockID == assemblyline.AssemblyLine.machineID && metadata == 0)
{
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture("/textures/Ejector.png"));
GL11.glPushMatrix();
GL11.glTranslatef((float) 0.6F, (float)1.5F, (float)0.6F);
GL11.glRotatef(180f, 0f, 0f, 1f);
GL11.glRotatef(-90f, 0f, 1f, 0f);
modelEj.renderMain(0.0625F);
modelEj.renderPiston(0.0625F, 1);
GL11.glPopMatrix();
}
}
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
public boolean shouldRender3DInInventory() {
return true;
}
public int getRenderId()
{
return blockRenderId;
}
}

View file

@ -0,0 +1,239 @@
package assemblyline.render;
import net.minecraft.src.Entity;
import net.minecraft.src.ModelBase;
import net.minecraft.src.ModelRenderer;
public class ModelConveyorBelt extends ModelBase
{
// fields
ModelRenderer bBELTLong;
ModelRenderer FBELT;
ModelRenderer BacBELT;
ModelRenderer BBelt;
ModelRenderer FRL;
ModelRenderer MRL;
ModelRenderer FLL;
ModelRenderer BLL;
ModelRenderer MRoller;
ModelRenderer BRoller;
ModelRenderer tBELT;
ModelRenderer FRoller;
ModelRenderer BRL;
ModelRenderer BML;
ModelRenderer tBELTLong;
ModelRenderer tBELT15;
ModelRenderer bBELT15;
ModelRenderer c4;
ModelRenderer c3;
ModelRenderer c2;
ModelRenderer c1;
public ModelConveyorBelt()
{
textureWidth = 128;
textureHeight = 128;
bBELTLong = new ModelRenderer(this, 0, 66);
bBELTLong.addBox(0F, 0F, 0F, 14, 1, 16);
bBELTLong.setRotationPoint(-7F, 22F, -8F);
bBELTLong.setTextureSize(128, 128);
bBELTLong.mirror = true;
setRotation(bBELTLong, 0F, 0F, 0F);
FBELT = new ModelRenderer(this, 0, 16);
FBELT.addBox(0F, 0F, 0F, 14, 2, 1);
FBELT.setRotationPoint(-7F, 20F, -8F);
FBELT.setTextureSize(128, 128);
FBELT.mirror = true;
setRotation(FBELT, 0F, 0F, 0F);
BacBELT = new ModelRenderer(this, 0, 16);
BacBELT.addBox(0F, 0F, 0F, 14, 2, 1);
BacBELT.setRotationPoint(-7F, 20F, 7F);
BacBELT.setTextureSize(128, 128);
BacBELT.mirror = true;
setRotation(BacBELT, 0F, 0F, 0F);
BBelt = new ModelRenderer(this, 0, 31);
BBelt.addBox(0F, 0F, 0F, 14, 1, 14);
BBelt.setRotationPoint(-7F, 22F, -7F);
BBelt.setTextureSize(128, 128);
BBelt.mirror = true;
setRotation(BBelt, 0F, 0F, 0F);
FRL = new ModelRenderer(this, 0, 20);
FRL.addBox(0F, 0F, 0F, 1, 3, 2);
FRL.setRotationPoint(-8F, 21F, -6F);
FRL.setTextureSize(128, 128);
FRL.mirror = true;
setRotation(FRL, 0F, 0F, 0F);
MRL = new ModelRenderer(this, 0, 20);
MRL.addBox(0F, 0F, 0F, 1, 3, 2);
MRL.setRotationPoint(-8F, 21F, -1F);
MRL.setTextureSize(128, 128);
MRL.mirror = true;
setRotation(MRL, 0F, 0F, 0F);
FLL = new ModelRenderer(this, 0, 20);
FLL.addBox(0F, 0F, 0F, 1, 3, 2);
FLL.setRotationPoint(7F, 21F, -6F);
FLL.setTextureSize(128, 128);
FLL.mirror = true;
setRotation(FLL, 0F, 0F, 0F);
BLL = new ModelRenderer(this, 0, 20);
BLL.addBox(0F, 0F, 0F, 1, 3, 2);
BLL.setRotationPoint(7F, 21F, 4F);
BLL.setTextureSize(128, 128);
BLL.mirror = true;
setRotation(BLL, 0F, 0F, 0F);
MRoller = new ModelRenderer(this, 0, 26);
MRoller.addBox(-7F, -1F, -1F, 14, 2, 2);
MRoller.setRotationPoint(0F, 21F, 0F);
MRoller.setTextureSize(128, 128);
MRoller.mirror = true;
setRotation(MRoller, 0F, 0F, 0F);
BRoller = new ModelRenderer(this, 0, 26);
BRoller.addBox(-7F, -1F, -1F, 14, 2, 2);
BRoller.setRotationPoint(0F, 21F, 5F);
BRoller.setTextureSize(128, 128);
BRoller.mirror = true;
setRotation(BRoller, 0F, 0F, 0F);
tBELT = new ModelRenderer(this, 0, 0);
tBELT.addBox(0F, 0F, 0F, 14, 1, 14);
tBELT.setRotationPoint(-7F, 19F, -7F);
tBELT.setTextureSize(128, 128);
tBELT.mirror = true;
setRotation(tBELT, 0F, 0F, 0F);
FRoller = new ModelRenderer(this, 0, 26);
FRoller.addBox(-7F, -1F, -1F, 14, 2, 2);
FRoller.setRotationPoint(0F, 21F, -5F);
FRoller.setTextureSize(128, 128);
FRoller.mirror = true;
setRotation(FRoller, 0F, 0F, 0F);
BRL = new ModelRenderer(this, 0, 20);
BRL.addBox(0F, 0F, 0F, 1, 3, 2);
BRL.setRotationPoint(-8F, 21F, 4F);
BRL.setTextureSize(128, 128);
BRL.mirror = true;
setRotation(BRL, 0F, 0F, 0F);
BML = new ModelRenderer(this, 0, 20);
BML.addBox(0F, 0F, 0F, 1, 3, 2);
BML.setRotationPoint(7F, 21F, -1F);
BML.setTextureSize(128, 128);
BML.mirror = true;
setRotation(BML, 0F, 0F, 0F);
tBELTLong = new ModelRenderer(this, 0, 48);
tBELTLong.addBox(0F, 0F, 0F, 14, 1, 16);
tBELTLong.setRotationPoint(-7F, 19F, -8F);
tBELTLong.setTextureSize(128, 128);
tBELTLong.mirror = true;
setRotation(tBELTLong, 0F, 0F, 0F);
// 15p long belts for end caps
tBELT15 = new ModelRenderer(this, 0, 84);
tBELT15.addBox(0F, 0F, 0F, 14, 1, 15);
tBELT15.setRotationPoint(-7F, 19F, -8F);
tBELT15.setTextureSize(128, 128);
tBELT15.mirror = true;
setRotation(tBELT15, 0F, 0F, 0F);
bBELT15 = new ModelRenderer(this, 0, 84);
bBELT15.addBox(0F, 0F, 0F, 14, 1, 15);
bBELT15.setRotationPoint(-7F, 22F, -8F);
bBELT15.setTextureSize(128, 128);
bBELT15.mirror = true;
setRotation(bBELT15, 0F, 0F, 0F);
// bracers if connected to machane above
c4 = new ModelRenderer(this, 60, 20);
c4.addBox(0F, 0F, 0F, 1, 16, 1);
c4.setRotationPoint(7F, 8F, 7F);
c4.setTextureSize(128, 128);
c4.mirror = true;
setRotation(c4, 0F, 0F, 0F);
c3 = new ModelRenderer(this, 60, 20);
c3.addBox(0F, 0F, 0F, 1, 16, 1);
c3.setRotationPoint(7F, 8F, -8F);
c3.setTextureSize(128, 128);
c3.mirror = true;
setRotation(c3, 0F, 0F, 0F);
c2 = new ModelRenderer(this, 60, 20);
c2.addBox(0F, 0F, 0F, 1, 16, 1);
c2.setRotationPoint(-8F, 8F, 7F);
c2.setTextureSize(128, 128);
c2.mirror = true;
setRotation(c2, 0F, 0F, 0F);
c1 = new ModelRenderer(this, 60, 20);
c1.addBox(0F, 0F, 0F, 1, 16, 1);
c1.setRotationPoint(-8F, 8F, -8F);
c1.setTextureSize(128, 128);
c1.mirror = true;
setRotation(c1, 0F, 0F, 0F);
}
public void render(float f5, int pos, boolean front, boolean back, boolean above)
{
boolean mid = front && back ? true : false;
boolean leftCap = !front && back ? true : false;
boolean rightCap = front && !back ? true : false;
if (back || front)
{
// use longer belts if needs to render
// none normal
if (leftCap)
{
FBELT.render(f5);
tBELT15.setRotationPoint(-7F, 19F, -7F);
bBELT15.setRotationPoint(-7F, 22F, -7F);
tBELT15.render(f5);
bBELT15.render(f5);
}
else if (rightCap)
{
BacBELT.render(f5);
tBELT15.setRotationPoint(-7F, 19F, -8F);
bBELT15.setRotationPoint(-7F, 22F, -8F);
tBELT15.render(f5);
bBELT15.render(f5);
}
else
{
bBELTLong.render(f5);
tBELTLong.render(f5);
}
}
else
{
// render normal if nothing is on
// either side
FBELT.render(f5);
BacBELT.render(f5);
BBelt.render(f5);
tBELT.render(f5);
}
if (above)
{
c1.render(f5);
c2.render(f5);
c3.render(f5);
c4.render(f5);
}
// rollers
MRoller.rotateAngleX = 0.7853982F * pos;
BRoller.rotateAngleX = 0.7853982F * pos;
FRoller.rotateAngleX = 0.7853982F * pos;
MRoller.render(f5);
BRoller.render(f5);
FRoller.render(f5);
// legs
BRL.render(f5);
BML.render(f5);
FLL.render(f5);
BLL.render(f5);
FRL.render(f5);
MRL.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -0,0 +1,203 @@
package assemblyline.render;
import net.minecraft.src.Entity;
import net.minecraft.src.ModelBase;
import net.minecraft.src.ModelRenderer;
public class ModelMachineBelt extends ModelBase
{
// fields
ModelRenderer bBELTLong;
ModelRenderer FBELT;
ModelRenderer BacPanel;
ModelRenderer BBelt;
ModelRenderer FRL;
ModelRenderer MRL;
ModelRenderer FLL;
ModelRenderer BLL;
ModelRenderer MRoller;
ModelRenderer BRoller;
ModelRenderer tBELT;
ModelRenderer FRoller;
ModelRenderer BRL;
ModelRenderer BML;
ModelRenderer tBELTLong;
ModelRenderer RPanel;
ModelRenderer LPanel;
ModelRenderer TopPanel;
ModelRenderer RCPanel;
ModelRenderer LCPanel;
public ModelMachineBelt()
{
textureWidth = 128;
textureHeight = 128;
bBELTLong = new ModelRenderer(this, 0, 66);
bBELTLong.addBox(0F, 0F, 0F, 14, 1, 16);
bBELTLong.setRotationPoint(-7F, 22F, -8F);
bBELTLong.setTextureSize(128, 128);
bBELTLong.mirror = true;
setRotation(bBELTLong, 0F, 0F, 0F);
FBELT = new ModelRenderer(this, 0, 16);
FBELT.addBox(0F, 0F, 0F, 14, 2, 1);
FBELT.setRotationPoint(-7F, 20F, -8F);
FBELT.setTextureSize(128, 128);
FBELT.mirror = true;
setRotation(FBELT, 0F, 0F, 0F);
BacPanel = new ModelRenderer(this, 0, 86);
BacPanel.addBox(0F, -12F, 0F, 14, 12, 1);
BacPanel.setRotationPoint(-7F, 24F, 7F);
BacPanel.setTextureSize(128, 128);
BacPanel.mirror = true;
setRotation(BacPanel, 0F, 0F, 0F);
BBelt = new ModelRenderer(this, 0, 31);
BBelt.addBox(0F, 0F, 0F, 14, 1, 14);
BBelt.setRotationPoint(-7F, 22F, -7F);
BBelt.setTextureSize(128, 128);
BBelt.mirror = true;
setRotation(BBelt, 0F, 0F, 0F);
FRL = new ModelRenderer(this, 0, 20);
FRL.addBox(0F, 0F, 0F, 1, 3, 2);
FRL.setRotationPoint(-8F, 21F, -6F);
FRL.setTextureSize(128, 128);
FRL.mirror = true;
setRotation(FRL, 0F, 0F, 0F);
MRL = new ModelRenderer(this, 0, 20);
MRL.addBox(0F, 0F, 0F, 1, 3, 2);
MRL.setRotationPoint(-8F, 21F, -1F);
MRL.setTextureSize(128, 128);
MRL.mirror = true;
setRotation(MRL, 0F, 0F, 0F);
FLL = new ModelRenderer(this, 0, 20);
FLL.addBox(0F, 0F, 0F, 1, 3, 2);
FLL.setRotationPoint(7F, 21F, -6F);
FLL.setTextureSize(128, 128);
FLL.mirror = true;
setRotation(FLL, 0F, 0F, 0F);
BLL = new ModelRenderer(this, 0, 20);
BLL.addBox(0F, 0F, 0F, 1, 3, 2);
BLL.setRotationPoint(7F, 21F, 4F);
BLL.setTextureSize(128, 128);
BLL.mirror = true;
setRotation(BLL, 0F, 0F, 0F);
MRoller = new ModelRenderer(this, 0, 26);
MRoller.addBox(-7F, -1F, -1F, 14, 2, 2);
MRoller.setRotationPoint(0F, 21F, 0F);
MRoller.setTextureSize(128, 128);
MRoller.mirror = true;
setRotation(MRoller, 0F, 0F, 0F);
BRoller = new ModelRenderer(this, 0, 26);
BRoller.addBox(-7F, -1F, -1F, 14, 2, 2);
BRoller.setRotationPoint(0F, 21F, 5F);
BRoller.setTextureSize(128, 128);
BRoller.mirror = true;
setRotation(BRoller, 0F, 0F, 0F);
tBELT = new ModelRenderer(this, 0, 0);
tBELT.addBox(0F, 0F, 0F, 14, 1, 14);
tBELT.setRotationPoint(-7F, 19F, -7F);
tBELT.setTextureSize(128, 128);
tBELT.mirror = true;
setRotation(tBELT, 0F, 0F, 0F);
FRoller = new ModelRenderer(this, 0, 26);
FRoller.addBox(-7F, -1F, -1F, 14, 2, 2);
FRoller.setRotationPoint(0F, 21F, -5F);
FRoller.setTextureSize(128, 128);
FRoller.mirror = true;
setRotation(FRoller, 0F, 0F, 0F);
BRL = new ModelRenderer(this, 0, 20);
BRL.addBox(0F, 0F, 0F, 1, 3, 2);
BRL.setRotationPoint(-8F, 21F, 4F);
BRL.setTextureSize(128, 128);
BRL.mirror = true;
setRotation(BRL, 0F, 0F, 0F);
BML = new ModelRenderer(this, 0, 20);
BML.addBox(0F, 0F, 0F, 1, 3, 2);
BML.setRotationPoint(7F, 21F, -1F);
BML.setTextureSize(128, 128);
BML.mirror = true;
setRotation(BML, 0F, 0F, 0F);
tBELTLong = new ModelRenderer(this, 0, 48);
tBELTLong.addBox(0F, 0F, 0F, 14, 1, 16);
tBELTLong.setRotationPoint(-7F, 19F, -8F);
tBELTLong.setTextureSize(128, 128);
tBELTLong.mirror = true;
setRotation(tBELTLong, 0F, 0F, 0F);
RPanel = new ModelRenderer(this, 65, 41);
RPanel.addBox(0F, -2F, -8F, 1, 4, 16);
RPanel.setRotationPoint(-8F, 19F, 0F);
RPanel.setTextureSize(128, 128);
RPanel.mirror = true;
setRotation(RPanel, 0F, 0F, 0F);
LPanel = new ModelRenderer(this, 65, 20);
LPanel.addBox(0F, -2F, -8F, 1, 4, 16);
LPanel.setRotationPoint(7F, 19F, 0F);
LPanel.setTextureSize(128, 128);
LPanel.mirror = true;
setRotation(LPanel, 0F, 0F, 0F);
TopPanel = new ModelRenderer(this, 0, 105);
TopPanel.addBox(0F, 0F, 0F, 14, 2, 10);
TopPanel.setRotationPoint(-7F, 12F, -3F);
TopPanel.setTextureSize(128, 128);
TopPanel.mirror = true;
setRotation(TopPanel, 0F, 0F, 0F);
RCPanel = new ModelRenderer(this, 50, 105);
RCPanel.addBox(-1F, 0F, 0F, 2, 5, 10);
RCPanel.setRotationPoint(-7F, 14F, -3F);
RCPanel.setTextureSize(128, 128);
RCPanel.mirror = true;
setRotation(RCPanel, 0F, 0F, 0F);
LCPanel = new ModelRenderer(this, 76, 105);
LCPanel.addBox(0F, 0F, 0F, 2, 5, 10);
LCPanel.setRotationPoint(6F, 14F, -3F);
LCPanel.setTextureSize(128, 128);
LCPanel.mirror = true;
setRotation(LCPanel, 0F, 0F, 0F);
}
public void render(float f5, boolean cc, int pos)
{
// body panels
BacPanel.render(f5);
RPanel.render(f5);
LPanel.render(f5);
TopPanel.render(f5);
RCPanel.render(f5);
LCPanel.render(f5);
// legs
FRL.render(f5);
MRL.render(f5);
FLL.render(f5);
BLL.render(f5);
BRL.render(f5);
BML.render(f5);
// rollers
MRoller.rotateAngleX = 0.7853982F * pos;
BRoller.rotateAngleX = 0.7853982F * pos;
FRoller.rotateAngleX = 0.7853982F * pos;
MRoller.render(f5);
BRoller.render(f5);
FRoller.render(f5);
if (cc)
{
// long belt
tBELTLong.render(f5);
bBELTLong.render(f5);
}
else
{
// short belt
FBELT.render(f5);
tBELT.render(f5);
BBelt.render(f5);
}
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -0,0 +1,44 @@
package assemblyline.render;
import net.minecraft.src.TileEntity;
import net.minecraft.src.TileEntitySpecialRenderer;
import org.lwjgl.opengl.GL11;
import assemblyline.belts.TileEntityConveyorBelt;
public class RenderBeltMain extends TileEntitySpecialRenderer
{
private ModelConveyorBelt model = new ModelConveyorBelt();
public void renderAModelAt(TileEntityConveyorBelt tileEntity, double x, double y, double z, float f)
{
String flip = "";//if(tileEntity.flip){flip = "F";}
boolean mid = tileEntity.middleBelt();
int face = tileEntity.getBeltDirection();
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GL11.glRotatef(180f, 0f, 0f, 1f);
int pos = 0;
bindTextureByName("/textures/BeltTexture"+flip+".png");
if(face==2){ GL11.glRotatef(180f, 0f, 1f, 0f);}
if(face==3){ GL11.glRotatef(0f, 0f, 1f, 0f);}
if(face==4){ GL11.glRotatef(90f, 0f, 1f, 0f);}
if(face==5){ GL11.glRotatef(270f, 0f, 1f, 0f);}
int ent = tileEntity.worldObj.getBlockId(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
model.render(0.0625F,pos,tileEntity.BackCap(),tileEntity.FrontCap(), false);
GL11.glPopMatrix();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{
this.renderAModelAt((TileEntityConveyorBelt)tileEntity, var2, var4, var6, var8);
}
}

View file

@ -0,0 +1,44 @@
package assemblyline.render;
import net.minecraft.src.TileEntity;
import net.minecraft.src.TileEntitySpecialRenderer;
import org.lwjgl.opengl.GL11;
import assemblyline.belts.TileEntityConveyorBelt;
import assemblyline.interaction.TileEntityMachineInput;
public class RenderMachineBelt extends TileEntitySpecialRenderer
{
private ModelMachineBelt model = new ModelMachineBelt();
public void renderAModelAt(TileEntityMachineInput tileEntity, double x, double y, double z, float f)
{
String flip = "";//if(tileEntity.flip){flip = "F";}
int face = tileEntity.getBeltDirection();
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GL11.glRotatef(180f, 0f, 0f, 1f);
int pos = 0;
bindTextureByName("/textures/machineBelt.png");
if(face==2){ GL11.glRotatef(0f, 0f, 1f, 0f);}
if(face==3){ GL11.glRotatef(180f, 0f, 1f, 0f);}
if(face==4){ GL11.glRotatef(270f, 0f, 1f, 0f);}
if(face==5){ GL11.glRotatef(90f, 0f, 1f, 0f);}
int ent = tileEntity.worldObj.getBlockId(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
model.render(0.0625F, true,pos);//TODO change the true part to check if there is a TE on the input side
GL11.glPopMatrix();
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{
this.renderAModelAt((TileEntityMachineInput)tileEntity, var2, var4, var6, var8);
}
}