From 5040a7a18c71c1163876883d6248d1071af8c492 Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Tue, 3 Sep 2013 00:13:10 -0400 Subject: [PATCH] import changes --- .../dark/assembly/common/ALRecipeLoader.java | 2 +- .../dark/assembly/common/AssemblyLine.java | 4 ++-- .../common/armbot/TileEntityArmbot.java | 12 ++++++------ .../common/armbot/command/CommandBreak.java | 6 +++--- .../common/armbot/command/CommandPowerTo.java | 4 ++-- .../common/imprinter/ContainerImprinter.java | 8 ++++---- .../common/imprinter/TileEntityImprinter.java | 10 +++++----- .../common/machine/BlockAssembly.java | 18 ++++++++++++++++++ .../common/machine/InventoryCrate.java | 2 +- .../common/machine/TileEntityAssembly.java | 19 +++++++------------ .../machine/belt/TileEntityConveyorBelt.java | 16 ++++++++-------- .../crane/TileEntityCraneController.java | 2 +- .../machine/encoder/ContainerEncoder.java | 2 +- 13 files changed, 59 insertions(+), 46 deletions(-) diff --git a/src/minecraft/dark/assembly/common/ALRecipeLoader.java b/src/minecraft/dark/assembly/common/ALRecipeLoader.java index 2f7ce886..7770b934 100644 --- a/src/minecraft/dark/assembly/common/ALRecipeLoader.java +++ b/src/minecraft/dark/assembly/common/ALRecipeLoader.java @@ -7,7 +7,7 @@ import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import cpw.mods.fml.common.registry.GameRegistry; import dark.assembly.common.machine.BlockCrate; -import dark.core.RecipeLoader; +import dark.common.RecipeLoader; public class ALRecipeLoader extends RecipeLoader { diff --git a/src/minecraft/dark/assembly/common/AssemblyLine.java b/src/minecraft/dark/assembly/common/AssemblyLine.java index 14af2449..67d8ad31 100644 --- a/src/minecraft/dark/assembly/common/AssemblyLine.java +++ b/src/minecraft/dark/assembly/common/AssemblyLine.java @@ -51,8 +51,8 @@ import dark.assembly.common.machine.crane.TileEntityCraneRail; import dark.assembly.common.machine.encoder.BlockEncoder; import dark.assembly.common.machine.encoder.ItemDisk; import dark.assembly.common.machine.encoder.TileEntityEncoder; -import dark.core.BlockRegistry.BlockData; -import dark.core.DarkMain; +import dark.common.DarkMain; +import dark.common.BlockRegistry.BlockData; import dark.prefab.ModPrefab; @ModstatInfo(prefix = "asmline") diff --git a/src/minecraft/dark/assembly/common/armbot/TileEntityArmbot.java b/src/minecraft/dark/assembly/common/armbot/TileEntityArmbot.java index 76bc1d8c..a4bb653f 100644 --- a/src/minecraft/dark/assembly/common/armbot/TileEntityArmbot.java +++ b/src/minecraft/dark/assembly/common/armbot/TileEntityArmbot.java @@ -40,9 +40,9 @@ import dark.assembly.common.armbot.command.CommandRotateTo; import dark.assembly.common.armbot.command.CommandUse; import dark.assembly.common.machine.TileEntityAssembly; import dark.assembly.common.machine.encoder.ItemDisk; -import dark.core.DarkMain; -import dark.core.helpers.ItemFindingHelper; +import dark.common.DarkMain; import dark.prefab.IMultiBlock; +import dark.prefab.helpers.ItemWorldHelper; public class TileEntityArmbot extends TileEntityAssembly implements IMultiBlock, IPacketReceiver, IArmbot, IPeripheral { @@ -842,7 +842,7 @@ public class TileEntityArmbot extends TileEntityAssembly implements IMultiBlock, if (object instanceof ItemStack) { Vector3 handPosition = this.getHandPosition(); - ItemFindingHelper.dropItemStackExact(worldObj, handPosition.x, handPosition.y, handPosition.z, (ItemStack) object); + ItemWorldHelper.dropItemStack(worldObj, handPosition, (ItemStack) object, false); this.grabbedItems.remove((ItemStack) object); } if (object instanceof String) @@ -855,7 +855,7 @@ public class TileEntityArmbot extends TileEntityAssembly implements IMultiBlock, while (it.hasNext()) { - ItemFindingHelper.dropItemStackExact(worldObj, handPosition.x, handPosition.y, handPosition.z, it.next()); + ItemWorldHelper.dropItemStack(worldObj, handPosition, it.next(),false); } this.grabbedEntities.clear(); @@ -911,9 +911,9 @@ public class TileEntityArmbot extends TileEntityAssembly implements IMultiBlock, { if (this.getCurrentCommand() != null) { - return 2; + return .4;//400w } - return .1; + return .03;//30w } @Override diff --git a/src/minecraft/dark/assembly/common/armbot/command/CommandBreak.java b/src/minecraft/dark/assembly/common/armbot/command/CommandBreak.java index 7ada1dac..b258651b 100644 --- a/src/minecraft/dark/assembly/common/armbot/command/CommandBreak.java +++ b/src/minecraft/dark/assembly/common/armbot/command/CommandBreak.java @@ -6,10 +6,10 @@ import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import universalelectricity.core.vector.Vector3; -import dark.core.helpers.ItemFindingHelper; +import dark.prefab.helpers.ItemWorldHelper; /** Used by arms to break a specific block in a position. - * + * * @author Calclavia */ public class CommandBreak extends Command { @@ -33,7 +33,7 @@ public class CommandBreak extends Command if (!this.keep || items.size() > 1) { - ItemFindingHelper.dropBlockAsItem(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ()); + ItemWorldHelper.dropBlockAsItem(this.world, serachPosition); } else { diff --git a/src/minecraft/dark/assembly/common/armbot/command/CommandPowerTo.java b/src/minecraft/dark/assembly/common/armbot/command/CommandPowerTo.java index 9e0f269f..c0c2376f 100644 --- a/src/minecraft/dark/assembly/common/armbot/command/CommandPowerTo.java +++ b/src/minecraft/dark/assembly/common/armbot/command/CommandPowerTo.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 dark.core.helpers.ItemFindingHelper; +import dark.prefab.helpers.ItemWorldHelper; public class CommandPowerTo extends Command { @@ -57,7 +57,7 @@ public class CommandPowerTo extends Command List stacks = new ArrayList(); stacks.add(new ItemStack(Block.torchRedstoneActive, 1, 0)); stacks.add(new ItemStack(Block.torchRedstoneIdle, 1, 0)); - if (ItemFindingHelper.filterItems(this.tileEntity.getGrabbedItems(), stacks).size() > 0) + if (ItemWorldHelper.filterItems(this.tileEntity.getGrabbedItems(), stacks).size() > 0) { this.powerBlock(true); } diff --git a/src/minecraft/dark/assembly/common/imprinter/ContainerImprinter.java b/src/minecraft/dark/assembly/common/imprinter/ContainerImprinter.java index 176336c2..47900240 100644 --- a/src/minecraft/dark/assembly/common/imprinter/ContainerImprinter.java +++ b/src/minecraft/dark/assembly/common/imprinter/ContainerImprinter.java @@ -6,10 +6,10 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import dark.assembly.common.AssemblyLine; -import dark.core.gui.ISlotWatcher; -import dark.core.gui.SlotCraftingResult; -import dark.core.gui.SlotRestricted; -import dark.core.gui.WatchedSlot; +import dark.prefab.invgui.ISlotWatcher; +import dark.prefab.invgui.SlotCraftingResult; +import dark.prefab.invgui.SlotRestricted; +import dark.prefab.invgui.WatchedSlot; public class ContainerImprinter extends Container implements ISlotWatcher { diff --git a/src/minecraft/dark/assembly/common/imprinter/TileEntityImprinter.java b/src/minecraft/dark/assembly/common/imprinter/TileEntityImprinter.java index eaa3c283..310adea3 100644 --- a/src/minecraft/dark/assembly/common/imprinter/TileEntityImprinter.java +++ b/src/minecraft/dark/assembly/common/imprinter/TileEntityImprinter.java @@ -27,11 +27,11 @@ import com.google.common.io.ByteArrayDataInput; import dark.assembly.api.IArmbot; import dark.assembly.api.IArmbotUseable; import dark.assembly.common.AssemblyLine; -import dark.core.gui.ISlotPickResult; -import dark.core.helpers.AutoCraftingManager; -import dark.core.helpers.IAutoCrafter; -import dark.core.helpers.Pair; import dark.prefab.TileEntityMulti; +import dark.prefab.helpers.AutoCraftingManager; +import dark.prefab.helpers.AutoCraftingManager.IAutoCrafter; +import dark.prefab.helpers.Pair; +import dark.prefab.invgui.ISlotPickResult; public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInventory, IArmbotUseable, IPacketReceiver, ISlotPickResult, IAutoCrafter { @@ -190,7 +190,7 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv } /** Construct an InventoryCrafting Matrix on the fly. - * + * * @return */ public InventoryCrafting getCraftingMatrix() { diff --git a/src/minecraft/dark/assembly/common/machine/BlockAssembly.java b/src/minecraft/dark/assembly/common/machine/BlockAssembly.java index f52249b2..079c6730 100644 --- a/src/minecraft/dark/assembly/common/machine/BlockAssembly.java +++ b/src/minecraft/dark/assembly/common/machine/BlockAssembly.java @@ -1,7 +1,11 @@ package dark.assembly.common.machine; import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Icon; +import net.minecraft.world.World; import dark.assembly.common.AssemblyLine; import dark.assembly.common.TabAssemblyLine; import dark.prefab.BlockMachine; @@ -17,4 +21,18 @@ public abstract class BlockAssembly extends BlockMachine this.setCreativeTab(TabAssemblyLine.INSTANCE); } + public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) + { + if(entityPlayer != null && entityPlayer.getHeldItem() != null && entityPlayer.getHeldItem().itemID == Item.stick.itemID) + { + TileEntity entity = world.getBlockTileEntity(x, y, z); + if(entity instanceof TileEntityAssembly) + { + System.out.println(((TileEntityAssembly) entity).getTileNetwork().toString()); + } + + } + return false; + } + } \ No newline at end of file diff --git a/src/minecraft/dark/assembly/common/machine/InventoryCrate.java b/src/minecraft/dark/assembly/common/machine/InventoryCrate.java index 27e97b4a..f8bd7acf 100644 --- a/src/minecraft/dark/assembly/common/machine/InventoryCrate.java +++ b/src/minecraft/dark/assembly/common/machine/InventoryCrate.java @@ -3,7 +3,7 @@ package dark.assembly.common.machine; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import dark.prefab.InvChest; +import dark.prefab.invgui.InvChest; public class InventoryCrate extends InvChest { diff --git a/src/minecraft/dark/assembly/common/machine/TileEntityAssembly.java b/src/minecraft/dark/assembly/common/machine/TileEntityAssembly.java index c1ce0c1d..1267c71a 100644 --- a/src/minecraft/dark/assembly/common/machine/TileEntityAssembly.java +++ b/src/minecraft/dark/assembly/common/machine/TileEntityAssembly.java @@ -9,18 +9,17 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.ForgeDirection; import universalelectricity.core.electricity.ElectricityPack; import universalelectricity.core.vector.Vector3; -import universalelectricity.prefab.network.IPacketReceiver; import dark.assembly.common.AssemblyLine; -import dark.core.tile.network.NetworkSharedPower; -import dark.core.tile.network.NetworkTileEntities; import dark.interfaces.INetworkEnergyPart; import dark.prefab.TileEntityMachine; +import dark.prefab.tilenetwork.NetworkSharedPower; +import dark.prefab.tilenetwork.NetworkTileEntities; /** A class to be inherited by all machines on the assembly line. This class acts as a single peace * in a network of similar tiles allowing all to share power from one or more sources * * @author DarkGuardsman */ -public abstract class TileEntityAssembly extends TileEntityMachine implements IPacketReceiver, INetworkEnergyPart +public abstract class TileEntityAssembly extends TileEntityMachine implements INetworkEnergyPart { /** lowest value the network can update at */ public static int refresh_min_rate = 20; @@ -108,7 +107,7 @@ public abstract class TileEntityAssembly extends TileEntityMachine implements IP @Override public boolean canTileConnect(TileEntity entity, ForgeDirection dir) { - return entity != null && entity instanceof TileEntityAssembly; + return true; } @Override @@ -165,18 +164,14 @@ public abstract class TileEntityAssembly extends TileEntityMachine implements IP @Override public float receiveElectricity(ForgeDirection from, ElectricityPack receive, boolean doReceive) { - if (this.getInputDirections().contains(from)) - { - return this.getTileNetwork().dumpPower(this, receive.getWatts(), doReceive); - } - - return 0; + System.out.println("AssemblyTile has recieve power packet: " + (receive != null ? receive.toString() : "null")); + return this.getTileNetwork().dumpPower(this, receive.getWatts(), doReceive); } /** Amount of energy this tile runs on per tick */ public double getWattLoad() { - return 1; + return .1;//100w } @Override diff --git a/src/minecraft/dark/assembly/common/machine/belt/TileEntityConveyorBelt.java b/src/minecraft/dark/assembly/common/machine/belt/TileEntityConveyorBelt.java index 6a98fa3f..5352ec57 100644 --- a/src/minecraft/dark/assembly/common/machine/belt/TileEntityConveyorBelt.java +++ b/src/minecraft/dark/assembly/common/machine/belt/TileEntityConveyorBelt.java @@ -96,7 +96,7 @@ public class TileEntityConveyorBelt extends TileEntityAssembly implements IPacke @Override public Packet getDescriptionPacket() { - return PacketManager.getPacket(AssemblyLine.CHANNEL, this, 3, this.slantType.ordinal()); + return PacketManager.getPacket(AssemblyLine.CHANNEL, this, "beltSlant", this.slantType.ordinal()); } public SlantType getSlant() @@ -155,13 +155,13 @@ public class TileEntityConveyorBelt extends TileEntityAssembly implements IPacke } @Override - public boolean simplePacket(int id, DataInputStream dis, EntityPlayer player) + public boolean simplePacket(String id, DataInputStream dis, EntityPlayer player) { if (!super.simplePacket(id, dis, player) && this.worldObj.isRemote) { try { - if (id == 3) + if (id.equalsIgnoreCase("beltSlant")) { this.slantType = SlantType.values()[dis.readInt()]; return true; @@ -241,13 +241,13 @@ public class TileEntityConveyorBelt extends TileEntityAssembly implements IPacke TileEntity front, rear; if (this.slantType == SlantType.DOWN) { - face.add(new Vector3(0, -1, 0)); - back.add(new Vector3(0, 1, 0)); + face.translate(new Vector3(0, -1, 0)); + back.translate(new Vector3(0, 1, 0)); } else if (this.slantType == SlantType.UP) { - face.add(new Vector3(0, 1, 0)); - back.add(new Vector3(0, -1, 0)); + face.translate(new Vector3(0, 1, 0)); + back.translate(new Vector3(0, -1, 0)); } else { @@ -272,7 +272,7 @@ public class TileEntityConveyorBelt extends TileEntityAssembly implements IPacke @Override public double getWattLoad() { - return 0.1 + (0.1 * this.getAffectedEntities().size()); + return 0.05 + (0.01 * this.getAffectedEntities().size());//50w + (10w * loadSize) } } diff --git a/src/minecraft/dark/assembly/common/machine/crane/TileEntityCraneController.java b/src/minecraft/dark/assembly/common/machine/crane/TileEntityCraneController.java index fbbbee4b..3a4462d2 100644 --- a/src/minecraft/dark/assembly/common/machine/crane/TileEntityCraneController.java +++ b/src/minecraft/dark/assembly/common/machine/crane/TileEntityCraneController.java @@ -7,7 +7,7 @@ import net.minecraftforge.common.ForgeDirection; import universalelectricity.core.vector.Vector3; import dark.assembly.api.ICraneStructure; import dark.assembly.common.machine.TileEntityAssembly; -import dark.core.DarkMain; +import dark.common.DarkMain; public class TileEntityCraneController extends TileEntityAssembly implements ICraneStructure { diff --git a/src/minecraft/dark/assembly/common/machine/encoder/ContainerEncoder.java b/src/minecraft/dark/assembly/common/machine/encoder/ContainerEncoder.java index 1e33d083..8b1e07fa 100644 --- a/src/minecraft/dark/assembly/common/machine/encoder/ContainerEncoder.java +++ b/src/minecraft/dark/assembly/common/machine/encoder/ContainerEncoder.java @@ -6,7 +6,7 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import dark.assembly.common.AssemblyLine; -import dark.core.gui.SlotRestricted; +import dark.prefab.invgui.SlotRestricted; public class ContainerEncoder extends Container {