(untested) removed all red errors
This commit is contained in:
parent
77183651d0
commit
f749ddc7fa
22 changed files with 212 additions and 413 deletions
|
@ -14,6 +14,7 @@ import net.minecraft.client.gui.GuiButton;
|
|||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.resources.ResourceLocation;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
@ -309,7 +310,7 @@ public class GuiEncoder extends GuiContainer implements IInventoryWatcher
|
|||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
|
||||
{
|
||||
this.mc.renderEngine.bindTexture(AssemblyLine.GUI_TEXTURES_PATH + "gui_encoder.png");
|
||||
this.mc.func_110434_K().func_110577_a( new ResourceLocation(AssemblyLine.GUI_TEXTURES_PATH + "gui_encoder.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
this.drawTexturedModalRect(containerWidth, containerHeight + ContainerEncoder.Y_OFFSET, 0, 0, this.xSize, this.ySize);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package assemblyline.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.ResourceLocation;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -23,9 +24,7 @@ public class GuiImprinter extends GuiContainer
|
|||
this.ySize = 201;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items)
|
||||
*/
|
||||
/** Draw the foreground layer for the GuiContainer (everything in front of the items) */
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
|
@ -34,13 +33,11 @@ public class GuiImprinter extends GuiContainer
|
|||
this.fontRenderer.drawString(TranslationHelper.getLocal("tile.imprinter.name"), 68, 6, 4210752);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the background layer for the GuiContainer (everything behind the items)
|
||||
*/
|
||||
/** Draw the background layer for the GuiContainer (everything behind the items) */
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
|
||||
{
|
||||
this.mc.renderEngine.bindTexture(AssemblyLine.GUI_TEXTURES_PATH + "gui_imprinter.png");
|
||||
this.mc.func_110434_K().func_110577_a(new ResourceLocation(AssemblyLine.GUI_TEXTURES_PATH + "gui_imprinter.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.containerWidth = (this.width - this.xSize) / 2;
|
||||
this.containerHeight = (this.height - this.ySize) / 2;
|
||||
|
|
|
@ -2,6 +2,7 @@ package assemblyline.client.render;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.resources.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -33,13 +34,13 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
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(AssemblyLine.MODEL_TEXTURES_PATH + "belt/frame0.png"));
|
||||
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation(AssemblyLine.MODEL_TEXTURES_PATH + "belt/frame0.png"));
|
||||
modelConveyorBelt.render(0.0625F, 0, false, false, false, false);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (block.blockID == AssemblyLine.blockRejector.blockID)
|
||||
{
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(AssemblyLine.MODEL_TEXTURES_PATH + "rejector.png"));
|
||||
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation(AssemblyLine.MODEL_TEXTURES_PATH + "rejector.png"));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) 0.6F, (float) 1.5F, (float) 0.6F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
|
@ -50,7 +51,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
}
|
||||
else if (block.blockID == AssemblyLine.blockManipulator.blockID)
|
||||
{
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(AssemblyLine.MODEL_TEXTURES_PATH + "manipulator1.png"));
|
||||
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation(AssemblyLine.MODEL_TEXTURES_PATH + "manipulator1.png"));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) 0.6F, (float) 1.5F, (float) 0.6F);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
|
@ -60,7 +61,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
}
|
||||
else if (block.blockID == AssemblyLine.blockArmbot.blockID)
|
||||
{
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(AssemblyLine.MODEL_TEXTURES_PATH + RenderArmbot.TEXTURE));
|
||||
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation(AssemblyLine.MODEL_TEXTURES_PATH + RenderArmbot.TEXTURE));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.4f, 0.8f, 0f);
|
||||
GL11.glScalef(0.7f, 0.7f, 0.7f);
|
||||
|
@ -71,7 +72,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
}
|
||||
else if (block.blockID == AssemblyLine.blockCraneController.blockID)
|
||||
{
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(AssemblyLine.MODEL_TEXTURES_PATH + RenderCraneController.TEXTURE));
|
||||
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation(AssemblyLine.MODEL_TEXTURES_PATH + RenderCraneController.TEXTURE));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0f, 1f, 0f);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
|
@ -81,7 +82,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
}
|
||||
else if (block.blockID == AssemblyLine.blockCraneFrame.blockID)
|
||||
{
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, FMLClientHandler.instance().getClient().renderEngine.getTexture(AssemblyLine.MODEL_TEXTURES_PATH + RenderCraneFrame.TEXTURE));
|
||||
FMLClientHandler.instance().getClient().renderEngine.func_110577_a(new ResourceLocation(AssemblyLine.MODEL_TEXTURES_PATH + RenderCraneFrame.TEXTURE));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0f, 1f, 0f);
|
||||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
|
|
|
@ -8,18 +8,17 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.multiblock.IMultiBlock;
|
||||
import assemblyline.client.render.BlockRenderingHandler;
|
||||
import assemblyline.common.TabAssemblyLine;
|
||||
import assemblyline.common.machine.BlockAssembly;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.library.machine.IMultiBlock;
|
||||
|
||||
public class BlockArmbot extends BlockAssembly
|
||||
{
|
||||
public BlockArmbot(int id)
|
||||
{
|
||||
super(id, UniversalElectricity.machine,"armbot");
|
||||
super(id, UniversalElectricity.machine, "armbot");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,9 +17,9 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.grid.IElectricityNetwork;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.TranslationHelper;
|
||||
import universalelectricity.prefab.multiblock.IMultiBlock;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import assemblyline.api.IArmbot;
|
||||
|
@ -40,9 +40,11 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import dan200.computer.api.IComputerAccess;
|
||||
import dan200.computer.api.IPeripheral;
|
||||
import dark.helpers.ItemFindingHelper;
|
||||
import dark.library.machine.IMultiBlock;
|
||||
|
||||
public class TileEntityArmbot extends TileEntityAssembly implements IMultiBlock, IInventory, IPacketReceiver, IArmbot, IPeripheral
|
||||
{
|
||||
|
||||
private final CommandManager commandManager = new CommandManager();
|
||||
/** The items this container contains. */
|
||||
protected ItemStack disk = null;
|
||||
|
@ -67,6 +69,11 @@ public class TileEntityArmbot extends TileEntityAssembly implements IMultiBlock,
|
|||
/** Client Side Object Storage */
|
||||
public EntityItem renderEntityItem = null;
|
||||
|
||||
public TileEntityArmbot()
|
||||
{
|
||||
super(5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initiate()
|
||||
{
|
||||
|
@ -918,4 +925,25 @@ public class TileEntityArmbot extends TileEntityAssembly implements IMultiBlock,
|
|||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getCurrentCapacity()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNetwork(IElectricityNetwork network)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.CommonProxy;
|
||||
import assemblyline.common.TabAssemblyLine;
|
||||
import assemblyline.common.machine.BlockAssembly;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -27,7 +26,7 @@ public class BlockImprinter extends BlockAssembly
|
|||
|
||||
public BlockImprinter(int id)
|
||||
{
|
||||
super(id, Material.wood,"imprinter");
|
||||
super(id, Material.wood, "imprinter");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -46,9 +45,7 @@ public class BlockImprinter extends BlockAssembly
|
|||
return getIcon(side, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the block texture based on the side being looked at. Args: side
|
||||
*/
|
||||
/** Returns the block texture based on the side being looked at. Args: side */
|
||||
@Override
|
||||
public Icon getIcon(int side, int meta)
|
||||
{
|
||||
|
@ -66,9 +63,7 @@ public class BlockImprinter extends BlockAssembly
|
|||
return this.imprinter_side;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called upon block activation (right click on the block.)
|
||||
*/
|
||||
/** Called upon block activation (right click on the block.) */
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,6 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.core.vector.VectorHelper;
|
||||
import universalelectricity.prefab.TranslationHelper;
|
||||
import universalelectricity.prefab.multiblock.TileEntityMulti;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
||||
|
@ -32,6 +31,7 @@ import dark.helpers.Pair;
|
|||
import dark.library.gui.ISlotPickResult;
|
||||
import dark.library.machine.AutoCraftingManager;
|
||||
import dark.library.machine.IAutoCrafter;
|
||||
import dark.library.machine.TileEntityMulti;
|
||||
|
||||
public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInventory, IArmbotUseable, IPacketReceiver, ISlotPickResult, IAutoCrafter
|
||||
{
|
||||
|
@ -39,9 +39,7 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
public static final int INVENTORY_START = IMPRINTER_MATRIX_START + 3;
|
||||
|
||||
private AutoCraftingManager craftManager;
|
||||
/**
|
||||
* 9 slots for crafting, 1 slot for an imprint, 1 slot for an item
|
||||
*/
|
||||
/** 9 slots for crafting, 1 slot for an imprint, 1 slot for an item */
|
||||
public ItemStack[] craftingMatrix = new ItemStack[9];
|
||||
public static final int[] craftingSlots = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
|
||||
|
@ -51,25 +49,17 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
int imprintOutputSlot = 1;
|
||||
int craftingOutputSlot = 2;
|
||||
|
||||
/**
|
||||
* The Imprinter inventory containing slots.
|
||||
*/
|
||||
/** The Imprinter inventory containing slots. */
|
||||
public ItemStack[] containingItems = new ItemStack[18];
|
||||
public static int[] inventorySlots;
|
||||
|
||||
/**
|
||||
* The containing currently used by the imprinter.
|
||||
*/
|
||||
/** The containing currently used by the imprinter. */
|
||||
public ContainerImprinter container;
|
||||
|
||||
/**
|
||||
* Is the current crafting result a result of an imprint?
|
||||
*/
|
||||
/** Is the current crafting result a result of an imprint? */
|
||||
private boolean isImprinting = false;
|
||||
|
||||
/**
|
||||
* The ability for the imprinter to serach nearby inventories.
|
||||
*/
|
||||
/** The ability for the imprinter to serach nearby inventories. */
|
||||
public boolean searchInventories = true;
|
||||
|
||||
@Override
|
||||
|
@ -78,9 +68,7 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the AutoCraftingManager that does all the crafting results
|
||||
*/
|
||||
/** Gets the AutoCraftingManager that does all the crafting results */
|
||||
public AutoCraftingManager getCraftingManager()
|
||||
{
|
||||
if (craftManager == null)
|
||||
|
@ -96,10 +84,8 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
return this.craftingMatrix.length + this.imprinterMatrix.length + this.containingItems.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the given item stack to the specified slot in the inventory (can be crafting or armor
|
||||
* sections).
|
||||
*/
|
||||
/** Sets the given item stack to the specified slot in the inventory (can be crafting or armor
|
||||
* sections). */
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack itemStack)
|
||||
{
|
||||
|
@ -168,10 +154,8 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* When some containers are closed they call this on each slot, then drop whatever it returns as
|
||||
* an EntityItem - like when you close a workbench GUI.
|
||||
*/
|
||||
/** When some containers are closed they call this on each slot, then drop whatever it returns as
|
||||
* an EntityItem - like when you close a workbench GUI. */
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
{
|
||||
|
@ -205,11 +189,9 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
this.onInventoryChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an InventoryCrafting Matrix on the fly.
|
||||
/** Construct an InventoryCrafting Matrix on the fly.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
* @return */
|
||||
public InventoryCrafting getCraftingMatrix()
|
||||
{
|
||||
if (this.container != null)
|
||||
|
@ -246,17 +228,13 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates all the output slots. Call this to update the Imprinter.
|
||||
*/
|
||||
/** Updates all the output slots. Call this to update the Imprinter. */
|
||||
@Override
|
||||
public void onInventoryChanged()
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
/**
|
||||
* Makes the stamping recipe for filters
|
||||
*/
|
||||
/** Makes the stamping recipe for filters */
|
||||
this.isImprinting = false;
|
||||
|
||||
if (this.isMatrixEmpty() && this.imprinterMatrix[imprintInputSlot] != null && this.imprinterMatrix[1] != null)
|
||||
|
@ -293,14 +271,10 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
{
|
||||
this.imprinterMatrix[craftingOutputSlot] = null;
|
||||
|
||||
/**
|
||||
* Try to craft from crafting grid. If not possible, then craft from imprint.
|
||||
*/
|
||||
/** Try to craft from crafting grid. If not possible, then craft from imprint. */
|
||||
boolean didCraft = false;
|
||||
|
||||
/**
|
||||
* Simulate an Inventory Crafting Instance
|
||||
*/
|
||||
/** Simulate an Inventory Crafting Instance */
|
||||
InventoryCrafting inventoryCrafting = this.getCraftingMatrix();
|
||||
|
||||
if (inventoryCrafting != null)
|
||||
|
@ -375,9 +349,7 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all valid inventories that imprinter can use for resources
|
||||
*/
|
||||
/** Gets all valid inventories that imprinter can use for resources */
|
||||
private IInventory[] getAvaliableInventories()
|
||||
{
|
||||
IInventory[] inventories = new IInventory[6];
|
||||
|
@ -413,9 +385,7 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
return inventories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to let the Armbot craft an item.
|
||||
*/
|
||||
/** Tries to let the Armbot craft an item. */
|
||||
@Override
|
||||
public boolean onUse(IArmbot armbot, String[] args)
|
||||
{
|
||||
|
@ -436,9 +406,7 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
// // Save And Data processing //////
|
||||
// ///////////////////////////////////////
|
||||
|
||||
/**
|
||||
* NBT Data
|
||||
*/
|
||||
/** NBT Data */
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
|
@ -463,9 +431,7 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
this.searchInventories = nbt.getBoolean("searchInventories");
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a tile entity to NBT.
|
||||
*/
|
||||
/** Writes a tile entity to NBT. */
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,6 @@ package assemblyline.common.imprinter.prefab;
|
|||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -10,27 +9,22 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import universalelectricity.prefab.implement.IRedstoneReceptor;
|
||||
import assemblyline.api.IFilterable;
|
||||
import assemblyline.common.imprinter.ItemImprinter;
|
||||
import assemblyline.common.machine.BlockAssembly;
|
||||
|
||||
/**
|
||||
* Extend this block class if a filter is allowed to be placed inside of this block.
|
||||
/** Extend this block class if a filter is allowed to be placed inside of this block.
|
||||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
* @author Calclavia */
|
||||
public abstract class BlockImprintable extends BlockAssembly
|
||||
{
|
||||
public BlockImprintable(String name, int id, Material material, CreativeTabs creativeTab)
|
||||
{
|
||||
super(id, material,name);
|
||||
super(id, material, name);
|
||||
this.setCreativeTab(creativeTab);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows filters to be placed inside of this block.
|
||||
*/
|
||||
/** Allows filters to be placed inside of this block. */
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
|
@ -97,22 +91,6 @@ public abstract class BlockImprintable extends BlockAssembly
|
|||
return this.onMachineActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase par5EntityLiving, ItemStack stack)
|
||||
{
|
||||
|
@ -135,7 +113,7 @@ public abstract class BlockImprintable extends BlockAssembly
|
|||
break;
|
||||
|
||||
}
|
||||
world.setBlockMetadataWithNotify(x, y, z, change,3);
|
||||
world.setBlockMetadataWithNotify(x, y, z, change, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -161,7 +139,7 @@ public abstract class BlockImprintable extends BlockAssembly
|
|||
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, change,3);
|
||||
world.setBlockMetadataWithNotify(x, y, z, change, 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,34 +1,29 @@
|
|||
package assemblyline.common.imprinter.prefab;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.prefab.implement.IRotatable;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import universalelectricity.prefab.tile.IRotatable;
|
||||
import assemblyline.api.IFilterable;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.imprinter.ItemImprinter;
|
||||
import assemblyline.common.machine.TileEntityAssembly;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public abstract class TileEntityFilterable extends TileEntityAssembly implements IRotatable, IFilterable, IPacketReceiver
|
||||
{
|
||||
public TileEntityFilterable(int tickEnergy)
|
||||
{
|
||||
super(tickEnergy);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
private ItemStack filterItem;
|
||||
private boolean inverted;
|
||||
|
||||
|
@ -89,27 +84,16 @@ public abstract class TileEntityFilterable extends TileEntityAssembly implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getDirection(IBlockAccess world, int x, int y, int z)
|
||||
public ForgeDirection getDirection()
|
||||
{
|
||||
return ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection(World world, int x, int y, int z, ForgeDirection facingDirection)
|
||||
public void setDirection(ForgeDirection facingDirection)
|
||||
{
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal(), 3);
|
||||
}
|
||||
|
||||
public void setDirection(ForgeDirection facingDirection)
|
||||
{
|
||||
this.setDirection(worldObj, xCoord, yCoord, zCoord, facingDirection);
|
||||
}
|
||||
|
||||
public ForgeDirection getDirection()
|
||||
{
|
||||
return this.getDirection(worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
/** Don't override this! Override getPackData() instead! */
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
|
|
|
@ -54,7 +54,7 @@ public class BlockAssembly extends BlockMachine
|
|||
|
||||
if (tileEntity instanceof INetworkPart)
|
||||
{
|
||||
((INetworkPart) tileEntity).updateNetworkConnections();
|
||||
((INetworkPart) tileEntity).refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class BlockAssembly extends BlockMachine
|
|||
|
||||
if (tileEntity instanceof INetworkPart)
|
||||
{
|
||||
((INetworkPart) tileEntity).updateNetworkConnections();
|
||||
((INetworkPart) tileEntity).refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,24 +14,20 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.TabAssemblyLine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* A block that allows the placement of mass amount of a specific item within it. It will be allowed
|
||||
/** A block that allows the placement of mass amount of a specific item within it. It will be allowed
|
||||
* to go on Conveyor Belts
|
||||
*
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
* @author Calclavia */
|
||||
public class BlockCrate extends BlockAssembly
|
||||
{
|
||||
Icon crate_icon;
|
||||
|
||||
public BlockCrate(int id)
|
||||
{
|
||||
super(id, UniversalElectricity.machine,"crate");
|
||||
super(id, UniversalElectricity.machine, "crate");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -62,9 +58,7 @@ public class BlockCrate extends BlockAssembly
|
|||
{
|
||||
TileEntityCrate tileEntity = (TileEntityCrate) world.getBlockTileEntity(x, y, z);
|
||||
|
||||
/**
|
||||
* Make double clicking input all stacks.
|
||||
*/
|
||||
/** Make double clicking input all stacks. */
|
||||
boolean allMode = (world.getWorldTime() - tileEntity.prevClickTime < 10);
|
||||
|
||||
tileEntity.prevClickTime = world.getWorldTime();
|
||||
|
@ -75,9 +69,7 @@ public class BlockCrate extends BlockAssembly
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Placed the item the player is holding into the crate.
|
||||
*/
|
||||
/** Placed the item the player is holding into the crate. */
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
|
@ -92,9 +84,7 @@ public class BlockCrate extends BlockAssembly
|
|||
{
|
||||
TileEntityCrate tileEntity = (TileEntityCrate) world.getBlockTileEntity(x, y, z);
|
||||
|
||||
/**
|
||||
* Make double clicking input all stacks.
|
||||
*/
|
||||
/** Make double clicking input all stacks. */
|
||||
boolean allMode = (world.getWorldTime() - tileEntity.prevClickTime < 10);
|
||||
|
||||
tileEntity.prevClickTime = world.getWorldTime();
|
||||
|
@ -123,10 +113,8 @@ public class BlockCrate extends BlockAssembly
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to inject it into the crate. Otherwise, look around for nearby crates and try to put them
|
||||
* in.
|
||||
*/
|
||||
/** Try to inject it into the crate. Otherwise, look around for nearby crates and try to put them
|
||||
* in. */
|
||||
public void tryInsert(TileEntityCrate tileEntity, EntityPlayer player, boolean allMode, boolean doSearch)
|
||||
{
|
||||
boolean success;
|
||||
|
@ -182,9 +170,7 @@ public class BlockCrate extends BlockAssembly
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a the itemStack the player is holding into the crate.
|
||||
*/
|
||||
/** Inserts a the itemStack the player is holding into the crate. */
|
||||
public boolean insertCurrentItem(TileEntityCrate tileEntity, EntityPlayer player)
|
||||
{
|
||||
ItemStack currentStack = player.getCurrentEquippedItem();
|
||||
|
@ -221,11 +207,9 @@ public class BlockCrate extends BlockAssembly
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts all items of the same type this player has into the crate.
|
||||
/** Inserts all items of the same type this player has into the crate.
|
||||
*
|
||||
* @return True on success
|
||||
*/
|
||||
* @return True on success */
|
||||
public boolean insertAllItems(TileEntityCrate tileEntity, EntityPlayer player)
|
||||
{
|
||||
ItemStack requestStack = null;
|
||||
|
@ -268,14 +252,12 @@ public class BlockCrate extends BlockAssembly
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ejects and item out of the crate and spawn it under the player entity.
|
||||
/** Ejects and item out of the crate and spawn it under the player entity.
|
||||
*
|
||||
* @param tileEntity
|
||||
* @param player
|
||||
* @param requestSize - The maximum stack size to take out. Default should be 64.
|
||||
* @return True on success
|
||||
*/
|
||||
* @return True on success */
|
||||
public boolean ejectItems(TileEntityCrate tileEntity, EntityPlayer player, int requestSize)
|
||||
{
|
||||
World world = tileEntity.worldObj;
|
||||
|
@ -322,12 +304,10 @@ public class BlockCrate extends BlockAssembly
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts an itemStack into the crate.
|
||||
/** Puts an itemStack into the crate.
|
||||
*
|
||||
* @param tileEntity
|
||||
* @param itemStack
|
||||
*/
|
||||
* @param itemStack */
|
||||
public static ItemStack addStackToCrate(TileEntityCrate tileEntity, ItemStack itemStack)
|
||||
{
|
||||
if (itemStack == null || itemStack.getItem().isDamageable() && itemStack.getItem().getDamage(itemStack) > 0)
|
||||
|
@ -380,7 +360,7 @@ public class BlockCrate extends BlockAssembly
|
|||
double dropY = (double) (world.rand.nextFloat() * area) + (double) (1.0F - area) * 0.5D;
|
||||
double dropZ = (double) (world.rand.nextFloat() * area) + (double) (1.0F - area) * 0.5D;
|
||||
|
||||
ItemStack dropStack = new ItemStack(this, 1, tileEntity.getTier());
|
||||
ItemStack dropStack = new ItemStack(this, 1, tileEntity.getBlockMetadata());
|
||||
ItemBlockCrate.setContainingItemStack(dropStack, containingStack);
|
||||
|
||||
EntityItem var13 = new EntityItem(world, (double) x + dropX, (double) y + dropY, (double) z + dropZ, dropStack);
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Random;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -16,21 +15,20 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.implement.IRotatable;
|
||||
import universalelectricity.prefab.tile.IRotatable;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.TabAssemblyLine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockTurntable extends BlockAssembly
|
||||
{
|
||||
private Icon top;
|
||||
|
||||
|
||||
public BlockTurntable(int par1)
|
||||
{
|
||||
super(par1, Material.piston,"turntable");
|
||||
super(par1, Material.piston, "turntable");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconReg)
|
||||
|
@ -44,7 +42,7 @@ public class BlockTurntable extends BlockAssembly
|
|||
{
|
||||
this.updateTurntableState(world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
|
||||
|
@ -53,7 +51,7 @@ public class BlockTurntable extends BlockAssembly
|
|||
return this.top;
|
||||
return this.machine_icon;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIcon(int side, int meta)
|
||||
|
@ -124,7 +122,7 @@ public class BlockTurntable extends BlockAssembly
|
|||
|
||||
if (rotatable != null)
|
||||
{
|
||||
int newDir = ((IRotatable) tileEntity).getDirection(world, x, y, z).ordinal();
|
||||
int newDir = ((IRotatable) tileEntity).getDirection().ordinal();
|
||||
newDir++;
|
||||
|
||||
while (newDir >= 6)
|
||||
|
@ -137,7 +135,7 @@ public class BlockTurntable extends BlockAssembly
|
|||
newDir += 6;
|
||||
}
|
||||
|
||||
rotatable.setDirection(world, x, y, z, ForgeDirection.getOrientation(newDir));
|
||||
rotatable.setDirection(ForgeDirection.getOrientation(newDir));
|
||||
|
||||
world.markBlockForUpdate(position.intX(), position.intY(), position.intZ());
|
||||
world.playSoundEffect((double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, "tile.piston.in", 0.5F, world.rand.nextFloat() * 0.15F + 0.6F);
|
||||
|
|
|
@ -12,8 +12,7 @@ import net.minecraft.tileentity.TileEntityChest;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.multiblock.TileEntityMulti;
|
||||
import assemblyline.common.imprinter.ItemImprinter;
|
||||
import dark.library.machine.TileEntityMulti;
|
||||
|
||||
public class InvInteractionHelper
|
||||
{
|
||||
|
@ -33,7 +32,7 @@ public class InvInteractionHelper
|
|||
}
|
||||
this.inverted = inverted;
|
||||
}
|
||||
|
||||
|
||||
public void setFilter(List<ItemStack> filters, boolean inverted)
|
||||
{
|
||||
this.filterItems = filters;
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
package assemblyline.common.machine;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import dark.core.api.INetworkPart;
|
||||
import dark.core.tile.network.NetworkPowerTiles;
|
||||
import dark.core.tile.network.NetworkTileEntities;
|
||||
|
||||
public class NetworkAssembly extends NetworkPowerTiles
|
||||
public class NetworkAssembly extends NetworkTileEntities
|
||||
{
|
||||
public NetworkAssembly(INetworkPart... parts)
|
||||
{
|
||||
|
@ -20,57 +15,6 @@ public class NetworkAssembly extends NetworkPowerTiles
|
|||
return new NetworkAssembly();
|
||||
}
|
||||
|
||||
/** Consumes power for the tile to run on
|
||||
*
|
||||
* @param tile - tileEntity
|
||||
* @return true if the power was consumed */
|
||||
public boolean consumePower(TileEntityAssembly tile)
|
||||
{
|
||||
if (tile != null && this.wattStored >= tile.getWattLoad())
|
||||
{
|
||||
this.wattStored -= tile.getWattLoad();
|
||||
//System.out.println("Power| ---" + ElectricityDisplay.getDisplaySimple(tile.getWattLoad(), ElectricUnit.WATT, 2) + " A: " + ElectricityDisplay.getDisplaySimple(this.wattStored, ElectricUnit.WATT, 2));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Adds power to the network. Does not save power on area unload */
|
||||
public void addPower(double d)
|
||||
{
|
||||
double before = this.wattStored;
|
||||
this.wattStored = Math.min(this.wattStored + d, this.getMaxBattery());
|
||||
System.out.println("Power| +++" + ElectricityDisplay.getDisplaySimple(d, ElectricUnit.WATT, 2) + " A: " + ElectricityDisplay.getDisplaySimple(this.wattStored, ElectricUnit.WATT, 2));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ElectricityPack getRequest(TileEntity... ents)
|
||||
{
|
||||
ElectricityPack pack = super.getRequest(ents);
|
||||
if (pack == null || pack.voltage == 0 || pack.amperes == 0)
|
||||
{
|
||||
pack = new ElectricityPack(0, 120);
|
||||
}
|
||||
|
||||
return ElectricityPack.getFromWatts(pack.getWatts() + this.getMemberRequest(), pack.voltage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMemberRequest()
|
||||
{
|
||||
double watt = 0;
|
||||
for (INetworkPart part : this.getNetworkMemebers())
|
||||
{
|
||||
//TODO do check for ignored tiles/ents
|
||||
if (part instanceof TileEntityAssembly)
|
||||
{
|
||||
watt += ((TileEntityAssembly) part).getWattLoad();
|
||||
}
|
||||
}
|
||||
return watt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidMember(INetworkPart part)
|
||||
{
|
||||
|
@ -80,7 +24,7 @@ public class NetworkAssembly extends NetworkPowerTiles
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "AssemblyNetwork[" + this.hashCode() + "][parts:" + this.networkMember.size() + "][Power:" + ElectricityDisplay.getDisplaySimple(this.wattStored, ElectricUnit.WATT, 2) + "]";
|
||||
return "AssemblyNetwork[" + this.hashCode() + "][parts:" + this.networkMember.size() + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,21 +13,17 @@ import net.minecraft.network.packet.Packet;
|
|||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.core.block.IConductor;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
import universalelectricity.core.electricity.IElectricityNetwork;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import universalelectricity.core.grid.IElectricityNetwork;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import buildcraft.api.power.PowerProvider;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import dark.core.api.INetworkPart;
|
||||
import dark.core.tile.network.NetworkPowerTiles;
|
||||
import dark.core.tile.network.NetworkTileEntities;
|
||||
import dark.library.machine.TileEntityRunnableMachine;
|
||||
|
||||
|
@ -37,6 +33,12 @@ import dark.library.machine.TileEntityRunnableMachine;
|
|||
* @author DarkGuardsman */
|
||||
public abstract class TileEntityAssembly extends TileEntityRunnableMachine implements INetworkPart, IPacketReceiver, IConductor
|
||||
{
|
||||
public TileEntityAssembly(float d)
|
||||
{
|
||||
super(d);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/** Is the tile currently powered allowing it to run */
|
||||
public boolean running = false;
|
||||
private boolean prevRun = false;
|
||||
|
@ -76,9 +78,9 @@ public abstract class TileEntityAssembly extends TileEntityRunnableMachine imple
|
|||
if (ticks % updateTick == 0)
|
||||
{
|
||||
this.updateTick = ((int) random.nextInt(10) + 20);
|
||||
this.updateNetworkConnections();
|
||||
this.refresh();
|
||||
}
|
||||
this.running = ((NetworkAssembly) this.getTileNetwork()).consumePower(this);
|
||||
this.running = this.canRun();
|
||||
if (running != prevRun)
|
||||
{
|
||||
Packet packet = PacketManager.getPacket(AssemblyLine.CHANNEL, this, AssemblyTilePacket.POWER.ordinal(), this.running);
|
||||
|
@ -89,25 +91,6 @@ public abstract class TileEntityAssembly extends TileEntityRunnableMachine imple
|
|||
this.onUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(ForgeDirection side, double voltage, double amperes)
|
||||
{
|
||||
if (voltage <= 0 || amperes <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (voltage > this.getVoltage())
|
||||
{
|
||||
this.onDisable(2);
|
||||
return;
|
||||
}
|
||||
if (this.getTileNetwork() instanceof NetworkAssembly)
|
||||
{
|
||||
((NetworkAssembly) this.getTileNetwork()).addPower(voltage * amperes);
|
||||
//System.out.println("Tile got power Side:" + side.toString() + " " + ElectricityDisplay.getDisplaySimple(voltage, ElectricUnit.VOLTAGE, 2) + " " + ElectricityDisplay.getDisplaySimple(amperes, ElectricUnit.AMPERE, 2));
|
||||
}
|
||||
}
|
||||
|
||||
/** Same as updateEntity */
|
||||
public abstract void onUpdate();
|
||||
|
||||
|
@ -131,38 +114,6 @@ public abstract class TileEntityAssembly extends TileEntityRunnableMachine imple
|
|||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBattery(ForgeDirection side)
|
||||
{
|
||||
if (this.getTileNetwork() instanceof NetworkAssembly)
|
||||
{
|
||||
return ((NetworkAssembly) this.getTileNetwork()).getMaxBattery();
|
||||
}
|
||||
return super.getBattery(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCurrentBattery(ForgeDirection side)
|
||||
{
|
||||
if (this.getTileNetwork() instanceof NetworkAssembly)
|
||||
{
|
||||
return ((NetworkAssembly) this.getTileNetwork()).getCurrentBattery();
|
||||
}
|
||||
return super.getCurrentBattery(side);
|
||||
}
|
||||
|
||||
/** Amount of energy the network needs at any given time */
|
||||
@Override
|
||||
public double getRequest(ForgeDirection side)
|
||||
{
|
||||
if (this.getTileNetwork() instanceof NetworkAssembly)
|
||||
{
|
||||
NetworkAssembly net = ((NetworkAssembly) this.getTileNetwork());
|
||||
return Math.min(100 + net.getMemberRequest(), Math.max(0, net.getRequest(new Vector3(this).modifyPositionFromSide(side).getTileEntity(this.worldObj), this).getWatts()));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTileConnect(TileEntity entity, ForgeDirection dir)
|
||||
{
|
||||
|
@ -170,7 +121,7 @@ public abstract class TileEntityAssembly extends TileEntityRunnableMachine imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateNetworkConnections()
|
||||
public void refresh()
|
||||
{
|
||||
if (this.worldObj != null && !this.worldObj.isRemote)
|
||||
{
|
||||
|
@ -296,24 +247,17 @@ public abstract class TileEntityAssembly extends TileEntityRunnableMachine imple
|
|||
@Override
|
||||
public TileEntity[] getAdjacentConnections()
|
||||
{
|
||||
return new TileEntity[6];
|
||||
return this.connectedTiles.toArray(new TileEntity[this.connectedTiles.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAdjacentConnections()
|
||||
public float getResistance()
|
||||
{
|
||||
this.updateNetworkConnections();
|
||||
|
||||
return 0.01f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getResistance()
|
||||
{
|
||||
return 0.01;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCurrentCapcity()
|
||||
public float getCurrentCapacity()
|
||||
{
|
||||
return 1000;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.nbt.NBTTagList;
|
|||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import universalelectricity.prefab.implement.ITier;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
||||
|
@ -20,7 +19,7 @@ import com.google.common.io.ByteArrayDataInput;
|
|||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class TileEntityCrate extends TileEntityAdvanced implements ITier, IInventory, IPacketReceiver, ISidedInventory
|
||||
public class TileEntityCrate extends TileEntityAdvanced implements IInventory, IPacketReceiver, ISidedInventory
|
||||
{
|
||||
/* Collective total stack of all inv slots */
|
||||
private ItemStack sampleStack;
|
||||
|
@ -31,9 +30,7 @@ public class TileEntityCrate extends TileEntityAdvanced implements ITier, IInven
|
|||
|
||||
public long prevClickTime = -1000;
|
||||
|
||||
/**
|
||||
* Clones the single stack into an inventory format for automation interaction
|
||||
*/
|
||||
/** Clones the single stack into an inventory format for automation interaction */
|
||||
public void buildInventory()
|
||||
{
|
||||
ItemStack baseStack = this.sampleStack.copy();
|
||||
|
@ -53,13 +50,11 @@ public class TileEntityCrate extends TileEntityAdvanced implements ITier, IInven
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns the inventory array into a single stack of matching items. This assumes that all items
|
||||
/** Turns the inventory array into a single stack of matching items. This assumes that all items
|
||||
* in the crate are the same TODO eject minority items and only keep the majority that are the
|
||||
* same to prevent duplication issues
|
||||
*
|
||||
* @param force - force a rebuild of the inventory from the single stack created
|
||||
*/
|
||||
* @param force - force a rebuild of the inventory from the single stack created */
|
||||
public void buildSampleStack(boolean force)
|
||||
{
|
||||
int count = 0;
|
||||
|
@ -147,7 +142,7 @@ public class TileEntityCrate extends TileEntityAdvanced implements ITier, IInven
|
|||
|
||||
public int getSlotCount()
|
||||
{
|
||||
return TileEntityCrate.getSlotCount(this.getTier());
|
||||
return TileEntityCrate.getSlotCount(this.getBlockMetadata());
|
||||
}
|
||||
|
||||
public static int getSlotCount(int metadata)
|
||||
|
@ -317,9 +312,7 @@ public class TileEntityCrate extends TileEntityAdvanced implements ITier, IInven
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* NBT Data
|
||||
*/
|
||||
/** NBT Data */
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
|
@ -394,22 +387,6 @@ public class TileEntityCrate extends TileEntityAdvanced implements ITier, IInven
|
|||
return "inv.Crate";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTier()
|
||||
{
|
||||
if (this.worldObj == null)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
return this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTier(int tier)
|
||||
{
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, tier, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized()
|
||||
{
|
||||
|
|
|
@ -8,16 +8,14 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.implement.IRedstoneReceptor;
|
||||
import universalelectricity.prefab.implement.IRotatable;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import universalelectricity.prefab.tile.IRotatable;
|
||||
import assemblyline.api.IManipulator;
|
||||
import assemblyline.common.imprinter.ItemImprinter;
|
||||
import assemblyline.common.imprinter.prefab.TileEntityFilterable;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public class TileEntityManipulator extends TileEntityFilterable implements IRotatable, IRedstoneReceptor, IManipulator
|
||||
public class TileEntityManipulator extends TileEntityFilterable implements IRotatable, IManipulator
|
||||
{
|
||||
|
||||
/** True to auto output items with a redstone pulse */
|
||||
private boolean selfPulse = false;
|
||||
/** True if outputting items */
|
||||
|
@ -27,6 +25,11 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
|
|||
/** The class that interacts with inventories for this machine */
|
||||
private InvInteractionHelper invExtractionHelper;
|
||||
|
||||
public TileEntityManipulator()
|
||||
{
|
||||
super(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
|
@ -40,6 +43,7 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
|
|||
}
|
||||
else
|
||||
{
|
||||
this.isRedstonePowered = this.worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
|
||||
if (this.isSelfPulse() && this.ticks % 10 == 0)
|
||||
{
|
||||
this.isRedstonePowered = true;
|
||||
|
@ -120,7 +124,7 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
|
|||
@Override
|
||||
public void eject()
|
||||
{
|
||||
this.onPowerOff();
|
||||
this.isRedstonePowered = false;
|
||||
/** input location up */
|
||||
Vector3 inputUp = new Vector3(this);
|
||||
inputUp.modifyPositionFromSide(ForgeDirection.UP);
|
||||
|
@ -172,18 +176,6 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
|
|||
nbt.setBoolean("selfpulse", this.isSelfPulse());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPowerOn()
|
||||
{
|
||||
this.isRedstonePowered = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPowerOff()
|
||||
{
|
||||
this.isRedstonePowered = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection dir)
|
||||
{
|
||||
|
|
|
@ -16,17 +16,24 @@ import assemblyline.common.imprinter.prefab.TileEntityFilterable;
|
|||
/** @author Darkguardsman */
|
||||
public class TileEntityRejector extends TileEntityFilterable
|
||||
{
|
||||
|
||||
/** should the piston fire, or be extended */
|
||||
public boolean firePiston = false;
|
||||
|
||||
public TileEntityRejector()
|
||||
{
|
||||
super(1);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
/** Has to update a bit faster than a conveyer belt */
|
||||
if (this.ticks % 5 == 0 && !this.isDisabled())
|
||||
{
|
||||
this.firePiston = false;
|
||||
|
||||
this.firePiston = false;
|
||||
|
||||
Vector3 searchPosition = new Vector3(this);
|
||||
searchPosition.modifyPositionFromSide(this.getDirection());
|
||||
TileEntity tileEntity = searchPosition.getTileEntity(this.worldObj);
|
||||
|
|
|
@ -8,29 +8,21 @@ import java.util.List;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.implement.IRotatable;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import universalelectricity.prefab.tile.IRotatable;
|
||||
import assemblyline.api.IBelt;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.machine.TileEntityAssembly;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class TileEntityConveyorBelt extends TileEntityAssembly implements IPacketReceiver, IBelt, IRotatable
|
||||
{
|
||||
|
||||
public enum SlantType
|
||||
{
|
||||
NONE,
|
||||
|
@ -51,6 +43,12 @@ public class TileEntityConveyorBelt extends TileEntityAssembly implements IPacke
|
|||
/** Entities that are ignored allowing for other tiles to interact with them */
|
||||
public List<Entity> IgnoreList = new ArrayList<Entity>();
|
||||
|
||||
public TileEntityConveyorBelt()
|
||||
{
|
||||
super(0.1f);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
|
@ -179,25 +177,15 @@ public class TileEntityConveyorBelt extends TileEntityAssembly implements IPacke
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDirection(World world, int x, int y, int z, ForgeDirection facingDirection)
|
||||
public void setDirection(ForgeDirection facingDirection)
|
||||
{
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal(), 3);
|
||||
}
|
||||
|
||||
public void setDirection(ForgeDirection facingDirection)
|
||||
{
|
||||
this.setDirection(worldObj, xCoord, yCoord, zCoord, facingDirection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getDirection(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
}
|
||||
|
||||
public ForgeDirection getDirection()
|
||||
{
|
||||
return this.getDirection(worldObj, xCoord, yCoord, zCoord);
|
||||
return ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -244,9 +232,9 @@ public class TileEntityConveyorBelt extends TileEntityAssembly implements IPacke
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateNetworkConnections()
|
||||
public void refresh()
|
||||
{
|
||||
super.updateNetworkConnections();
|
||||
super.refresh();
|
||||
if (this.worldObj != null && !this.worldObj.isRemote)
|
||||
{
|
||||
Vector3 face = new Vector3(this).modifyPositionFromSide(this.getDirection());
|
||||
|
|
|
@ -14,38 +14,50 @@ public class TileEntityCraneController extends TileEntityAssembly implements ICr
|
|||
int width, depth;
|
||||
boolean isCraneValid;
|
||||
Vector3 armPos;
|
||||
|
||||
public TileEntityCraneController()
|
||||
{
|
||||
super(10);
|
||||
width = depth = 0;
|
||||
isCraneValid = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initiate()
|
||||
{
|
||||
this.validateCrane();
|
||||
if(armPos == null || armPos.equals(new Vector3()))
|
||||
if (armPos == null || armPos.equals(new Vector3()))
|
||||
{
|
||||
int deltaX = 0;
|
||||
int deltaZ = 0;
|
||||
switch(this.getFacing())
|
||||
switch (this.getFacing())
|
||||
{
|
||||
case SOUTH: case EAST: deltaX = (this.width/2);deltaZ = (this.depth/2);break;
|
||||
case NORTH: case WEST: deltaX = -(this.width/2);deltaZ = -(this.depth/2);break;
|
||||
case SOUTH:
|
||||
case EAST:
|
||||
deltaX = (this.width / 2);
|
||||
deltaZ = (this.depth / 2);
|
||||
break;
|
||||
case NORTH:
|
||||
case WEST:
|
||||
deltaX = -(this.width / 2);
|
||||
deltaZ = -(this.depth / 2);
|
||||
break;
|
||||
}
|
||||
armPos = new Vector3(this.xCoord + deltaX, this.yCoord, this.zCoord+ deltaZ);
|
||||
armPos = new Vector3(this.xCoord + deltaX, this.yCoord, this.zCoord + deltaZ);
|
||||
}
|
||||
}
|
||||
|
||||
public ForgeDirection getFacing()
|
||||
{
|
||||
return ForgeDirection.getOrientation(this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord));
|
||||
}
|
||||
public TileEntityCraneController()
|
||||
{
|
||||
super();
|
||||
width = depth = 0;
|
||||
isCraneValid = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if(this.worldObj.isRemote && armPos != null)
|
||||
if (this.worldObj.isRemote && armPos != null)
|
||||
{
|
||||
AssemblyLine.proxy.renderBeam(this.worldObj, new Vector3(this), armPos, Color.BLUE, 1);
|
||||
}
|
||||
|
@ -66,15 +78,15 @@ public class TileEntityCraneController extends TileEntityAssembly implements ICr
|
|||
isCraneValid = false;
|
||||
width = depth = 0;
|
||||
findCraneWidth();
|
||||
System.out.println("CraneValidator: Width = "+ this.width);
|
||||
System.out.println("CraneValidator: Width = " + this.width);
|
||||
findCraneDepth();
|
||||
System.out.println("CraneValidator: Depth = "+ this.depth);
|
||||
System.out.println("CraneValidator: Depth = " + this.depth);
|
||||
if (Math.abs(width) > 1 && Math.abs(depth) > 1)
|
||||
{
|
||||
isCraneValid = isFrameValid();
|
||||
|
||||
|
||||
}
|
||||
System.out.println("CraneValidator: is valid? "+ this.isCraneValid);
|
||||
System.out.println("CraneValidator: is valid? " + this.isCraneValid);
|
||||
}
|
||||
|
||||
private boolean isFrameValid()
|
||||
|
@ -109,14 +121,12 @@ public class TileEntityCraneController extends TileEntityAssembly implements ICr
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find x size and store in this.width
|
||||
*/
|
||||
/** Find x size and store in this.width */
|
||||
private void findCraneWidth()
|
||||
{
|
||||
int x = 0;
|
||||
ForgeDirection facing = this.getFacing();
|
||||
System.out.println("CraneValidator: Width direction = "+ facing.ordinal());
|
||||
System.out.println("CraneValidator: Width direction = " + facing.ordinal());
|
||||
while (true)
|
||||
{
|
||||
if (Math.abs(x) >= CraneHelper.MAX_SIZE)
|
||||
|
@ -125,7 +135,7 @@ public class TileEntityCraneController extends TileEntityAssembly implements ICr
|
|||
}
|
||||
if (!CraneHelper.isCraneStructureBlock(worldObj, xCoord + x, yCoord, zCoord))
|
||||
{
|
||||
System.out.println("CraneValidator: Hit non block at x = "+ x);
|
||||
System.out.println("CraneValidator: Hit non block at x = " + x);
|
||||
break;
|
||||
}
|
||||
if (facing == ForgeDirection.NORTH || facing == ForgeDirection.EAST)
|
||||
|
@ -148,9 +158,7 @@ public class TileEntityCraneController extends TileEntityAssembly implements ICr
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find x size and store in this.depth
|
||||
*/
|
||||
/** Find x size and store in this.depth */
|
||||
private void findCraneDepth()
|
||||
{
|
||||
int z = 0;
|
||||
|
@ -213,10 +221,11 @@ public class TileEntityCraneController extends TileEntityAssembly implements ICr
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,12 @@ import assemblyline.common.machine.TileEntityAssembly;
|
|||
public class TileEntityCraneRail extends TileEntityAssembly implements ICraneStructure
|
||||
{
|
||||
|
||||
public TileEntityCraneRail()
|
||||
{
|
||||
super(0);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFrameConnectTo(ForgeDirection side)
|
||||
{
|
||||
|
|
|
@ -14,8 +14,14 @@ import assemblyline.common.imprinter.prefab.TileEntityFilterable;
|
|||
|
||||
public class TileEntityDetector extends TileEntityFilterable
|
||||
{
|
||||
|
||||
private boolean powering = false;
|
||||
|
||||
public TileEntityDetector()
|
||||
{
|
||||
super(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
|
@ -115,6 +121,6 @@ public class TileEntityDetector extends TileEntityFilterable
|
|||
public void onUpdate()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue