From f23892e224865ad89578659d437cf674af61afd7 Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Tue, 25 Jun 2013 22:30:27 -0400 Subject: [PATCH] Reworking assembly network Changing the fake network like power system for the belts into a better network. This way i can start to do more with the network and manage it better. --- .../common/armbot/TileEntityArmbot.java | 9 +- .../common/armbot/command/CommandGive.java | 4 +- .../common/armbot/command/CommandTake.java | 4 +- .../prefab/TileEntityFilterable.java | 4 +- .../common/machine/BlockBeltSorter.java | 17 -- ...nHelper.java => InvInteractionHelper.java} | 4 +- .../common/machine/NetworkAssembly.java | 59 +++++ .../common/machine/TileEntityAssembly.java | 96 ++++++++ .../machine/TileEntityAssemblyNetwork.java | 100 -------- .../common/machine/TileEntityManipulator.java | 8 +- .../common/machine/TileEntityRejector.java | 1 - .../machine/TileEntityRoboticSorter.java | 233 ------------------ .../machine/belt/BlockConveyorBelt.java | 1 - .../machine/belt/TileEntityConveyorBelt.java | 67 +---- .../machine/belt/TileEntityCoveredBelt.java | 13 - .../crane/TileEntityCraneController.java | 10 +- .../machine/crane/TileEntityCraneRail.java | 11 +- .../machine/detector/TileEntityDetector.java | 7 + 18 files changed, 200 insertions(+), 448 deletions(-) delete mode 100644 src/minecraft/assemblyline/common/machine/BlockBeltSorter.java rename src/minecraft/assemblyline/common/machine/{InvExtractionHelper.java => InvInteractionHelper.java} (98%) create mode 100644 src/minecraft/assemblyline/common/machine/NetworkAssembly.java create mode 100644 src/minecraft/assemblyline/common/machine/TileEntityAssembly.java delete mode 100644 src/minecraft/assemblyline/common/machine/TileEntityAssemblyNetwork.java delete mode 100644 src/minecraft/assemblyline/common/machine/TileEntityRoboticSorter.java delete mode 100644 src/minecraft/assemblyline/common/machine/belt/TileEntityCoveredBelt.java diff --git a/src/minecraft/assemblyline/common/armbot/TileEntityArmbot.java b/src/minecraft/assemblyline/common/armbot/TileEntityArmbot.java index 45de0a3e7..36404475e 100644 --- a/src/minecraft/assemblyline/common/armbot/TileEntityArmbot.java +++ b/src/minecraft/assemblyline/common/armbot/TileEntityArmbot.java @@ -39,7 +39,7 @@ import assemblyline.common.armbot.command.CommandReturn; import assemblyline.common.armbot.command.CommandRotateBy; import assemblyline.common.armbot.command.CommandRotateTo; import assemblyline.common.armbot.command.CommandUse; -import assemblyline.common.machine.TileEntityAssemblyNetwork; +import assemblyline.common.machine.TileEntityAssembly; import assemblyline.common.machine.encoder.ItemDisk; import com.google.common.io.ByteArrayDataInput; @@ -51,7 +51,7 @@ import dan200.computer.api.IComputerAccess; import dan200.computer.api.IPeripheral; import dark.helpers.ItemFindingHelper; -public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMultiBlock, IInventory, IPacketReceiver, IElectricityStorage, IArmbot, IPeripheral +public class TileEntityArmbot extends TileEntityAssembly implements IMultiBlock, IInventory, IPacketReceiver, IElectricityStorage, IArmbot, IPeripheral { private final CommandManager commandManager = new CommandManager(); private static final int PACKET_COMMANDS = 128; @@ -311,7 +311,7 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult { NBTTagCompound nbt = new NBTTagCompound(); writeToNBT(nbt); - return PacketManager.getPacket(AssemblyLine.CHANNEL, this, this.powerTransferRange, nbt); + return PacketManager.getPacket(AssemblyLine.CHANNEL, this, nbt); } /** @@ -331,9 +331,8 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult x = dis.readInt(); y = dis.readInt(); z = dis.readInt(); - this.powerTransferRange = dis.readInt(); NBTTagCompound tag = Packet.readNBTTagCompound(dis); - readFromNBT(tag); + this.readFromNBT(tag); } catch (IOException e) { diff --git a/src/minecraft/assemblyline/common/armbot/command/CommandGive.java b/src/minecraft/assemblyline/common/armbot/command/CommandGive.java index 783f987b5..7ffe24cdb 100644 --- a/src/minecraft/assemblyline/common/armbot/command/CommandGive.java +++ b/src/minecraft/assemblyline/common/armbot/command/CommandGive.java @@ -9,7 +9,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeDirection; import universalelectricity.core.vector.Vector3; -import assemblyline.common.machine.InvExtractionHelper; +import assemblyline.common.machine.InvInteractionHelper; public class CommandGive extends Command { @@ -63,7 +63,7 @@ public class CommandGive extends Command { stacks.add(stack); } - InvExtractionHelper invEx = new InvExtractionHelper(this.tileEntity.worldObj, new Vector3(this.tileEntity), stacks, false); + InvInteractionHelper invEx = new InvInteractionHelper(this.tileEntity.worldObj, new Vector3(this.tileEntity), stacks, false); Iterator targetIt = this.tileEntity.getGrabbedItems().iterator(); boolean flag = true; diff --git a/src/minecraft/assemblyline/common/armbot/command/CommandTake.java b/src/minecraft/assemblyline/common/armbot/command/CommandTake.java index fa5d38e0a..b48d0e907 100644 --- a/src/minecraft/assemblyline/common/armbot/command/CommandTake.java +++ b/src/minecraft/assemblyline/common/armbot/command/CommandTake.java @@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeDirection; import universalelectricity.core.vector.Vector3; -import assemblyline.common.machine.InvExtractionHelper; +import assemblyline.common.machine.InvInteractionHelper; public class CommandTake extends Command { @@ -62,7 +62,7 @@ public class CommandTake extends Command { stacks.add(stack); } - InvExtractionHelper invEx = new InvExtractionHelper(this.tileEntity.worldObj, new Vector3(this.tileEntity), stacks, false); + InvInteractionHelper invEx = new InvInteractionHelper(this.tileEntity.worldObj, new Vector3(this.tileEntity), stacks, false); this.tileEntity.grabItem(invEx.tryGrabFromPosition(new Vector3(targetTile), direction, this.stack != null ? stack.stackSize : 1)); return !(this.tileEntity.getGrabbedItems().size() > 0); diff --git a/src/minecraft/assemblyline/common/imprinter/prefab/TileEntityFilterable.java b/src/minecraft/assemblyline/common/imprinter/prefab/TileEntityFilterable.java index 211002fbf..cc8a5976b 100644 --- a/src/minecraft/assemblyline/common/imprinter/prefab/TileEntityFilterable.java +++ b/src/minecraft/assemblyline/common/imprinter/prefab/TileEntityFilterable.java @@ -20,14 +20,14 @@ import universalelectricity.prefab.network.PacketManager; import assemblyline.api.IFilterable; import assemblyline.common.AssemblyLine; import assemblyline.common.imprinter.ItemImprinter; -import assemblyline.common.machine.TileEntityAssemblyNetwork; +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 TileEntityAssemblyNetwork implements IRotatable, IFilterable, IPacketReceiver +public abstract class TileEntityFilterable extends TileEntityAssembly implements IRotatable, IFilterable, IPacketReceiver { private ItemStack filterItem; private boolean inverted; diff --git a/src/minecraft/assemblyline/common/machine/BlockBeltSorter.java b/src/minecraft/assemblyline/common/machine/BlockBeltSorter.java deleted file mode 100644 index 4058a816d..000000000 --- a/src/minecraft/assemblyline/common/machine/BlockBeltSorter.java +++ /dev/null @@ -1,17 +0,0 @@ -package assemblyline.common.machine; - -import net.minecraft.block.material.Material; -import assemblyline.common.TabAssemblyLine; -import assemblyline.common.block.BlockALMachine; - -public class BlockBeltSorter extends BlockALMachine -{ - - public BlockBeltSorter(int id) - { - super(id, Material.iron); - this.setCreativeTab(TabAssemblyLine.INSTANCE); - this.setUnlocalizedName("BeltSorter"); - } - -} diff --git a/src/minecraft/assemblyline/common/machine/InvExtractionHelper.java b/src/minecraft/assemblyline/common/machine/InvInteractionHelper.java similarity index 98% rename from src/minecraft/assemblyline/common/machine/InvExtractionHelper.java rename to src/minecraft/assemblyline/common/machine/InvInteractionHelper.java index 2aea01e1d..a7a76792f 100644 --- a/src/minecraft/assemblyline/common/machine/InvExtractionHelper.java +++ b/src/minecraft/assemblyline/common/machine/InvInteractionHelper.java @@ -17,14 +17,14 @@ import assemblyline.common.block.BlockCrate; import assemblyline.common.block.TileEntityCrate; import assemblyline.common.imprinter.ItemImprinter; -public class InvExtractionHelper +public class InvInteractionHelper { World world; Vector3 location; List filterItems; boolean inverted; - public InvExtractionHelper(World world, Vector3 location, List filters, boolean inverted) + public InvInteractionHelper(World world, Vector3 location, List filters, boolean inverted) { this.world = world; this.location = location; diff --git a/src/minecraft/assemblyline/common/machine/NetworkAssembly.java b/src/minecraft/assemblyline/common/machine/NetworkAssembly.java new file mode 100644 index 000000000..c264a6cf4 --- /dev/null +++ b/src/minecraft/assemblyline/common/machine/NetworkAssembly.java @@ -0,0 +1,59 @@ +package assemblyline.common.machine; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.tileentity.TileEntity; +import dark.core.api.INetworkPart; +import dark.core.tile.network.NetworkTileEntities; + +public class NetworkAssembly extends NetworkTileEntities +{ + /** List of network members that are providing power for the network */ + private List powerSources = new ArrayList(); + + public NetworkAssembly(INetworkPart... parts) + { + super(parts); + } + + public boolean canRun(TileEntityAssembly tile) + { + return false; + } + + @Override + public void postMergeProcessing(NetworkTileEntities network) + { + NetworkAssembly newNetwork = new NetworkAssembly(); + newNetwork.getNetworkMemebers().addAll(this.getNetworkMemebers()); + newNetwork.getNetworkMemebers().addAll(network.getNetworkMemebers()); + + newNetwork.cleanUpConductors(); + } + + public boolean addNetworkPart(INetworkPart part) + { + boolean added = super.addNetworkPart(part); + if (added) + { + + } + return added; + } + + /** Marks a tile as the source of power for the network */ + public void markAsPowerSource(TileEntity entity) + { + if (!this.powerSources.contains(entity)) + { + this.powerSources.add(entity); + } + } + + /** unmarks or removes the tile as a source of power for the network */ + public void removeAsPowerSource(TileEntity entity) + { + this.powerSources.remove(entity); + } +} diff --git a/src/minecraft/assemblyline/common/machine/TileEntityAssembly.java b/src/minecraft/assemblyline/common/machine/TileEntityAssembly.java new file mode 100644 index 000000000..62a5b479b --- /dev/null +++ b/src/minecraft/assemblyline/common/machine/TileEntityAssembly.java @@ -0,0 +1,96 @@ +package assemblyline.common.machine; + +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; +import universalelectricity.core.electricity.ElectricityPack; +import universalelectricity.prefab.network.PacketManager; +import assemblyline.common.AssemblyLine; +import dark.core.api.INetworkPart; +import dark.core.tile.network.NetworkTileEntities; +import dark.library.machine.TileEntityRunnableMachine; + +/** A class to be inherited by all machines on the assembly line. This will allow all machines to be + * able to be powered through the powering of only one machine. + * + * @author Calclavia */ +public abstract class TileEntityAssembly extends TileEntityRunnableMachine implements INetworkPart +{ + boolean powered = false; + /** Network used to link assembly machines together */ + private NetworkAssembly assemblyNetwork; + + public boolean isRunning() + { + boolean running = AssemblyLine.REQUIRE_NO_POWER || this.powered; + if (!running && this.getTileNetwork() instanceof NetworkAssembly) + { + + } + return running; + } + + @Override + public void updateEntity() + { + super.updateEntity(); + this.onUpdate(); + + if (this.wattsReceived >= this.getRequest().getWatts()) + { + this.wattsReceived -= getRequest().getWatts(); + } + } + + public abstract void onUpdate(); + + @Override + public ElectricityPack getRequest() + { + return new ElectricityPack(1, this.getVoltage()); + } + + protected int getMaxTransferRange() + { + return 30; + } + + @Override + public boolean canTileConnect(TileEntity entity, ForgeDirection dir) + { + return entity != null && entity instanceof TileEntityAssembly; + } + + @Override + public TileEntity[] getNetworkConnections() + { + // TODO Auto-generated method stub + return null; + } + + @Override + public void updateNetworkConnections() + { + // TODO Auto-generated method stub + + } + + @Override + public NetworkTileEntities getTileNetwork() + { + if (this.assemblyNetwork == null) + { + this.assemblyNetwork = new NetworkAssembly(this); + } + return null; + } + + @Override + public void setTileNetwork(NetworkTileEntities network) + { + if(network instanceof NetworkAssembly) + { + this.assemblyNetwork = (NetworkAssembly) network; + } + + } +} diff --git a/src/minecraft/assemblyline/common/machine/TileEntityAssemblyNetwork.java b/src/minecraft/assemblyline/common/machine/TileEntityAssemblyNetwork.java deleted file mode 100644 index a2f00072c..000000000 --- a/src/minecraft/assemblyline/common/machine/TileEntityAssemblyNetwork.java +++ /dev/null @@ -1,100 +0,0 @@ -package assemblyline.common.machine; - -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; -import universalelectricity.core.electricity.ElectricityPack; -import universalelectricity.prefab.network.PacketManager; -import assemblyline.common.AssemblyLine; -import dark.library.machine.TileEntityRunnableMachine; - -/** - * A class to be inherited by all machines on the assembly line. This will allow all machines to be - * able to be powered through the powering of only one machine. - * - * @author Calclavia - * - */ -public abstract class TileEntityAssemblyNetwork extends TileEntityRunnableMachine -{ - /** - * The range in which power can be transfered. - */ - public int powerTransferRange = 0; - - public boolean isRunning() - { - return AssemblyLine.REQUIRE_NO_POWER || this.powerTransferRange > 0 || this.wattsReceived > this.getRequest().getWatts(); - } - - public void updatePowerTransferRange() - { - int maximumTransferRange = 0; - - for (int i = 0; i < 6; i++) - { - ForgeDirection direction = ForgeDirection.getOrientation(i); - TileEntity tileEntity = worldObj.getBlockTileEntity(this.xCoord + direction.offsetX, this.yCoord + direction.offsetY, this.zCoord + direction.offsetZ); - - if (tileEntity != null) - { - if (tileEntity instanceof TileEntityAssemblyNetwork) - { - TileEntityAssemblyNetwork assemblyNetwork = (TileEntityAssemblyNetwork) tileEntity; - - if (assemblyNetwork.powerTransferRange > maximumTransferRange) - { - maximumTransferRange = assemblyNetwork.powerTransferRange; - } - } - } - } - - this.powerTransferRange = Math.max(maximumTransferRange - 1, 0); - } - - @Override - public void updateEntity() - { - super.updateEntity(); - - this.onUpdate(); - - if (this.ticks % 10 == 0) - { - if (this.wattsReceived >= this.getRequest().getWatts()) - { - this.wattsReceived -= getRequest().getWatts(); - this.powerTransferRange = this.getMaxTransferRange(); - } - else - { - this.powerTransferRange = 0; - this.updatePowerTransferRange(); - } - - if (!this.worldObj.isRemote) - { - if (this.getDescriptionPacket() != null) - { - PacketManager.sendPacketToClients(this.getDescriptionPacket()); - } - } - } - } - - protected void onUpdate() - { - - } - - @Override - public ElectricityPack getRequest() - { - return new ElectricityPack(1, this.getVoltage()); - } - - protected int getMaxTransferRange() - { - return 30; - } -} diff --git a/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java b/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java index e22e34239..3eb1f29f4 100644 --- a/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java +++ b/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java @@ -25,10 +25,10 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota /** True if is currently powered by redstone */ private boolean isRedstonePowered = false; /** The class that interacts with inventories for this machine */ - private InvExtractionHelper invExtractionHelper; + private InvInteractionHelper invExtractionHelper; @Override - protected void onUpdate() + public void onUpdate() { if (!this.worldObj.isRemote) { @@ -201,11 +201,11 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota } /** Gets the class that managed extracting and placing items into inventories */ - public InvExtractionHelper invHelper() + public InvInteractionHelper invHelper() { if (invExtractionHelper == null || invExtractionHelper.world != this.worldObj) { - this.invExtractionHelper = new InvExtractionHelper(this.worldObj, new Vector3(this), this.getFilter() != null ? ItemImprinter.getFilters(getFilter()) : null, this.isInverted()); + this.invExtractionHelper = new InvInteractionHelper(this.worldObj, new Vector3(this), this.getFilter() != null ? ItemImprinter.getFilters(getFilter()) : null, this.isInverted()); } return invExtractionHelper; } diff --git a/src/minecraft/assemblyline/common/machine/TileEntityRejector.java b/src/minecraft/assemblyline/common/machine/TileEntityRejector.java index f74298a77..a72da7148 100644 --- a/src/minecraft/assemblyline/common/machine/TileEntityRejector.java +++ b/src/minecraft/assemblyline/common/machine/TileEntityRejector.java @@ -39,7 +39,6 @@ public class TileEntityRejector extends TileEntityFilterable @Override public void onUpdate() { - super.onUpdate(); /** * Has to update a bit faster than a conveyer belt */ diff --git a/src/minecraft/assemblyline/common/machine/TileEntityRoboticSorter.java b/src/minecraft/assemblyline/common/machine/TileEntityRoboticSorter.java deleted file mode 100644 index 885a2317a..000000000 --- a/src/minecraft/assemblyline/common/machine/TileEntityRoboticSorter.java +++ /dev/null @@ -1,233 +0,0 @@ -package assemblyline.common.machine; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet250CustomPayload; -import net.minecraftforge.common.ForgeDirection; -import universalelectricity.prefab.network.IPacketReceiver; -import universalelectricity.prefab.tile.TileEntityElectricityRunnable; -import assemblyline.common.machine.belt.TileEntityConveyorBelt; - -import com.google.common.io.ByteArrayDataInput; - -public class TileEntityRoboticSorter extends TileEntityElectricityRunnable implements IPacketReceiver, IInventory -{ - /** - * The items this container contains. - */ - protected ItemStack[] containingItems = new ItemStack[this.getSizeInventory()]; - - /** - * Used to id the packet types - */ - private enum PacketTypes - { - ANIMATION, GUI, SETTINGON - } - - /** - * Joules required per tick. - */ - public static final int WATT_REQUEST = 10; - - /** - * Stored energy - */ - public double wattsReceived = 0; - /** - * on/off value for the GUI buttons - */ - public boolean[] guiButtons = new boolean[] { true, true, true, true, true }; - /** - * the belt found in the search area - */ - public TileEntityConveyorBelt[] beltSide = new TileEntityConveyorBelt[6]; - - private int playerUsing = 0; - - @Override - public String getInvName() - { - return "Sorter"; - } - - @Override - public int getSizeInventory() - { - return 4; - } - - /** - * Inventory functions. - */ - @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 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() - { - this.playerUsing++; - } - - @Override - public void closeChest() - { - this.playerUsing--; - } - - /** - * NBT Data - */ - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - for (int i = 0; i < this.guiButtons.length; i++) - { - this.guiButtons[i] = nbt.getBoolean("guiButton" + i); - } - - NBTTagList var2 = nbt.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"); - - if (var5 >= 0 && var5 < this.containingItems.length) - { - this.containingItems[var5] = ItemStack.loadItemStackFromNBT(var4); - } - } - } - - @Override - public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream) - { - // TODO Auto-generated method stub - - } - - /** - * Writes a tile entity to NBT. - */ - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - for (int i = 0; i < this.guiButtons.length; i++) - { - nbt.setBoolean("guiButton" + i, this.guiButtons[i]); - } - - 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); - } - } - nbt.setTag("Items", var2); - } - - @Override - public int getInventoryStackLimit() - { - return 1; - } - - @Override - public boolean canConnect(ForgeDirection dir) - { - return dir == ForgeDirection.DOWN; - } - - @Override - public boolean isInvNameLocalized() - { - return false; - } - - @Override - public boolean isStackValidForSlot(int i, ItemStack itemstack) - { - return false; - } -} diff --git a/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java b/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java index 50350b918..cd282c49d 100644 --- a/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java +++ b/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java @@ -246,7 +246,6 @@ public class BlockConveyorBelt extends BlockALMachine public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) world.getBlockTileEntity(x, y, z); - tileEntity.updatePowerTransferRange(); if (tileEntity.IgnoreList.contains(entity)) { return; diff --git a/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java b/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java index 484d09113..36fe86840 100644 --- a/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java +++ b/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java @@ -19,14 +19,14 @@ import universalelectricity.prefab.network.IPacketReceiver; import universalelectricity.prefab.network.PacketManager; import assemblyline.api.IBelt; import assemblyline.common.AssemblyLine; -import assemblyline.common.machine.TileEntityAssemblyNetwork; +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 TileEntityAssemblyNetwork implements IPacketReceiver, IBelt, IRotatable +public class TileEntityConveyorBelt extends TileEntityAssembly implements IPacketReceiver, IBelt, IRotatable { public enum SlantType { @@ -45,67 +45,10 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements public float wheelRotation = 0; private int animFrame = 0; // this is from 0 to 15 private SlantType slantType = SlantType.NONE; + /** Entities that are ignored allowing for other tiles to interact with them */ + public List IgnoreList = new ArrayList(); - public List IgnoreList = new ArrayList();// Entities that need to be ignored to - // prevent movement - - /** - * This function is overriden to allow conveyor belts to power belts that are diagonally going - * up. - */ - @Override - public void updatePowerTransferRange() - { - int maximumTransferRange = 0; - - for (int i = 0; i < 6; i++) - { - ForgeDirection direction = ForgeDirection.getOrientation(i); - TileEntity tileEntity = worldObj.getBlockTileEntity(this.xCoord + direction.offsetX, this.yCoord + direction.offsetY, this.zCoord + direction.offsetZ); - - if (tileEntity != null) - { - if (tileEntity instanceof TileEntityAssemblyNetwork) - { - TileEntityAssemblyNetwork assemblyNetwork = (TileEntityAssemblyNetwork) tileEntity; - - if (assemblyNetwork.powerTransferRange > maximumTransferRange) - { - maximumTransferRange = assemblyNetwork.powerTransferRange; - } - } - } - } - - for (int d = 0; d <= 1; d++) - { - ForgeDirection direction = this.getDirection(); - - if (d == 1) - { - direction = direction.getOpposite(); - } - - for (int i = -1; i <= 1; i++) - { - TileEntity tileEntity = worldObj.getBlockTileEntity(this.xCoord + direction.offsetX, this.yCoord + i, this.zCoord + direction.offsetZ); - if (tileEntity != null) - { - if (tileEntity instanceof TileEntityAssemblyNetwork) - { - TileEntityAssemblyNetwork assemblyNetwork = (TileEntityAssemblyNetwork) tileEntity; - - if (assemblyNetwork.powerTransferRange > maximumTransferRange) - { - maximumTransferRange = assemblyNetwork.powerTransferRange; - } - } - } - } - } - - this.powerTransferRange = Math.max(maximumTransferRange - 1, 0); - } + @Override public void onUpdate() diff --git a/src/minecraft/assemblyline/common/machine/belt/TileEntityCoveredBelt.java b/src/minecraft/assemblyline/common/machine/belt/TileEntityCoveredBelt.java deleted file mode 100644 index b105d577b..000000000 --- a/src/minecraft/assemblyline/common/machine/belt/TileEntityCoveredBelt.java +++ /dev/null @@ -1,13 +0,0 @@ -package assemblyline.common.machine.belt; - -/** - * For the moment this is just a render place holder, but will be convered to prevent item pickups - * from the belts. - * - * @author Rseifert - * - */ -public class TileEntityCoveredBelt extends TileEntityConveyorBelt -{ - -} diff --git a/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneController.java b/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneController.java index ea9de66e5..e5f9e15b5 100644 --- a/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneController.java +++ b/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneController.java @@ -7,9 +7,9 @@ import net.minecraftforge.common.ForgeDirection; import universalelectricity.core.vector.Vector3; import assemblyline.api.ICraneStructure; import assemblyline.common.AssemblyLine; -import assemblyline.common.machine.TileEntityAssemblyNetwork; +import assemblyline.common.machine.TileEntityAssembly; -public class TileEntityCraneController extends TileEntityAssemblyNetwork implements ICraneStructure +public class TileEntityCraneController extends TileEntityAssembly implements ICraneStructure { int width, depth; boolean isCraneValid; @@ -213,4 +213,10 @@ public class TileEntityCraneController extends TileEntityAssemblyNetwork impleme { return true; } + @Override + public void onUpdate() + { + // TODO Auto-generated method stub + + } } diff --git a/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneRail.java b/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneRail.java index 8eca5e7c0..8d13f215a 100644 --- a/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneRail.java +++ b/src/minecraft/assemblyline/common/machine/crane/TileEntityCraneRail.java @@ -2,9 +2,9 @@ package assemblyline.common.machine.crane; import net.minecraftforge.common.ForgeDirection; import assemblyline.api.ICraneStructure; -import assemblyline.common.machine.TileEntityAssemblyNetwork; +import assemblyline.common.machine.TileEntityAssembly; -public class TileEntityCraneRail extends TileEntityAssemblyNetwork implements ICraneStructure +public class TileEntityCraneRail extends TileEntityAssembly implements ICraneStructure { @Override @@ -19,4 +19,11 @@ public class TileEntityCraneRail extends TileEntityAssemblyNetwork implements IC return false; } + @Override + public void onUpdate() + { + // TODO Auto-generated method stub + + } + } diff --git a/src/minecraft/assemblyline/common/machine/detector/TileEntityDetector.java b/src/minecraft/assemblyline/common/machine/detector/TileEntityDetector.java index 94882d8ff..75c0186c9 100644 --- a/src/minecraft/assemblyline/common/machine/detector/TileEntityDetector.java +++ b/src/minecraft/assemblyline/common/machine/detector/TileEntityDetector.java @@ -110,4 +110,11 @@ public class TileEntityDetector extends TileEntityFilterable { return direction != this.getDirection(); } + + @Override + public void onUpdate() + { + // TODO Auto-generated method stub + + } }