diff --git a/.gitignore b/.gitignore index 3f1c016f..2105c720 100644 --- a/.gitignore +++ b/.gitignore @@ -22,13 +22,12 @@ LICENSE.txt /builds/ !/src/*/assemblyline/ -!/src/*/dan200/ !/src/*/buildcraft/ !/src/*/universalelectricity/ !/Include Resources.bat !/mcmod.info - -!/resources/* +!/resources/ +!/models/ !/modversion.txt !/publish.bat !/README \ No newline at end of file diff --git a/Models/ReadMe.txt b/Models/ReadMe.txt index 9be5beed..34048862 100644 --- a/Models/ReadMe.txt +++ b/Models/ReadMe.txt @@ -1 +1 @@ -These 3D creations are created and copy righted by DarkGuardsman. They are to be used only for the AssemblyLine mod. \ No newline at end of file +These 3D creations are created and copy righted by DarkGuardsman. They are to be used only for the Assembly Line mod. \ No newline at end of file diff --git a/buildnumber.txt b/buildnumber.txt index ec635144..52a8c6d1 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -9 +10 diff --git a/info.txt b/info.txt index 6fc5365f..fb9ac863 100644 --- a/info.txt +++ b/info.txt @@ -6,3 +6,4 @@ @ AssemblyLine_v0.0.6.7.jar @ AssemblyLine_v0.0.6.8.jar AssemblyLine_v0.0.6.8_api.zip stable AssemblyLine_v0.0.6.10.jar AssemblyLine_v0.0.6.10_api.zip +* AssemblyLine_v0.1.2.10.jar AssemblyLine_v0.1.2.10_api.zip diff --git a/mcmod.info b/mcmod.info index 6d91f15e..0fd44988 100644 --- a/mcmod.info +++ b/mcmod.info @@ -2,9 +2,9 @@ { "modid": "AssemblyLine", "name": "Assembly Line", - "description": "A mod bringing a realistic conveyor belt transporting system to Minecraft.", - "version": "0.1.0", - "mcversion": "1.4.2", + "description": "A mod that brings conveyor belt transporting systems to Minecraft.", + "version": "0.1.2", + "mcversion": "1.4.4", "url": "http://calclavia.com/universalelectricity/?m=18", "updateUrl": "http://calclavia.com/universalelectricity/?m=18", "authors": [ diff --git a/modversion.txt b/modversion.txt index 99d85ecd..8294c184 100644 --- a/modversion.txt +++ b/modversion.txt @@ -1 +1 @@ -0.0.6 \ No newline at end of file +0.1.2 \ No newline at end of file diff --git a/src/common/assemblyline/ALCommonProxy.java b/src/common/assemblyline/ALCommonProxy.java index 1bf12f4a..2f5816ed 100644 --- a/src/common/assemblyline/ALCommonProxy.java +++ b/src/common/assemblyline/ALCommonProxy.java @@ -3,15 +3,14 @@ package assemblyline; import net.minecraft.src.EntityPlayer; import net.minecraft.src.TileEntity; import net.minecraft.src.World; -import assemblyline.gui.GuiSorter; -import assemblyline.machines.ContainerSorter; -import assemblyline.machines.TileEntityRejector; +import assemblyline.machine.ContainerSorter; +import assemblyline.machine.TileEntityRejector; import cpw.mods.fml.common.network.IGuiHandler; public class ALCommonProxy implements IGuiHandler { public static final int GUI_ARCHITECHT_TABLE = 4; - + public void preInit() { diff --git a/src/common/assemblyline/AssemblyLine.java b/src/common/assemblyline/AssemblyLine.java index e2d43bf5..2180af6b 100644 --- a/src/common/assemblyline/AssemblyLine.java +++ b/src/common/assemblyline/AssemblyLine.java @@ -3,21 +3,23 @@ package assemblyline; import java.io.File; import net.minecraft.src.Block; -import net.minecraft.src.BlockArchitectTable; import net.minecraft.src.Item; import net.minecraft.src.ItemStack; import net.minecraftforge.common.Configuration; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import universalelectricity.core.UEConfig; +import universalelectricity.core.UniversalElectricity; +import universalelectricity.prefab.UETab; import universalelectricity.prefab.network.PacketManager; -import assemblyline.belts.BlockConveyorBelt; -import assemblyline.belts.TileEntityConveyorBelt; -import assemblyline.machines.BlockMulti; -import assemblyline.machines.BlockMulti.MachineType; -import assemblyline.machines.ItemBlockMulti; -import assemblyline.machines.TileEntityManipulator; -import assemblyline.machines.TileEntityRejector; +import assemblyline.machine.BlockArchitectTable; +import assemblyline.machine.BlockMulti; +import assemblyline.machine.BlockMulti.MachineType; +import assemblyline.machine.ItemBlockMulti; +import assemblyline.machine.TileEntityManipulator; +import assemblyline.machine.TileEntityRejector; +import assemblyline.machine.belt.BlockConveyorBelt; +import assemblyline.machine.belt.TileEntityConveyorBelt; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; @@ -42,7 +44,7 @@ public class AssemblyLine @Instance("AssemblyLine") public static AssemblyLine instance; - public static final String VERSION = "0.1.1"; + public static final String VERSION = "0.1.2"; public static final String CHANNEL = "AssemblyLine"; @@ -58,6 +60,7 @@ public class AssemblyLine @PreInit public void preInit(FMLPreInitializationEvent event) { + UniversalElectricity.register(this, 1, 1, 1, false); instance = this; NetworkRegistry.instance().registerGuiHandler(this, this.proxy); GameRegistry.registerBlock(blockConveyorBelt); @@ -70,13 +73,13 @@ public class AssemblyLine public void load(FMLInitializationEvent evt) { proxy.init(); - + GameRegistry.registerTileEntity(TileEntityConveyorBelt.class, "ConveyorBelt"); GameRegistry.registerTileEntity(TileEntityRejector.class, "Sorter"); GameRegistry.registerTileEntity(TileEntityManipulator.class, "Manipulator"); // Add Names - LanguageRegistry.addName(new ItemStack(blockConveyorBelt, 1), "Conveyor Belt"); + LanguageRegistry.addName(blockConveyorBelt, "Conveyor Belt"); LanguageRegistry.addName(blockArchitectTable, "Architect's Table"); for (MachineType type : MachineType.values()) @@ -95,5 +98,7 @@ public class AssemblyLine // Retriever GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(blockInteraction, 1, MachineType.MANIPULATOR.metadata), new Object[] { Block.dispenser, "basicCircuit" })); + + UETab.setItemStack(new ItemStack(blockConveyorBelt)); } } \ No newline at end of file diff --git a/src/common/assemblyline/ai/ArmHelper.java b/src/common/assemblyline/ai/ArmHelper.java index d8789c7e..9f79c336 100644 --- a/src/common/assemblyline/ai/ArmHelper.java +++ b/src/common/assemblyline/ai/ArmHelper.java @@ -6,7 +6,7 @@ import net.minecraft.src.AxisAlignedBB; import net.minecraft.src.EntityItem; import net.minecraft.src.ItemStack; import net.minecraft.src.World; -import universalelectricity.core.Vector3; +import universalelectricity.core.vector.Vector3; public class ArmHelper { diff --git a/src/common/assemblyline/api/IManipulator.java b/src/common/assemblyline/api/IManipulator.java index 69960f47..7cb4b163 100644 --- a/src/common/assemblyline/api/IManipulator.java +++ b/src/common/assemblyline/api/IManipulator.java @@ -1,7 +1,7 @@ package assemblyline.api; import net.minecraft.src.ItemStack; -import universalelectricity.core.Vector3; +import universalelectricity.core.vector.Vector3; public interface IManipulator { diff --git a/src/common/assemblyline/machine/BlockArchitectTable.java b/src/common/assemblyline/machine/BlockArchitectTable.java new file mode 100644 index 00000000..0ce5fce3 --- /dev/null +++ b/src/common/assemblyline/machine/BlockArchitectTable.java @@ -0,0 +1,45 @@ +package assemblyline.machine; + +import net.minecraft.src.Block; +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.Material; +import net.minecraft.src.World; +import universalelectricity.prefab.UETab; + +public class BlockArchitectTable extends Block +{ + public BlockArchitectTable(int par1) + { + super(par1, Material.wood); + this.blockIndexInTexture = 59; + this.setBlockName("ArchitectTable"); + this.setCreativeTab(UETab.INSTANCE); + } + + /** + * Returns the block texture based on the side + * being looked at. Args: side + */ + public int getBlockTextureFromSide(int par1) + { + return par1 == 1 ? this.blockIndexInTexture - 16 : (par1 == 0 ? Block.planks.getBlockTextureFromSide(0) : (par1 != 2 && par1 != 4 ? this.blockIndexInTexture : this.blockIndexInTexture + 1)); + } + + /** + * Called upon block activation (right click + * on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.isRemote) + { + return true; + } + else + { + par5EntityPlayer.displayGUIWorkbench(par2, par3, par4); + return true; + } + } + +} diff --git a/src/common/assemblyline/machines/BlockMulti.java b/src/common/assemblyline/machine/BlockMulti.java similarity index 95% rename from src/common/assemblyline/machines/BlockMulti.java rename to src/common/assemblyline/machine/BlockMulti.java index 50c76fb6..4ce62bbd 100644 --- a/src/common/assemblyline/machines/BlockMulti.java +++ b/src/common/assemblyline/machine/BlockMulti.java @@ -1,4 +1,4 @@ -package assemblyline.machines; +package assemblyline.machine; import java.util.List; @@ -7,12 +7,13 @@ import net.minecraft.src.CreativeTabs; import net.minecraft.src.EntityLiving; import net.minecraft.src.EntityPlayer; import net.minecraft.src.ItemStack; -import net.minecraft.src.Material; import net.minecraft.src.MathHelper; import net.minecraft.src.TileEntity; import net.minecraft.src.World; -import universalelectricity.implement.IRedstoneReceptor; +import universalelectricity.core.UniversalElectricity; import universalelectricity.prefab.BlockMachine; +import universalelectricity.prefab.UETab; +import universalelectricity.prefab.implement.IRedstoneReceptor; import assemblyline.AssemblyLine; import assemblyline.render.RenderHelper; import cpw.mods.fml.common.network.PacketDispatcher; @@ -101,8 +102,8 @@ public class BlockMulti extends BlockMachine public BlockMulti(int id) { - super("Interaction Machine", id, Material.iron); - this.setCreativeTab(CreativeTabs.tabTransport); + super("AssemblyLineMachine", id, UniversalElectricity.machine); + this.setCreativeTab(UETab.INSTANCE); } @Override diff --git a/src/common/assemblyline/machines/ContainerSorter.java b/src/common/assemblyline/machine/ContainerSorter.java similarity index 92% rename from src/common/assemblyline/machines/ContainerSorter.java rename to src/common/assemblyline/machine/ContainerSorter.java index aad538f9..6b2d936c 100644 --- a/src/common/assemblyline/machines/ContainerSorter.java +++ b/src/common/assemblyline/machine/ContainerSorter.java @@ -1,4 +1,4 @@ -package assemblyline.machines; +package assemblyline.machine; import net.minecraft.src.Container; import net.minecraft.src.EntityPlayer; @@ -46,7 +46,7 @@ public class ContainerSorter extends Container * clicking. */ @Override - public ItemStack func_82846_b(EntityPlayer par1EntityPlayer, int par1) + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) { ItemStack itemStack3 = null; Slot itemStack = (Slot) this.inventorySlots.get(par1); @@ -77,7 +77,7 @@ public class ContainerSorter extends Container if (itemStack2.stackSize == itemStack3.stackSize) { return null; } - itemStack.func_82870_a(par1EntityPlayer, itemStack2); + itemStack.onPickupFromSlot(par1EntityPlayer, itemStack2); } return itemStack3; diff --git a/src/common/assemblyline/machines/ItemBlockMulti.java b/src/common/assemblyline/machine/ItemBlockMulti.java similarity index 83% rename from src/common/assemblyline/machines/ItemBlockMulti.java rename to src/common/assemblyline/machine/ItemBlockMulti.java index d27a76ad..c130423c 100644 --- a/src/common/assemblyline/machines/ItemBlockMulti.java +++ b/src/common/assemblyline/machine/ItemBlockMulti.java @@ -1,8 +1,8 @@ -package assemblyline.machines; +package assemblyline.machine; import net.minecraft.src.ItemBlock; import net.minecraft.src.ItemStack; -import assemblyline.machines.BlockMulti.MachineType; +import assemblyline.machine.BlockMulti.MachineType; public class ItemBlockMulti extends ItemBlock { diff --git a/src/common/assemblyline/machines/TileEntityManipulator.java b/src/common/assemblyline/machine/TileEntityManipulator.java similarity index 97% rename from src/common/assemblyline/machines/TileEntityManipulator.java rename to src/common/assemblyline/machine/TileEntityManipulator.java index 3109037c..4075e4ba 100644 --- a/src/common/assemblyline/machines/TileEntityManipulator.java +++ b/src/common/assemblyline/machine/TileEntityManipulator.java @@ -1,4 +1,4 @@ -package assemblyline.machines; +package assemblyline.machine; import java.util.List; @@ -15,15 +15,15 @@ import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntityChest; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ISidedInventory; -import universalelectricity.core.Vector3; -import universalelectricity.electricity.ElectricInfo; -import universalelectricity.implement.IRedstoneReceptor; -import universalelectricity.prefab.TileEntityElectricityReceiver; +import universalelectricity.core.electricity.ElectricInfo; +import universalelectricity.core.vector.Vector3; +import universalelectricity.prefab.implement.IRedstoneReceptor; import universalelectricity.prefab.network.IPacketReceiver; import universalelectricity.prefab.network.PacketManager; +import universalelectricity.prefab.tile.TileEntityElectricityReceiver; import assemblyline.AssemblyLine; import assemblyline.api.IManipulator; -import assemblyline.machines.BlockMulti.MachineType; +import assemblyline.machine.BlockMulti.MachineType; import com.google.common.io.ByteArrayDataInput; diff --git a/src/common/assemblyline/machines/TileEntityRejector.java b/src/common/assemblyline/machine/TileEntityRejector.java similarity index 98% rename from src/common/assemblyline/machines/TileEntityRejector.java rename to src/common/assemblyline/machine/TileEntityRejector.java index 7d0150e1..e240997e 100644 --- a/src/common/assemblyline/machines/TileEntityRejector.java +++ b/src/common/assemblyline/machine/TileEntityRejector.java @@ -1,4 +1,4 @@ -package assemblyline.machines; +package assemblyline.machine; import java.util.List; @@ -15,12 +15,12 @@ import net.minecraft.src.Packet; import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.TileEntity; import net.minecraftforge.common.ForgeDirection; -import universalelectricity.core.Vector3; -import universalelectricity.prefab.TileEntityElectricityReceiver; +import universalelectricity.core.vector.Vector3; import universalelectricity.prefab.network.IPacketReceiver; import universalelectricity.prefab.network.PacketManager; +import universalelectricity.prefab.tile.TileEntityElectricityReceiver; import assemblyline.AssemblyLine; -import assemblyline.belts.TileEntityConveyorBelt; +import assemblyline.machine.belt.TileEntityConveyorBelt; import com.google.common.io.ByteArrayDataInput; diff --git a/src/common/assemblyline/machines/TileEntityRoboticSorter.java b/src/common/assemblyline/machine/TileEntityRoboticSorter.java similarity index 96% rename from src/common/assemblyline/machines/TileEntityRoboticSorter.java rename to src/common/assemblyline/machine/TileEntityRoboticSorter.java index 5d701e9d..7c95c019 100644 --- a/src/common/assemblyline/machines/TileEntityRoboticSorter.java +++ b/src/common/assemblyline/machine/TileEntityRoboticSorter.java @@ -1,4 +1,4 @@ -package assemblyline.machines; +package assemblyline.machine; import net.minecraft.src.EntityPlayer; import net.minecraft.src.IInventory; @@ -9,9 +9,9 @@ import net.minecraft.src.NBTTagList; import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.TileEntity; import net.minecraftforge.common.ForgeDirection; -import universalelectricity.prefab.TileEntityElectricityReceiver; import universalelectricity.prefab.network.IPacketReceiver; -import assemblyline.belts.TileEntityConveyorBelt; +import universalelectricity.prefab.tile.TileEntityElectricityReceiver; +import assemblyline.machine.belt.TileEntityConveyorBelt; import com.google.common.io.ByteArrayDataInput; diff --git a/src/common/assemblyline/belts/BlockConveyorBelt.java b/src/common/assemblyline/machine/belt/BlockConveyorBelt.java similarity index 94% rename from src/common/assemblyline/belts/BlockConveyorBelt.java rename to src/common/assemblyline/machine/belt/BlockConveyorBelt.java index f447e918..ed6cccbc 100644 --- a/src/common/assemblyline/belts/BlockConveyorBelt.java +++ b/src/common/assemblyline/machine/belt/BlockConveyorBelt.java @@ -1,6 +1,5 @@ -package assemblyline.belts; +package assemblyline.machine.belt; -import net.minecraft.src.CreativeTabs; import net.minecraft.src.EntityLiving; import net.minecraft.src.EntityPlayer; import net.minecraft.src.MathHelper; @@ -8,6 +7,7 @@ import net.minecraft.src.TileEntity; import net.minecraft.src.World; import universalelectricity.core.UniversalElectricity; import universalelectricity.prefab.BlockMachine; +import universalelectricity.prefab.UETab; import assemblyline.render.RenderHelper; /** @@ -21,7 +21,7 @@ public class BlockConveyorBelt extends BlockMachine { super("Conveyor Belt", id, UniversalElectricity.machine); this.setBlockBounds(0, 0, 0, 1, 0.3f, 1); - this.setCreativeTab(CreativeTabs.tabTransport); + this.setCreativeTab(UETab.INSTANCE); } @Override diff --git a/src/common/assemblyline/belts/TileEntityConveyorBelt.java b/src/common/assemblyline/machine/belt/TileEntityConveyorBelt.java similarity index 96% rename from src/common/assemblyline/belts/TileEntityConveyorBelt.java rename to src/common/assemblyline/machine/belt/TileEntityConveyorBelt.java index 46e620f5..e09a5d39 100644 --- a/src/common/assemblyline/belts/TileEntityConveyorBelt.java +++ b/src/common/assemblyline/machine/belt/TileEntityConveyorBelt.java @@ -1,4 +1,4 @@ -package assemblyline.belts; +package assemblyline.machine.belt; import java.util.ArrayList; import java.util.List; @@ -12,12 +12,12 @@ import net.minecraft.src.Packet; import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.TileEntity; import net.minecraftforge.common.ForgeDirection; -import universalelectricity.core.Vector3; -import universalelectricity.electricity.ElectricInfo; -import universalelectricity.implement.IConductor; -import universalelectricity.prefab.TileEntityElectricityReceiver; +import universalelectricity.core.electricity.ElectricInfo; +import universalelectricity.core.implement.IConductor; +import universalelectricity.core.vector.Vector3; import universalelectricity.prefab.network.IPacketReceiver; import universalelectricity.prefab.network.PacketManager; +import universalelectricity.prefab.tile.TileEntityElectricityReceiver; import assemblyline.AssemblyLine; import assemblyline.api.IBelt; diff --git a/src/common/assemblyline/belts/TileEntityCoveredBelt.java b/src/common/assemblyline/machine/belt/TileEntityCoveredBelt.java similarity index 86% rename from src/common/assemblyline/belts/TileEntityCoveredBelt.java rename to src/common/assemblyline/machine/belt/TileEntityCoveredBelt.java index dd235833..2c9ce86d 100644 --- a/src/common/assemblyline/belts/TileEntityCoveredBelt.java +++ b/src/common/assemblyline/machine/belt/TileEntityCoveredBelt.java @@ -1,4 +1,4 @@ -package assemblyline.belts; +package assemblyline.machine.belt; /** * For the moment this is just a render place diff --git a/src/common/assemblyline/belts/TileEntityElevatorBelt.java b/src/common/assemblyline/machine/belt/TileEntityElevatorBelt.java similarity index 97% rename from src/common/assemblyline/belts/TileEntityElevatorBelt.java rename to src/common/assemblyline/machine/belt/TileEntityElevatorBelt.java index bb7d75be..12fbdaa1 100644 --- a/src/common/assemblyline/belts/TileEntityElevatorBelt.java +++ b/src/common/assemblyline/machine/belt/TileEntityElevatorBelt.java @@ -1,4 +1,4 @@ -package assemblyline.belts; +package assemblyline.machine.belt; import java.util.ArrayList; import java.util.List; diff --git a/src/common/assemblyline/machines/crafter/BlockCrafter.java b/src/common/assemblyline/machines/crafter/BlockCrafter.java index 56429394..38f5753a 100644 --- a/src/common/assemblyline/machines/crafter/BlockCrafter.java +++ b/src/common/assemblyline/machines/crafter/BlockCrafter.java @@ -1,21 +1,21 @@ package assemblyline.machines.crafter; -import net.minecraft.src.CreativeTabs; import net.minecraft.src.EntityPlayer; -import net.minecraft.src.Material; import net.minecraft.src.TileEntity; import net.minecraft.src.World; +import universalelectricity.core.UniversalElectricity; import universalelectricity.prefab.BlockMachine; +import universalelectricity.prefab.UETab; import assemblyline.AssemblyLine; public class BlockCrafter extends BlockMachine { - protected BlockCrafter(int par1) + protected BlockCrafter(int id) { - super("AutoCrafters", par1, Material.iron); + super("AutoCrafter", id, UniversalElectricity.machine); this.setResistance(5.0f); this.setHardness(5.0f); - this.setCreativeTab(CreativeTabs.tabTools); + this.setCreativeTab(UETab.INSTANCE); } public static enum CrafterType diff --git a/src/common/assemblyline/machines/crafter/ContainerCrafter.java b/src/common/assemblyline/machines/crafter/ContainerCrafter.java index a8e997e0..f959d544 100644 --- a/src/common/assemblyline/machines/crafter/ContainerCrafter.java +++ b/src/common/assemblyline/machines/crafter/ContainerCrafter.java @@ -59,7 +59,7 @@ public class ContainerCrafter extends Container * clicking. */ @Override - public ItemStack func_82846_b(EntityPlayer par1EntityPlayer, int par1) + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) { ItemStack itemStack3 = null; Slot itemStack = (Slot) this.inventorySlots.get(par1); @@ -90,7 +90,7 @@ public class ContainerCrafter extends Container if (itemStack2.stackSize == itemStack3.stackSize) { return null; } - itemStack.func_82870_a(par1EntityPlayer, itemStack2); + itemStack.onPickupFromSlot(par1EntityPlayer, itemStack2); } return itemStack3; diff --git a/src/common/assemblyline/machines/crafter/EntityCraftingArm.java b/src/common/assemblyline/machines/crafter/EntityCraftingArm.java index 147d9cb5..3205cd18 100644 --- a/src/common/assemblyline/machines/crafter/EntityCraftingArm.java +++ b/src/common/assemblyline/machines/crafter/EntityCraftingArm.java @@ -5,7 +5,7 @@ import net.minecraft.src.EntityItem; import net.minecraft.src.ItemStack; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.World; -import universalelectricity.core.Vector3; +import universalelectricity.core.vector.Vector3; public class EntityCraftingArm extends Entity { diff --git a/src/common/assemblyline/machines/crafter/TileEntityAutoCrafter.java b/src/common/assemblyline/machines/crafter/TileEntityAutoCrafter.java index bff59af5..fcdd2c8c 100644 --- a/src/common/assemblyline/machines/crafter/TileEntityAutoCrafter.java +++ b/src/common/assemblyline/machines/crafter/TileEntityAutoCrafter.java @@ -3,7 +3,7 @@ package assemblyline.machines.crafter; import net.minecraft.src.EntityPlayer; import net.minecraft.src.INetworkManager; import net.minecraft.src.Packet250CustomPayload; -import universalelectricity.prefab.TileEntityAdvanced; +import universalelectricity.prefab.tile.TileEntityAdvanced; import com.google.common.io.ByteArrayDataInput; diff --git a/src/common/assemblyline/machines/crafter/TileEntityCraftingArm.java b/src/common/assemblyline/machines/crafter/TileEntityCraftingArm.java index 3aa5b6d8..19e712a3 100644 --- a/src/common/assemblyline/machines/crafter/TileEntityCraftingArm.java +++ b/src/common/assemblyline/machines/crafter/TileEntityCraftingArm.java @@ -9,8 +9,8 @@ import net.minecraft.src.NBTTagList; import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.TileEntity; import net.minecraftforge.common.ForgeDirection; -import universalelectricity.prefab.TileEntityElectricityReceiver; import universalelectricity.prefab.network.IPacketReceiver; +import universalelectricity.prefab.tile.TileEntityElectricityReceiver; import assemblyline.ai.TaskManager; import com.google.common.io.ByteArrayDataInput; diff --git a/src/common/buildcraft/api/core/Orientations.java b/src/common/buildcraft/api/core/Orientations.java deleted file mode 100644 index 6b27a4b0..00000000 --- a/src/common/buildcraft/api/core/Orientations.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) SpaceToad, 2011 - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ - -package buildcraft.api.core; - -import net.minecraftforge.common.ForgeDirection; - -public enum Orientations { - YNeg, // 0 - YPos, // 1 - ZNeg, // 2 - ZPos, // 3 - XNeg, // 4 - XPos, // 5 - Unknown; - - public Orientations reverse() { - switch (this) { - case YPos: - return Orientations.YNeg; - case YNeg: - return Orientations.YPos; - case ZPos: - return Orientations.ZNeg; - case ZNeg: - return Orientations.ZPos; - case XPos: - return Orientations.XNeg; - case XNeg: - return Orientations.XPos; - default: - return Orientations.Unknown; - } - } - - public ForgeDirection toDirection(){ - switch(this){ - case YNeg: - return ForgeDirection.DOWN; - case YPos: - return ForgeDirection.UP; - case ZNeg: - return ForgeDirection.NORTH; - case ZPos: - return ForgeDirection.SOUTH; - case XNeg: - return ForgeDirection.WEST; - case XPos: - return ForgeDirection.EAST; - default: - return ForgeDirection.UNKNOWN; - - } - } - - public Orientations rotateLeft() { - switch (this) { - case XPos: - return ZPos; - case ZNeg: - return XPos; - case XNeg: - return ZNeg; - case ZPos: - return XNeg; - default: - return this; - } - } - - public static Orientations[] dirs() { - return new Orientations[] { YNeg, YPos, ZNeg, ZPos, XNeg, XPos }; - } -} diff --git a/src/common/buildcraft/api/core/Position.java b/src/common/buildcraft/api/core/Position.java deleted file mode 100644 index 2ee79d7e..00000000 --- a/src/common/buildcraft/api/core/Position.java +++ /dev/null @@ -1,141 +0,0 @@ -/** - * Copyright (c) SpaceToad, 2011 - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ - -package buildcraft.api.core; - -import net.minecraft.src.NBTTagCompound; -import net.minecraft.src.TileEntity; - -public class Position { - - public double x, y, z; - public Orientations orientation; - - public Position(double ci, double cj, double ck) { - x = ci; - y = cj; - z = ck; - orientation = Orientations.Unknown; - } - - public Position(double ci, double cj, double ck, Orientations corientation) { - x = ci; - y = cj; - z = ck; - orientation = corientation; - } - - public Position(Position p) { - x = p.x; - y = p.y; - z = p.z; - orientation = p.orientation; - } - - public Position(NBTTagCompound nbttagcompound) { - x = nbttagcompound.getDouble("i"); - y = nbttagcompound.getDouble("j"); - z = nbttagcompound.getDouble("k"); - - orientation = Orientations.Unknown; - } - - public Position(TileEntity tile) { - x = tile.xCoord; - y = tile.yCoord; - z = tile.zCoord; - } - - public void moveRight(double step) { - switch (orientation) { - case ZPos: - x = x - step; - break; - case ZNeg: - x = x + step; - break; - case XPos: - z = z + step; - break; - case XNeg: - z = z - step; - break; - default: - } - } - - public void moveLeft(double step) { - moveRight(-step); - } - - public void moveForwards(double step) { - switch (orientation) { - case YPos: - y = y + step; - break; - case YNeg: - y = y - step; - break; - case ZPos: - z = z + step; - break; - case ZNeg: - z = z - step; - break; - case XPos: - x = x + step; - break; - case XNeg: - x = x - step; - break; - default: - } - } - - public void moveBackwards(double step) { - moveForwards(-step); - } - - public void moveUp(double step) { - switch (orientation) { - case ZPos: - case ZNeg: - case XPos: - case XNeg: - y = y + step; - break; - default: - } - - } - - public void moveDown(double step) { - moveUp(-step); - } - - public void writeToNBT(NBTTagCompound nbttagcompound) { - nbttagcompound.setDouble("i", x); - nbttagcompound.setDouble("j", y); - nbttagcompound.setDouble("k", z); - } - - @Override - public String toString() { - return "{" + x + ", " + y + ", " + z + "}"; - } - - public Position min(Position p) { - return new Position(p.x > x ? x : p.x, p.y > y ? y : p.y, p.z > z ? z : p.z); - } - - public Position max(Position p) { - return new Position(p.x < x ? x : p.x, p.y < y ? y : p.y, p.z < z ? z : p.z); - } - -} \ No newline at end of file diff --git a/src/common/buildcraft/api/core/SafeTimeTracker.java b/src/common/buildcraft/api/core/SafeTimeTracker.java deleted file mode 100644 index b5cf2649..00000000 --- a/src/common/buildcraft/api/core/SafeTimeTracker.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) SpaceToad, 2011 - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ - -package buildcraft.api.core; - -import net.minecraft.src.World; - -public class SafeTimeTracker { - - private long lastMark = 0; - - /** - * Return true if a given delay has passed since last time marked was called - * successfully. - */ - public boolean markTimeIfDelay(World world, long delay) { - if (world == null) { - return false; - } - - long currentTime = world.getWorldTime(); - - if (currentTime < lastMark) { - lastMark = currentTime; - return false; - } else if (lastMark + delay <= currentTime) { - lastMark = world.getWorldTime(); - return true; - } else { - return false; - } - - } - - public void markTime(World world) { - lastMark = world.getWorldTime(); - } -} diff --git a/src/common/buildcraft/api/liquids/ILiquid.java b/src/common/buildcraft/api/liquids/ILiquid.java deleted file mode 100644 index 74d9fbe9..00000000 --- a/src/common/buildcraft/api/liquids/ILiquid.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) SpaceToad, 2011 - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ - -package buildcraft.api.liquids; - -public interface ILiquid { - - public int stillLiquidId(); - - public boolean isMetaSensitive(); - - public int stillLiquidMeta(); - -} diff --git a/src/common/buildcraft/api/liquids/ILiquidTank.java b/src/common/buildcraft/api/liquids/ILiquidTank.java deleted file mode 100644 index d570e16e..00000000 --- a/src/common/buildcraft/api/liquids/ILiquidTank.java +++ /dev/null @@ -1,27 +0,0 @@ -package buildcraft.api.liquids; - -public interface ILiquidTank { - - /** - * @return LiquidStack representing the liquid contained in the tank, null if empty. - */ - LiquidStack getLiquid(); - void setLiquid(LiquidStack liquid); - void setCapacity(int capacity); - int getCapacity(); - - /** - * - * @param resource - * @param doFill - * @return Amount of liquid used for filling. - */ - int fill(LiquidStack resource, boolean doFill); - /** - * - * @param maxDrain - * @param doDrain - * @return Null if nothing was drained, otherwise a LiquidStack containing the drained. - */ - LiquidStack drain(int maxDrain, boolean doDrain); -} diff --git a/src/common/buildcraft/api/liquids/ITankContainer.java b/src/common/buildcraft/api/liquids/ITankContainer.java deleted file mode 100644 index 51c89126..00000000 --- a/src/common/buildcraft/api/liquids/ITankContainer.java +++ /dev/null @@ -1,46 +0,0 @@ -package buildcraft.api.liquids; - -import buildcraft.api.core.Orientations; - -public interface ITankContainer { - - /** - * Fills liquid into internal tanks, distribution is left to the ITankContainer. - * @param from Orientation the liquid is pumped in from. - * @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer - * @param doFill If false filling will only be simulated. - * @return Amount of resource that was filled into internal tanks. - */ - int fill(Orientations from, LiquidStack resource, boolean doFill); - /** - * Fills liquid into the specified internal tank. - * @param from Orientation the liquid is pumped in from. - * @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer - * @param doFill If false filling will only be simulated. - * @return Amount of resource that was filled into internal tanks. - */ - int fill(int tankIndex, LiquidStack resource, boolean doFill); - - /** - * Drains liquid out of internal tanks, distribution is left to the ITankContainer. - * @param from Orientation the liquid is drained to. - * @param maxDrain Maximum amount of liquid to drain. - * @param doDrain If false draining will only be simulated. - * @return LiquidStack representing the liquid and amount actually drained from the ITankContainer - */ - LiquidStack drain(Orientations from, int maxDrain, boolean doDrain); - /** - * Drains liquid out of the specified internal tank. - * @param from Orientation the liquid is drained to. - * @param maxDrain Maximum amount of liquid to drain. - * @param doDrain If false draining will only be simulated. - * @return LiquidStack representing the liquid and amount actually drained from the ITankContainer - */ - LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain); - - /** - * @return Array of {@link LiquidTank}s contained in this ITankContainer - */ - ILiquidTank[] getTanks(); - -} diff --git a/src/common/buildcraft/api/liquids/LiquidData.java b/src/common/buildcraft/api/liquids/LiquidData.java deleted file mode 100644 index 97187772..00000000 --- a/src/common/buildcraft/api/liquids/LiquidData.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) SpaceToad, 2011 - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ - -package buildcraft.api.liquids; - -import net.minecraft.src.Item; -import net.minecraft.src.ItemStack; - -public class LiquidData { - - public final LiquidStack stillLiquid; - public final LiquidStack movingLiquid; - - public final ItemStack filled; - public final ItemStack container; - - public LiquidData(int stillLiquidId, int movingLiquidId, Item filled) { - this(new LiquidStack(stillLiquidId, LiquidManager.BUCKET_VOLUME), new LiquidStack(movingLiquidId, LiquidManager.BUCKET_VOLUME), new ItemStack(filled, 1), new ItemStack(Item.bucketEmpty)); - } - - public LiquidData(int stillLiquidId, int movingLiquidId, ItemStack filled) { - this(new LiquidStack(stillLiquidId, LiquidManager.BUCKET_VOLUME), new LiquidStack(movingLiquidId, LiquidManager.BUCKET_VOLUME), filled, new ItemStack(Item.bucketEmpty)); - } - - public LiquidData(LiquidStack stillLiquid, ItemStack filled, ItemStack container) { - this(stillLiquid, stillLiquid, filled, container); - } - - public LiquidData(LiquidStack stillLiquid, LiquidStack movingLiquid, ItemStack filled, ItemStack container) { - this.stillLiquid = stillLiquid; - this.movingLiquid = movingLiquid; - this.filled = filled; - this.container = container; - - if(stillLiquid == null || filled == null || container == null) - throw new RuntimeException("stillLiquid, filled, or container is null, this is an error"); - } - -} diff --git a/src/common/buildcraft/api/liquids/LiquidDictionary.java b/src/common/buildcraft/api/liquids/LiquidDictionary.java deleted file mode 100644 index fece9bfa..00000000 --- a/src/common/buildcraft/api/liquids/LiquidDictionary.java +++ /dev/null @@ -1,57 +0,0 @@ -package buildcraft.api.liquids; - -import java.util.HashMap; -import java.util.Map; - -/** - * When creating liquids you should register them with this class. - * - * @author CovertJaguar - */ -public abstract class LiquidDictionary -{ - - private static Map liquids = new HashMap(); - - /** - * When creating liquids you should call this function. - * - * Upon passing it a name and liquid item it will return either - * a preexisting implementation of that liquid or the liquid passed in. - * - * - * @param name the name of the liquid - * @param liquid the liquid to use if one doesn't exist - * @return - */ - public static LiquidStack getOrCreateLiquid(String name, LiquidStack liquid) - { - LiquidStack existing = liquids.get(name); - if(existing != null) { - return existing.copy(); - } - liquids.put(name, liquid.copy()); - return liquid; - } - - /** - * Returns the liquid matching the name, - * if such a liquid exists. - * - * Can return null. - * - * @param name the name of the liquid - * @param amount the amout of liquid - * @return - */ - public static LiquidStack getLiquid(String name, int amount) - { - LiquidStack liquid = liquids.get(name); - if(liquid == null) - return null; - - liquid = liquid.copy(); - liquid.amount = amount; - return liquid; - } -} diff --git a/src/common/buildcraft/api/liquids/LiquidManager.java b/src/common/buildcraft/api/liquids/LiquidManager.java deleted file mode 100644 index a9494951..00000000 --- a/src/common/buildcraft/api/liquids/LiquidManager.java +++ /dev/null @@ -1,64 +0,0 @@ -package buildcraft.api.liquids; - -import java.util.LinkedList; - -import net.minecraft.src.ItemStack; - -public class LiquidManager { - - public static final int BUCKET_VOLUME = 1000; - public static LinkedList liquids = new LinkedList(); - - public static LiquidStack getLiquidForFilledItem(ItemStack filledItem) { - if (filledItem == null) - return null; - - for (LiquidData liquid : liquids) - if (liquid.filled.isItemEqual(filledItem)) - return liquid.stillLiquid; - - return null; - } - - public static int getLiquidIDForFilledItem(ItemStack filledItem) { - LiquidStack liquidForFilledItem = getLiquidForFilledItem(filledItem); - - if (liquidForFilledItem == null) - return 0; - - return liquidForFilledItem.itemID; - } - - public static ItemStack getFilledItemForLiquid(LiquidStack liquid) { - for (LiquidData data : liquids) - if(data.stillLiquid.isLiquidEqual(liquid)) - return data.filled.copy(); - - return null; - } - - public static ItemStack fillLiquidContainer(int liquidId, int quantity, ItemStack emptyContainer) { - return fillLiquidContainer(new LiquidStack(liquidId, quantity, 0), emptyContainer); - } - - public static ItemStack fillLiquidContainer(LiquidStack liquid, ItemStack emptyContainer) { - for(LiquidData data : liquids) - if(liquid.containsLiquid(data.stillLiquid) - && data.container.isItemEqual(emptyContainer)) - return data.filled.copy(); - return null; - } - - public static boolean isLiquid(ItemStack block) { - if (block.itemID == 0) - return false; - - for (LiquidData liquid : liquids) - if (liquid.stillLiquid.isLiquidEqual(block) || liquid.movingLiquid.isLiquidEqual(block)) - return true; - - return false; - } - - -} diff --git a/src/common/buildcraft/api/liquids/LiquidStack.java b/src/common/buildcraft/api/liquids/LiquidStack.java deleted file mode 100644 index 60ec6e06..00000000 --- a/src/common/buildcraft/api/liquids/LiquidStack.java +++ /dev/null @@ -1,109 +0,0 @@ -package buildcraft.api.liquids; - -import net.minecraft.src.Block; -import net.minecraft.src.Item; -import net.minecraft.src.ItemStack; -import net.minecraft.src.NBTTagCompound; - -/** - * ItemStack substitute for liquids - * @author SirSengir - */ -public class LiquidStack { - public int itemID; - public int amount; - public int itemMeta; - - private LiquidStack() { - } - - public LiquidStack(int itemID, int amount) { - this(itemID, amount, 0); - } - - public LiquidStack(Item item, int amount) { - this(item.shiftedIndex, amount, 0); - } - - public LiquidStack(Block block, int amount) { - this(block.blockID, amount, 0); - } - - public LiquidStack(int itemID, int amount, int itemDamage) { - this.itemID = itemID; - this.amount = amount; - this.itemMeta = itemDamage; - } - - public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { - nbttagcompound.setShort("Id", (short) itemID); - nbttagcompound.setInteger("Amount", amount); - nbttagcompound.setShort("Meta", (short) itemMeta); - return nbttagcompound; - } - - public void readFromNBT(NBTTagCompound nbttagcompound) { - itemID = nbttagcompound.getShort("Id"); - amount = nbttagcompound.getInteger("Amount"); - itemMeta = nbttagcompound.getShort("Meta"); - } - - /** - * @return A copy of this LiquidStack - */ - public LiquidStack copy() { - return new LiquidStack(itemID, amount, itemMeta); - } - - /** - * @param other - * @return true if this LiquidStack contains the same liquid as the one passed in. - */ - public boolean isLiquidEqual(LiquidStack other) { - if(other == null) - return false; - - return itemID == other.itemID && itemMeta == other.itemMeta; - } - - /** - * @param other - * @return true if this LiquidStack contains the other liquid (liquids are equal and amount >= other.amount). - */ - public boolean containsLiquid(LiquidStack other) { - if(!isLiquidEqual(other)) - return false; - - return amount >= other.amount; - } - - /** - * @param other ItemStack containing liquids. - * @return true if this LiquidStack contains the same liquid as the one passed in. - */ - public boolean isLiquidEqual(ItemStack other) { - if(other == null) - return false; - - return itemID == other.itemID && itemMeta == other.getItemDamage(); - } - - /** - * @return ItemStack representation of this LiquidStack - */ - public ItemStack asItemStack() { - return new ItemStack(itemID, 1, itemMeta); - } - - /** - * Reads a liquid stack from the passed nbttagcompound and returns it. - * - * @param nbttagcompound - * @return - */ - public static LiquidStack loadLiquidStackFromNBT(NBTTagCompound nbttagcompound) { - LiquidStack liquidstack = new LiquidStack(); - liquidstack.readFromNBT(nbttagcompound); - return liquidstack.itemID == 0 ? null : liquidstack; - } -} diff --git a/src/common/buildcraft/api/liquids/LiquidTank.java b/src/common/buildcraft/api/liquids/LiquidTank.java deleted file mode 100644 index 62f51755..00000000 --- a/src/common/buildcraft/api/liquids/LiquidTank.java +++ /dev/null @@ -1,100 +0,0 @@ -package buildcraft.api.liquids; - -/** - * Reference implementation of ILiquidTank. Use this or implement your own. - */ -public class LiquidTank implements ILiquidTank { - private LiquidStack liquid; - private int capacity; - - public LiquidTank(int capacity) { - this(null, capacity); - } - - public LiquidTank(int liquidId, int quantity, int capacity) { - this(new LiquidStack(liquidId, quantity), capacity); - } - public LiquidTank(LiquidStack liquid, int capacity) { - this.liquid = liquid; - this.capacity = capacity; - } - - @Override - public LiquidStack getLiquid() { - return this.liquid; - } - - @Override - public void setLiquid(LiquidStack liquid) { - this.liquid = liquid; - } - - @Override - public void setCapacity(int capacity) { - this.capacity = capacity; - } - - @Override - public int getCapacity() { - return this.capacity; - } - - @Override - public int fill(LiquidStack resource, boolean doFill) { - if(resource == null || resource.itemID <= 0) - return 0; - - if(liquid == null || liquid.itemID <= 0) { - if(resource.amount <= capacity) { - if(doFill) - this.liquid = resource.copy(); - return resource.amount; - } else { - if(doFill) { - this.liquid = resource.copy(); - this.liquid.amount = capacity; - } - return capacity; - } - } - - if(!liquid.isLiquidEqual(resource)) - return 0; - - int space = capacity - liquid.amount; - if(resource.amount <= space) { - if(doFill) - this.liquid.amount += resource.amount; - return resource.amount; - } else { - - if(doFill) - this.liquid.amount = capacity; - return space; - } - - } - @Override - public LiquidStack drain(int maxDrain, boolean doDrain) { - if(liquid == null || liquid.itemID <= 0) - return null; - if(liquid.amount <= 0) - return null; - - int used = maxDrain; - if(liquid.amount < used) - used = liquid.amount; - - if(doDrain) { - liquid.amount -= used; - } - - LiquidStack drained = new LiquidStack(liquid.itemID, used, liquid.itemMeta); - - // Reset liquid if emptied - if(liquid.amount <= 0) - liquid = null; - - return drained; - } -} diff --git a/src/common/buildcraft/api/power/IPowerProvider.java b/src/common/buildcraft/api/power/IPowerProvider.java deleted file mode 100644 index 97506496..00000000 --- a/src/common/buildcraft/api/power/IPowerProvider.java +++ /dev/null @@ -1,41 +0,0 @@ -package buildcraft.api.power; - -import buildcraft.api.core.Orientations; -import buildcraft.api.core.SafeTimeTracker; -import net.minecraft.src.NBTTagCompound; - -public interface IPowerProvider { - - int getLatency(); - - int getMinEnergyReceived(); - - int getMaxEnergyReceived(); - - int getMaxEnergyStored(); - - int getActivationEnergy(); - - float getEnergyStored(); - - void configure(int latency, int minEnergyReceived, int maxEnergyReceived, int minActivationEnergy, int maxStoredEnergy); - - void configurePowerPerdition(int powerLoss, int powerLossRegularity); - - boolean update(IPowerReceptor receptor); - - boolean preConditions(IPowerReceptor receptor); - - float useEnergy(float min, float max, boolean doUse); - - void readFromNBT(NBTTagCompound nbttagcompound); - - void writeToNBT(NBTTagCompound nbttagcompound); - - void receiveEnergy(float quantity, Orientations from); - - boolean isPowerSource(Orientations from); - - SafeTimeTracker getTimeTracker(); - -} diff --git a/src/common/buildcraft/api/power/IPowerReceptor.java b/src/common/buildcraft/api/power/IPowerReceptor.java deleted file mode 100644 index f6150480..00000000 --- a/src/common/buildcraft/api/power/IPowerReceptor.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) SpaceToad, 2011 - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ - -package buildcraft.api.power; - - -public interface IPowerReceptor { - - public void setPowerProvider(IPowerProvider provider); - - public IPowerProvider getPowerProvider(); - - public void doWork(); - - public int powerRequest(); - -} diff --git a/src/common/buildcraft/api/power/PowerFramework.java b/src/common/buildcraft/api/power/PowerFramework.java deleted file mode 100644 index 26cc4e4f..00000000 --- a/src/common/buildcraft/api/power/PowerFramework.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) SpaceToad, 2011 - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ - -package buildcraft.api.power; - -import net.minecraft.src.NBTTagCompound; - -public abstract class PowerFramework { - - static private String baseNBTName = "net.minecraft.src.buildcarft.Power"; - - public static PowerFramework currentFramework; - - public abstract IPowerProvider createPowerProvider(); - - public void loadPowerProvider(IPowerReceptor receptor, NBTTagCompound compound) { - - IPowerProvider provider = createPowerProvider(); - - if (compound.hasKey(baseNBTName)) { - NBTTagCompound cpt = compound.getCompoundTag(baseNBTName); - if (cpt.getString("class").equals(this.getClass().getName())) { - provider.readFromNBT(cpt.getCompoundTag("contents")); - } - } - - receptor.setPowerProvider(provider); - } - - public void savePowerProvider(IPowerReceptor receptor, NBTTagCompound compound) { - - IPowerProvider provider = receptor.getPowerProvider(); - - if (provider == null) { - return; - } - - NBTTagCompound cpt = new NBTTagCompound(); - - cpt.setString("class", this.getClass().getName()); - - NBTTagCompound contents = new NBTTagCompound(); - - provider.writeToNBT(contents); - - cpt.setTag("contents", contents); - compound.setTag(baseNBTName, cpt); - } - -} diff --git a/src/common/buildcraft/api/power/PowerProvider.java b/src/common/buildcraft/api/power/PowerProvider.java deleted file mode 100644 index 54acf335..00000000 --- a/src/common/buildcraft/api/power/PowerProvider.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Copyright (c) SpaceToad, 2011 - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ - -package buildcraft.api.power; - -import buildcraft.api.core.Orientations; -import buildcraft.api.core.SafeTimeTracker; -import net.minecraft.src.NBTTagCompound; -import net.minecraft.src.TileEntity; - -public abstract class PowerProvider implements IPowerProvider { - - protected int latency; - protected int minEnergyReceived; - protected int maxEnergyReceived; - protected int maxEnergyStored; - protected int minActivationEnergy; - protected float energyStored = 0; - - protected int powerLoss = 1; - protected int powerLossRegularity = 100; - - public SafeTimeTracker timeTracker = new SafeTimeTracker(); - public SafeTimeTracker energyLossTracker = new SafeTimeTracker(); - - public int[] powerSources = { 0, 0, 0, 0, 0, 0 }; - - @Override public SafeTimeTracker getTimeTracker() { return this.timeTracker; } - - @Override public int getLatency() { return this.latency; } - @Override public int getMinEnergyReceived() { return this.minEnergyReceived; } - @Override public int getMaxEnergyReceived() { return this.maxEnergyReceived; } - @Override public int getMaxEnergyStored() { return this.maxEnergyStored; } - @Override public int getActivationEnergy() { return this.minActivationEnergy; } - @Override public float getEnergyStored() { return this.energyStored; } - - @Override - public void configure(int latency, int minEnergyReceived, int maxEnergyReceived, int minActivationEnergy, int maxStoredEnergy) { - this.latency = latency; - this.minEnergyReceived = minEnergyReceived; - this.maxEnergyReceived = maxEnergyReceived; - this.maxEnergyStored = maxStoredEnergy; - this.minActivationEnergy = minActivationEnergy; - } - - @Override - public void configurePowerPerdition(int powerLoss, int powerLossRegularity) { - this.powerLoss = powerLoss; - this.powerLossRegularity = powerLossRegularity; - } - - @Override - public boolean update(IPowerReceptor receptor) { - if (!preConditions(receptor)) { - return false; - } - - TileEntity tile = (TileEntity) receptor; - boolean result = false; - - if (energyStored >= minActivationEnergy) { - if (latency == 0) { - receptor.doWork(); - result = true; - } else { - if (timeTracker.markTimeIfDelay(tile.worldObj, latency)) { - receptor.doWork(); - result = true; - } - } - } - - if (powerLoss > 0 && energyLossTracker.markTimeIfDelay(tile.worldObj, powerLossRegularity)) { - - energyStored -= powerLoss; - if (energyStored < 0) { - energyStored = 0; - } - } - - for (int i = 0; i < 6; ++i) { - if (powerSources[i] > 0) { - powerSources[i]--; - } - } - - return result; - } - - @Override - public boolean preConditions(IPowerReceptor receptor) { - return true; - } - - @Override - public float useEnergy(float min, float max, boolean doUse) { - float result = 0; - - if (energyStored >= min) { - if (energyStored <= max) { - result = energyStored; - if (doUse) { - energyStored = 0; - } - } else { - result = max; - if (doUse) { - energyStored -= max; - } - } - } - - return result; - } - - @Override - public void readFromNBT(NBTTagCompound nbttagcompound) { - latency = nbttagcompound.getInteger("latency"); - minEnergyReceived = nbttagcompound.getInteger("minEnergyReceived"); - maxEnergyReceived = nbttagcompound.getInteger("maxEnergyReceived"); - maxEnergyStored = nbttagcompound.getInteger("maxStoreEnergy"); - minActivationEnergy = nbttagcompound.getInteger("minActivationEnergy"); - - try { - energyStored = nbttagcompound.getFloat("storedEnergy"); - } catch (Throwable c) { - energyStored = 0; - } - } - - @Override - public void writeToNBT(NBTTagCompound nbttagcompound) { - nbttagcompound.setInteger("latency", latency); - nbttagcompound.setInteger("minEnergyReceived", minEnergyReceived); - nbttagcompound.setInteger("maxEnergyReceived", maxEnergyReceived); - nbttagcompound.setInteger("maxStoreEnergy", maxEnergyStored); - nbttagcompound.setInteger("minActivationEnergy", minActivationEnergy); - nbttagcompound.setFloat("storedEnergy", energyStored); - } - - @Override - public void receiveEnergy(float quantity, Orientations from) { - powerSources[from.ordinal()] = 2; - - energyStored += quantity; - - if (energyStored > maxEnergyStored) { - energyStored = maxEnergyStored; - } - } - - @Override - public boolean isPowerSource(Orientations from) { - return powerSources[from.ordinal()] != 0; - } -} diff --git a/src/common/dan200/computer/api/IComputerAccess.java b/src/common/dan200/computer/api/IComputerAccess.java deleted file mode 100644 index 52a034e2..00000000 --- a/src/common/dan200/computer/api/IComputerAccess.java +++ /dev/null @@ -1,131 +0,0 @@ - -package dan200.computer.api; - -/** - * The interface passed to peripherals by computers or turtles, providing methods - * that they can call. This should not be implemented by your classes. Do not interact - * with computers except via this interface. - */ -public interface IComputerAccess -{ - /** - * Creates a new numbered directory in a subPath of the users game save, and return that number. To be used with mountSaveDir.
- * For example: n = createNewSaveDir( "computer/cdrom" ), will create a new - * numbered folder in the "computer/cdrom" subdirectory of the users save file, and return that number. - * mountSaveDir( "computer/rom", n ) could then be used to mount that folder onto the computers directory - * structure, and the value n could be saved out and used again in future to give the peripheral - * persistant storage. - * @param subPath A relative file path from the users world save, where the directory should be located. - * @return The numeric represenation of the name of the folder created. Will be positive. - * @see #mountSaveDir(String, String, int, boolean, long) - */ - public int createNewSaveDir( String subPath ); - - /** - * Equivalent to mountSaveDir( String desiredLocation, String subPath, int id, boolean readOnly, long spaceLimit ) with no space limit. - * Mounts created with this method will have unlimited capacity. - * @see #mountSaveDir(String, String, int, boolean, long) - */ - public String mountSaveDir( String desiredLocation, String subPath, int id, boolean readOnly ); - - /** - * Mounts a directory into the computers file system, from a real directory a subPath of the users game save, - * with a numerical name. To be used with createNewSaveDir.
- * For example: n = createNewSaveDir( "computer/cdrom" ), will create a new - * numbered folder in the "computer/cdrom" subdirectory of the users save file, and return that number. - * mountSaveDir( "computer/rom", n ) could then be used to mount that folder onto the computers directory - * structure, and the value n can be saved out by the peripheral and used again, to give the peripheral - * persistant storage.
- * When a directory is mounted, it will appear in the computers file system, and the user will be - * able to use file operation to read from and write to the directory (unless readOnly, then only writes will be allowed). - * @param desiredLocation The desired location in the computers file system where you would like the directory to appear. - * If this location already exists, a number will be appended until a free name is found, and the - * actual location will be returned. eg: "cdrom" can become "cdrom2" if two peripherals attempt to - * mount "cdrom", or a "cdrom" folder already exists. - * @param subPath The real relative file path from the users world save, where the directory to mount can be located. - * @param id The numerical name of the folder to mount from the subPath: ex: mountSaveDir( "cdrom", "computer/cdrom", 7 ) - * will mount the directory "computer/cdrom/7". Use createNewSaveDir to obtain a unique directory id. - * @param readOnly Whether the computer will be disallowed from making changes to the mounted directory and modifing or creating files therin. - * @param spaceLimit The size limit of the mount, in bytes. - * @return The location in the computers file system where the directory was mounted. This may differ from "desiredLocation", so the - * return value should be kept track of so the folder can be unmounted later. - * @see #createNewSaveDir(String) - * @see #mountFixedDir(String, String, boolean, long) - * @see #unmount(String) - */ - public String mountSaveDir( String desiredLocation, String subPath, int id, boolean readOnly, long spaceLimit ); - - /** - * Equivalent to mountFixedDir( String desiredLocation, String path, boolean readOnly, long spaceLimit ) with no space limit. - * Mounts created with this method will have unlimited capacity. - * @see #mountFixedDir(String, String, boolean, long) - */ - public String mountFixedDir( String desiredLocation, String path, boolean readOnly ); - - /** - * Mounts a directory into the computers file system, from a real directory in the Minecraft install folder.
- * For example: mountFixedDir( "stuff", "mods/mymod/lua/stuff", true ), will mount the "lua/stuff" folder from - * your mod's directory into the computers filesystem at the location "stuff", with readonly permission, giving the - * computer access to those files.
- * When a directory is mounted, it will appear in the computers file system, and the user will be - * able to use file operation to read from and write to the directory (unless readOnly, then only writes will be allowed).
- * mountFixedDir can also be used to mount files, for example: mountFixedDir( "rom/apis/myapi", "mods/mymod/lua/myapi.lua", true ) can - * be used to have the peripheral install an API onto the computer it attaches to. - * @param desiredLocation The desired location in the computers file system where you would like the directory to appear. - * If this location already exists, a number will be appended until a free name is found, and the - * actual location will be returned. eg: "cdrom" can become "cdrom2" if two peripherals attempt to - * mount "cdrom", or a "cdrom" folder already exists. - * @param subPath The real relative file path from the minecraft install root, where the directory to mount can be located. - * @param readOnly Whether the computer will be disallowed from making changes to the mounted directory and modifing or creating files therin. - * @param spaceLimit The size limit of the mount, in bytes. - * @return The location in the computers file system where the directory was mounted. This may differ from "desiredLocation", so the - * return value should be kept track of so the folder can be unmounted later. - * @see #mountSaveDir(String, String, int, boolean, long) - * @see #unmount(String) - */ - public String mountFixedDir( String desiredLocation, String path, boolean readOnly, long spaceLimit ); - - /** - * Unmounts a directory previously mounted onto the computers file system by mountSaveDir or mountFixedDir.
- * When a directory is unmounted, it will disappear from the computers file system, and the user will no longer be able to - * access it. All directories mounted by a mountFixedDir or mountSaveDir are automatically unmounted when the peripheral - * is attached if they have not been explicitly unmounted. - * @param location The desired location in the computers file system of the directory to unmount. - * This must be the location of a directory previously mounted by mountFixedDir() or mountSaveDir(), as - * indicated by their return value. - * @see #mountSaveDir(String, String, int, boolean, long) - * @see #mountFixedDir(String, String, boolean, long) - */ - public void unmount( String location ); - - /** - * Returns the numerical ID of this computer.
- * This is the same number obtained by calling os.getComputerID() or running the "id" program from lua, - * and is guarunteed unique. This number will be positive. - * @return The identifier. - */ - public int getID(); - - /** - * Equivalent to queueEvent( String event, Object[] arguments ) with an empty arguments array. - * @see #queueEvent(String, Object[]) - */ - public void queueEvent( String event ); - - /** - * Causes an event to be raised on this computer, which the computer can respond to by calling - * os.pullEvent(). This can be used to notify the computer when things happen in the world or to - * this peripheral. - * @param event A string identifying the type of event that has occurred, this will be - * returned as the first value from os.pullEvent(). It is recommended that you - * you choose a name that is unique, and recognisable as originating from your - * peripheral. eg: If your peripheral type is "button", a suitable event would be - * "button_pressed". - * @param arguments In addition to a name, you may pass an array of extra arguments to the event, that will - * be supplied as extra return values to os.pullEvent(). Objects in the array will be converted - * to lua data types in the same fashion as the return values of IPeripheral.callMethod().
- * You may supply null to indicate that no arguments are to be supplied. - * @see IPeripheral#callMethod - */ - public void queueEvent( String event, Object[] arguments ); -} diff --git a/src/common/dan200/computer/api/IPeripheral.java b/src/common/dan200/computer/api/IPeripheral.java deleted file mode 100644 index 8dfeb8dc..00000000 --- a/src/common/dan200/computer/api/IPeripheral.java +++ /dev/null @@ -1,103 +0,0 @@ - -package dan200.computer.api; - -/** - * The interface that defines a peripheral. This should be implemented by the - * TileEntity of any block that you wish to be interacted with by - * computer or turtle. - */ -public interface IPeripheral -{ - /** - * Should return a string that uniquely identifies this type of peripheral. - * This can be queried from lua by calling peripheral.getType() - * @return A string identifying the type of peripheral. - */ - public String getType(); - - /** - * Should return an array of strings that identify the methods that this - * peripheral exposes to Lua. This will be called once before each attachment, - * and should not change when called multiple times. - * @return An array of strings representing method names. - * @see #callMethod - */ - public String[] getMethodNames(); - - /** - * This is called when a lua program on an attached computer calls peripheral.call() with - * one of the methods exposed by getMethodNames().
- *
- * Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe - * when interacting with minecraft objects. - * @param computer The interface to the computer that is making the call. Remember that multiple - * computers can be attached to a peripheral at once. - * @param method An integer identifying which of the methods from getMethodNames() the computer - * wishes to call. The integer indicates the index into the getMethodNames() table - * that corresponds to the string passed into peripheral.call() - * @param arguments An array of objects, representing the arguments passed into peripheral.call().
- * Lua values of type "string" will be represented by Object type String.
- * Lua values of type "number" will be represented by Object type Double.
- * Lua values of type "boolean" will be represented by Object type Boolean.
- * Lua values of any other type will be represented by a null object.
- * This array will be empty if no arguments are passed. - * @return An array of objects, representing values you wish to return to the lua program.
- * Integers, Doubles, Floats, Strings, Booleans and null be converted to their corresponding lua type.
- * All other types will be converted to nil.
- * You may return null to indicate no values should be returned. - * @throws Exception If you throw any exception from this function, a lua error will be raised with the - * same message as your exception. Use this to throw appropriate errors if the wrong - * arguments are supplied to your method. - * @see #getMethodNames - */ - public Object[] callMethod( IComputerAccess computer, int method, Object[] arguments ) throws Exception; - - /** - * Is called before the computer attempts to attach to the peripheral, and should return whether to allow - * the attachment. Use this to restrict the number of computers that can attach, or to limit attachments to - * certain world directions.
- * If true is returned, attach() will be called shortly afterwards, and the computer will be able to make method calls. - * If false is returned, attach() will not be called, and the peripheral will be invisible to the computer. - * @param side The world direction (0=bottom, 1=top, etc) that the computer lies relative to the peripheral. - * @return Whether to allow the attachment, as a boolean. - * @see #attach - */ - public boolean canAttachToSide( int side ); - - /** - * Is called when canAttachToSide has returned true, and a computer is attaching to the peripheral. - * This will occur when a peripheral is placed next to an active computer, when a computer is turned on next to a peripheral, - * or when a turtle travels into a square next to a peripheral. - * Between calls to attach() and detach(), the attached computer can make method calls on the peripheral using peripheral.call(). - * This method can be used to keep track of which computers are attached to the peripheral, or to take action when attachment - * occurs.
- *
- * Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe - * when interacting with minecraft objects. - * @param computer The interface to the computer that is being attached. Remember that multiple - * computers can be attached to a peripheral at once. - * @param computerSide A string indicating which "side" of the computer the peripheral is attaching, - * relative to the computers orientation. This value will be one of "top", "bottom", - * "left", "right", "front" or "back". This can be used to uniquely identify the - * peripheral when raising events or returning values to the computer. - * @see #canAttachToSide - * @see #detach - */ - public void attach( IComputerAccess computer, String computerSide ); - - /** - * Is called when a computer is detaching from the peripheral. - * This will occur when a computer shuts down, when the peripheral is removed while attached to computers, - * or when a turtle moves away from a square attached to a peripheral. - * This method can be used to keep track of which computers are attached to the peripheral, or to take action when detachment - * occurs.
- *
- * Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe - * when interacting with minecraft objects. - * @param computer The interface to the computer that is being detached. Remember that multiple - * computers can be attached to a peripheral at once. - * @see #canAttachToSide - * @see #detach - */ - public void detach( IComputerAccess computer ); -} diff --git a/src/common/universalelectricity/core/UELoader.java b/src/common/universalelectricity/core/UELoader.java index c55205c0..10454d58 100644 --- a/src/common/universalelectricity/core/UELoader.java +++ b/src/common/universalelectricity/core/UELoader.java @@ -4,17 +4,19 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.world.WorldEvent.Load; import net.minecraftforge.event.world.WorldEvent.Unload; -import universalelectricity.electricity.ElectricityManager; -import universalelectricity.electricity.ElectricityManagerTicker; +import universalelectricity.core.electricity.ElectricityManager; +import universalelectricity.core.electricity.ElectricityManagerTicker; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Side; import cpw.mods.fml.common.registry.TickRegistry; /** - * A class used to load Universal Electricity and make it work. + * A class used to load Universal Electricity and + * make it work. + * * @author Calclavia - * + * */ public class UELoader { diff --git a/src/common/universalelectricity/core/UniversalElectricity.java b/src/common/universalelectricity/core/UniversalElectricity.java index 3db01584..6c069102 100644 --- a/src/common/universalelectricity/core/UniversalElectricity.java +++ b/src/common/universalelectricity/core/UniversalElectricity.java @@ -12,17 +12,20 @@ import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.Loader; /** - * Instructions for using the Universal Electricity API. + * Instructions for using the Universal + * Electricity API. * - * The less you include of the API, the more compatible your - * mod will be for future releases of Universal Electricity. + * The less you include of the API, the more + * compatible your mod will be for future releases + * of Universal Electricity. * - * REQUIRED PACKAGES: - * "universalelectricity" + * REQUIRED PACKAGES: "universalelectricity" * "universalelectricity.electricity" - * "universalelectricity.implements" - Some interfaces can be removed if not needed. + * "universalelectricity.implements" - Some + * interfaces can be removed if not needed. * - * The rest of the classes should be removed if you are not going to use them. + * The rest of the classes should be removed if + * you are not going to use them. * * @author Calclavia * @@ -30,20 +33,23 @@ import cpw.mods.fml.common.Loader; public class UniversalElectricity { /** - * The version of the Universal Electricity API. + * The version of the Universal Electricity + * API. */ public static final int MAJOR_VERSION = 1; - public static final int MINOR_VERSION = 0; - public static final int REVISION_VERSION = 0; + public static final int MINOR_VERSION = 1; + public static final int REVISION_VERSION = 1; public static final String VERSION = MAJOR_VERSION + "." + MINOR_VERSION + "." + REVISION_VERSION; /** - * The Universal Electricity configuration file. + * The Universal Electricity configuration + * file. */ public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), "UniversalElectricity/UniversalElectricity.cfg")); /** - * Conversion ratios between Buildcraft and Industrialcraft energy. + * Conversion ratios between Buildcraft and + * Industrialcraft energy. */ // EU to Watts ratio public static final float IC2_RATIO = (float) UEConfig.getConfigData(CONFIGURATION, "IndustrialCraft Conversion Ratio", 7); @@ -53,16 +59,17 @@ public class UniversalElectricity public static final float TO_BC_RATIO = 1 / BC3_RATIO; /** - * Use this material for all your machine blocks. It can be breakable by - * hand. + * Use this material for all your machine + * blocks. It can be breakable by hand. */ public static final Material machine = new Material(MapColor.ironColor); public static final List mods = new ArrayList(); /** - * You must register your mod with Universal Electricity. Call this in your - * mod's pre-initialization stage. + * You must register your mod with Universal + * Electricity. Call this in your mod's + * pre-initialization stage. */ public static void register(Object mod, int major, int minor, int revision, boolean strict) { @@ -83,15 +90,15 @@ public class UniversalElectricity } mods.add(mod); - - FMLLog.fine(mod.getClass().getSimpleName()+" has been registered to Universal Electricity."); - + + FMLLog.fine(mod.getClass().getSimpleName() + " has been registered to Universal Electricity."); + UELoader.INSTANCE.initiate(); } /** - * A function that allows you to lock your mod to a specific version of - * Forge. + * A function that allows you to lock your mod + * to a specific version of Forge. */ public static void forgeLock(int major, int minor, int revision, boolean strict) { diff --git a/src/common/universalelectricity/electricity/ElectricInfo.java b/src/common/universalelectricity/core/electricity/ElectricInfo.java similarity index 95% rename from src/common/universalelectricity/electricity/ElectricInfo.java rename to src/common/universalelectricity/core/electricity/ElectricInfo.java index 6652f3d1..4cf5757f 100644 --- a/src/common/universalelectricity/electricity/ElectricInfo.java +++ b/src/common/universalelectricity/core/electricity/ElectricInfo.java @@ -1,7 +1,8 @@ -package universalelectricity.electricity; +package universalelectricity.core.electricity; /** - * An easy way to display information on electricity. + * An easy way to display information on + * electricity. * * @author Calclavia */ @@ -131,7 +132,8 @@ public class ElectricInfo } /** - * Displays the unit as text. Works only for positive numbers. + * Displays the unit as text. Works only for + * positive numbers. */ public static String getDisplay(double value, ElectricUnit unit, int significantFigures, boolean isShort) { @@ -184,7 +186,8 @@ public class ElectricInfo } /** - * Rounds a number to a specific number place places + * Rounds a number to a specific number place + * places * * @param The * number diff --git a/src/common/universalelectricity/electricity/ElectricityManager.java b/src/common/universalelectricity/core/electricity/ElectricityManager.java similarity index 98% rename from src/common/universalelectricity/electricity/ElectricityManager.java rename to src/common/universalelectricity/core/electricity/ElectricityManager.java index 51335940..bbb264b0 100644 --- a/src/common/universalelectricity/electricity/ElectricityManager.java +++ b/src/common/universalelectricity/core/electricity/ElectricityManager.java @@ -1,4 +1,4 @@ -package universalelectricity.electricity; +package universalelectricity.core.electricity; import java.util.ArrayList; import java.util.EnumSet; @@ -9,9 +9,9 @@ import java.util.Map; import net.minecraft.src.TileEntity; import net.minecraftforge.common.ForgeDirection; -import universalelectricity.core.Vector3; -import universalelectricity.implement.IConductor; -import universalelectricity.implement.IElectricityReceiver; +import universalelectricity.core.implement.IConductor; +import universalelectricity.core.implement.IElectricityReceiver; +import universalelectricity.core.vector.Vector3; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.TickType; diff --git a/src/common/universalelectricity/electricity/ElectricityManagerTicker.java b/src/common/universalelectricity/core/electricity/ElectricityManagerTicker.java similarity index 94% rename from src/common/universalelectricity/electricity/ElectricityManagerTicker.java rename to src/common/universalelectricity/core/electricity/ElectricityManagerTicker.java index 91af3872..95f9d40d 100644 --- a/src/common/universalelectricity/electricity/ElectricityManagerTicker.java +++ b/src/common/universalelectricity/core/electricity/ElectricityManagerTicker.java @@ -1,4 +1,4 @@ -package universalelectricity.electricity; +package universalelectricity.core.electricity; import java.util.EnumSet; @@ -28,7 +28,7 @@ public class ElectricityManagerTicker implements ITickHandler @Override public void tickEnd(EnumSet type, Object... tickData) { - + } @Override diff --git a/src/common/universalelectricity/electricity/ElectricityNetwork.java b/src/common/universalelectricity/core/electricity/ElectricityNetwork.java similarity index 87% rename from src/common/universalelectricity/electricity/ElectricityNetwork.java rename to src/common/universalelectricity/core/electricity/ElectricityNetwork.java index 77106962..2d561cea 100644 --- a/src/common/universalelectricity/electricity/ElectricityNetwork.java +++ b/src/common/universalelectricity/core/electricity/ElectricityNetwork.java @@ -1,12 +1,12 @@ -package universalelectricity.electricity; +package universalelectricity.core.electricity; import java.util.ArrayList; import java.util.List; import net.minecraft.src.TileEntity; import net.minecraftforge.common.ForgeDirection; -import universalelectricity.implement.IConductor; -import universalelectricity.implement.IElectricityReceiver; +import universalelectricity.core.implement.IConductor; +import universalelectricity.core.implement.IElectricityReceiver; public class ElectricityNetwork { @@ -29,8 +29,8 @@ public class ElectricityNetwork } /** - * Get only the electric units that can receive electricity from the given - * side. + * Get only the electric units that can + * receive electricity from the given side. */ public List getConnectedReceivers() { @@ -108,9 +108,10 @@ public class ElectricityNetwork return lowestAmp; } - + /** - * This function is called to refresh all conductors in this network + * This function is called to refresh all + * conductors in this network */ public void refreshConductors() { diff --git a/src/common/universalelectricity/electricity/ElectricityTransferData.java b/src/common/universalelectricity/core/electricity/ElectricityTransferData.java similarity index 73% rename from src/common/universalelectricity/electricity/ElectricityTransferData.java rename to src/common/universalelectricity/core/electricity/ElectricityTransferData.java index 52ba7231..7e657ac1 100644 --- a/src/common/universalelectricity/electricity/ElectricityTransferData.java +++ b/src/common/universalelectricity/core/electricity/ElectricityTransferData.java @@ -1,8 +1,8 @@ -package universalelectricity.electricity; +package universalelectricity.core.electricity; import net.minecraft.src.TileEntity; import net.minecraftforge.common.ForgeDirection; -import universalelectricity.implement.IElectricityReceiver; +import universalelectricity.core.implement.IElectricityReceiver; public class ElectricityTransferData { @@ -15,11 +15,14 @@ public class ElectricityTransferData /** * @param sender - * - Tile that's sending electricity. + * - Tile that's sending + * electricity. * @param receiver - * - Receiver that's receiving electricity + * - Receiver that's receiving + * electricity * @param conductor - * - Conductor that is conducting the electricity + * - Conductor that is conducting + * the electricity * @param side * - * @param amps diff --git a/src/common/universalelectricity/implement/IConductor.java b/src/common/universalelectricity/core/implement/IConductor.java similarity index 50% rename from src/common/universalelectricity/implement/IConductor.java rename to src/common/universalelectricity/core/implement/IConductor.java index afb0a526..18a5c344 100644 --- a/src/common/universalelectricity/implement/IConductor.java +++ b/src/common/universalelectricity/core/implement/IConductor.java @@ -1,12 +1,13 @@ -package universalelectricity.implement; +package universalelectricity.core.implement; import net.minecraft.src.TileEntity; import net.minecraft.src.World; import net.minecraftforge.common.ForgeDirection; -import universalelectricity.electricity.ElectricityNetwork; +import universalelectricity.core.electricity.ElectricityNetwork; /** - * Must be applied to all tile entities that are conductors. + * Must be applied to all tile entities that are + * conductors. * * @author Calclavia * @@ -14,54 +15,63 @@ import universalelectricity.electricity.ElectricityNetwork; public interface IConductor extends IConnector { /** - * The electrical network this conductor is on. + * The electrical network this conductor is + * on. */ public ElectricityNetwork getNetwork(); public void setNetwork(ElectricityNetwork network); /** - * The UE tile entities that this conductor is connected to. + * The UE tile entities that this conductor is + * connected to. * * @return */ public TileEntity[] getConnectedBlocks(); /** - * Gets the resistance of the conductor. Used to calculate energy loss. A - * higher resistance means a higher energy loss. + * Gets the resistance of the conductor. Used + * to calculate energy loss. A higher + * resistance means a higher energy loss. * * @return The amount of Ohm's of resistance. */ public double getResistance(); /** - * The maximum amount of amps this conductor can handle before melting down. - * This is calculating PER TICK! + * The maximum amount of amps this conductor + * can handle before melting down. This is + * calculating PER TICK! * * @return The amount of amps in volts */ public double getMaxAmps(); /** - * Called when the electricity passing through exceeds the maximum voltage. + * Called when the electricity passing through + * exceeds the maximum voltage. */ public void onOverCharge(); /** - * Resets the conductor and recalculate connection IDs again + * Resets the conductor and recalculate + * connection IDs again */ public void reset(); public World getWorld(); /** - * Adds a connection between this conductor and a UE unit + * Adds a connection between this conductor + * and a UE unit * * @param tileEntity - * - Must be either a producer, consumer or a conductor + * - Must be either a producer, + * consumer or a conductor * @param side - * - side in which the connection is coming from + * - side in which the connection + * is coming from */ public void updateConnection(TileEntity tileEntity, ForgeDirection side); diff --git a/src/common/universalelectricity/core/implement/IConnector.java b/src/common/universalelectricity/core/implement/IConnector.java new file mode 100644 index 00000000..04482e09 --- /dev/null +++ b/src/common/universalelectricity/core/implement/IConnector.java @@ -0,0 +1,24 @@ +package universalelectricity.core.implement; + +import net.minecraftforge.common.ForgeDirection; + +/** + * Applied to a TileEntity that can connect to UE + * wires. + * + * @author Calclavia + * + */ +public interface IConnector +{ + /** + * Can this TileEntity visually connect to a + * wire on this specific side? + * + * @param side + * - The side in which the + * connection is coming from. + * @return - True if so. + */ + public boolean canConnect(ForgeDirection side); +} diff --git a/src/common/universalelectricity/core/implement/IDisableable.java b/src/common/universalelectricity/core/implement/IDisableable.java new file mode 100644 index 00000000..dcd28964 --- /dev/null +++ b/src/common/universalelectricity/core/implement/IDisableable.java @@ -0,0 +1,31 @@ +package universalelectricity.core.implement; + +/** + * This class should be applied to all tile + * entities (mainly machines) that can be disabled + * (by things like EMP, short circuit etc.). + * + * @author Calclavia + * + */ +public interface IDisableable +{ + /** + * This is called when the tile entity is to + * be disabled. + * + * @param duration + * - The duration of the disable in + * ticks. + */ + public void onDisable(int duration); + + /** + * Called to see if this tile entity is + * disabled. + * + * @return True if the tile entity is + * disabled. + */ + public boolean isDisabled(); +} diff --git a/src/common/universalelectricity/core/implement/IElectricityProducer.java b/src/common/universalelectricity/core/implement/IElectricityProducer.java new file mode 100644 index 00000000..3e55cef3 --- /dev/null +++ b/src/common/universalelectricity/core/implement/IElectricityProducer.java @@ -0,0 +1,14 @@ +package universalelectricity.core.implement; + +/** + * Applied to TileEntities that can produces + * electricity. Of course, you will still need to + * call ElectricityManager.instance.produce() to + * actually output the electricity. + * + * @author Calclavia + */ +public interface IElectricityProducer extends IConnector, IDisableable, IVoltage +{ + +} diff --git a/src/common/universalelectricity/core/implement/IElectricityReceiver.java b/src/common/universalelectricity/core/implement/IElectricityReceiver.java new file mode 100644 index 00000000..e481c278 --- /dev/null +++ b/src/common/universalelectricity/core/implement/IElectricityReceiver.java @@ -0,0 +1,47 @@ +package universalelectricity.core.implement; + +import net.minecraft.src.TileEntity; +import net.minecraftforge.common.ForgeDirection; + +/** + * The IElectricityReceiver interface is an + * interface that must be applied to all tile + * entities that can receive electricity. + * + * @author Calclavia + * + */ +public interface IElectricityReceiver extends IDisableable, IConnector, IVoltage +{ + /** + * Called every tick on this machine. + * + * @param amps + * - Amount of amps this electric + * unit is receiving. + * @param voltage + * - The voltage of the electricity + * sent. If more than one packet is + * being sent to you in this + * update, the highest voltage will + * override. + * @param side + * - The side of the block in which + * the electricity is coming from. + */ + public void onReceive(TileEntity sender, double amps, double voltage, ForgeDirection side); + + /** + * How many watts does this electrical unit + * need this tick? Recommended for you to + * return the max electricity storage of this + * machine (if there is one). + */ + public double wattRequest(); + + /** + * Can this unit receive electricity from this + * specific side? + */ + public boolean canReceiveFromSide(ForgeDirection side); +} \ No newline at end of file diff --git a/src/common/universalelectricity/implement/IItemElectric.java b/src/common/universalelectricity/core/implement/IItemElectric.java similarity index 58% rename from src/common/universalelectricity/implement/IItemElectric.java rename to src/common/universalelectricity/core/implement/IItemElectric.java index 032d8e1d..9eeab06c 100644 --- a/src/common/universalelectricity/implement/IItemElectric.java +++ b/src/common/universalelectricity/core/implement/IItemElectric.java @@ -1,4 +1,4 @@ -package universalelectricity.implement; +package universalelectricity.core.implement; import net.minecraft.src.ItemStack; @@ -10,22 +10,25 @@ public interface IItemElectric extends IJouleStorage, IVoltage public double onReceive(double amps, double voltage, ItemStack itemStack); /** - * Called when something requests electricity from this item. + * Called when something requests electricity + * from this item. * * @return - The amount of given joules */ public double onUse(double joulesNeeded, ItemStack itemStack); /** - * @return Returns true or false if this consumer can receive electricity at + * @return Returns true or false if this + * consumer can receive electricity at * this given tick or moment. */ public boolean canReceiveElectricity(); /** - * Can this item give out electricity when placed in an tile entity? - * Electric items like batteries should be able to produce electricity (if - * they are rechargeable). + * Can this item give out electricity when + * placed in an tile entity? Electric items + * like batteries should be able to produce + * electricity (if they are rechargeable). * * @return - True or False. */ diff --git a/src/common/universalelectricity/core/implement/IJouleStorage.java b/src/common/universalelectricity/core/implement/IJouleStorage.java new file mode 100644 index 00000000..182d6030 --- /dev/null +++ b/src/common/universalelectricity/core/implement/IJouleStorage.java @@ -0,0 +1,28 @@ +package universalelectricity.core.implement; + +/** + * This interface is to be applied to all tile + * entities which stores energy within them. + * + * @author Calclavia + */ +public interface IJouleStorage +{ + /** + * Returns the amount of joules this unit has + * stored. + */ + public double getJoules(Object... data); + + /** + * Sets the amount of joules this unit has + * stored. + */ + public void setJoules(double wattHours, Object... data); + + /** + * Gets the maximum amount of joules this unit + * can store. + */ + public double getMaxJoules(Object... data); +} diff --git a/src/common/universalelectricity/implement/IVoltage.java b/src/common/universalelectricity/core/implement/IVoltage.java similarity index 60% rename from src/common/universalelectricity/implement/IVoltage.java rename to src/common/universalelectricity/core/implement/IVoltage.java index 5d95d0d1..3e90673c 100644 --- a/src/common/universalelectricity/implement/IVoltage.java +++ b/src/common/universalelectricity/core/implement/IVoltage.java @@ -1,15 +1,18 @@ -package universalelectricity.implement; +package universalelectricity.core.implement; /** * Applies to all objects that has a voltage. + * * @author Calclavia - * + * */ public interface IVoltage { /** * Gets the voltage of this object. - * @return The amount of volts. E.g 120v or 240v + * + * @return The amount of volts. E.g 120v or + * 240v */ public double getVoltage(); } diff --git a/src/common/universalelectricity/core/vector/Region2.java b/src/common/universalelectricity/core/vector/Region2.java new file mode 100644 index 00000000..d38d8875 --- /dev/null +++ b/src/common/universalelectricity/core/vector/Region2.java @@ -0,0 +1,36 @@ +package universalelectricity.core.vector; + +public class Region2 +{ + public Vector2 min; + public Vector2 max; + + public Region2() + { + this(new Vector2(), new Vector2()); + } + + public Region2(Vector2 min, Vector2 max) + { + this.min = min; + this.max = max; + } + + /** + * Checks if a point is located inside a + * region + */ + public boolean isIn(Vector2 point) + { + return (point.x > this.min.x && point.x < this.max.x) && (point.y > this.min.y && point.y < this.max.y); + } + + /** + * Returns whether the given region intersects + * with this one. + */ + public boolean isIn(Region2 region) + { + return region.max.x > this.min.x && region.min.x < this.max.x ? (region.max.y > this.min.y && region.min.y < this.max.y ? true : false) : false; + } +} diff --git a/src/common/universalelectricity/core/vector/Region3.java b/src/common/universalelectricity/core/vector/Region3.java new file mode 100644 index 00000000..81515425 --- /dev/null +++ b/src/common/universalelectricity/core/vector/Region3.java @@ -0,0 +1,131 @@ +package universalelectricity.core.vector; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.src.AxisAlignedBB; +import net.minecraft.src.Entity; +import net.minecraft.src.World; + +/** + * A cubical region class. + * + * @author Calclavia + */ +public class Region3 +{ + public Vector3 min; + public Vector3 max; + + public Region3() + { + this(new Vector3(), new Vector3()); + } + + public Region3(Vector3 min, Vector3 max) + { + this.min = min; + this.max = max; + } + + public Region3 get(AxisAlignedBB aabb) + { + return new Region3(new Vector3(aabb.minX, aabb.minY, aabb.minZ), new Vector3(aabb.maxX, aabb.maxY, aabb.maxZ)); + } + + public AxisAlignedBB toAABB() + { + return AxisAlignedBB.getBoundingBox(this.min.x, this.min.y, this.min.z, this.max.x, this.max.y, this.max.z); + } + + public Region2 toRegion2() + { + return new Region2(this.min.toVector2(), this.max.toVector2()); + } + + /** + * Checks if a point is located inside a + * region + */ + public boolean isIn(Vector3 point) + { + return (point.x > this.min.x && point.x < this.max.x) && (point.y > this.min.y && point.y < this.max.y) && (point.z > this.min.z && point.z < this.max.z); + } + + /** + * Returns whether the given region intersects + * with this one. + */ + public boolean isIn(Region3 region) + { + return region.max.x > this.min.x && region.min.x < this.max.x ? (region.max.y > this.min.y && region.min.y < this.max.y ? region.max.z > this.min.z && region.min.z < this.max.z : false) : false; + } + + public void expand(Vector3 difference) + { + this.min.subtract(difference); + this.max.add(difference); + } + + /** + * @return List of vectors within this region. + */ + public List getVectors() + { + List vectors = new ArrayList(); + + for (int x = this.min.intX(); x < this.max.intX(); x++) + { + for (int y = this.min.intY(); x < this.max.intY(); y++) + { + for (int z = this.min.intZ(); x < this.max.intZ(); z++) + { + vectors.add(new Vector3(x, y, z)); + } + } + } + + return vectors; + } + + public List getVectors(Vector3 center, int radius) + { + List vectors = new ArrayList(); + + for (int x = this.min.intX(); x < this.max.intX(); x++) + { + for (int y = this.min.intY(); x < this.max.intY(); y++) + { + for (int z = this.min.intZ(); x < this.max.intZ(); z++) + { + Vector3 vector3 = new Vector3(x, y, z); + + if (center.distanceTo(vector3) <= radius) + { + vectors.add(vector3); + } + } + } + } + + return vectors; + } + + /** + * Returns all entities in this region. + */ + public List getEntities(World world, Class entityClass) + { + return world.getEntitiesWithinAABB(entityClass, this.toAABB()); + } + + public List getEntitiesExlude(World world, Entity entity) + { + return world.getEntitiesWithinAABBExcludingEntity(entity, this.toAABB()); + } + + public List getEntities(World world) + { + return this.getEntities(world, Entity.class); + } +} diff --git a/src/common/universalelectricity/core/Vector2.java b/src/common/universalelectricity/core/vector/Vector2.java similarity index 67% rename from src/common/universalelectricity/core/Vector2.java rename to src/common/universalelectricity/core/vector/Vector2.java index b7f3373e..cc0b76e9 100644 --- a/src/common/universalelectricity/core/Vector2.java +++ b/src/common/universalelectricity/core/vector/Vector2.java @@ -1,12 +1,13 @@ -package universalelectricity.core; +package universalelectricity.core.vector; import net.minecraft.src.MathHelper; /** - * Vector2 Class is used for defining objects in a 2D space. Vector2 makes it - * easier to handle the coordinates of objects. Instead of fumbling with x and y - * variables, all x and y variables are stored in one class. Vector3.x, - * Vector3.y. + * Vector2 Class is used for defining objects in a + * 2D space. Vector2 makes it easier to handle the + * coordinates of objects. Instead of fumbling + * with x and y variables, all x and y variables + * are stored in one class. Vector3.x, Vector3.y. * * @author Calclavia */ @@ -45,7 +46,8 @@ public class Vector2 implements Cloneable } /** - * Makes a new copy of this Vector. Prevents variable referencing problems. + * Makes a new copy of this Vector. Prevents + * variable referencing problems. */ @Override public Vector2 clone() @@ -53,11 +55,6 @@ public class Vector2 implements Cloneable return new Vector2(this.x, this.y); } - public static boolean isPointInRegion(Vector2 point, Vector2 minPoint, Vector2 maxPoint) - { - return (point.x > minPoint.x && point.x < maxPoint.x) && (point.y > minPoint.y && point.y < maxPoint.y); - } - public static double distance(Vector2 par1, Vector2 par2) { double var2 = par1.x - par2.x; @@ -83,6 +80,18 @@ public class Vector2 implements Cloneable this.x += par1; this.y += par1; } + + public void substract(Vector2 par1) + { + this.x -= par1.x; + this.y -= par1.y; + } + + public void substract(double par1) + { + this.x -= par1; + this.y -= par1; + } public Vector2 round() { @@ -94,13 +103,9 @@ public class Vector2 implements Cloneable return new Vector2(Math.floor(this.x), Math.floor(this.y)); } - public String output() + @Override + public String toString() { return "Vector2: " + this.x + "," + this.y; } - - public void printVector() - { - System.out.println(output()); - } } \ No newline at end of file diff --git a/src/common/universalelectricity/core/Vector3.java b/src/common/universalelectricity/core/vector/Vector3.java similarity index 80% rename from src/common/universalelectricity/core/Vector3.java rename to src/common/universalelectricity/core/vector/Vector3.java index ee50f979..2b25fea9 100644 --- a/src/common/universalelectricity/core/Vector3.java +++ b/src/common/universalelectricity/core/vector/Vector3.java @@ -1,7 +1,8 @@ -package universalelectricity.core; +package universalelectricity.core.vector; import net.minecraft.src.ChunkCoordinates; import net.minecraft.src.Entity; +import net.minecraft.src.IBlockAccess; import net.minecraft.src.MathHelper; import net.minecraft.src.MovingObjectPosition; import net.minecraft.src.NBTTagCompound; @@ -9,12 +10,14 @@ import net.minecraft.src.TileEntity; import net.minecraft.src.Vec3; import net.minecraft.src.World; import net.minecraftforge.common.ForgeDirection; -import universalelectricity.implement.IConnector; +import universalelectricity.core.implement.IConnector; /** - * Vector3 Class is used for defining objects in a 3D space. Vector3 makes it - * easier to handle the coordinates of objects. Instead of fumbling with x, y - * and z variables, all x, y and z variables are stored in one class. Vector3.x, + * Vector3 Class is used for defining objects in a + * 3D space. Vector3 makes it easier to handle the + * coordinates of objects. Instead of fumbling + * with x, y and z variables, all x, y and z + * variables are stored in one class. Vector3.x, * Vector3.y, Vector3.z. * * @author Calclavia @@ -62,7 +65,8 @@ public class Vector3 extends Vector2 implements Cloneable } /** - * Makes a new copy of this Vector. Prevents variable referencing problems. + * Makes a new copy of this Vector. Prevents + * variable referencing problems. */ @Override public Vector3 clone() @@ -71,56 +75,45 @@ public class Vector3 extends Vector2 implements Cloneable } /** - * Converts a TileEntity's position into Vector3 + * Vector3 Shortcut Functions */ + public static Vector3 get(Entity par1) { return new Vector3(par1.posX, par1.posY, par1.posZ); } - /** - * Converts an entity's position into Vector3 - */ public static Vector3 get(TileEntity par1) { return new Vector3(par1.xCoord, par1.yCoord, par1.zCoord); } - /** - * Converts from Vec3 into a Vector3 - */ public static Vector3 get(Vec3 par1) { return new Vector3(par1.xCoord, par1.yCoord, par1.zCoord); } - /** - * Converts a MovingObjectPosition to Vector3 - */ public static Vector3 get(MovingObjectPosition par1) { return new Vector3(par1.blockX, par1.blockY, par1.blockZ); } - /** - * Converts a MovingObjectPosition to Vector3 - */ public static Vector3 get(ChunkCoordinates par1) { return new Vector3(par1.posX, par1.posY, par1.posZ); } - public int getBlockID(World world) + public int getBlockID(IBlockAccess world) { return world.getBlockId(this.intX(), this.intY(), this.intZ()); } - public int getBlockMetadata(World world) + public int getBlockMetadata(IBlockAccess world) { return world.getBlockMetadata(this.intX(), this.intY(), this.intZ()); } - public TileEntity getTileEntity(World world) + public TileEntity getTileEntity(IBlockAccess world) { return world.getBlockTileEntity(this.intX(), this.intY(), this.intZ()); } @@ -146,7 +139,8 @@ public class Vector3 extends Vector2 implements Cloneable } /** - * Converts this Vector3 into a Vector2 by dropping the Y axis. + * Converts this Vector3 into a Vector2 by + * dropping the Y axis. */ public Vector2 toVector2() { @@ -154,7 +148,8 @@ public class Vector3 extends Vector2 implements Cloneable } /** - * Converts this vector three into a Minecraft Vec3 object + * Converts this vector three into a Minecraft + * Vec3 object */ public Vec3 toVec3() { @@ -162,15 +157,8 @@ public class Vector3 extends Vector2 implements Cloneable } /** - * Checks if a Vector3 point is located inside a region - */ - public static boolean isPointInRegion(Vector3 point, Vector3 minPoint, Vector3 maxPoint) - { - return (point.x > minPoint.x && point.x < maxPoint.x) && (point.y > minPoint.y && point.y < maxPoint.y) && (point.z > minPoint.z && point.z < maxPoint.z); - } - - /** - * Compares two vectors and see if they are equal. True if so. + * Compares two vectors and see if they are + * equal. True if so. */ public boolean isEqual(Vector3 vector3) { @@ -228,6 +216,13 @@ public class Vector3 extends Vector2 implements Cloneable this.z += par1; } + public void subtract(Vector3 amount) + { + this.x -= amount.x; + this.y -= amount.y; + this.z -= amount.z; + } + public static Vector3 multiply(Vector3 par1, Vector3 par2) { return new Vector3(par1.x * par2.x, par1.y * par2.y, par1.z * par2.z); @@ -251,9 +246,11 @@ public class Vector3 extends Vector2 implements Cloneable * Saves this Vector3 to disk * * @param prefix - * - The prefix of this save. Use some unique string. + * - The prefix of this save. Use + * some unique string. * @param par1NBTTagCompound - * - The NBT compound object to save the data in + * - The NBT compound object to + * save the data in */ public void writeToNBT(String prefix, NBTTagCompound par1NBTTagCompound) { @@ -273,21 +270,18 @@ public class Vector3 extends Vector2 implements Cloneable { return new Vector3(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z)); } - - @Override - public String output() - { - return "Vector3: " + this.x + "," + this.y + "," + this.z; - } + /** - * Gets a position relative to another position's side + * Gets a position relative to another + * position's side * * @param position * - The position * @param side * - The side. 0-5 - * @return The position relative to the original position's side + * @return The position relative to the + * original position's side */ public void modifyPositionFromSide(ForgeDirection side) { @@ -321,7 +315,8 @@ public class Vector3 extends Vector2 implements Cloneable } /** - * Gets a connector unit based on the given side. + * Gets a connector unit based on the given + * side. */ public static TileEntity getConnectorFromSide(World world, Vector3 position, ForgeDirection side) { @@ -336,18 +331,25 @@ public class Vector3 extends Vector2 implements Cloneable } /** - * Finds the side of a block depending on it's facing direction from the - * given side. The side numbers are compatible with the - * function"getBlockTextureFromSideAndMetadata". + * Finds the side of a block depending on it's + * facing direction from the given side. The + * side numbers are compatible with the + * function + * "getBlockTextureFromSideAndMetadata". * - * Bottom: 0; Top: 1; Back: 2; Front: 3; Left: 4; Right: 5; + * Bottom: 0; Top: 1; Back: 2; Front: 3; Left: + * 4; Right: 5; * * @param front - * - The direction in which this block is facing/front. Use a - * number between 0 and 5. Default is 3. + * - The direction in which this + * block is facing/front. Use a + * number between 0 and 5. Default + * is 3. * @param side - * - The side you are trying to find. A number between 0 and 5. - * @return The side relative to the facing direction. + * - The side you are trying to + * find. A number between 0 and 5. + * @return The side relative to the facing + * direction. */ public static ForgeDirection getOrientationFromSide(ForgeDirection front, ForgeDirection side) @@ -445,4 +447,10 @@ public class Vector3 extends Vector2 implements Cloneable return ForgeDirection.UNKNOWN; } + + @Override + public String toString() + { + return "Vector3: " + this.x + "," + this.y + "," + this.z; + } } \ No newline at end of file diff --git a/src/common/universalelectricity/implement/IConnector.java b/src/common/universalelectricity/implement/IConnector.java deleted file mode 100644 index 8979569b..00000000 --- a/src/common/universalelectricity/implement/IConnector.java +++ /dev/null @@ -1,21 +0,0 @@ -package universalelectricity.implement; - -import net.minecraftforge.common.ForgeDirection; - -/** - * Applied to TileEntities that can connect to UE wires. - * - * @author Calclavia - * - */ -public interface IConnector -{ - /** - * Can this tile entity visually connect to a wire on this specific side? - * - * @param side - * - The side in which the connection is coming from. - * @return - True if so. - */ - public boolean canConnect(ForgeDirection side); -} diff --git a/src/common/universalelectricity/implement/IDisableable.java b/src/common/universalelectricity/implement/IDisableable.java deleted file mode 100644 index 535782a0..00000000 --- a/src/common/universalelectricity/implement/IDisableable.java +++ /dev/null @@ -1,26 +0,0 @@ -package universalelectricity.implement; - -/** - * This class should be applied to all tile entities (mainly machines) that can - * be disabled (by things like EMP, short circuit etc.). - * - * @author Calclavia - * - */ -public interface IDisableable -{ - /** - * This is called when the tile entity is to be disabled. - * - * @param duration - * - The duration of the disable in ticks. - */ - public void onDisable(int duration); - - /** - * Called to see if this tile entity is disabled. - * - * @return True if the tile entity is disabled. - */ - public boolean isDisabled(); -} diff --git a/src/common/universalelectricity/implement/IElectricityProducer.java b/src/common/universalelectricity/implement/IElectricityProducer.java deleted file mode 100644 index 80cbb5bc..00000000 --- a/src/common/universalelectricity/implement/IElectricityProducer.java +++ /dev/null @@ -1,20 +0,0 @@ -package universalelectricity.implement; - -import net.minecraftforge.common.ForgeDirection; - -/** - * Applied to tile entities that can produce electricity - * - * @author Calclavia - */ -public interface IElectricityProducer extends IConnector, IDisableable, IVoltage -{ - /** - * Can this machine visually connect to a wire on this specific side? - * - * @param side - * . 0-5 byte - * @return - True if so. - */ - public boolean canConnect(ForgeDirection side); -} diff --git a/src/common/universalelectricity/implement/IElectricityReceiver.java b/src/common/universalelectricity/implement/IElectricityReceiver.java deleted file mode 100644 index 531d30a4..00000000 --- a/src/common/universalelectricity/implement/IElectricityReceiver.java +++ /dev/null @@ -1,41 +0,0 @@ -package universalelectricity.implement; - -import net.minecraft.src.TileEntity; -import net.minecraftforge.common.ForgeDirection; - -/** - * The IElectricityReceiver interface is an interface that must be applied to - * all tile entities that can input or output electricity. - * - * @author Calclavia - * - */ -public interface IElectricityReceiver extends IDisableable, IConnector, IVoltage -{ - /** - * Called every tick on this machine. - * - * @param amps - * - Amount of amps this electric unit is receiving. - * @param voltage - * - The voltage of the electricity sent. If more than one packet - * is being sent to you in this update, the highest voltage will - * override. - * @param side - * - The side of the block in which the electricity is coming - * from. - */ - public void onReceive(TileEntity sender, double amps, double voltage, ForgeDirection side); - - /** - * How many watts does this electrical unit need this tick? Recommended for - * you to return the max electricity storage of this machine (if there is - * one). - */ - public double wattRequest(); - - /** - * Can this unit receive electricity from this specific side? - */ - public boolean canReceiveFromSide(ForgeDirection side); -} \ No newline at end of file diff --git a/src/common/universalelectricity/implement/IJouleStorage.java b/src/common/universalelectricity/implement/IJouleStorage.java deleted file mode 100644 index 244f7756..00000000 --- a/src/common/universalelectricity/implement/IJouleStorage.java +++ /dev/null @@ -1,25 +0,0 @@ -package universalelectricity.implement; - -/** - * This interface is to be applied to all tile entities which stores energy - * within them. - * - * @author Calclavia - */ -public interface IJouleStorage -{ - /** - * Returns the amount of joules this unit has stored. - */ - public double getJoules(Object... data); - - /** - * Sets the amount of joules this unit has stored. - */ - public void setJoules(double wattHours, Object... data); - - /** - * Gets the maximum amount of joules this unit can store. - */ - public double getMaxJoules(); -} diff --git a/src/common/universalelectricity/implement/IRedstoneProvider.java b/src/common/universalelectricity/implement/IRedstoneProvider.java deleted file mode 100644 index 1e87ff12..00000000 --- a/src/common/universalelectricity/implement/IRedstoneProvider.java +++ /dev/null @@ -1,14 +0,0 @@ -package universalelectricity.implement; - -/** - * This should be applied on tile entities that can provide redstone power - * - * @author Henry - * - */ -public interface IRedstoneProvider -{ - public boolean isPoweringTo(byte side); - - public boolean isIndirectlyPoweringTo(byte side); -} diff --git a/src/common/universalelectricity/implement/IRedstoneReceptor.java b/src/common/universalelectricity/implement/IRedstoneReceptor.java deleted file mode 100644 index 41a0cee9..00000000 --- a/src/common/universalelectricity/implement/IRedstoneReceptor.java +++ /dev/null @@ -1,21 +0,0 @@ -package universalelectricity.implement; - -/** - * OPTIONAL This interface should be applied onto all tile entities that needs - * to receive redstone power. Look at TileEntityBatteryBox for reference. - * - * @author Calclavia - * - */ -public interface IRedstoneReceptor -{ - /** - * Called when the block is powered on by redstone - */ - public void onPowerOn(); - - /** - * Called when the block is powered off by redstone - */ - public void onPowerOff(); -} diff --git a/src/common/universalelectricity/implement/IRotatable.java b/src/common/universalelectricity/implement/IRotatable.java deleted file mode 100644 index 04b4268b..00000000 --- a/src/common/universalelectricity/implement/IRotatable.java +++ /dev/null @@ -1,33 +0,0 @@ -package universalelectricity.implement; - -import net.minecraftforge.common.ForgeDirection; - -/** - * This interface should be applied onto all tile entities that are - * rotatable. This interface however is optional and you do not need it for your - * add-on to function. It just makes things easier for you to code. - * - * @author Calclavia - * - */ - -public interface IRotatable -{ - /** - * Gets the facing direction of the tile entity. Always returns the front - * side of the tile entity. - * - * @return The facing side from 0-5 The full list of which side the number - * represents is in the UniversalElectricity class. - */ - public ForgeDirection getDirection(); - - /** - * Sets the facing direction of the tile entity. - * - * @param facingDirection - * - A direction from 0-5. The full list of which side the number - * represents is in the UniversalElectricity class. - */ - public void setDirection(ForgeDirection facingDirection); -} diff --git a/src/common/universalelectricity/implement/UEDamageSource.java b/src/common/universalelectricity/implement/UEDamageSource.java deleted file mode 100644 index 35cf8314..00000000 --- a/src/common/universalelectricity/implement/UEDamageSource.java +++ /dev/null @@ -1,57 +0,0 @@ -package universalelectricity.implement; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.src.DamageSource; -import cpw.mods.fml.common.registry.LanguageRegistry; - -public class UEDamageSource extends DamageSource -{ - public static final List damageSources = new ArrayList(); - - /** - * Use this damage source for all types of electrical attacks. - */ - public static final UEDamageSource electrocution = (UEDamageSource) new UEDamageSource("electrocution", "%1$s got electrocuted!").setDamageBypassesArmor(); - - public String deathMessage; - - public UEDamageSource(String damageType) - { - super(damageType); - damageSources.add(this); - } - - public UEDamageSource(String damageType, String deathMessage) - { - this(damageType); - this.setDeathMessage(deathMessage); - } - - public UEDamageSource setDeathMessage(String deathMessage) - { - this.deathMessage = deathMessage; - return this; - } - - public DamageSource setDamageBypassesArmor() - { - return super.setDamageBypassesArmor(); - } - - public DamageSource setDamageAllowedInCreativeMode() - { - return super.setDamageAllowedInCreativeMode(); - } - - public DamageSource setFireDamage() - { - return super.setFireDamage(); - } - - public void registerDeathMessage() - { - LanguageRegistry.instance().addStringLocalization("death." + this.damageType, this.deathMessage); - } -} diff --git a/src/common/universalelectricity/prefab/BlockConductor.java b/src/common/universalelectricity/prefab/BlockConductor.java deleted file mode 100644 index 3852281d..00000000 --- a/src/common/universalelectricity/prefab/BlockConductor.java +++ /dev/null @@ -1,55 +0,0 @@ -package universalelectricity.prefab; - -import net.minecraft.src.BlockContainer; -import net.minecraft.src.Material; -import net.minecraft.src.TileEntity; -import net.minecraft.src.World; -import universalelectricity.implement.IConductor; - -public abstract class BlockConductor extends BlockContainer -{ - public BlockConductor(int id, Material material) - { - super(id, material); - } - - /** - * Called whenever the block is added into the world. Args: world, x, y, z - */ - @Override - public void onBlockAdded(World world, int x, int y, int z) - { - super.onBlockAdded(world, x, y, z); - - TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - - if(tileEntity != null) - { - if(tileEntity instanceof IConductor) - { - ((IConductor)tileEntity).refreshConnectedBlocks(); - } - } - } - - /** - * Lets the block know when one of its neighbor changes. Doesn't know which - * neighbor changed (coordinates passed are their own) Args: x, y, z, - * neighbor blockID - */ - @Override - public void onNeighborBlockChange(World world, int x, int y, int z, int blockID) - { - TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - - if(tileEntity != null) - { - if(tileEntity instanceof IConductor) - { - ((IConductor)tileEntity).refreshConnectedBlocks(); - } - } - - world.markBlockNeedsUpdate(x, y, z); - } -} diff --git a/src/common/universalelectricity/prefab/BlockMachine.java b/src/common/universalelectricity/prefab/BlockMachine.java index 75e393ee..ce276eb5 100644 --- a/src/common/universalelectricity/prefab/BlockMachine.java +++ b/src/common/universalelectricity/prefab/BlockMachine.java @@ -12,13 +12,15 @@ import net.minecraft.src.Material; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.TileEntity; import net.minecraft.src.World; -import universalelectricity.implement.IItemElectric; +import universalelectricity.core.implement.IItemElectric; import buildcraft.api.tools.IToolWrench; /** - * A block you may extend from to create your machine blocks! You do not have to - * extend from this block if you do not want to. It's optional but it comes with - * some useful functions that will make coding easier for you. + * A block you may extend from to create your + * machine blocks! You do not have to extend from + * this block if you do not want to. It's optional + * but it comes with some useful functions that + * will make coding easier for you. */ public abstract class BlockMachine extends BlockContainer { @@ -42,7 +44,8 @@ public abstract class BlockMachine extends BlockContainer } /** - * Returns the quantity of items to drop on block destruction. + * Returns the quantity of items to drop on + * block destruction. */ @Override public int quantityDropped(Random par1Random) @@ -51,7 +54,8 @@ public abstract class BlockMachine extends BlockContainer } /** - * Returns the ID of the items to drop on destruction. + * Returns the ID of the items to drop on + * destruction. */ @Override public int idDropped(int par1, Random par2Random, int par3) @@ -60,10 +64,13 @@ public abstract class BlockMachine extends BlockContainer } /** - * DO NOT OVERRIDE THIS FUNCTION! Called when the block is right clicked by - * the player. This modified version detects electric items and wrench - * actions on your machine block. Do not override this function. Use - * machineActivated instead! (It does the same thing) + * DO NOT OVERRIDE THIS FUNCTION! Called when + * the block is right clicked by the player. + * This modified version detects electric + * items and wrench actions on your machine + * block. Do not override this function. Use + * machineActivated instead! (It does the same + * thing) */ @Override public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) @@ -71,8 +78,9 @@ public abstract class BlockMachine extends BlockContainer int metadata = par1World.getBlockMetadata(x, y, z); /** - * Check if the player is holding a wrench or an electric item. If so, - * do not open the GUI. + * Check if the player is holding a wrench + * or an electric item. If so, do not open + * the GUI. */ if (par5EntityPlayer.inventory.getCurrentItem() != null) { @@ -107,7 +115,8 @@ public abstract class BlockMachine extends BlockContainer } /** - * Called when the machine is right clicked by the player + * Called when the machine is right clicked by + * the player * * @return True if something happens */ @@ -117,8 +126,8 @@ public abstract class BlockMachine extends BlockContainer } /** - * Called when the machine is right clicked by the player while sneaking - * (shift clicking) + * Called when the machine is right clicked by + * the player while sneaking (shift clicking) * * @return True if something happens */ @@ -128,7 +137,8 @@ public abstract class BlockMachine extends BlockContainer } /** - * Called when a player uses an electric item on the machine + * Called when a player uses an electric item + * on the machine * * @return True if some happens */ @@ -138,7 +148,8 @@ public abstract class BlockMachine extends BlockContainer } /** - * Called when a player uses a wrench on the machine + * Called when a player uses a wrench on the + * machine * * @return True if some happens */ @@ -148,7 +159,8 @@ public abstract class BlockMachine extends BlockContainer } /** - * Called when a player uses a wrench on the machine while sneaking + * Called when a player uses a wrench on the + * machine while sneaking * * @return True if some happens */ @@ -158,8 +170,10 @@ public abstract class BlockMachine extends BlockContainer } /** - * Returns the TileEntity used by this block. You should use the metadata - * sensitive version of this to get the maximum optimization! + * Returns the TileEntity used by this block. + * You should use the metadata sensitive + * version of this to get the maximum + * optimization! */ @Override public TileEntity createNewTileEntity(World var1) @@ -168,8 +182,9 @@ public abstract class BlockMachine extends BlockContainer } /** - * Override this if you don't need it. This will eject all items out of this - * machine if it has an inventory + * Override this if you don't need it. This + * will eject all items out of this machine if + * it has an inventory */ @Override public void breakBlock(World par1World, int x, int y, int z, int par5, int par6) diff --git a/src/common/universalelectricity/prefab/ItemElectric.java b/src/common/universalelectricity/prefab/ItemElectric.java deleted file mode 100644 index 45c79054..00000000 --- a/src/common/universalelectricity/prefab/ItemElectric.java +++ /dev/null @@ -1,207 +0,0 @@ -package universalelectricity.prefab; - -import java.util.List; - -import net.minecraft.src.CreativeTabs; -import net.minecraft.src.Entity; -import net.minecraft.src.EntityPlayer; -import net.minecraft.src.Item; -import net.minecraft.src.ItemStack; -import net.minecraft.src.NBTTagCompound; -import net.minecraft.src.NBTTagFloat; -import net.minecraft.src.World; -import universalelectricity.electricity.ElectricInfo; -import universalelectricity.electricity.ElectricInfo.ElectricUnit; -import universalelectricity.implement.IItemElectric; - -/** - * Extend from this class if your item requires electricity or to be charged. - * Optionally, you can implement IItemElectric instead. - * - * @author Calclavia - * - */ -public abstract class ItemElectric extends Item implements IItemElectric -{ - public ItemElectric(int id, CreativeTabs tabs) - { - super(id); - this.setMaxStackSize(1); - this.setMaxDamage((int) this.getMaxJoules()); - this.setNoRepair(); - this.setCreativeTab(tabs); - } - - public ItemElectric(int id) - { - this(id, CreativeTabs.tabTools); - } - - /** - * Allows items to add custom lines of information to the mouseover - * description. If you want to add more information to your item, you can - * super.addInformation() to keep the electiricty info in the item info bar. - */ - @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - String color = ""; - double joules = this.getJoules(par1ItemStack); - - if (joules <= this.getMaxJoules() / 3) - { - color = "\u00a74"; - } - else if (joules > this.getMaxJoules() * 2 / 3) - { - color = "\u00a72"; - } - else - { - color = "\u00a76"; - } - - par3List.add(color + ElectricInfo.getDisplay(joules, ElectricUnit.JOULES) + " - " + Math.round((joules / this.getMaxJoules()) * 100) + "%"); - } - - /** - * Make sure you super this method! - */ - @Override - public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) - { - // Makes sure the damage is set correctly for this electric item! - ItemElectric item = ((ItemElectric) par1ItemStack.getItem()); - item.setJoules(item.getJoules(par1ItemStack), par1ItemStack); - } - - /** - * Makes sure the item is uncharged when it is crafted and not charged. - * Change this if you do not want this to happen! - */ - @Override - public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - par1ItemStack = this.getUncharged(); - } - - @Override - public double onReceive(double amps, double voltage, ItemStack itemStack) - { - double rejectedElectricity = Math.max((this.getJoules(itemStack) + ElectricInfo.getJoules(amps, voltage, 1)) - this.getMaxJoules(), 0); - this.setJoules(this.getJoules(itemStack) + ElectricInfo.getJoules(amps, voltage, 1) - rejectedElectricity, itemStack); - return rejectedElectricity; - } - - @Override - public double onUse(double joulesNeeded, ItemStack itemStack) - { - double electricityToUse = Math.min(this.getJoules(itemStack), joulesNeeded); - this.setJoules(this.getJoules(itemStack) - electricityToUse, itemStack); - return electricityToUse; - } - - public boolean canReceiveElectricity() - { - return true; - } - - public boolean canProduceElectricity() - { - return false; - } - - /** - * This function sets the electriicty. Do not directly call this function. - * Try to use onReceiveElectricity or onUseElectricity instead. - * - * @param wattHours - * - The amount of electricity in joules - */ - @Override - public void setJoules(double wattHours, Object... data) - { - if (data[0] instanceof ItemStack) - { - ItemStack itemStack = (ItemStack) data[0]; - - // Saves the frequency in the itemstack - if (itemStack.stackTagCompound == null) - { - itemStack.setTagCompound(new NBTTagCompound()); - } - - double electricityStored = Math.max(Math.min(wattHours, this.getMaxJoules()), 0); - itemStack.stackTagCompound.setDouble("electricity", electricityStored); - itemStack.setItemDamage((int) (getMaxJoules() - electricityStored)); - } - } - - /** - * This function is called to get the electricity stored in this item - * - * @return - The amount of electricity stored in watts - */ - @Override - public double getJoules(Object... data) - { - if (data[0] instanceof ItemStack) - { - ItemStack itemStack = (ItemStack) data[0]; - - if (itemStack.stackTagCompound == null) { return 0; } - double electricityStored = 0; - if (itemStack.stackTagCompound.getTag("electricity") instanceof NBTTagFloat) - { - electricityStored = itemStack.stackTagCompound.getFloat("electricity"); - } - else - { - electricityStored = itemStack.stackTagCompound.getDouble("electricity"); - } - itemStack.setItemDamage((int) (getMaxJoules() - electricityStored)); - return electricityStored; - } - - return -1; - } - - /** - * Returns an uncharged version of the electric item. Use this if you want - * the crafting recipe to use a charged version of the electric item instead - * of an empty version of the electric item - * - * @return The ItemStack of a fully charged electric item - */ - public ItemStack getUncharged() - { - ItemStack chargedItem = new ItemStack(this); - chargedItem.setItemDamage((int) this.getMaxJoules()); - return chargedItem; - } - - public static ItemStack getUncharged(ItemStack itemStack) - { - if(itemStack.getItem() instanceof IItemElectric) - { - ItemStack chargedItem = itemStack.copy(); - chargedItem.setItemDamage((int)((IItemElectric)itemStack.getItem()).getMaxJoules()); - return chargedItem; - } - - return null; - } - - @Override - public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) - { - // Add an uncharged version of the electric item - ItemStack unchargedItem = new ItemStack(this, 1); - unchargedItem.setItemDamage((int) this.getMaxJoules()); - par3List.add(unchargedItem); - // Add an electric item to the creative list that is fully charged - ItemStack chargedItem = new ItemStack(this, 1); - this.setJoules(((IItemElectric) chargedItem.getItem()).getMaxJoules(), chargedItem); - par3List.add(chargedItem); - } -} diff --git a/src/common/universalelectricity/prefab/RecipeHelper.java b/src/common/universalelectricity/prefab/RecipeHelper.java deleted file mode 100644 index 62a13cc1..00000000 --- a/src/common/universalelectricity/prefab/RecipeHelper.java +++ /dev/null @@ -1,96 +0,0 @@ -package universalelectricity.prefab; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.src.CraftingManager; -import net.minecraft.src.IRecipe; -import net.minecraft.src.ItemStack; -import net.minecraftforge.common.Configuration; -import universalelectricity.core.UEConfig; -import cpw.mods.fml.common.registry.GameRegistry; - -/** - * This class is used to replace recipes that are already added in the existing - * recipe pool for crafting and smelting. All recipe functions take account of - * the Forge Ore Dictionary. It also includes some recipe helper functions to - * shorten some of your function calls. - * - * @author Calclavia - * - */ -public class RecipeHelper -{ - public static List getRecipesByOutput(ItemStack output) - { - List list = new ArrayList(); - - for (Object obj : CraftingManager.getInstance().getRecipeList()) - { - if (obj instanceof IRecipe) - { - if (((IRecipe) obj).getRecipeOutput() == output) - { - list.add((IRecipe)obj); - } - } - } - - return list; - } - - public static boolean replaceRecipe(IRecipe recipe, IRecipe newRecipe) - { - for (Object obj : CraftingManager.getInstance().getRecipeList()) - { - if (obj instanceof IRecipe) - { - if (((IRecipe) obj).equals(recipe) || obj == recipe) - { - CraftingManager.getInstance().getRecipeList().remove(obj); - CraftingManager.getInstance().getRecipeList().add(newRecipe); - return true; - } - } - } - - return false; - } - - public static boolean removeRecipe(IRecipe recipe) - { - for (Object obj : CraftingManager.getInstance().getRecipeList()) - { - if (obj instanceof IRecipe) - { - if (((IRecipe) obj).equals(recipe) || obj == recipe) - { - CraftingManager.getInstance().getRecipeList().remove(obj); - return true; - } - } - } - - return false; - } - - /** - * Use this function if you want to check if the recipe is allowed in the - * configuration file. - */ - public static void addRecipe(IRecipe recipe, String name, Configuration config, boolean defaultBoolean) - { - if (config != null) - { - if (UEConfig.getConfigData(config, "Allow " + name + " Crafting", defaultBoolean)) - { - GameRegistry.addRecipe(recipe); - } - } - } - - public static void addRecipe(IRecipe recipe, Configuration config, boolean defaultBoolean) - { - addRecipe(recipe, recipe.getRecipeOutput().getItemName(), config, defaultBoolean); - } -} diff --git a/src/common/universalelectricity/prefab/SlotElectricItem.java b/src/common/universalelectricity/prefab/SlotElectricItem.java deleted file mode 100644 index 3d8b7569..00000000 --- a/src/common/universalelectricity/prefab/SlotElectricItem.java +++ /dev/null @@ -1,31 +0,0 @@ -package universalelectricity.prefab; - -import net.minecraft.src.IInventory; -import net.minecraft.src.ItemStack; -import net.minecraft.src.Slot; -import universalelectricity.implement.IItemElectric; - -/** - * This slot should be used by any container that needs the slot for an electric - * items only. - * - * @author Calclavia - * - */ -public class SlotElectricItem extends Slot -{ - public SlotElectricItem(IInventory par2IInventory, int par3, int par4, int par5) - { - super(par2IInventory, par3, par4, par5); - } - - /** - * Check if the stack is a valid item for this slot. Always true beside for - * the armor slots. - */ - @Override - public boolean isItemValid(ItemStack par1ItemStack) - { - return par1ItemStack.getItem() instanceof IItemElectric; - } -} diff --git a/src/common/universalelectricity/prefab/UETab.java b/src/common/universalelectricity/prefab/UETab.java new file mode 100644 index 00000000..1cf92eed --- /dev/null +++ b/src/common/universalelectricity/prefab/UETab.java @@ -0,0 +1,34 @@ +package universalelectricity.prefab; + +import net.minecraft.src.Block; +import net.minecraft.src.CreativeTabs; +import net.minecraft.src.ItemStack; +import cpw.mods.fml.common.registry.LanguageRegistry; + +public class UETab extends CreativeTabs +{ + public static final UETab INSTANCE = new UETab("UniversalElectricity"); + private static ItemStack itemStack; + + public UETab(String par2Str) + { + super(CreativeTabs.getNextID(), par2Str); + LanguageRegistry.instance().addStringLocalization("itemGroup.UniversalElectricity", "en_US", "Universal Electricity"); + } + + public static void setItemStack(ItemStack newItemStack) + { + if (itemStack == null) + { + itemStack = newItemStack; + } + } + + @Override + public ItemStack getIconItemStack() + { + if (itemStack == null) { return new ItemStack(Block.blocksList[this.getTabIconItemIndex()]); } + + return itemStack; + } +} diff --git a/src/common/universalelectricity/prefab/implement/IRedstoneProvider.java b/src/common/universalelectricity/prefab/implement/IRedstoneProvider.java new file mode 100644 index 00000000..b839f1f5 --- /dev/null +++ b/src/common/universalelectricity/prefab/implement/IRedstoneProvider.java @@ -0,0 +1,17 @@ +package universalelectricity.prefab.implement; + +import net.minecraftforge.common.ForgeDirection; + +/** + * This should be applied on tile entities that + * can provide redstone power + * + * @author Calclavia + * + */ +public interface IRedstoneProvider +{ + public boolean isPoweringTo(ForgeDirection side); + + public boolean isIndirectlyPoweringTo(ForgeDirection side); +} diff --git a/src/common/universalelectricity/prefab/implement/IRedstoneReceptor.java b/src/common/universalelectricity/prefab/implement/IRedstoneReceptor.java new file mode 100644 index 00000000..ab1105b6 --- /dev/null +++ b/src/common/universalelectricity/prefab/implement/IRedstoneReceptor.java @@ -0,0 +1,24 @@ +package universalelectricity.prefab.implement; + +/** + * This interface should be applied onto all tile + * entities that needs to receive redstone power. + * Look at TileEntityBatteryBox for reference. + * + * @author Calclavia + * + */ +public interface IRedstoneReceptor +{ + /** + * Called when the block is powered on by + * redstone + */ + public void onPowerOn(); + + /** + * Called when the block is powered off by + * redstone + */ + public void onPowerOff(); +} diff --git a/src/common/universalelectricity/prefab/implement/IRotatable.java b/src/common/universalelectricity/prefab/implement/IRotatable.java new file mode 100644 index 00000000..e8b2bbc8 --- /dev/null +++ b/src/common/universalelectricity/prefab/implement/IRotatable.java @@ -0,0 +1,41 @@ +package universalelectricity.prefab.implement; + +import net.minecraftforge.common.ForgeDirection; + +/** + * This interface should be applied onto all tile + * entities that are rotatable. This interface + * however is optional and you do not need it for + * your add-on to function. It just makes things + * easier for you to code. + * + * @author Calclavia + * + */ + +public interface IRotatable +{ + /** + * Gets the facing direction of the tile + * entity. Always returns the front side of + * the tile entity. + * + * @return The facing side from 0-5 The full + * list of which side the number + * represents is in the + * UniversalElectricity class. + */ + public ForgeDirection getDirection(); + + /** + * Sets the facing direction of the tile + * entity. + * + * @param facingDirection + * - A direction from 0-5. The full + * list of which side the number + * represents is in the + * UniversalElectricity class. + */ + public void setDirection(ForgeDirection facingDirection); +} diff --git a/src/common/universalelectricity/implement/ITier.java b/src/common/universalelectricity/prefab/implement/ITier.java similarity index 70% rename from src/common/universalelectricity/implement/ITier.java rename to src/common/universalelectricity/prefab/implement/ITier.java index f3ae19fe..a7ec663f 100644 --- a/src/common/universalelectricity/implement/ITier.java +++ b/src/common/universalelectricity/prefab/implement/ITier.java @@ -1,7 +1,8 @@ -package universalelectricity.implement; +package universalelectricity.prefab.implement; /** - * This interface should be applied to all things that has a tier/level. + * This interface should be applied to all things + * that has a tier/level. * * @author Calclavia * diff --git a/src/common/universalelectricity/prefab/multiblock/BlockMulti.java b/src/common/universalelectricity/prefab/multiblock/BlockMulti.java index 5eb1052a..1a97cec0 100644 --- a/src/common/universalelectricity/prefab/multiblock/BlockMulti.java +++ b/src/common/universalelectricity/prefab/multiblock/BlockMulti.java @@ -10,7 +10,7 @@ import net.minecraft.src.MovingObjectPosition; import net.minecraft.src.TileEntity; import net.minecraft.src.World; import universalelectricity.core.UniversalElectricity; -import universalelectricity.core.Vector3; +import universalelectricity.core.vector.Vector3; public class BlockMulti extends BlockContainer { @@ -36,10 +36,12 @@ public class BlockMulti extends BlockContainer } /** - * Called when the block is right clicked by the player. This modified - * version detects electric items and wrench actions on your machine block. - * Do not override this function. Use machineActivated instead! (It does the - * same thing) + * Called when the block is right clicked by + * the player. This modified version detects + * electric items and wrench actions on your + * machine block. Do not override this + * function. Use machineActivated instead! (It + * does the same thing) */ @Override public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) @@ -49,7 +51,8 @@ public class BlockMulti extends BlockContainer } /** - * Returns the quantity of items to drop on block destruction. + * Returns the quantity of items to drop on + * block destruction. */ @Override public int quantityDropped(Random par1Random) diff --git a/src/common/universalelectricity/prefab/multiblock/IBlockActivate.java b/src/common/universalelectricity/prefab/multiblock/IBlockActivate.java index bbac0a96..0003fe93 100644 --- a/src/common/universalelectricity/prefab/multiblock/IBlockActivate.java +++ b/src/common/universalelectricity/prefab/multiblock/IBlockActivate.java @@ -3,7 +3,8 @@ package universalelectricity.prefab.multiblock; import net.minecraft.src.EntityPlayer; /** - * A general interface to be implemented by anything that needs it. + * A general interface to be implemented by + * anything that needs it. * * @author Calclavia * diff --git a/src/common/universalelectricity/prefab/multiblock/IMultiBlock.java b/src/common/universalelectricity/prefab/multiblock/IMultiBlock.java index 8207bd62..9671cbe8 100644 --- a/src/common/universalelectricity/prefab/multiblock/IMultiBlock.java +++ b/src/common/universalelectricity/prefab/multiblock/IMultiBlock.java @@ -1,11 +1,12 @@ package universalelectricity.prefab.multiblock; import net.minecraft.src.TileEntity; -import universalelectricity.core.Vector3; +import universalelectricity.core.vector.Vector3; /** - * Interface to be applied to tile entity blocks that occupies more than one - * block space. Useful for large machines. + * Interface to be applied to tile entity blocks + * that occupies more than one block space. Useful + * for large machines. * * @author Calclavia * @@ -16,15 +17,18 @@ public interface IMultiBlock extends IBlockActivate * Called when this multiblock is created * * @param placedPosition - * - The position the block was placed at + * - The position the block was + * placed at */ public void onCreate(Vector3 placedPosition); /** - * Called when one of the multiblocks of this block is destroyed + * Called when one of the multiblocks of this + * block is destroyed * * @param callingBlock - * - The tile entity who called the onDestroy function + * - The tile entity who called the + * onDestroy function */ public void onDestroy(TileEntity callingBlock); } diff --git a/src/common/universalelectricity/prefab/multiblock/TileEntityMulti.java b/src/common/universalelectricity/prefab/multiblock/TileEntityMulti.java index aeb56258..77901181 100644 --- a/src/common/universalelectricity/prefab/multiblock/TileEntityMulti.java +++ b/src/common/universalelectricity/prefab/multiblock/TileEntityMulti.java @@ -7,14 +7,15 @@ import net.minecraft.src.Packet; import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.TileEntity; import net.minecraft.src.World; -import universalelectricity.core.Vector3; +import universalelectricity.core.vector.Vector3; import universalelectricity.prefab.network.IPacketReceiver; import universalelectricity.prefab.network.PacketManager; import com.google.common.io.ByteArrayDataInput; /** - * This is a multiblock to be used for blocks that are bigger than one block. + * This is a multiblock to be used for blocks that + * are bigger than one block. * * @author Calclavia * @@ -96,9 +97,11 @@ public class TileEntityMulti extends TileEntity implements IPacketReceiver } /** - * Determines if this TileEntity requires update calls. + * Determines if this TileEntity requires + * update calls. * - * @return True if you want updateEntity() to be called, false if not + * @return True if you want updateEntity() to + * be called, false if not */ public boolean canUpdate() { diff --git a/src/common/universalelectricity/prefab/network/ISimpleConnectionHandler.java b/src/common/universalelectricity/prefab/network/ISimpleConnectionHandler.java index 472e8475..b5072346 100644 --- a/src/common/universalelectricity/prefab/network/ISimpleConnectionHandler.java +++ b/src/common/universalelectricity/prefab/network/ISimpleConnectionHandler.java @@ -5,8 +5,9 @@ import universalelectricity.prefab.network.ConnectionHandler.ConnectionType; public interface ISimpleConnectionHandler { /** - * Called when a player logs in. Use this to reset some tile entities - * variables if you need to. + * Called when a player logs in. Use this to + * reset some tile entities variables if you + * need to. * * @param player */ diff --git a/src/common/universalelectricity/prefab/network/PacketManager.java b/src/common/universalelectricity/prefab/network/PacketManager.java index 0e3f6889..acdb8cc5 100644 --- a/src/common/universalelectricity/prefab/network/PacketManager.java +++ b/src/common/universalelectricity/prefab/network/PacketManager.java @@ -10,7 +10,7 @@ import net.minecraft.src.Packet; import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.TileEntity; import net.minecraft.src.World; -import universalelectricity.core.Vector3; +import universalelectricity.core.vector.Vector3; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteStreams; @@ -21,15 +21,20 @@ import cpw.mods.fml.common.network.PacketDispatcher; import cpw.mods.fml.common.network.Player; /** - * This class is used for sending and receiving packets between the server and - * the client. You can directly use this by registering this packet manager with - * NetworkMod. Example: + * This class is used for sending and receiving + * packets between the server and the client. You + * can directly use this by registering this + * packet manager with NetworkMod. Example: * - * @NetworkMod(channels = { "BasicComponents" }, clientSideRequired = true, - * serverSideRequired = false, packetHandler = + * @NetworkMod(channels = { "BasicComponents" }, + * clientSideRequired = true, + * serverSideRequired = + * false, packetHandler = * PacketManager.class) * - * Check out {@link #BasicComponents} for better reference. + * Check out + * {@link #BasicComponents} + * for better reference. * * @author Calclavia */ @@ -46,6 +51,7 @@ public class PacketManager implements IPacketHandler, IPacketReceiver } } + @SuppressWarnings("resource") public static Packet getPacketWithID(String channelName, int id, Object... sendData) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); @@ -83,6 +89,7 @@ public class PacketManager implements IPacketHandler, IPacketReceiver * * @return */ + @SuppressWarnings("resource") public static Packet getPacket(String channelName, TileEntity sender, Object... sendData) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); @@ -114,9 +121,10 @@ public class PacketManager implements IPacketHandler, IPacketReceiver } /** - * Sends packets to clients around a specific coordinate. A wrapper using - * Vector3. See {@PacketDispatcher} for detailed - * information. + * Sends packets to clients around a specific + * coordinate. A wrapper using Vector3. See + * {@PacketDispatcher} for + * detailed information. */ public static void sendPacketToClients(Packet packet, World worldObj, Vector3 position, double range) { @@ -132,7 +140,8 @@ public class PacketManager implements IPacketHandler, IPacketReceiver } /** - * Sends a packet to all the clients on this server. + * Sends a packet to all the clients on this + * server. */ public static void sendPacketToClients(Packet packet, World worldObj) { diff --git a/src/common/universalelectricity/prefab/ore/OreGenBase.java b/src/common/universalelectricity/prefab/ore/OreGenBase.java deleted file mode 100644 index 343f8edc..00000000 --- a/src/common/universalelectricity/prefab/ore/OreGenBase.java +++ /dev/null @@ -1,104 +0,0 @@ -package universalelectricity.prefab.ore; - -import java.util.Random; - -import net.minecraft.src.Block; -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.ItemStack; -import net.minecraft.src.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.oredict.OreDictionary; -import universalelectricity.core.UEConfig; -import universalelectricity.core.UniversalElectricity; - -/** - * This class is used for storing ore generation data. If you are too lazy to - * generate your own ores, you can do - * {@link #OreGenerator.ORES_TO_GENERATE.add()} to add your ore to the list of - * ores to generate. - * - * @author Calclavia - * - */ -public abstract class OreGenBase -{ - public String name; - - public String oreDictionaryName; - - public boolean shouldGenerate; - - public int blockIndexTexture; - - public ItemStack oreStack; - - public int oreID; - - public int oreMeta; - - /** - * What harvest level does this machine need to be acquired? - */ - public int harvestLevel; - - /** - * The predefined tool classes are "pickaxe", "shovel", "axe". You can add - * others for custom tools. - */ - public String harvestTool; - - /** - * @param name - * - The name of the ore for display - * @param textureFile - * - The 16x16 png texture of your ore to override - * @param minGenerateLevel - * - The highest generation level of your ore - * @param maxGenerateLevel - * - The lowest generation level of your ore - * @param amountPerChunk - * - The amount of ores to generate per chunk - * @param amountPerBranch - * - The amount of ores to generate in a clutter. E.g coal - * generates with a lot of other coal next to it. How much do you - * want? - */ - public OreGenBase(String name, String oreDiectionaryName, ItemStack stack, String harvestTool, int harvestLevel) - { - this.name = name; - this.shouldGenerate = false; - this.harvestTool = harvestTool; - this.harvestLevel = harvestLevel; - this.oreDictionaryName = oreDiectionaryName; - this.oreStack = stack; - this.oreID = stack.itemID; - this.oreMeta = stack.getItemDamage(); - - OreDictionary.registerOre(oreDictionaryName, stack); - MinecraftForge.setBlockHarvestLevel(Block.blocksList[stack.itemID], stack.getItemDamage(), harvestTool, harvestLevel); - } - - public OreGenBase enable() - { - this.shouldGenerate = shouldGenerateOre(name); - return this; - } - - // You may inherit from this class and change this function if you want a - // custom texture render for your ore. - public int getBlockTextureFromSide(int side) - { - return this.blockIndexTexture; - } - - // Checks the config file and see if Universal Electricity should generate - // this ore - private static boolean shouldGenerateOre(String oreName) - { - return UEConfig.getConfigData(UniversalElectricity.CONFIGURATION, "Generate " + oreName, true); - } - - public abstract void generate(World world, Random random, int varX, int varZ); - - public abstract boolean isOreGeneratedInWorld(World world, IChunkProvider chunkGenerator); -} diff --git a/src/common/universalelectricity/prefab/ore/OreGenReplace.java b/src/common/universalelectricity/prefab/ore/OreGenReplace.java deleted file mode 100644 index 3be688e7..00000000 --- a/src/common/universalelectricity/prefab/ore/OreGenReplace.java +++ /dev/null @@ -1,134 +0,0 @@ -package universalelectricity.prefab.ore; - -import java.util.Random; - -import net.minecraft.src.ChunkProviderEnd; -import net.minecraft.src.ChunkProviderGenerate; -import net.minecraft.src.ChunkProviderHell; -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.ItemStack; -import net.minecraft.src.MathHelper; -import net.minecraft.src.World; - -/** - * This class is used for storing ore generation data. If you are too lazy to - * generate your own ores, you can do - * {@link #OreGenerator.ORES_TO_GENERATE.add()} to add your ore to the list of - * ores to generate. - * - * @author Calclavia - * - */ -public class OreGenReplace extends OreGenBase -{ - - public int minGenerateLevel; - public int maxGenerateLevel; - public int amountPerChunk; - public int amountPerBranch; - public int replaceID; - - public boolean generateSurface; - public boolean generateNether; - public boolean generateEnd; - - /** - * @param name - * - The name of the ore for display - * @param textureFile - * - The 16x16 png texture of your ore to override - * @param minGenerateLevel - * - The highest generation level of your ore - * @param maxGenerateLevel - * - The lowest generation level of your ore - * @param amountPerChunk - * - The amount of ores to generate per chunk - * @param amountPerBranch - * - The amount of ores to generate in a clutter. E.g coal - * generates with a lot of other coal next to it. How much do you - * want? - */ - public OreGenReplace(String name, String oreDiectionaryName, ItemStack stack, int replaceID, int minGenerateLevel, int maxGenerateLevel, int amountPerChunk, int amountPerBranch, String harvestTool, int harvestLevel) - { - super(name, oreDiectionaryName, stack, harvestTool, harvestLevel); - this.minGenerateLevel = minGenerateLevel; - this.maxGenerateLevel = maxGenerateLevel; - this.amountPerChunk = amountPerChunk; - this.amountPerBranch = amountPerBranch; - this.replaceID = replaceID; - } - - public void generate(World world, Random random, int varX, int varZ) - { - - for (int i = 0; i < this.amountPerChunk; i++) - { - int x = varX + random.nextInt(16); - int z = varZ + random.nextInt(16); - int y = random.nextInt(this.maxGenerateLevel - this.minGenerateLevel) + this.minGenerateLevel; - generateReplace(world, random, x, y, z); - } - } - - public boolean generateReplace(World par1World, Random par2Random, int par3, int par4, int par5) - { - float var6 = par2Random.nextFloat() * (float) Math.PI; - double var7 = (double) ((float) (par3 + 8) + MathHelper.sin(var6) * (float) this.amountPerBranch / 8.0F); - double var9 = (double) ((float) (par3 + 8) - MathHelper.sin(var6) * (float) this.amountPerBranch / 8.0F); - double var11 = (double) ((float) (par5 + 8) + MathHelper.cos(var6) * (float) this.amountPerBranch / 8.0F); - double var13 = (double) ((float) (par5 + 8) - MathHelper.cos(var6) * (float) this.amountPerBranch / 8.0F); - double var15 = (double) (par4 + par2Random.nextInt(3) - 2); - double var17 = (double) (par4 + par2Random.nextInt(3) - 2); - - for (int var19 = 0; var19 <= this.amountPerBranch; ++var19) - { - double var20 = var7 + (var9 - var7) * (double) var19 / (double) this.amountPerBranch; - double var22 = var15 + (var17 - var15) * (double) var19 / (double) this.amountPerBranch; - double var24 = var11 + (var13 - var11) * (double) var19 / (double) this.amountPerBranch; - double var26 = par2Random.nextDouble() * (double) this.amountPerBranch / 16.0D; - double var28 = (double) (MathHelper.sin((float) var19 * (float) Math.PI / (float) this.amountPerBranch) + 1.0F) * var26 + 1.0D; - double var30 = (double) (MathHelper.sin((float) var19 * (float) Math.PI / (float) this.amountPerBranch) + 1.0F) * var26 + 1.0D; - int var32 = MathHelper.floor_double(var20 - var28 / 2.0D); - int var33 = MathHelper.floor_double(var22 - var30 / 2.0D); - int var34 = MathHelper.floor_double(var24 - var28 / 2.0D); - int var35 = MathHelper.floor_double(var20 + var28 / 2.0D); - int var36 = MathHelper.floor_double(var22 + var30 / 2.0D); - int var37 = MathHelper.floor_double(var24 + var28 / 2.0D); - - for (int var38 = var32; var38 <= var35; ++var38) - { - double var39 = ((double) var38 + 0.5D - var20) / (var28 / 2.0D); - - if (var39 * var39 < 1.0D) - { - for (int var41 = var33; var41 <= var36; ++var41) - { - double var42 = ((double) var41 + 0.5D - var22) / (var30 / 2.0D); - - if (var39 * var39 + var42 * var42 < 1.0D) - { - for (int var44 = var34; var44 <= var37; ++var44) - { - double var45 = ((double) var44 + 0.5D - var24) / (var28 / 2.0D); - - int block = par1World.getBlockId(var38, var41, var44); - if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && (this.replaceID == 0 || block == this.replaceID)) - { - par1World.setBlockAndMetadata(var38, var41, var44, this.oreID, this.oreMeta); - } - } - } - } - } - } - } - - return true; - } - - @Override - public boolean isOreGeneratedInWorld(World world, IChunkProvider chunkGenerator) - { - return ((this.generateSurface && chunkGenerator instanceof ChunkProviderGenerate) || (this.generateNether && chunkGenerator instanceof ChunkProviderHell) || (this.generateEnd && chunkGenerator instanceof ChunkProviderEnd)); - } -} diff --git a/src/common/universalelectricity/prefab/ore/OreGenReplaceStone.java b/src/common/universalelectricity/prefab/ore/OreGenReplaceStone.java deleted file mode 100644 index 463fa2bc..00000000 --- a/src/common/universalelectricity/prefab/ore/OreGenReplaceStone.java +++ /dev/null @@ -1,18 +0,0 @@ -package universalelectricity.prefab.ore; - -import net.minecraft.src.ItemStack; - -public class OreGenReplaceStone extends OreGenReplace -{ - public OreGenReplaceStone(String name, String oreDiectionaryName, ItemStack stack, int replaceID, int minGenerateLevel, int maxGenerateLevel, int amountPerChunk, int amountPerBranch, String harvestTool, int harvestLevel) - { - super(name, oreDiectionaryName, stack, 1, minGenerateLevel, maxGenerateLevel, amountPerChunk, amountPerBranch, harvestTool, harvestLevel); - this.generateSurface = true; - } - - // A simplified version of the constructor - public OreGenReplaceStone(String name, String oreDiectionaryName, ItemStack stack, int replaceID, int maxGenerateLevel, int amountPerChunk, int amountPerBranch) - { - this(name, oreDiectionaryName, stack, 0, replaceID, maxGenerateLevel, amountPerChunk, amountPerBranch, "pickaxe", 1); - } -} \ No newline at end of file diff --git a/src/common/universalelectricity/prefab/ore/OreGenerator.java b/src/common/universalelectricity/prefab/ore/OreGenerator.java deleted file mode 100644 index d116b8c4..00000000 --- a/src/common/universalelectricity/prefab/ore/OreGenerator.java +++ /dev/null @@ -1,75 +0,0 @@ -package universalelectricity.prefab.ore; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import net.minecraft.src.IChunkProvider; -import net.minecraft.src.World; -import cpw.mods.fml.common.IWorldGenerator; -import cpw.mods.fml.common.registry.GameRegistry; - -public class OreGenerator implements IWorldGenerator -{ - public static boolean isInitiated = false; - - /** - * Add your ore data to this list of ores for it to automatically generate! - * No hassle indeed! - */ - private static final List ORES_TO_GENERATE = new ArrayList(); - - /** - * Adds an ore to the ore generate list. Do this in pre-init. - */ - public static void addOre(OreGenBase data) - { - if (!isInitiated) - { - GameRegistry.registerWorldGenerator(new OreGenerator()); - } - - ORES_TO_GENERATE.add(data); - } - - /** - * Checks to see if this ore - * - * @param oreName - * @return - */ - public static boolean oreExists(String oreName) - { - for (OreGenBase ore : ORES_TO_GENERATE) - { - if (ore.oreDictionaryName == oreName) { return true; } - } - - return false; - } - - /** - * Removes an ore to the ore generate list. Do this in init. - */ - public static void removeOre(OreGenBase data) - { - ORES_TO_GENERATE.remove(data); - } - - @Override - public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) - { - chunkX = chunkX << 4; - chunkZ = chunkZ << 4; - - // Checks to make sure this is the normal world - for (OreGenBase oreData : ORES_TO_GENERATE) - { - if (oreData.shouldGenerate && oreData.isOreGeneratedInWorld(world, chunkGenerator)) - { - oreData.generate(world, rand, chunkX, chunkZ); - } - - } - } -} diff --git a/src/common/universalelectricity/prefab/potion/CustomPotion.java b/src/common/universalelectricity/prefab/potion/CustomPotion.java deleted file mode 100644 index fc13deb9..00000000 --- a/src/common/universalelectricity/prefab/potion/CustomPotion.java +++ /dev/null @@ -1,41 +0,0 @@ -package universalelectricity.prefab.potion; - -import net.minecraft.src.Potion; -import cpw.mods.fml.common.registry.LanguageRegistry; - -public abstract class CustomPotion extends Potion -{ - /** - * Creates a new type of potion - * - * @param id - * - The ID of this potion. Make it greater than 20. - * @param isBadEffect - * - Is this potion a good potion or a bad one? - * @param color - * - The color of this potion. - * @param name - * - The name of this potion. - */ - public CustomPotion(int id, boolean isBadEffect, int color, String name) - { - super(id, isBadEffect, color); - this.setPotionName("potion." + name); - LanguageRegistry.instance().addStringLocalization(this.getName(), name); - } - - @Override - public Potion setIconIndex(int par1, int par2) - { - super.setIconIndex(par1, par2); - return this; - } - - /** - * You must register all your potion effects during mod initialization! - */ - public void register() - { - Potion.potionTypes[this.getId()] = this; - } -} diff --git a/src/common/universalelectricity/prefab/potion/CustomPotionEffect.java b/src/common/universalelectricity/prefab/potion/CustomPotionEffect.java deleted file mode 100644 index fedd88cc..00000000 --- a/src/common/universalelectricity/prefab/potion/CustomPotionEffect.java +++ /dev/null @@ -1,41 +0,0 @@ -package universalelectricity.prefab.potion; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.src.ItemStack; -import net.minecraft.src.Potion; -import net.minecraft.src.PotionEffect; - -public class CustomPotionEffect extends PotionEffect -{ - public CustomPotionEffect(int potionID, int duration, int amplifier) - { - super(potionID, duration, amplifier); - } - - public CustomPotionEffect(Potion potion, int duration, int amplifier) - { - this(potion.getId(), duration, amplifier); - } - - /** - * Creates a potion effect with custom curable items. - * - * @param curativeItems - * - ItemStacks that can cure this potion effect - */ - public CustomPotionEffect(int potionID, int duration, int amplifier, List curativeItems) - { - super(potionID, duration, amplifier); - - if (curativeItems == null) - { - this.setCurativeItems(new ArrayList()); - } - else - { - this.setCurativeItems(curativeItems); - } - } -} diff --git a/src/common/universalelectricity/prefab/TileEntityAdvanced.java b/src/common/universalelectricity/prefab/tile/TileEntityAdvanced.java similarity index 90% rename from src/common/universalelectricity/prefab/TileEntityAdvanced.java rename to src/common/universalelectricity/prefab/tile/TileEntityAdvanced.java index a9bf8420..f36eeb0a 100644 --- a/src/common/universalelectricity/prefab/TileEntityAdvanced.java +++ b/src/common/universalelectricity/prefab/tile/TileEntityAdvanced.java @@ -1,10 +1,11 @@ -package universalelectricity.prefab; +package universalelectricity.prefab.tile; import net.minecraft.src.Block; import net.minecraft.src.TileEntity; /** - * A TileEntity with some pre-added functionalities. + * A TileEntity with some pre-added + * functionalities. * * @author Calclavia * diff --git a/src/common/universalelectricity/prefab/TileEntityConductor.java b/src/common/universalelectricity/prefab/tile/TileEntityConductor.java similarity index 91% rename from src/common/universalelectricity/prefab/TileEntityConductor.java rename to src/common/universalelectricity/prefab/tile/TileEntityConductor.java index 11123fbd..3aacb1c1 100644 --- a/src/common/universalelectricity/prefab/TileEntityConductor.java +++ b/src/common/universalelectricity/prefab/tile/TileEntityConductor.java @@ -1,4 +1,4 @@ -package universalelectricity.prefab; +package universalelectricity.prefab.tile; import net.minecraft.src.EntityPlayer; import net.minecraft.src.INetworkManager; @@ -6,11 +6,11 @@ import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.TileEntity; import net.minecraft.src.World; import net.minecraftforge.common.ForgeDirection; -import universalelectricity.core.Vector3; -import universalelectricity.electricity.ElectricityManager; -import universalelectricity.electricity.ElectricityNetwork; -import universalelectricity.implement.IConductor; -import universalelectricity.implement.IConnector; +import universalelectricity.core.electricity.ElectricityManager; +import universalelectricity.core.electricity.ElectricityNetwork; +import universalelectricity.core.implement.IConductor; +import universalelectricity.core.implement.IConnector; +import universalelectricity.core.vector.Vector3; import universalelectricity.prefab.network.IPacketReceiver; import com.google.common.io.ByteArrayDataInput; diff --git a/src/common/universalelectricity/prefab/TileEntityDisableable.java b/src/common/universalelectricity/prefab/tile/TileEntityDisableable.java similarity index 67% rename from src/common/universalelectricity/prefab/TileEntityDisableable.java rename to src/common/universalelectricity/prefab/tile/TileEntityDisableable.java index fa45746b..0b6deba1 100644 --- a/src/common/universalelectricity/prefab/TileEntityDisableable.java +++ b/src/common/universalelectricity/prefab/tile/TileEntityDisableable.java @@ -1,10 +1,11 @@ -package universalelectricity.prefab; +package universalelectricity.prefab.tile; -import universalelectricity.implement.IDisableable; +import universalelectricity.core.implement.IDisableable; /** - * An easier way to implement the methods from IElectricityDisableable with - * default values set. + * An easier way to implement the methods from + * IElectricityDisableable with default values + * set. * * @author Calclavia */ @@ -26,7 +27,8 @@ public abstract class TileEntityDisableable extends TileEntityAdvanced implement } /** - * Called every tick while this tile entity is disabled. + * Called every tick while this tile entity is + * disabled. */ protected void whileDisable() { diff --git a/src/common/universalelectricity/prefab/TileEntityElectricityReceiver.java b/src/common/universalelectricity/prefab/tile/TileEntityElectricityReceiver.java similarity index 70% rename from src/common/universalelectricity/prefab/TileEntityElectricityReceiver.java rename to src/common/universalelectricity/prefab/tile/TileEntityElectricityReceiver.java index 76ff0aa9..d8722544 100644 --- a/src/common/universalelectricity/prefab/TileEntityElectricityReceiver.java +++ b/src/common/universalelectricity/prefab/tile/TileEntityElectricityReceiver.java @@ -1,11 +1,11 @@ -package universalelectricity.prefab; +package universalelectricity.prefab.tile; import net.minecraftforge.common.ForgeDirection; -import universalelectricity.implement.IElectricityReceiver; +import universalelectricity.core.implement.IElectricityReceiver; /** - * An easier way to implement the methods from IElectricityReceiver with default - * values set. + * An easier way to implement the methods from + * IElectricityReceiver with default values set. * * @author Calclavia */ diff --git a/src/minecraft/assemblyline/ALClientProxy.java b/src/minecraft/assemblyline/ALClientProxy.java index 65318bd5..cffe9bb4 100644 --- a/src/minecraft/assemblyline/ALClientProxy.java +++ b/src/minecraft/assemblyline/ALClientProxy.java @@ -4,10 +4,10 @@ import net.minecraft.src.EntityPlayer; import net.minecraft.src.TileEntity; import net.minecraft.src.World; import net.minecraftforge.client.MinecraftForgeClient; -import assemblyline.belts.TileEntityConveyorBelt; import assemblyline.gui.GuiSorter; -import assemblyline.machines.TileEntityManipulator; -import assemblyline.machines.TileEntityRejector; +import assemblyline.machine.TileEntityManipulator; +import assemblyline.machine.TileEntityRejector; +import assemblyline.machine.belt.TileEntityConveyorBelt; import assemblyline.render.RenderConveyorBelt; import assemblyline.render.RenderHelper; import assemblyline.render.RenderManipulator; diff --git a/src/minecraft/assemblyline/gui/GuiSorter.java b/src/minecraft/assemblyline/gui/GuiSorter.java index b28d1d27..93df35cc 100644 --- a/src/minecraft/assemblyline/gui/GuiSorter.java +++ b/src/minecraft/assemblyline/gui/GuiSorter.java @@ -9,8 +9,8 @@ import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; import assemblyline.AssemblyLine; -import assemblyline.machines.ContainerSorter; -import assemblyline.machines.TileEntityRejector; +import assemblyline.machine.ContainerSorter; +import assemblyline.machine.TileEntityRejector; public class GuiSorter extends GuiContainer { diff --git a/src/minecraft/assemblyline/render/RenderConveyorBelt.java b/src/minecraft/assemblyline/render/RenderConveyorBelt.java index c78c01ac..aab6ffe8 100644 --- a/src/minecraft/assemblyline/render/RenderConveyorBelt.java +++ b/src/minecraft/assemblyline/render/RenderConveyorBelt.java @@ -6,7 +6,7 @@ import net.minecraft.src.TileEntitySpecialRenderer; import org.lwjgl.opengl.GL11; import assemblyline.AssemblyLine; -import assemblyline.belts.TileEntityConveyorBelt; +import assemblyline.machine.belt.TileEntityConveyorBelt; import assemblyline.model.ModelConveyorBelt; public class RenderConveyorBelt extends TileEntitySpecialRenderer diff --git a/src/minecraft/assemblyline/render/RenderHelper.java b/src/minecraft/assemblyline/render/RenderHelper.java index 4fde3f55..f4cedb3d 100644 --- a/src/minecraft/assemblyline/render/RenderHelper.java +++ b/src/minecraft/assemblyline/render/RenderHelper.java @@ -7,7 +7,7 @@ import net.minecraft.src.RenderBlocks; import org.lwjgl.opengl.GL11; import assemblyline.AssemblyLine; -import assemblyline.machines.BlockMulti.MachineType; +import assemblyline.machine.BlockMulti.MachineType; import assemblyline.model.ModelConveyorBelt; import assemblyline.model.ModelManipulator; import assemblyline.model.ModelSorter; diff --git a/src/minecraft/assemblyline/render/RenderManipulator.java b/src/minecraft/assemblyline/render/RenderManipulator.java index d8a2ec16..81e7ce9b 100644 --- a/src/minecraft/assemblyline/render/RenderManipulator.java +++ b/src/minecraft/assemblyline/render/RenderManipulator.java @@ -6,7 +6,7 @@ import net.minecraft.src.TileEntitySpecialRenderer; import org.lwjgl.opengl.GL11; import assemblyline.AssemblyLine; -import assemblyline.machines.TileEntityManipulator; +import assemblyline.machine.TileEntityManipulator; import assemblyline.model.ModelManipulator; public class RenderManipulator extends TileEntitySpecialRenderer diff --git a/src/minecraft/assemblyline/render/RenderSorter.java b/src/minecraft/assemblyline/render/RenderSorter.java index 78178466..4d5684de 100644 --- a/src/minecraft/assemblyline/render/RenderSorter.java +++ b/src/minecraft/assemblyline/render/RenderSorter.java @@ -6,7 +6,7 @@ import net.minecraft.src.TileEntitySpecialRenderer; import org.lwjgl.opengl.GL11; import assemblyline.AssemblyLine; -import assemblyline.machines.TileEntityRejector; +import assemblyline.machine.TileEntityRejector; import assemblyline.model.ModelSorter; public class RenderSorter extends TileEntitySpecialRenderer diff --git a/src/minecraft/assemblyline/textures/BeltMid.png b/src/minecraft/assemblyline/textures/BeltMid.png deleted file mode 100644 index 36c17346..00000000 Binary files a/src/minecraft/assemblyline/textures/BeltMid.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/BeltSingle.png b/src/minecraft/assemblyline/textures/BeltSingle.png deleted file mode 100644 index 953cfb33..00000000 Binary files a/src/minecraft/assemblyline/textures/BeltSingle.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/BeltTexture.png b/src/minecraft/assemblyline/textures/BeltTexture.png deleted file mode 100644 index bf356148..00000000 Binary files a/src/minecraft/assemblyline/textures/BeltTexture.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/CoalGenerator.png b/src/minecraft/assemblyline/textures/CoalGenerator.png deleted file mode 100644 index ac811713..00000000 Binary files a/src/minecraft/assemblyline/textures/CoalGenerator.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/ConveyorBelt.png b/src/minecraft/assemblyline/textures/ConveyorBelt.png deleted file mode 100644 index 5666d206..00000000 Binary files a/src/minecraft/assemblyline/textures/ConveyorBelt.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/ConveyorBeltF.png b/src/minecraft/assemblyline/textures/ConveyorBeltF.png deleted file mode 100644 index 96aac9bf..00000000 Binary files a/src/minecraft/assemblyline/textures/ConveyorBeltF.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/ConveyorBeltR.png b/src/minecraft/assemblyline/textures/ConveyorBeltR.png deleted file mode 100644 index 7e2c17ed..00000000 Binary files a/src/minecraft/assemblyline/textures/ConveyorBeltR.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/ConveyorBeltRF.png b/src/minecraft/assemblyline/textures/ConveyorBeltRF.png deleted file mode 100644 index 41768def..00000000 Binary files a/src/minecraft/assemblyline/textures/ConveyorBeltRF.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/Grey64.png b/src/minecraft/assemblyline/textures/Grey64.png deleted file mode 100644 index 999e6c05..00000000 Binary files a/src/minecraft/assemblyline/textures/Grey64.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/dropbox.png b/src/minecraft/assemblyline/textures/dropbox.png deleted file mode 100644 index 02f2d965..00000000 Binary files a/src/minecraft/assemblyline/textures/dropbox.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/ejector.png b/src/minecraft/assemblyline/textures/ejector.png deleted file mode 100644 index feba2e00..00000000 Binary files a/src/minecraft/assemblyline/textures/ejector.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/gui@.png b/src/minecraft/assemblyline/textures/gui@.png deleted file mode 100644 index 5755b10e..00000000 Binary files a/src/minecraft/assemblyline/textures/gui@.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/gui_crafter.png b/src/minecraft/assemblyline/textures/gui_crafter.png deleted file mode 100644 index f9ad07aa..00000000 Binary files a/src/minecraft/assemblyline/textures/gui_crafter.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/gui_ejector.png b/src/minecraft/assemblyline/textures/gui_ejector.png deleted file mode 100644 index 2123e869..00000000 Binary files a/src/minecraft/assemblyline/textures/gui_ejector.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/injector.png b/src/minecraft/assemblyline/textures/injector.png deleted file mode 100644 index f63471e5..00000000 Binary files a/src/minecraft/assemblyline/textures/injector.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/manipulator1.png b/src/minecraft/assemblyline/textures/manipulator1.png deleted file mode 100644 index f63471e5..00000000 Binary files a/src/minecraft/assemblyline/textures/manipulator1.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/manipulator2.png b/src/minecraft/assemblyline/textures/manipulator2.png deleted file mode 100644 index f14fe55e..00000000 Binary files a/src/minecraft/assemblyline/textures/manipulator2.png and /dev/null differ diff --git a/src/minecraft/assemblyline/textures/sorter.png b/src/minecraft/assemblyline/textures/sorter.png deleted file mode 100644 index feba2e00..00000000 Binary files a/src/minecraft/assemblyline/textures/sorter.png and /dev/null differ