From 3868dde692be43dd4ce9a1c15133551760751bc6 Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 20 Dec 2013 02:11:52 -0500 Subject: [PATCH] reworked and pieced out some things to other mods --- src/dark/api/ColorCode.java | 103 ------- src/dark/api/DataPack.java | 75 ----- src/dark/api/FluidMasterList.java | 65 ---- src/dark/api/IAimable.java | 23 -- src/dark/api/IToolReadOut.java | 34 --- src/dark/api/events/FluidMixingEvent.java | 70 ----- src/dark/api/events/LaserEvent.java | 280 ------------------ src/dark/core/basics/EnumMaterial.java | 213 ------------- src/dark/core/basics/EnumOrePart.java | 43 --- src/dark/core/basics/ItemOreDirv.java | 164 ---------- src/dark/core/basics/ItemParts.java | 138 --------- .../core/prefab/entities/EntityFakeBlock.java | 99 ------- .../core/prefab/machine/BlockMachine.java | 184 ------------ src/dark/machines/CoreMachine.java | 63 +--- src/dark/machines/CoreRecipeLoader.java | 276 ++--------------- .../blocks}/BlockGasOre.java | 2 +- .../basics => machines/blocks}/BlockOre.java | 3 +- .../blocks}/GasOreGenerator.java | 2 +- src/dark/machines/client/ClientProxy.java | 10 +- .../client/models/ModelSmallFluidCan.java | 126 -------- .../client/renders/BlockRenderInfo.java | 56 ---- .../client/renders/ItemRenderFluidCan.java | 112 ------- .../client/renders/RenderBlockEntity.java | 194 ------------ .../client/renders/RenderBlockFluid.java | 125 -------- .../client/renders/RenderTestCar.java | 2 +- src/dark/machines/deco/BlockColored.java | 3 +- src/dark/machines/deco/ItemBlockColored.java | 3 +- .../generators/TileEntitySolarPanel.java | 2 +- .../basics => machines/items}/EnumTool.java | 61 +++- .../items}/ItemBlockOre.java | 5 +- src/dark/machines/items/ItemColoredDust.java | 2 +- .../items}/ItemCommonTool.java | 56 ++-- src/dark/machines/items/ItemFluidCan.java | 92 ------ src/dark/machines/items/ItemReadoutTools.java | 4 +- src/dark/machines/items/ItemStorageCan.java | 9 - .../machines}/TileEntityGenerator.java | 2 +- .../prefab/LaserEntityDamageSource.java | 2 +- .../{core => machines}/prefab/ModPrefab.java | 2 +- .../prefab/TileDamageSource.java | 2 +- .../prefab/entities/EntityAdvanced.java | 2 +- .../prefab/entities/EntityTestCar.java | 2 +- .../prefab/entities/EntityVehicle.java | 2 +- .../prefab/entities/ItemVehicleSpawn.java | 2 +- .../machines/transmit/TileEntityWire.java | 3 +- 44 files changed, 146 insertions(+), 2572 deletions(-) delete mode 100644 src/dark/api/ColorCode.java delete mode 100644 src/dark/api/DataPack.java delete mode 100644 src/dark/api/FluidMasterList.java delete mode 100644 src/dark/api/IAimable.java delete mode 100644 src/dark/api/IToolReadOut.java delete mode 100644 src/dark/api/events/FluidMixingEvent.java delete mode 100644 src/dark/api/events/LaserEvent.java delete mode 100644 src/dark/core/basics/EnumMaterial.java delete mode 100644 src/dark/core/basics/EnumOrePart.java delete mode 100644 src/dark/core/basics/ItemOreDirv.java delete mode 100644 src/dark/core/basics/ItemParts.java delete mode 100644 src/dark/core/prefab/entities/EntityFakeBlock.java delete mode 100644 src/dark/core/prefab/machine/BlockMachine.java rename src/dark/{core/basics => machines/blocks}/BlockGasOre.java (99%) rename src/dark/{core/basics => machines/blocks}/BlockOre.java (98%) rename src/dark/{core/basics => machines/blocks}/GasOreGenerator.java (99%) delete mode 100644 src/dark/machines/client/models/ModelSmallFluidCan.java delete mode 100644 src/dark/machines/client/renders/BlockRenderInfo.java delete mode 100644 src/dark/machines/client/renders/ItemRenderFluidCan.java delete mode 100644 src/dark/machines/client/renders/RenderBlockEntity.java delete mode 100644 src/dark/machines/client/renders/RenderBlockFluid.java rename src/dark/{core/basics => machines/items}/EnumTool.java (50%) rename src/dark/{core/basics => machines/items}/ItemBlockOre.java (86%) rename src/dark/{core/basics => machines/items}/ItemCommonTool.java (88%) delete mode 100644 src/dark/machines/items/ItemFluidCan.java delete mode 100644 src/dark/machines/items/ItemStorageCan.java rename src/dark/{core/prefab/machine => machines/machines}/TileEntityGenerator.java (98%) rename src/dark/{core => machines}/prefab/LaserEntityDamageSource.java (98%) rename src/dark/{core => machines}/prefab/ModPrefab.java (98%) rename src/dark/{core => machines}/prefab/TileDamageSource.java (97%) rename src/dark/{core => machines}/prefab/entities/EntityAdvanced.java (99%) rename src/dark/{core => machines}/prefab/entities/EntityTestCar.java (93%) rename src/dark/{core => machines}/prefab/entities/EntityVehicle.java (99%) rename src/dark/{core => machines}/prefab/entities/ItemVehicleSpawn.java (99%) diff --git a/src/dark/api/ColorCode.java b/src/dark/api/ColorCode.java deleted file mode 100644 index 959efb87e..000000000 --- a/src/dark/api/ColorCode.java +++ /dev/null @@ -1,103 +0,0 @@ -package dark.api; - -import java.awt.Color; - -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public enum ColorCode -{ - BLACK("Black", Color.black), - RED("Red", Color.red), - GREEN("Green", Color.green), - BROWN("Brown", new Color(139, 69, 19)), - BLUE("Blue", Color.BLUE), - PURPLE("Purple", new Color(75, 0, 130)), - CYAN("Cyan", Color.cyan), - SILVER("Silver", new Color(192, 192, 192)), - GREY("Grey", Color.gray), - PINK("Pink", Color.pink), - LIME("Lime", new Color(0, 255, 0)), - YELLOW("Yellow", Color.yellow), - LIGHTBLUE("LightBlue", new Color(135, 206, 250)), - MAGENTA("Magenta", Color.magenta), - ORANGE("Orange", Color.orange), - WHITE("White", Color.white), - UNKOWN("", Color.BLACK); - - public String name; - public Color color; - - private ColorCode(String name, Color color) - { - this.name = name; - this.color = color; - } - - public String getName() - { - return this.name; - } - - /** gets a ColorCode from any of the following - * - * @param obj - Integer,String,LiquidData,ColorCode - * @return Color NONE if it can't find it */ - public static ColorCode get(Object obj) - { - if (obj instanceof Integer && ((Integer) obj) < ColorCode.values().length) - { - return ColorCode.values()[((Integer) obj)]; - } - else if (obj instanceof ColorCode) - { - return (ColorCode) obj; - } - else if (obj instanceof String) - { - for (int i = 0; i < ColorCode.values().length; i++) - { - if (((String) obj).equalsIgnoreCase(ColorCode.get(i).getName())) - { - return ColorCode.get(i); - } - } - } - return UNKOWN; - } - - /** Used on anything that is coded for a set color for varies reasons */ - public static interface IColorCoded - { - /** Returns the ColorCode of the object */ - public ColorCode getColor(); - - /** Sets the ColorCode of the Object */ - public boolean setColor(Object obj); - } - - public static interface IColoredItem - { - /** Returns the ColorCode of the object */ - public ColorCode getColor(ItemStack stack); - - /** Sets the ColorCode of the Object */ - public boolean setColor(ItemStack stack, Object obj); - } - - public static interface IColoredId - { - /** Returns the ColorCode of the object */ - public ColorCode getColor(int i); - } - - public static interface IColoredBlock - { - /** Returns the ColorCode of the object */ - public ColorCode getColor(World world, int x, int y, int z); - - /** Sets the ColorCode of the Object */ - public void setColor(World world, int x, int y, int z, Object obj); - } - -} diff --git a/src/dark/api/DataPack.java b/src/dark/api/DataPack.java deleted file mode 100644 index e54d01f97..000000000 --- a/src/dark/api/DataPack.java +++ /dev/null @@ -1,75 +0,0 @@ -package dark.api; - -import net.minecraft.nbt.NBTTagCompound; - -import com.dark.save.ISaveObj; -import com.dark.save.NBTFileHelper; - -/** Wrapper for data to be sent threw a network to a device - * - * @author DarkGuardsman */ -public class DataPack implements ISaveObj, Cloneable -{ - private Object[] data; - - public DataPack(Object... data) - { - this.data = data; - } - - public Object[] getData() - { - return this.data; - } - - @Override - public void save(NBTTagCompound nbt) - { - if (data != null) - { - nbt.setInteger("dataCnt", data.length); - for (int i = 0; i < data.length; i++) - { - if (data[i] != null) - { - NBTFileHelper.saveObject(nbt, "data" + i, data[i]); - } - } - } - } - - @Override - public void load(NBTTagCompound nbt) - { - if (nbt.hasKey("dataCnt")) - { - int dataLength = nbt.getInteger("dataCnt"); - data = new Object[dataLength]; - for (int i = 0; i < dataLength; i++) - { - if (nbt.hasKey("data" + i)) - { - data[i] = NBTFileHelper.loadObject(nbt, "data" + i); - } - } - } - - } - - @Override - public DataPack clone() - { - return new DataPack(this.data); - } - - public boolean isEqual(DataPack pack) - { - return this.data != null && pack.data != null && this.data.equals(pack.data); - } - - @Override - public String toString() - { - return "DataPack [Obj:" + (this.data != null ? data.length : "none") + "]"; - } -} diff --git a/src/dark/api/FluidMasterList.java b/src/dark/api/FluidMasterList.java deleted file mode 100644 index 7868658ba..000000000 --- a/src/dark/api/FluidMasterList.java +++ /dev/null @@ -1,65 +0,0 @@ -package dark.api; - -import java.util.HashMap; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import com.builtbroken.common.Pair; - -public class FluidMasterList -{ - public static HashMap moltenFluids = new HashMap(); - /** Map containing items to FluidStack for melting down. Anything not in the list will be turned - * into slag. */ - public static HashMap, FluidStack> meltDownMap = new HashMap(); - - public static final Fluid WATER = FluidRegistry.WATER; - public static final Fluid LAVA = FluidRegistry.LAVA; - - static - { - //http://www.engineeringtoolbox.com/melting-temperature-metals-d_860.html - moltenFluids.put("lava", 1200f); - moltenFluids.put("molten-iron", 1200f); - moltenFluids.put("molten-gold", 1063f); - moltenFluids.put("molten-silver", 1000f); - } - - /** Registers a fluid, by fluid name, as a molten fluids so pipes will interact with it different - * - * @param name - fluid name - * @param heatValue - temperature of the fluid */ - public static void registerMoltenFluid(String name, float heatValue) - { - if (name != null && heatValue > 0) - { - moltenFluids.put(name, heatValue); - } - } - - /** Try to only register very simple items as a reverse recipe system will be used to get to the - * items used to craft the object - * - * @param id - item id - * @param meta - item meta - * @param stack - fluid stack to return */ - public static void registerMeltDown(int id, int meta, FluidStack stack) - { - if (id > 0 && stack != null) - { - meltDownMap.put(new Pair(id, meta), stack); - } - } - - public static boolean isMolten(Fluid fluid) - { - return fluid != null && moltenFluids.containsKey(fluid.getName()); - } - - public static float getHeatPerPass(Fluid fluid) - { - return moltenFluids.get(fluid.getName()); - } -} diff --git a/src/dark/api/IAimable.java b/src/dark/api/IAimable.java deleted file mode 100644 index 948cb1388..000000000 --- a/src/dark/api/IAimable.java +++ /dev/null @@ -1,23 +0,0 @@ -package dark.api; - -import universalelectricity.core.vector.Vector3; - -/** Applied to objects that can be aimed by yaw and pitch. This is used by things like sentry guns, - * vehicles, or mining tools. - * - * @author DarkGuardsman */ -public interface IAimable -{ - /** Vector which runs from the objects eyes(or gun). Should be right outside the objects bounds - * but no farther than that. */ - public Vector3 getLook(); - - /** X pitch, Y is yaw, z is roll. Roll is almost never used */ - public Vector3 getRotation(); - - /** This does not set the rotation but rather moves the current rotation by the given values */ - public void updateRotation(float pitch, float yaw, float roll); - - /** Forces the rotation to the angles */ - public void setRotation(float pitch, float yaw, float roll); -} diff --git a/src/dark/api/IToolReadOut.java b/src/dark/api/IToolReadOut.java deleted file mode 100644 index 4cfbb6583..000000000 --- a/src/dark/api/IToolReadOut.java +++ /dev/null @@ -1,34 +0,0 @@ -package dark.api; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.common.ForgeDirection; - -/** Simple way to control the read-out display over several tools when they are used on the - * tileEntity - * - * @author DarkGuardsman */ -public interface IToolReadOut -{ - /** Grabs the message displayed to the user on right click of the machine with the given tool - * - * @param user - * @param side - may not work correctly yet but should give you a side - * @return - a string to be displayed to the player for a reading. automatically adds ReadOut: - * to the beginning */ - public String getMeterReading(EntityPlayer user, ForgeDirection side, EnumTools tool); - - public static enum EnumTools - { - PIPE_GUAGE(), - MULTI_METER(); - - public static EnumTools get(int meta) - { - if (meta < EnumTools.values().length) - { - return EnumTools.values()[meta]; - } - return null; - } - } -} diff --git a/src/dark/api/events/FluidMixingEvent.java b/src/dark/api/events/FluidMixingEvent.java deleted file mode 100644 index c8ac6b95b..000000000 --- a/src/dark/api/events/FluidMixingEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -package dark.api.events; - -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.Cancelable; -import net.minecraftforge.fluids.FluidEvent; -import net.minecraftforge.fluids.FluidStack; -import universalelectricity.core.vector.Vector3; - -public class FluidMixingEvent extends FluidEvent -{ - - public FluidMixingEvent(FluidStack fluid, World world, Vector3 vec) - { - super(fluid, world, vec.intX(), vec.intY(), vec.intZ()); - } - - @Cancelable - /**Called before a fluid is mixed with something else, normally another fluid. You can use this event to cancel the mixing or change its output */ - public static class PreMixEvent extends FluidMixingEvent - { - public final Object input; - public Object output; - - public PreMixEvent(World world, Vector3 vec, FluidStack fluid, Object input, Object output) - { - super(fluid, world, vec); - this.input = input; - this.output = output; - } - - } - - @Cancelable - /**Called right when the fluid is mixed with an object. This is the last chance to cancel the mixing. As well this can be used to cause a different outcome */ - public static class MixEvent extends FluidMixingEvent - { - public final Object input; - public Object output; - - public MixEvent(World world, Vector3 vec, FluidStack fluid, Object input, Object output) - { - super(fluid, world, vec); - this.input = input; - this.output = output; - } - - } - - /** Called when a mixer has gone threw all the recipes and not found one for the fluid and input. - * Use this to hook into this can create a new recipe without registering it with the mixing - * class */ - public static class MixingRecipeCall extends FluidMixingEvent - { - public final Object input; - public Object output; - - public MixingRecipeCall(World world, Vector3 vec, FluidStack fluid, Object input) - { - super(fluid, world, vec); - this.input = input; - } - } - - public static final void fireEvent(FluidMixingEvent event) - { - MinecraftForge.EVENT_BUS.post(event); - } - -} diff --git a/src/dark/api/events/LaserEvent.java b/src/dark/api/events/LaserEvent.java deleted file mode 100644 index 85fbb3411..000000000 --- a/src/dark/api/events/LaserEvent.java +++ /dev/null @@ -1,280 +0,0 @@ -package dark.api.events; - -import java.util.ArrayList; -import java.util.List; - -import com.dark.helpers.ItemWorldHelper; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityTNTPrimed; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; -import net.minecraftforge.common.IPlantable; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.Cancelable; -import net.minecraftforge.event.Event; -import universalelectricity.core.vector.Vector3; -import dark.core.basics.EnumTool; - -/** An event triggered by entities or tiles that create lasers - * - * @author DarkGuardsman */ -public class LaserEvent extends Event -{ - public World world; - public Vector3 spot; - public Vector3 target; - - public LaserEvent(World world, Vector3 spot, Vector3 target) - { - this.world = world; - this.spot = spot; - this.target = target; - } - - /** Called when a laser is fired */ - @Cancelable - public static class LaserFireEvent extends LaserEvent - { - public Object shooter; - - public LaserFireEvent(World world, Vector3 spot, Vector3 target, Object shooter) - { - super(world, spot, target); - this.shooter = shooter; - } - - public LaserFireEvent(TileEntity tileEntity, MovingObjectPosition hit) - { - super(tileEntity.worldObj, new Vector3(tileEntity), new Vector3(hit)); - this.shooter = tileEntity; - } - } - - /** Called when a player fires a laser. Use this to cancel a laser hit event */ - @Cancelable - public static class LaserFiredPlayerEvent extends LaserFireEvent - { - public ItemStack laserItem; - public MovingObjectPosition hit; - - public LaserFiredPlayerEvent(EntityPlayer player, MovingObjectPosition hit, ItemStack stack) - { - super(player.worldObj, new Vector3(player), new Vector3(hit), player); - this.laserItem = stack; - this.hit = hit; - } - } - - /** Called when a laser is heating up a block to be mined */ - public static class LaserMeltBlockEvent extends LaserEvent - { - public Object shooter; - - public LaserMeltBlockEvent(World world, Vector3 spot, Vector3 hit, Object shooter) - { - super(world, spot, hit); - this.shooter = shooter; - } - } - - /** Use this to change what drops when the laser finishes mining a block */ - public static class LaserDropItemEvent extends LaserEvent - { - public List items; - - public LaserDropItemEvent(World world, Vector3 spot, Vector3 hit, List items) - { - super(world, spot, hit); - this.items = items; - } - } - - /** Called before a laser mines a block */ - @Cancelable - public static class LaserMineBlockEvent extends LaserEvent - { - public Object shooter; - - public LaserMineBlockEvent(World world, Vector3 spot, Vector3 hit, Object shooter) - { - super(world, spot, hit); - this.shooter = shooter; - } - - } - - public static boolean doLaserHarvestCheck(World world, Vector3 pos, Object player, Vector3 hit) - { - LaserEvent event = new LaserMineBlockEvent(world, pos, hit, player); - MinecraftForge.EVENT_BUS.post(event); - return !event.isCanceled(); - } - - /** Called while the block is being mined */ - public static void onLaserHitBlock(World world, Object player, Vector3 vec, ForgeDirection side) - { - int id = vec.getBlockID(world); - int meta = vec.getBlockID(world); - Block block = Block.blocksList[id]; - - Vector3 faceVec = vec.clone().modifyPositionFromSide(side); - int id2 = faceVec.getBlockID(world); - Block block2 = Block.blocksList[id2]; - - Vector3 start = null; - - if (player instanceof Entity) - { - start = new Vector3((Entity) player); - } - else if (player instanceof TileEntity) - { - start = new Vector3((TileEntity) player); - } - if (block != null) - { - float chance = world.rand.nextFloat(); - - int fireChance = block.getFlammability(world, vec.intX(), vec.intY(), vec.intZ(), meta, side); - if ((fireChance / 300) >= chance && (block2 == null || block2.isAirBlock(world, vec.intX(), vec.intY(), vec.intZ()))) - { - world.setBlock(vec.intX(), vec.intY(), vec.intZ(), Block.fire.blockID, 0, 3); - return; - } - if (block.blockID == Block.grass.blockID && (block2 == null || block2.isAirBlock(world, vec.intX(), vec.intY() + 1, vec.intZ()))) - { - world.setBlock(vec.intX(), vec.intY() + 1, vec.intZ(), Block.fire.blockID, 0, 3); - world.setBlock(vec.intX(), vec.intY(), vec.intZ(), Block.dirt.blockID, 0, 3); - return; - } - if (chance > 0.8f) - { - //TODO turn water into steam - if (block.blockID == Block.sand.blockID) - { - world.setBlock(vec.intX(), vec.intY(), vec.intZ(), Block.glass.blockID, 0, 3); - return; - } - else if (block.blockID == Block.cobblestone.blockID) - { - world.setBlock(vec.intX(), vec.intY(), vec.intZ(), 1, 0, 3); - return; - } - else if (block.blockID == Block.ice.blockID) - { - world.setBlock(vec.intX(), vec.intY(), vec.intZ(), Block.waterStill.blockID, 15, 3); - return; - } - else if (block.blockID == Block.obsidian.blockID) - { - world.setBlock(vec.intX(), vec.intY(), vec.intZ(), Block.lavaStill.blockID, 15, 3); - return; - } - } - MinecraftForge.EVENT_BUS.post(new LaserEvent.LaserMeltBlockEvent(world, start, vec, player)); - } - } - - /** Called when the block is actually mined */ - public static void onBlockMinedByLaser(World world, Object player, Vector3 vec) - { - int id = vec.getBlockID(world); - int meta = vec.getBlockID(world); - Block block = Block.blocksList[id]; - - Vector3 start = null; - if (player instanceof Entity) - { - start = new Vector3((Entity) player); - } - else if (player instanceof TileEntity) - { - start = new Vector3((TileEntity) player); - } - - //TODO make this use or call to the correct methods, and events so it can be canceled - if (block != null && block.getBlockHardness(world, vec.intX(), vec.intY(), vec.intZ()) >= 0 && doLaserHarvestCheck(world, start, player, vec)) - { - try - { - - Block blockBellow = Block.blocksList[vec.clone().modifyPositionFromSide(ForgeDirection.DOWN).getBlockID(world)]; - if (block != null) - { - if (block.blockID == Block.tnt.blockID) - { - world.setBlock(vec.intX(), vec.intY(), vec.intZ(), 0, 0, 3); - EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (vec.intX() + 0.5F), (vec.intY() + 0.5F), (vec.intZ() + 0.5F), player instanceof EntityLivingBase ? ((EntityLivingBase) player) : null); - entitytntprimed.fuse = world.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8; - world.spawnEntityInWorld(entitytntprimed); - return; - } - if (EnumTool.AX.effecticVsMaterials.contains(block.blockMaterial) || block.blockMaterial == Material.plants || block.blockMaterial == Material.pumpkin || block.blockMaterial == Material.cloth || block.blockMaterial == Material.web) - { - if (blockBellow != null && blockBellow.blockID == Block.tilledField.blockID && block instanceof IPlantable) - { - vec.clone().translate(new Vector3(0, -1, 0)).setBlock(world, Block.dirt.blockID, 0, 3); - } - vec.setBlock(world, Block.fire.blockID, 0, 3); - return; - } - List items = block.getBlockDropped(world, vec.intX(), vec.intY(), vec.intZ(), meta, 1); - if (items == null) - { - items = new ArrayList(); - } - //TODO have glass refract the laser causing it to hit random things - if (id == Block.glass.blockID) - { - items.add(new ItemStack(Block.glass, 1, meta)); - } - if (id == Block.thinGlass.blockID) - { - items.add(new ItemStack(Block.thinGlass, 1)); - } - List removeList = new ArrayList(); - for (int i = 0; i < items.size(); i++) - { - if (items.get(i).itemID == Block.wood.blockID) - { - items.set(i, new ItemStack(Item.coal, 1, 1)); - } - else if (items.get(i).itemID == Block.wood.blockID) - { - if (world.rand.nextFloat() < .25f) - { - items.set(i, new ItemStack(Item.coal, 1, 1)); - } - else - { - removeList.add(items.get(i)); - } - } - } - items.removeAll(removeList); - LaserEvent.LaserDropItemEvent event = new LaserEvent.LaserDropItemEvent(world, start, vec, items); - MinecraftForge.EVENT_BUS.post(event); - items = event.items; - for (ItemStack stack : items) - { - ItemWorldHelper.dropItemStack(world, vec.translate(0.5), stack, false); - } - } - } - catch (Exception e) - { - e.printStackTrace(); - } - world.setBlockToAir(vec.intX(), vec.intY(), vec.intZ()); - } - } -} diff --git a/src/dark/core/basics/EnumMaterial.java b/src/dark/core/basics/EnumMaterial.java deleted file mode 100644 index b55c93e66..000000000 --- a/src/dark/core/basics/EnumMaterial.java +++ /dev/null @@ -1,213 +0,0 @@ -package dark.core.basics; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.item.EnumToolMaterial; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import dark.machines.CoreRecipeLoader; - -/** Class for storing materials, there icon names, sub items to be made from them or there sub ores - * - * - * @author DarkGuardsman */ -public enum EnumMaterial -{ - WOOD("Wood", EnumToolMaterial.WOOD, EnumOrePart.INGOTS, EnumOrePart.PLATES, EnumOrePart.RUBBLE, EnumOrePart.ROD, EnumOrePart.GEARS, EnumOrePart.MOLTEN), - STONE("Stone", EnumToolMaterial.STONE, EnumOrePart.INGOTS, EnumOrePart.SCRAPS, EnumOrePart.MOLTEN), - IRON("Iron", EnumToolMaterial.IRON, EnumOrePart.INGOTS), - OBBY("Obby", true, 7.0f, 500, 4, EnumOrePart.INGOTS, EnumOrePart.RUBBLE, EnumOrePart.SCRAPS, EnumOrePart.PLATES, EnumOrePart.MOLTEN), - GOLD("Gold", EnumToolMaterial.GOLD, EnumOrePart.GEARS, EnumOrePart.INGOTS), - COAL("Coal", EnumToolMaterial.WOOD, EnumOrePart.GEARS, EnumOrePart.TUBE, EnumOrePart.PLATES, EnumOrePart.RUBBLE, EnumOrePart.SCRAPS, EnumOrePart.MOLTEN), - - COPPER("Copper", true, 3.5f, 79, 1), - TIN("Tin", true, 2.0f, 50, 1, EnumOrePart.GEARS, EnumOrePart.TUBE), - LEAD("Lead", false, 0, 0, 1, EnumOrePart.GEARS, EnumOrePart.TUBE), - ALUMINIUM("Aluminum", true, 5.0f, 100, 2, EnumOrePart.GEARS, EnumOrePart.TUBE), - SILVER("Silver", true, 11.0f, 30, 0, EnumOrePart.GEARS), - STEEL("Steel", true, 7.0f, 4, 1000, EnumOrePart.RUBBLE), - BRONZE("Bronze", true, 6.5f, 3, 560, EnumOrePart.RUBBLE); - - /** Name of the material */ - public String simpleName; - /** List of ore parts that to not be created for the material */ - public List unneedItems; - - public boolean hasTools = false; - - /** Limit by which each material is restricted by for creating orePart sub items */ - public static final int itemCountPerMaterial = 50; - public static final int toolCountPerMaterial = 10; - - /** Client side only var used by ore items to store icon per material set */ - @SideOnly(Side.CLIENT) - Icon[] itemIcons; - - @SideOnly(Side.CLIENT) - Icon[] toolIcons; - - public float materialEffectiveness = 2.0f; - public int maxUses = 100; - public float damageBoost = 0; - - private EnumMaterial(String name, EnumToolMaterial material, EnumOrePart... enumOreParts) - { - this(name, false, material.getEfficiencyOnProperMaterial(), material.getMaxUses(), material.getDamageVsEntity(), enumOreParts); - } - - private EnumMaterial(String name, boolean tool, float effectiveness, int toolUses, float damage, EnumOrePart... enumOreParts) - { - this.simpleName = name; - this.hasTools = tool; - this.materialEffectiveness = effectiveness; - this.maxUses = toolUses; - this.damageBoost = damage; - unneedItems = new ArrayList(); - for (int i = 0; enumOreParts != null && i < enumOreParts.length; i++) - { - unneedItems.add(enumOreParts[i]); - } - } - - /** Creates a new item stack using material and part given. Uses a preset length of 50 for parts - * enum so to prevent any unwanted changes in loading of itemStacks metadata. - * - * @param mat - material - * @param part - part - * @return new ItemStack created from the two enums as long as everything goes right */ - public static ItemStack getStack(Item item, EnumMaterial mat, EnumOrePart part, int ammount) - { - ItemStack reStack = null; - if (mat != null && part != null) - { - if (part == EnumOrePart.INGOTS) - { - if (mat == EnumMaterial.IRON) - { - return new ItemStack(Item.ingotIron, 1); - } - else if (mat == EnumMaterial.GOLD) - { - return new ItemStack(Item.ingotGold, 1); - } - } - int meta = mat.ordinal() * itemCountPerMaterial; - meta += part.ordinal(); - return new ItemStack(item, ammount, meta); - } - return reStack; - } - - public static ItemStack getStack(EnumMaterial mat, EnumOrePart part, int ammount) - { - return getStack(CoreRecipeLoader.itemMetals, mat, part, ammount); - } - - public ItemStack getStack(EnumOrePart part) - { - return this.getStack(part, 1); - } - - public ItemStack getStack(EnumOrePart part, int ammount) - { - return getStack(this, part, ammount); - } - - public ItemStack getStack(Item item, EnumOrePart part) - { - return this.getStack(item, part, 1); - } - - public ItemStack getStack(Item item, EnumOrePart part, int ammount) - { - return getStack(item, this, part, ammount); - } - - public static Icon getIcon(int metadata) - { - int mat = metadata / EnumMaterial.itemCountPerMaterial; - if (mat < EnumMaterial.values().length) - { - return EnumMaterial.values()[metadata / EnumMaterial.itemCountPerMaterial].itemIcons[metadata % EnumMaterial.itemCountPerMaterial]; - } - return null; - } - - public static Icon getToolIcon(int metadata) - { - int mat = getToolMatFromMeta(metadata).ordinal(); - int tool = getToolFromMeta(metadata).ordinal(); - if (mat < EnumMaterial.values().length) - { - if (EnumMaterial.values()[mat].toolIcons == null) - { - EnumMaterial.values()[mat].toolIcons = new Icon[toolCountPerMaterial]; - } - if (tool < EnumMaterial.values()[mat].toolIcons.length) - { - return EnumMaterial.values()[mat].toolIcons[tool]; - } - } - return null; - } - - public static String getOreName(EnumMaterial mat, EnumOrePart part) - { - return mat.getOreName(part); - } - - public String getOreName(EnumOrePart part) - { - return this.simpleName.toLowerCase() + part.simpleName; - } - - public static String getOreNameReverse(EnumMaterial mat, EnumOrePart part) - { - return mat.getOreNameReverse(part); - } - - public String getOreNameReverse(EnumOrePart part) - { - return part.simpleName.toLowerCase() + this.simpleName; - } - - public boolean shouldCreateItem(EnumOrePart part) - { - return this.unneedItems == null || !this.unneedItems.contains(part); - } - - public boolean shouldCreateTool() - { - return this.hasTools; - } - - public static ItemStack getTool(EnumTool tool, EnumMaterial mat) - { - return mat.getTool(tool); - } - - public ItemStack getTool(EnumTool tool) - { - ItemStack stack = null; - if (CoreRecipeLoader.itemDiggingTool instanceof ItemCommonTool) - { - stack = new ItemStack(CoreRecipeLoader.itemDiggingTool.itemID, 1, (this.ordinal() * toolCountPerMaterial) + tool.ordinal()); - } - return stack; - } - - public static EnumTool getToolFromMeta(int meta) - { - return EnumTool.values()[meta % toolCountPerMaterial]; - } - - public static EnumMaterial getToolMatFromMeta(int meta) - { - return EnumMaterial.values()[meta / EnumMaterial.toolCountPerMaterial]; - } - -} diff --git a/src/dark/core/basics/EnumOrePart.java b/src/dark/core/basics/EnumOrePart.java deleted file mode 100644 index 913ed6854..000000000 --- a/src/dark/core/basics/EnumOrePart.java +++ /dev/null @@ -1,43 +0,0 @@ -package dark.core.basics; - -public enum EnumOrePart -{ - - RUBBLE("Rubble"), - DUST("Dust"), - INGOTS("Ingot"), - PLATES("Plate"), - GEARS("Gears"), - TUBE("Tube"), - ROD("Rod"), - SCRAPS("Scraps"), - MOLTEN("Molten"); - - public String simpleName; - - private EnumOrePart(String name) - { - this.simpleName = name; - } - - public static String getPartName(int meta) - { - int partID = meta % EnumMaterial.itemCountPerMaterial; - if (partID < EnumOrePart.values().length) - { - return EnumOrePart.values()[partID].simpleName; - } - return "Part[" + partID + "]"; - } - - public static String getFullName(int meta) - { - int matID = meta / EnumMaterial.itemCountPerMaterial; - int partID = meta % EnumMaterial.itemCountPerMaterial; - if (matID < EnumMaterial.values().length && partID < EnumOrePart.values().length) - { - return EnumMaterial.values()[matID].simpleName + EnumOrePart.values()[partID].simpleName; - } - return "OrePart[" + matID + "][" + partID + "]"; - } -} diff --git a/src/dark/core/basics/ItemOreDirv.java b/src/dark/core/basics/ItemOreDirv.java deleted file mode 100644 index 0224fc2fd..000000000 --- a/src/dark/core/basics/ItemOreDirv.java +++ /dev/null @@ -1,164 +0,0 @@ -package dark.core.basics; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; -import net.minecraftforge.common.Configuration; -import net.minecraftforge.event.ForgeSubscribe; -import net.minecraftforge.oredict.OreDictionary; - -import com.dark.DarkCore; -import com.dark.IExtraInfo.IExtraItemInfo; -import com.dark.prefab.ItemBasic; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import dark.api.events.LaserEvent; -import dark.machines.CoreMachine; - -/** A series of items that are derived from a basic material - * - * @author DarkGuardsman */ -public class ItemOreDirv extends ItemBasic implements IExtraItemInfo -{ - public ItemOreDirv() - { - super(DarkCore.getNextItemId(), "Metal_Parts", CoreMachine.CONFIGURATION); - this.setHasSubtypes(true); - this.setCreativeTab(CreativeTabs.tabMaterials); - } - - @Override - public String getUnlocalizedName(ItemStack itemStack) - { - if (itemStack != null) - { - return "item." + CoreMachine.getInstance().PREFIX + EnumOrePart.getFullName(itemStack.getItemDamage()); - } - else - { - return this.getUnlocalizedName(); - } - } - - @Override - public Icon getIconFromDamage(int i) - { - return EnumMaterial.getIcon(i); - } - - @SideOnly(Side.CLIENT) - @Override - public void registerIcons(IconRegister iconRegister) - { - for (EnumMaterial mat : EnumMaterial.values()) - { - mat.itemIcons = new Icon[EnumOrePart.values().length]; - for (EnumOrePart part : EnumOrePart.values()) - { - if (mat.shouldCreateItem(part)) - { - mat.itemIcons[part.ordinal()] = iconRegister.registerIcon(CoreMachine.getInstance().PREFIX + mat.simpleName + part.simpleName); - } - } - } - } - - @Override - public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (EnumMaterial mat : EnumMaterial.values()) - { - for (EnumOrePart part : EnumOrePart.values()) - { - ItemStack stack = EnumMaterial.getStack(mat, part, 1); - if (stack != null && mat.shouldCreateItem(part) && mat.itemIcons[part.ordinal()] != null) - { - par3List.add(stack); - } - } - } - } - - @Override - public boolean hasExtraConfigs() - { - return false; - } - - @Override - public void loadExtraConfigs(Configuration config) - { - // TODO Auto-generated method stub - - } - - @Override - public void loadOreNames() - { - for (EnumMaterial mat : EnumMaterial.values()) - { - for (EnumOrePart part : EnumOrePart.values()) - { - if (mat.shouldCreateItem(part)) - { - System.out.println(" N: " + mat.getOreName(part) + " R:" + mat.getOreNameReverse(part)); - String B = mat.getOreNameReverse(part); - OreDictionary.registerOre(mat.getOreName(part), mat.getStack(this, part, 1)); - OreDictionary.registerOre(mat.getOreNameReverse(part), mat.getStack(this, part, 1)); - } - } - } - } - - @ForgeSubscribe - public void LaserSmeltEvent(LaserEvent.LaserDropItemEvent event) - { - if (event.items != null) - { - - for (int i = 0; i < event.items.size(); i++) - { - if (event.items.get(i).itemID == Block.blockIron.blockID) - { - event.items.set(i, EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.MOLTEN, event.items.get(i).stackSize * 9)); - } - else if (event.items.get(i).itemID == Block.blockGold.blockID) - { - event.items.set(i, EnumMaterial.getStack(EnumMaterial.GOLD, EnumOrePart.MOLTEN, event.items.get(i).stackSize * 9)); - } - else if (event.items.get(i).itemID == Block.oreIron.blockID) - { - event.items.set(i, EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.MOLTEN, event.items.get(i).stackSize)); - } - else if (event.items.get(i).itemID == Block.oreGold.blockID) - { - event.items.set(i, EnumMaterial.getStack(EnumMaterial.GOLD, EnumOrePart.MOLTEN, event.items.get(i).stackSize)); - } - - String oreName = OreDictionary.getOreName(OreDictionary.getOreID(event.items.get(i))); - - if (oreName != null) - { - for (EnumMaterial mat : EnumMaterial.values()) - { - if (oreName.equalsIgnoreCase("ore" + mat.simpleName) || oreName.equalsIgnoreCase(mat.simpleName + "ore")) - { - event.items.set(i, mat.getStack(EnumOrePart.MOLTEN, event.items.get(i).stackSize + 1 + event.world.rand.nextInt(3))); - break; - } - else if (oreName.equalsIgnoreCase("ingot" + mat.simpleName) || oreName.equalsIgnoreCase(mat.simpleName + "ingot")) - { - event.items.set(i, mat.getStack(EnumOrePart.MOLTEN, event.items.get(i).stackSize)); - break; - } - } - } - } - } - } -} diff --git a/src/dark/core/basics/ItemParts.java b/src/dark/core/basics/ItemParts.java deleted file mode 100644 index cb67fbc34..000000000 --- a/src/dark/core/basics/ItemParts.java +++ /dev/null @@ -1,138 +0,0 @@ -package dark.core.basics; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; -import net.minecraftforge.common.Configuration; -import net.minecraftforge.oredict.OreDictionary; - -import com.dark.DarkCore; -import com.dark.IExtraInfo.IExtraItemInfo; -import com.dark.prefab.ItemBasic; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import dark.machines.CoreMachine; - -/** A meta data item containing parts of various crafting recipes. These parts do not do anything but - * allow new crafting recipes to be created. - * - * @author DarkGuardsman */ -public class ItemParts extends ItemBasic implements IExtraItemInfo -{ - public ItemParts() - { - super(DarkCore.getNextItemId(), "DMParts", CoreMachine.CONFIGURATION); - this.setHasSubtypes(true); - this.setMaxDamage(0); - this.setMaxStackSize(64); - this.setCreativeTab(CreativeTabs.tabMaterials); - } - - @Override - public String getUnlocalizedName(ItemStack itemStack) - { - if (itemStack != null && itemStack.getItemDamage() < Parts.values().length) - { - return "item." + Parts.values()[itemStack.getItemDamage()].name; - } - return super.getUnlocalizedName(); - } - - @Override - @SideOnly(Side.CLIENT) - public Icon getIconFromDamage(int meta) - { - if (meta < Parts.values().length) - { - return Parts.values()[meta].icon; - } - return this.itemIcon; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IconRegister iconRegister) - { - super.registerIcons(iconRegister); - for (Parts part : Parts.values()) - { - part.icon = iconRegister.registerIcon(CoreMachine.getInstance().PREFIX + "part." + part.name); - } - } - - @Override - public int getMetadata(int meta) - { - return meta; - } - - @Override - public void getSubItems(int blockID, CreativeTabs tab, List itemStackList) - { - for (Parts part : Parts.values()) - { - if (part.show) - { - itemStackList.add(new ItemStack(this, 1, part.ordinal())); - } - } - } - - public static enum Parts - { - Seal("leatherSeal"), - GasSeal("gasSeal"), - Tank("unfinishedTank"), - Valve("valvePart"), - MiningIcon("miningIcon", false), - CircuitBasic("circuitBasic"), - CircuitAdvanced("circuitAdvanced"), - CircuitElite("circuitElite"), - Motor("motor"), - IC("ic_chip"), - COIL("copperCoil"), - LASER("laserDiode"); - - public String name; - public Icon icon; - boolean show = true; - - private Parts(String name) - { - this.name = name; - } - - private Parts(String name, boolean show) - { - this(name); - this.show = show; - } - } - - @Override - public boolean hasExtraConfigs() - { - return false; - } - - @Override - public void loadExtraConfigs(Configuration config) - { - // TODO Auto-generated method stub - - } - - @Override - public void loadOreNames() - { - for (Parts part : Parts.values()) - { - OreDictionary.registerOre(part.name, new ItemStack(this, 1, part.ordinal())); - } - - } -} diff --git a/src/dark/core/prefab/entities/EntityFakeBlock.java b/src/dark/core/prefab/entities/EntityFakeBlock.java deleted file mode 100644 index e60023205..000000000 --- a/src/dark/core/prefab/entities/EntityFakeBlock.java +++ /dev/null @@ -1,99 +0,0 @@ -package dark.core.prefab.entities; - -import net.minecraft.entity.Entity; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.Icon; -import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class EntityFakeBlock extends Entity -{ - - @SideOnly(Side.CLIENT) - public Icon texture; - public float shadowSize = 0; - public float rotationX = 0; - public float rotationY = 0; - public float rotationZ = 0; - public double iSize, jSize, kSize; - private int brightness = -1; - - public EntityFakeBlock(World world) - { - super(world); - preventEntitySpawning = false; - noClip = true; - isImmuneToFire = true; - } - - public EntityFakeBlock(World world, double xPos, double yPos, double zPos) - { - super(world); - setPositionAndRotation(xPos, yPos, zPos, 0, 0); - } - - public EntityFakeBlock(World world, double i, double j, double k, double iSize, double jSize, double kSize) - { - this(world); - this.iSize = iSize; - this.jSize = jSize; - this.kSize = kSize; - setPositionAndRotation(i, j, k, 0, 0); - this.motionX = 0.0; - this.motionY = 0.0; - this.motionZ = 0.0; - } - - @Override - public void setPosition(double d, double d1, double d2) - { - super.setPosition(d, d1, d2); - boundingBox.minX = posX; - boundingBox.minY = posY; - boundingBox.minZ = posZ; - - boundingBox.maxX = posX + iSize; - boundingBox.maxY = posY + jSize; - boundingBox.maxZ = posZ + kSize; - } - - @Override - public void moveEntity(double d, double d1, double d2) - { - setPosition(posX + d, posY + d1, posZ + d2); - } - - public void setBrightness(int brightness) - { - this.brightness = brightness; - } - - @Override - protected void entityInit() - { - // TODO Auto-generated method stub - } - - @Override - protected void readEntityFromNBT(NBTTagCompound data) - { - iSize = data.getDouble("iSize"); - jSize = data.getDouble("jSize"); - kSize = data.getDouble("kSize"); - } - - @Override - protected void writeEntityToNBT(NBTTagCompound data) - { - data.setDouble("iSize", iSize); - data.setDouble("jSize", jSize); - data.setDouble("kSize", kSize); - } - - @Override - public int getBrightnessForRender(float par1) - { - return brightness > 0 ? brightness : super.getBrightnessForRender(par1); - } -} diff --git a/src/dark/core/prefab/machine/BlockMachine.java b/src/dark/core/prefab/machine/BlockMachine.java deleted file mode 100644 index 1a6977429..000000000 --- a/src/dark/core/prefab/machine/BlockMachine.java +++ /dev/null @@ -1,184 +0,0 @@ -package dark.core.prefab.machine; - -import java.util.List; -import java.util.Set; - -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; -import net.minecraft.world.World; -import net.minecraftforge.common.Configuration; -import net.minecraftforge.oredict.OreDictionary; -import universalelectricity.prefab.block.BlockTile; - -import com.builtbroken.common.Pair; -import com.dark.DarkCore; -import com.dark.IExtraInfo.IExtraBlockInfo; -import com.dark.access.AccessUser; -import com.dark.access.ISpecialAccess; -import com.dark.tilenetwork.INetworkPart; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import dark.core.interfaces.IBlockActivated; -import dark.machines.CoreMachine; - -/** Basic TileEntity Container class designed to be used by generic machines. It is suggested that - * each mod using this create there own basic block extending this to reduce need to use build data - * per block. - * - * @author Darkguardsman */ -public abstract class BlockMachine extends BlockTile implements IExtraBlockInfo -{ - - public boolean zeroAnimation, zeroSound, zeroRendering; - public int guiID = -1; - - public Icon iconInput, iconOutput; - - public BlockMachine(Configuration config, String blockName, Material material) - { - super(config.getBlock(blockName, DarkCore.getNextID()).getInt(), material); - this.setUnlocalizedName(blockName); - this.setResistance(100f); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IconRegister iconReg) - { - this.blockIcon = iconReg.registerIcon(CoreMachine.getInstance().PREFIX + "machine"); - this.iconInput = iconReg.registerIcon(CoreMachine.getInstance().PREFIX + "machine_input"); - this.iconOutput = iconReg.registerIcon(CoreMachine.getInstance().PREFIX + "machine_output"); - } - - @Override - @SideOnly(Side.CLIENT) - public Icon getIcon(int side, int meta) - { - return this.blockIcon; - } - - @Override - public boolean isOpaqueCube() - { - return this.zeroRendering; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean renderAsNormalBlock() - { - return this.zeroRendering; - } - - /** 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 instanceof INetworkPart) - { - ((INetworkPart) tileEntity).refresh(); - } - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemStack) - { - TileEntity tile = world.getBlockTileEntity(x, y, z); - if (tile instanceof ISpecialAccess && entity instanceof EntityPlayer) - { - ((ISpecialAccess) tile).setUserAccess(new AccessUser((EntityPlayer) entity), ((ISpecialAccess) tile).getOwnerGroup()); - } - } - - @Override - public void onNeighborBlockChange(World world, int x, int y, int z, int blockID) - { - super.onNeighborBlockChange(world, x, y, z, blockID); - TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - - if (tileEntity instanceof INetworkPart) - { - ((INetworkPart) tileEntity).refresh(); - } - } - - @Override - public void breakBlock(World world, int x, int y, int z, int par5, int par6) - { - super.breakBlock(world, x, y, z, par5, par6); - world.notifyBlockChange(x, y, z, world.getBlockId(x, y, z)); - } - - @Override - public int getComparatorInputOverride(World world, int x, int y, int z, int side) - { - TileEntity entity = world.getBlockTileEntity(x, y, z); - if (entity instanceof IInventory) - { - return Container.calcRedstoneFromInventory((IInventory) entity); - } - return 0; - } - - @Override - public TileEntity createTileEntity(World world, int metadata) - { - return super.createTileEntity(world, metadata); - } - - @Override - public void getTileEntities(int blockID, Set>> list) - { - - } - - @Override - @SideOnly(Side.CLIENT) - public void getClientTileEntityRenderers(List, TileEntitySpecialRenderer>> list) - { - - } - - @Override - public boolean hasExtraConfigs() - { - return true; - } - - @Override - public void loadExtraConfigs(Configuration config) - { - this.zeroAnimation = config.get("Effects--Not_Supported_By_All_Blocks", "disableAnimation", false, "Turns off animations of the block").getBoolean(false); - this.zeroRendering = config.get("Effects--Not_Supported_By_All_Blocks", "disableRender", false, "Turns off the block render replacing it with a normal block").getBoolean(false); - this.zeroSound = config.get("Effects--Not_Supported_By_All_Blocks", "disableSound", false, "Turns of sound of the block for any of its actions").getBoolean(false); - } - - @Override - public void loadOreNames() - { - OreDictionary.registerOre(this.getUnlocalizedName().replace("tile.", ""), this); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) - { - TileEntity entity = world.getBlockTileEntity(x, y, z); - if (entity instanceof IBlockActivated && ((IBlockActivated) entity).onActivated(entityPlayer)) - { - return true; - } - return super.onBlockActivated(world, x, y, z, entityPlayer, side, hitX, hitY, hitZ); - } - -} diff --git a/src/dark/machines/CoreMachine.java b/src/dark/machines/CoreMachine.java index 364f4d1ec..d3853a0d2 100644 --- a/src/dark/machines/CoreMachine.java +++ b/src/dark/machines/CoreMachine.java @@ -1,28 +1,22 @@ package dark.machines; -import java.awt.Color; import java.io.File; import java.util.Arrays; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.oredict.OreDictionary; import universalelectricity.prefab.TranslationHelper; import universalelectricity.prefab.ore.OreGenReplaceStone; import universalelectricity.prefab.ore.OreGenerator; import com.dark.CoreRegistry; import com.dark.DarkCore; -import com.dark.IndustryTabs; import com.dark.fluid.EnumGas; import com.dark.network.PacketDataWatcher; import com.dark.network.PacketHandler; -import com.dark.prefab.BlockMulti; import com.dark.prefab.ItemBlockHolder; import cpw.mods.fml.common.FMLCommonHandler; @@ -43,21 +37,10 @@ import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; -import dark.api.reciepes.MachineRecipeHandler; -import dark.core.basics.BlockGasOre; -import dark.core.basics.BlockOre; -import dark.core.basics.BlockOre.OreData; -import dark.core.basics.EnumMaterial; -import dark.core.basics.EnumOrePart; -import dark.core.basics.GasOreGenerator; -import dark.core.basics.ItemBlockOre; -import dark.core.basics.ItemCommonTool; -import dark.core.basics.ItemOreDirv; -import dark.core.basics.ItemParts; -import dark.core.basics.ItemParts.Parts; -import dark.core.prefab.ModPrefab; -import dark.core.prefab.entities.EntityTestCar; -import dark.core.prefab.entities.ItemVehicleSpawn; +import dark.machines.blocks.BlockGasOre; +import dark.machines.blocks.BlockOre; +import dark.machines.blocks.BlockOre.OreData; +import dark.machines.blocks.GasOreGenerator; import dark.machines.deco.BlockBasalt; import dark.machines.deco.BlockColorGlass; import dark.machines.deco.BlockColorGlowGlass; @@ -66,13 +49,17 @@ import dark.machines.deco.ItemBlockColored; import dark.machines.generators.BlockSmallSteamGen; import dark.machines.generators.BlockSolarPanel; import dark.machines.items.ItemBattery; +import dark.machines.items.ItemBlockOre; import dark.machines.items.ItemColoredDust; -import dark.machines.items.ItemFluidCan; +import dark.machines.items.ItemCommonTool; import dark.machines.items.ItemReadoutTools; import dark.machines.items.ItemWrench; import dark.machines.machines.BlockDebug; import dark.machines.machines.BlockEnergyStorage; import dark.machines.machines.ItemBlockEnergyStorage; +import dark.machines.prefab.ModPrefab; +import dark.machines.prefab.entities.EntityTestCar; +import dark.machines.prefab.entities.ItemVehicleSpawn; import dark.machines.transmit.BlockWire; import dark.machines.transmit.ItemBlockWire; @@ -110,7 +97,7 @@ public class CoreMachine extends ModPrefab private static CoreMachine instance; public static CoreRecipeLoader recipeLoader; - + public static CoreMachine getInstance() { if (instance == null) @@ -165,17 +152,7 @@ public class CoreMachine extends ModPrefab } } } - if (CoreRecipeLoader.itemParts != null) - { - for (Parts part : Parts.values()) - { - OreDictionary.registerOre(part.name, new ItemStack(CoreRecipeLoader.itemParts, 1, part.ordinal())); - } - } - if (CoreRecipeLoader.itemMetals != null) - { - MinecraftForge.EVENT_BUS.register(CoreRecipeLoader.itemMetals); - } + FMLLog.info(" Loaded: " + TranslationHelper.loadLanguages(DarkCore.LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " Languages."); proxy.init(); } @@ -186,17 +163,6 @@ public class CoreMachine extends ModPrefab { super.postInit(event); proxy.postInit(); - if (CoreRecipeLoader.itemParts instanceof ItemParts) - { - IndustryTabs.tabMining().itemStack = new ItemStack(CoreRecipeLoader.itemParts.itemID, 1, ItemParts.Parts.MiningIcon.ordinal()); - } - if (CoreRecipeLoader.itemMetals instanceof ItemOreDirv) - { - IndustryTabs.tabIndustrial().itemStack = EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.GEARS, 1); - CoreRecipeLoader.parseOreNames(CONFIGURATION); - } - - CONFIGURATION.save(); } @Override @@ -215,7 +181,7 @@ public class CoreMachine extends ModPrefab CoreMachine.zeroRendering = CONFIGURATION.get("Graphics", "DisableAllRendering", false, "Replaces all model renderers with single block forms").getBoolean(false); CoreMachine.zeroGraphics = CONFIGURATION.get("Graphics", "DisableAllGraphics", false, "Disables extra effects that models and renders have. Such as particles, and text").getBoolean(false); } - /* BLOCKS */ + /* BLOCKS */ CoreRecipeLoader.blockSteamGen = CoreRegistry.createNewBlock("DMBlockSteamMachine", CoreMachine.MOD_ID, BlockSmallSteamGen.class, ItemBlockHolder.class); CoreRecipeLoader.blockOre = CoreRegistry.createNewBlock("DMBlockOre", CoreMachine.MOD_ID, BlockOre.class, ItemBlockOre.class); CoreRecipeLoader.blockWire = CoreRegistry.createNewBlock("DMBlockWire", CoreMachine.MOD_ID, BlockWire.class, ItemBlockWire.class); @@ -230,15 +196,12 @@ public class CoreMachine extends ModPrefab /* ITEMS */ CoreRecipeLoader.itemTool = CoreRegistry.createNewItem("DMReadoutTools", CoreMachine.MOD_ID, ItemReadoutTools.class, true); - CoreRecipeLoader.itemMetals = CoreRegistry.createNewItem("DMOreDirvParts", CoreMachine.MOD_ID, ItemOreDirv.class, true); CoreRecipeLoader.battery = CoreRegistry.createNewItem("DMItemBattery", CoreMachine.MOD_ID, ItemBattery.class, true); CoreRecipeLoader.wrench = CoreRegistry.createNewItem("DMWrench", CoreMachine.MOD_ID, ItemWrench.class, true); - CoreRecipeLoader.itemParts = CoreRegistry.createNewItem("DMCraftingParts", CoreMachine.MOD_ID, ItemParts.class, true); CoreRecipeLoader.itemGlowingSand = CoreRegistry.createNewItem("DMItemGlowingSand", CoreMachine.MOD_ID, ItemColoredDust.class, true); CoreRecipeLoader.itemDiggingTool = CoreRegistry.createNewItem("ItemDiggingTools", CoreMachine.MOD_ID, ItemCommonTool.class, true); CoreRecipeLoader.itemVehicleTest = CoreRegistry.createNewItem("ItemVehicleTest", CoreMachine.MOD_ID, ItemVehicleSpawn.class, true); - CoreRecipeLoader.itemFluidCan = CoreRegistry.createNewItem("ItemFluidCan", CoreMachine.MOD_ID, ItemFluidCan.class, true); - //Config saves in post init to allow for other feature to access it + CONFIGURATION.save(); } diff --git a/src/dark/machines/CoreRecipeLoader.java b/src/dark/machines/CoreRecipeLoader.java index 8b09ca08f..275ca0095 100644 --- a/src/dark/machines/CoreRecipeLoader.java +++ b/src/dark/machines/CoreRecipeLoader.java @@ -2,8 +2,6 @@ package dark.machines; import java.util.List; -import com.dark.prefab.RecipeLoader; - import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -11,22 +9,20 @@ import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraftforge.common.Configuration; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; + +import com.dark.EnumMaterial; +import com.dark.EnumOrePart; +import com.dark.helpers.ColorCode; +import com.dark.interfaces.IToolReadOut.EnumTools; +import com.dark.prefab.RecipeLoader; + import cpw.mods.fml.common.registry.GameRegistry; -import dark.api.ColorCode; -import dark.api.IToolReadOut.EnumTools; import dark.api.reciepes.MachineRecipeHandler; import dark.api.reciepes.ProcessorType; -import dark.core.basics.BlockOre; -import dark.core.basics.BlockOre.OreData; -import dark.core.basics.EnumMaterial; -import dark.core.basics.EnumOrePart; -import dark.core.basics.EnumTool; -import dark.core.basics.ItemCommonTool; -import dark.core.basics.ItemOreDirv; -import dark.core.basics.ItemParts; -import dark.core.basics.ItemParts.Parts; import dark.machines.deco.BlockBasalt; import dark.machines.generators.BlockSolarPanel; +import dark.machines.items.EnumTool; +import dark.machines.items.ItemCommonTool; import dark.machines.items.ItemReadoutTools; import dark.machines.items.ItemWrench; import dark.machines.transmit.BlockWire; @@ -44,17 +40,14 @@ public class CoreRecipeLoader extends RecipeLoader public static Block blockGas; /* ITEMS */ - public static Item itemMetals, battery, itemTool, itemParts; + public static Item battery; public static Item wrench; - public static ItemStack leatherSeal, slimeSeal; - public static ItemStack valvePart; - public static ItemStack unfinishedTank; public static Item itemGlowingSand; public static Item itemDiggingTool; public static Item itemVehicleTest; - public static Item itemFluidCan; public static boolean debugOreItems = false; + public static Item itemTool; @Override public void loadRecipes() @@ -79,169 +72,19 @@ public class CoreRecipeLoader extends RecipeLoader } if (itemDiggingTool instanceof ItemCommonTool) { + for (EnumMaterial mat : EnumMaterial.values()) { if (mat.shouldCreateTool()) { - GameRegistry.addRecipe(new ShapedOreRecipe(mat.getTool(EnumTool.PICKAX), "III", " S ", " S ", 'I', mat.getOreName(EnumOrePart.INGOTS), 'S', Item.stick)); - GameRegistry.addRecipe(new ShapedOreRecipe(mat.getTool(EnumTool.HOE), "II ", " S ", " S ", 'I', mat.getOreName(EnumOrePart.INGOTS), 'S', Item.stick)); - GameRegistry.addRecipe(new ShapedOreRecipe(mat.getTool(EnumTool.SPADE), " I ", " S ", " S ", 'I', mat.getOreName(EnumOrePart.INGOTS), 'S', Item.stick)); - GameRegistry.addRecipe(new ShapedOreRecipe(mat.getTool(EnumTool.AX), "II ", "IS ", " S ", 'I', mat.getOreName(EnumOrePart.INGOTS), 'S', Item.stick)); + GameRegistry.addRecipe(new ShapedOreRecipe(EnumTool.PICKAX.getTool(mat), "III", " S ", " S ", 'I', mat.getOreName(EnumOrePart.INGOTS), 'S', Item.stick)); + GameRegistry.addRecipe(new ShapedOreRecipe(EnumTool.HOE.getTool(mat), "II ", " S ", " S ", 'I', mat.getOreName(EnumOrePart.INGOTS), 'S', Item.stick)); + GameRegistry.addRecipe(new ShapedOreRecipe(EnumTool.SPADE.getTool(mat), " I ", " S ", " S ", 'I', mat.getOreName(EnumOrePart.INGOTS), 'S', Item.stick)); + GameRegistry.addRecipe(new ShapedOreRecipe(EnumTool.AX.getTool(mat), "II ", "IS ", " S ", 'I', mat.getOreName(EnumOrePart.INGOTS), 'S', Item.stick)); //GameRegistry.addRecipe(new ShapedOreRecipe(mat.getTool(EnumTool.SHEAR), "III", " S ", 'I', mat.getStack(EnumOrePart.INGOTS, 1))); } } } - this.loadParts(); - } - - public void loadParts() - { - if (itemParts instanceof ItemParts) - { - leatherSeal = new ItemStack(itemParts, 1, Parts.Seal.ordinal()); - slimeSeal = new ItemStack(itemParts, 1, Parts.GasSeal.ordinal()); - valvePart = new ItemStack(itemParts, 1, Parts.Tank.ordinal()); - unfinishedTank = new ItemStack(itemParts, 1, Parts.Tank.ordinal()); - - // seal - GameRegistry.addRecipe(this.setStackSize(leatherSeal, 16), new Object[] { "LL", "LL", 'L', Item.leather }); - // slime steal - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 4, Parts.GasSeal.ordinal()), " # ", "#S#", " # ", '#', Parts.Seal.name, 'S', Item.slimeBall)); - // part valve - GameRegistry.addRecipe(new ShapedOreRecipe(valvePart, new Object[] { "PLP", 'P', "ironPipe", 'L', Block.lever })); - //Basic Circuit - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.CircuitBasic.ordinal()), "!#!", "#@#", "!#!", '@', copperPlate, '#', Block.glass, '!', "copperWire")); - //Advanced Circuit - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.CircuitAdvanced.ordinal()), "!#!", "#@#", "!#!", '@', copperPlate, '#', Item.redstone, '!', "copperWire")); - //Elite Circuit - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.CircuitElite.ordinal()), "!#!", "#@#", "!#!", '@', "plateGold", '#', Item.redstone, '!', "copperWire")); - - // unfinished tank - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.Tank.ordinal()), " # ", "# #", " # ", '#', bronze)); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.Tank.ordinal()), " # ", "# #", " # ", '#', steel)); - //Motor - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.Motor.ordinal()), new Object[] { "@!@", "!#!", "@!@", '!', steel, '#', Item.ingotIron, '@', new ItemStack(itemParts, 8, Parts.COIL.ordinal()) })); - //Laser Diode - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 4, Parts.LASER.ordinal()), new Object[] { " G ", "!S!", " C ", '!', "copperWire", 'G', Block.glass, 'S', Block.sand, 'C', RecipeLoader.circuit })); - //Coil - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 8, Parts.COIL.ordinal()), new Object[] { "WWW", "W W", "WWW", 'W', "copperWire" })); - - } - - if (itemMetals instanceof ItemOreDirv) - { - //Alt salvaging item list - MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, Block.wood, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.DUST, 3)); - MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, Block.planks, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.DUST, 1)); - - MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Block.wood, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.SCRAPS, 3)); - MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Block.planks, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.SCRAPS, 1)); - - //Stone recipes - MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, Block.stone, EnumMaterial.getStack(EnumMaterial.STONE, EnumOrePart.DUST, 1)); - - //Wood recipes - MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, Block.wood, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.DUST, 3)); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, Block.planks, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.DUST, 1)); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.wood, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.SCRAPS, 3)); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.planks, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.SCRAPS, 1)); - - //Gold Recipes - MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.blockIron, EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.SCRAPS, 8)); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.oreIron, EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.RUBBLE, 1)); - //Iron Recipes - MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.blockGold, EnumMaterial.getStack(EnumMaterial.GOLD, EnumOrePart.SCRAPS, 8)); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.oreGold, EnumMaterial.getStack(EnumMaterial.GOLD, EnumOrePart.RUBBLE, 1)); - //Dust recipes - GameRegistry.addShapelessRecipe(EnumMaterial.getStack(EnumMaterial.STEEL, EnumOrePart.DUST, 1), new Object[] { EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.DUST, 1), new ItemStack(Item.coal, 1, 0), new ItemStack(Item.coal, 1, 0) }); - GameRegistry.addShapelessRecipe(EnumMaterial.getStack(EnumMaterial.STEEL, EnumOrePart.DUST, 1), new Object[] { EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.DUST, 1), new ItemStack(Item.coal, 1, 1), new ItemStack(Item.coal, 1, 1) }); - GameRegistry.addShapelessRecipe(EnumMaterial.getStack(EnumMaterial.STEEL, EnumOrePart.DUST, 1), new Object[] { EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.DUST, 1), new ItemStack(Item.coal, 1, 1), new ItemStack(Item.coal, 1, 0) }); - GameRegistry.addShapelessRecipe(EnumMaterial.getStack(EnumMaterial.BRONZE, EnumOrePart.DUST, 4), new Object[] { EnumMaterial.getStack(EnumMaterial.COPPER, EnumOrePart.DUST, 1), EnumMaterial.getStack(EnumMaterial.COPPER, EnumOrePart.DUST, 1), EnumMaterial.getStack(EnumMaterial.COPPER, EnumOrePart.DUST, 1), EnumMaterial.getStack(EnumMaterial.TIN, EnumOrePart.DUST, 1) }); - - if (debugOreItems) - { - System.out.println("\n\nTesting material part returns"); - for (EnumMaterial mat : EnumMaterial.values()) - { - System.out.println("\n-Material-> " + mat.simpleName); - for (EnumOrePart part : EnumOrePart.values()) - { - if (mat.shouldCreateItem(part)) - { - System.out.println("--Part-> " + part.simpleName); - System.out.println("----ItemStack-> " + mat.getStack(part, 1).toString()); - } - } - } - } - //Ore material recipe loop - for (EnumMaterial mat : EnumMaterial.values()) - { - //Dust recipes - if (mat.shouldCreateItem(EnumOrePart.DUST)) - { - FurnaceRecipes.smelting().addSmelting(mat.getStack(EnumOrePart.DUST, 1).itemID, mat.getStack(EnumOrePart.DUST, 1).getItemDamage(), mat.getStack(EnumOrePart.INGOTS, 1), 0.6f); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.RUBBLE, 1), mat.getStack(EnumOrePart.DUST, 1), 1, 4); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.SCRAPS, 1), mat.getStack(EnumOrePart.DUST, 1)); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.INGOTS, 1), mat.getStack(EnumOrePart.DUST, 1)); - MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, mat.getStack(EnumOrePart.INGOTS, 1), mat.getStack(EnumOrePart.DUST, 1)); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.PLATES, 1), mat.getStack(EnumOrePart.DUST, 1), 2, 4); - MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, mat.getStack(EnumOrePart.PLATES, 1), mat.getStack(EnumOrePart.DUST, 3)); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.ROD, 1), mat.getStack(EnumOrePart.DUST, 1)); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.TUBE, 1), mat.getStack(EnumOrePart.DUST, 1)); - } - - // Salvaging recipe - - if (mat.shouldCreateItem(EnumOrePart.SCRAPS)) - { - FurnaceRecipes.smelting().addSmelting(mat.getStack(EnumOrePart.SCRAPS, 1).itemID, mat.getStack(EnumOrePart.SCRAPS, 1).getItemDamage(), mat.getStack(EnumOrePart.INGOTS, 1), 0.6f); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.PLATES, 1), mat.getStack(EnumOrePart.SCRAPS, 3)); - MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.PLATES, 1), mat.getStack(EnumOrePart.SCRAPS, 3)); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.RUBBLE, 1), mat.getStack(EnumOrePart.SCRAPS, 1), 1, 5); - MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.INGOTS, 1), mat.getStack(EnumOrePart.SCRAPS, 1)); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.ROD, 1), mat.getStack(EnumOrePart.SCRAPS, 1)); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.TUBE, 1), mat.getStack(EnumOrePart.SCRAPS, 1)); - } - if (mat.shouldCreateItem(EnumOrePart.TUBE)) - { - GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(EnumOrePart.TUBE, 6), new Object[] { "I", "I", "I", 'I', mat.getOreName(EnumOrePart.INGOTS) })); - GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(EnumOrePart.TUBE, 6), new Object[] { "I", "I", "I", 'I', mat.getOreNameReverse(EnumOrePart.INGOTS) })); - GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(EnumOrePart.TUBE, 1), new Object[] { "I", 'I', mat.getOreName(EnumOrePart.ROD) })); - GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(EnumOrePart.TUBE, 1), new Object[] { "I", 'I', mat.getOreNameReverse(EnumOrePart.ROD) })); - } - if (mat.shouldCreateItem(EnumOrePart.ROD)) - { - GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(EnumOrePart.ROD, 4), new Object[] { "I", "I", 'I', mat.getOreName(EnumOrePart.ROD) })); - GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(EnumOrePart.ROD, 4), new Object[] { "I", "I", 'I', mat.getOreNameReverse(EnumOrePart.ROD) })); - } - if (mat.shouldCreateItem(EnumOrePart.PLATES)) - { - GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(EnumOrePart.PLATES, 1), new Object[] { "II", "II", 'I', mat.getOreName(EnumOrePart.INGOTS) })); - GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(EnumOrePart.PLATES, 1), new Object[] { "II", "II", 'I', mat.getOreNameReverse(EnumOrePart.INGOTS) })); - } - if (mat.shouldCreateItem(EnumOrePart.GEARS)) - { - GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(EnumOrePart.GEARS, 4), new Object[] { " I ", "IRI", " I ", 'I', mat.getOreName(EnumOrePart.INGOTS), 'R', mat.shouldCreateItem(EnumOrePart.ROD) ? mat.getOreName(EnumOrePart.ROD) : Item.stick })); - } - - } - } - - if (blockOre instanceof BlockOre) - { - for (OreData data : OreData.values()) - { - if (CoreRecipeLoader.itemMetals instanceof ItemOreDirv) - { - FurnaceRecipes.smelting().addSmelting(blockOre.blockID, data.ordinal(), EnumMaterial.getStack(data.mat, EnumOrePart.INGOTS, 1), 0.6f); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, new ItemStack(blockOre.blockID, 1, data.ordinal()), EnumMaterial.getStack(data.mat, EnumOrePart.RUBBLE, 1), 1, 2); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, new ItemStack(blockOre.blockID, 1, data.ordinal()), EnumMaterial.getStack(data.mat, EnumOrePart.DUST, 1), 1, 3); - - } - } - } - } public void loadStainGlass() @@ -299,91 +142,6 @@ public class CoreRecipeLoader extends RecipeLoader } } - - public static void parseOreNames(Configuration config) - { - if (config.get("Ore", "processOreDictionary", true, "Scans the ore dictionary and adds other mods ore to the machine recipes").getBoolean(true)) - { - for (EnumMaterial mat : EnumMaterial.values()) - { //Ingots - List ingots = OreDictionary.getOres("ingot" + mat.simpleName); - ingots.addAll(OreDictionary.getOres(mat.simpleName + "ingot")); - //plate - List plates = OreDictionary.getOres("plate" + mat.simpleName); - plates.addAll(OreDictionary.getOres(mat.simpleName + "plate")); - //ore - List ores = OreDictionary.getOres("ore" + mat.simpleName); - ores.addAll(OreDictionary.getOres(mat.simpleName + "ore")); - //dust - List dusts = OreDictionary.getOres("dust" + mat.simpleName); - dusts.addAll(OreDictionary.getOres(mat.simpleName + "dust")); - for (ItemStack du : dusts) - { - if (mat.shouldCreateItem(EnumOrePart.INGOTS) && config.get("Ore", "OverrideDustSmelthing", true, "Overrides other mods dust smelting so the ingots smelt as the same item.").getBoolean(true)) - { - FurnaceRecipes.smelting().addSmelting(du.itemID, du.getItemDamage(), mat.getStack(EnumOrePart.INGOTS, 1), 0.6f); - } - } - for (ItemStack ing : ingots) - { - if (mat.shouldCreateItem(EnumOrePart.DUST)) - { - MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, ing, mat.getStack(EnumOrePart.DUST, 1)); - MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, ing, mat.getStack(EnumOrePart.DUST, 1)); - } - if (mat.shouldCreateItem(EnumOrePart.SCRAPS)) - { - MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, ing, mat.getStack(EnumOrePart.SCRAPS, 1)); - MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, ing, mat.getStack(EnumOrePart.SCRAPS, 1)); - } - if (mat.shouldCreateItem(EnumOrePart.INGOTS)) - { - GameRegistry.addShapelessRecipe(mat.getStack(EnumOrePart.INGOTS, 1), new Object[] { ing }); - } - } - for (ItemStack pla : plates) - { - if (mat.shouldCreateItem(EnumOrePart.DUST)) - { - - MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, pla, mat.getStack(EnumOrePart.DUST, 1)); - MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, pla, mat.getStack(EnumOrePart.DUST, 1)); - - } - if (mat.shouldCreateItem(EnumOrePart.SCRAPS)) - { - - MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, pla, mat.getStack(EnumOrePart.SCRAPS, 1)); - MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, pla, mat.getStack(EnumOrePart.SCRAPS, 1)); - - } - if (mat.shouldCreateItem(EnumOrePart.PLATES)) - { - GameRegistry.addShapelessRecipe(mat.getStack(EnumOrePart.PLATES, 1), new Object[] { pla }); - if (config.get("Ore", "OverridePlateCrafting", true, "Overrides other mods metal plate crafting. As well creates new recipes for mod ingots without plate crafting.").getBoolean(true)) - { - GameRegistry.addShapelessRecipe(mat.getStack(EnumOrePart.INGOTS, 4), new Object[] { pla }); - } - } - } - for (ItemStack ore : ores) - { - if (mat.shouldCreateItem(EnumOrePart.RUBBLE)) - { - MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, ore, mat.getStack(EnumOrePart.RUBBLE, 1), 1, 2); - } - if (mat.shouldCreateItem(EnumOrePart.DUST)) - { - MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, ore, mat.getStack(EnumOrePart.DUST, 1), 1, 3); - } - if (mat.shouldCreateItem(EnumOrePart.INGOTS) && config.get("Ore", "OverrideOreSmelthing", true, "Overrides other mods smelting recipes for ingots").getBoolean(true)) - { - FurnaceRecipes.smelting().addSmelting(ore.itemID, ore.getItemDamage(), mat.getStack(EnumOrePart.INGOTS, 1), 0.6f); - } - } - - } - } - } + } diff --git a/src/dark/core/basics/BlockGasOre.java b/src/dark/machines/blocks/BlockGasOre.java similarity index 99% rename from src/dark/core/basics/BlockGasOre.java rename to src/dark/machines/blocks/BlockGasOre.java index 76cf3c350..a9842cc22 100644 --- a/src/dark/core/basics/BlockGasOre.java +++ b/src/dark/machines/blocks/BlockGasOre.java @@ -1,4 +1,4 @@ -package dark.core.basics; +package dark.machines.blocks; import java.awt.Color; import java.util.List; diff --git a/src/dark/core/basics/BlockOre.java b/src/dark/machines/blocks/BlockOre.java similarity index 98% rename from src/dark/core/basics/BlockOre.java rename to src/dark/machines/blocks/BlockOre.java index ae1088079..dc4d1c4a4 100644 --- a/src/dark/core/basics/BlockOre.java +++ b/src/dark/machines/blocks/BlockOre.java @@ -1,4 +1,4 @@ -package dark.core.basics; +package dark.machines.blocks; import java.util.List; import java.util.Set; @@ -18,6 +18,7 @@ import universalelectricity.prefab.ore.OreGenReplaceStone; import com.builtbroken.common.Pair; import com.dark.DarkCore; +import com.dark.EnumMaterial; import com.dark.IExtraInfo.IExtraBlockInfo; import cpw.mods.fml.relauncher.Side; diff --git a/src/dark/core/basics/GasOreGenerator.java b/src/dark/machines/blocks/GasOreGenerator.java similarity index 99% rename from src/dark/core/basics/GasOreGenerator.java rename to src/dark/machines/blocks/GasOreGenerator.java index d724aebac..f3620855c 100644 --- a/src/dark/core/basics/GasOreGenerator.java +++ b/src/dark/machines/blocks/GasOreGenerator.java @@ -1,4 +1,4 @@ -package dark.core.basics; +package dark.machines.blocks; import java.util.Random; diff --git a/src/dark/machines/client/ClientProxy.java b/src/dark/machines/client/ClientProxy.java index 7cdadee95..99f643243 100644 --- a/src/dark/machines/client/ClientProxy.java +++ b/src/dark/machines/client/ClientProxy.java @@ -5,7 +5,6 @@ import java.awt.Color; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import net.minecraftforge.client.MinecraftForgeClient; import universalelectricity.core.vector.Vector3; import com.dark.DarkCore; @@ -15,21 +14,19 @@ import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import dark.core.prefab.entities.EntityTestCar; import dark.machines.CommonProxy; -import dark.machines.CoreRecipeLoader; import dark.machines.client.gui.GuiBatteryBox; import dark.machines.client.renders.BlockRenderingHandler; -import dark.machines.client.renders.ItemRenderFluidCan; import dark.machines.client.renders.RenderTestCar; import dark.machines.machines.TileEntityBatteryBox; +import dark.machines.prefab.entities.EntityTestCar; @SideOnly(Side.CLIENT) public class ClientProxy extends CommonProxy { /** Renders a laser beam from one power to another by a set color for a set time - * + * * @param world - world this laser is to be rendered in * @param position - start vector3 * @param target - end vector3 @@ -54,8 +51,7 @@ public class ClientProxy extends CommonProxy public void init() { RenderingRegistry.registerBlockHandler(new BlockRenderingHandler()); - if (CoreRecipeLoader.itemFluidCan != null) - MinecraftForgeClient.registerItemRenderer(CoreRecipeLoader.itemFluidCan.itemID, new ItemRenderFluidCan()); + } @Override diff --git a/src/dark/machines/client/models/ModelSmallFluidCan.java b/src/dark/machines/client/models/ModelSmallFluidCan.java deleted file mode 100644 index 8113d4ff3..000000000 --- a/src/dark/machines/client/models/ModelSmallFluidCan.java +++ /dev/null @@ -1,126 +0,0 @@ -// Date: 11/27/2013 9:27:04 AM -// Template version 1.1 -// Java generated by Techne -// Keep in mind that you still need to fill in some blanks -// - ZeuX - -package dark.machines.client.models; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; - -public class ModelSmallFluidCan extends ModelBase -{ - //fields - ModelRenderer body1; - ModelRenderer body2; - ModelRenderer body3; - ModelRenderer body4; - ModelRenderer edge1; - ModelRenderer edge2; - ModelRenderer edge3; - ModelRenderer edge4; - ModelRenderer glass1; - ModelRenderer glass2; - ModelRenderer glass3; - ModelRenderer glass4; - - public ModelSmallFluidCan() - { - textureWidth = 64; - textureHeight = 32; - - body1 = new ModelRenderer(this, 12, 28); - body1.addBox(-1.5F, 0F, -1.5F, 3, 1, 3); - body1.setRotationPoint(0F, 23F, 0F); - body1.setTextureSize(64, 32); - body1.mirror = true; - setRotation(body1, 0F, 0F, 0F); - body2 = new ModelRenderer(this, 10, 22); - body2.addBox(-2F, -1F, -2F, 4, 1, 4); - body2.setRotationPoint(0F, 23F, 0F); - body2.setTextureSize(64, 32); - body2.mirror = true; - setRotation(body2, 0F, 0F, 0F); - body3 = new ModelRenderer(this, 10, 5); - body3.addBox(-2F, -1F, -2F, 4, 1, 4); - body3.setRotationPoint(0F, 17F, 0F); - body3.setTextureSize(64, 32); - body3.mirror = true; - setRotation(body3, 0F, 0F, 0F); - body4 = new ModelRenderer(this, 12, 0); - body4.addBox(-1.5F, 0F, -1.5F, 3, 1, 3); - body4.setRotationPoint(0F, 15F, 0F); - body4.setTextureSize(64, 32); - body4.mirror = true; - setRotation(body4, 0F, 0F, 0F); - edge1 = new ModelRenderer(this, 21, 13); - edge1.addBox(-1.9F, -1F, -1.9F, 1, 5, 1); - edge1.setRotationPoint(0F, 18F, 0F); - edge1.setTextureSize(64, 32); - edge1.mirror = true; - setRotation(edge1, 0F, 0F, 0F); - edge2 = new ModelRenderer(this, 26, 13); - edge2.addBox(-2.1F, -1F, -1.9F, 1, 5, 1); - edge2.setRotationPoint(3F, 18F, 0F); - edge2.setTextureSize(64, 32); - edge2.mirror = true; - setRotation(edge2, 0F, 0F, 0F); - edge3 = new ModelRenderer(this, 10, 13); - edge3.addBox(-2.1F, -1F, 0.9F, 1, 5, 1); - edge3.setRotationPoint(3F, 18F, 0F); - edge3.setTextureSize(64, 32); - edge3.mirror = true; - setRotation(edge3, 0F, 0F, 0F); - edge4 = new ModelRenderer(this, 16, 13); - edge4.addBox(-1.9F, -1F, 0.9F, 1, 5, 1); - edge4.setRotationPoint(0F, 18F, 0F); - edge4.setTextureSize(64, 32); - edge4.mirror = true; - setRotation(edge4, 0F, 0F, 0F); - glass1 = new ModelRenderer(this, 2, 13); - glass1.addBox(-3.1F, -1F, 1.8F, 2, 5, 0); - glass1.setRotationPoint(2F, 18F, 0F); - glass1.setTextureSize(64, 32); - glass1.mirror = true; - setRotation(glass1, 0F, 0F, 0F); - glass2 = new ModelRenderer(this, 2, 13); - glass2.addBox(-3.1F, -1F, 0.2F, 2, 5, 0); - glass2.setRotationPoint(2F, 18F, -2F); - glass2.setTextureSize(64, 32); - glass2.mirror = true; - setRotation(glass2, 0F, 0F, 0F); - glass3 = new ModelRenderer(this, 2, 13); - glass3.addBox(-1.1F, -1F, -0.2F, 2, 5, 0); - glass3.setRotationPoint(2F, 18F, 0F); - glass3.setTextureSize(64, 32); - glass3.mirror = true; - setRotation(glass3, 0F, 1.570796F, 0F); - glass4 = new ModelRenderer(this, 2, 13); - glass4.addBox(-1.1F, -1F, 2.2F, 2, 5, 0); - glass4.setRotationPoint(-4F, 18F, 0F); - glass4.setTextureSize(64, 32); - glass4.mirror = true; - setRotation(glass4, 0F, 1.570796F, 0F); - } - - public void render(float f5) - { - body1.render(f5); - body2.render(f5); - body3.render(f5); - body4.render(f5); - edge1.render(f5); - edge2.render(f5); - edge3.render(f5); - edge4.render(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - -} diff --git a/src/dark/machines/client/renders/BlockRenderInfo.java b/src/dark/machines/client/renders/BlockRenderInfo.java deleted file mode 100644 index 0db5f3c31..000000000 --- a/src/dark/machines/client/renders/BlockRenderInfo.java +++ /dev/null @@ -1,56 +0,0 @@ -package dark.machines.client.renders; - -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.Icon; -import net.minecraft.world.IBlockAccess; -import universalelectricity.core.vector.Vector3; - -/** Used to store info on a block mainly used for rendering */ -public class BlockRenderInfo -{ - /** Block lower corner size */ - public Vector3 min = new Vector3(0, 0, 0); - /** Block higher corner size */ - public Vector3 max = new Vector3(1, 1, 1); - /** Block to pull info from */ - public Block baseBlock = Block.sand; - /** Override render texture */ - public Icon texture = null; - /** meta data to use for block the block */ - public int meta = 0; - - /** Gets the block brightness at the given location */ - public float getBlockBrightness(IBlockAccess iblockaccess, int i, int j, int k) - { - return baseBlock.getBlockBrightness(iblockaccess, i, j, k); - } - - /** Gets the block texture from the given side */ - public Icon getBlockTextureFromSide(int side) - { - return this.getBlockIconFromSideAndMetadata(side, meta); - } - - /** Gets the block texture from side and meta */ - public Icon getBlockIconFromSideAndMetadata(int side, int meta) - { - return this.getIconSafe(baseBlock.getIcon(side, meta)); - } - - /** Gets the icon and does some safty checks */ - public Icon getIconSafe(Icon par1Icon) - { - Icon icon = par1Icon; - if (this.texture != null) - { - icon = texture; - } - if (par1Icon == null) - { - icon = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno"); - } - return icon; - } -} diff --git a/src/dark/machines/client/renders/ItemRenderFluidCan.java b/src/dark/machines/client/renders/ItemRenderFluidCan.java deleted file mode 100644 index 974ede909..000000000 --- a/src/dark/machines/client/renders/ItemRenderFluidCan.java +++ /dev/null @@ -1,112 +0,0 @@ -package dark.machines.client.renders; - -import net.minecraft.client.Minecraft; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.IItemRenderer; -import net.minecraftforge.fluids.FluidStack; - -import org.lwjgl.opengl.GL11; - -import com.dark.DarkCore; - -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import dark.machines.CoreRecipeLoader; -import dark.machines.CoreMachine; -import dark.machines.client.models.ModelSmallFluidCan; -import dark.machines.items.ItemFluidCan; - -@SideOnly(Side.CLIENT) -public class ItemRenderFluidCan implements IItemRenderer -{ - public static final ModelSmallFluidCan CAN_MODEL = new ModelSmallFluidCan(); - - public static final ResourceLocation CAN_TEXTURE = new ResourceLocation(CoreMachine.getInstance().DOMAIN, DarkCore.MODEL_DIRECTORY + "FluidCanA.png"); - - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) - { - return true; - } - - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) - { - return true; - } - - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) - { - if (CoreRecipeLoader.itemFluidCan != null && item.itemID == CoreRecipeLoader.itemFluidCan.itemID) - { - FluidStack liquid = ((ItemFluidCan) CoreRecipeLoader.itemFluidCan).drain(item, Integer.MAX_VALUE, false); - - if (liquid != null && liquid.amount > 100) - { - - int[] displayList = RenderBlockFluid.getFluidDisplayLists(liquid, Minecraft.getMinecraft().theWorld, false); - - GL11.glPushMatrix(); - GL11.glPushAttrib(GL11.GL_ENABLE_BIT); - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - - GL11.glScalef(0.4F, 1.5F, 0.4F); - - if (type == ItemRenderType.ENTITY) - { - GL11.glTranslatef(-.5F, 0F, -.5F); - } - else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) - { - GL11.glTranslatef(1.8F, 0.25F, 1.8F); - } - else if (type == ItemRenderType.EQUIPPED) - { - GL11.glTranslatef(0.9F, 0.4F, 1.2F); - } - else - { - GL11.glTranslatef(0.6F, 0F, 0.6F); - } - - FMLClientHandler.instance().getClient().renderEngine.bindTexture((RenderBlockFluid.getFluidSheet(liquid))); - - int cap = ((ItemFluidCan) CoreRecipeLoader.itemFluidCan).getCapacity(item); - if (liquid.getFluid().isGaseous()) - { - cap = liquid.amount; - } - GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (cap) * (RenderBlockFluid.DISPLAY_STAGES - 1))]); - - GL11.glPopAttrib(); - GL11.glPopMatrix(); - } - GL11.glPushMatrix(); - - FMLClientHandler.instance().getClient().renderEngine.bindTexture(CAN_TEXTURE); - float scale = 1.8f; - GL11.glScalef(scale, scale, scale); - if (type == ItemRenderType.ENTITY) - { - GL11.glTranslatef(0F, -1F, 0F); - } - else if (type == ItemRenderType.EQUIPPED) - { - GL11.glTranslatef(0.3F, -0.7F, 0.37F); - } - else - { - GL11.glTranslatef(0.5F, -0.8F, 0.5F); - } - CAN_MODEL.render(0.0625F); - GL11.glPopMatrix(); - } - - } -} diff --git a/src/dark/machines/client/renders/RenderBlockEntity.java b/src/dark/machines/client/renders/RenderBlockEntity.java deleted file mode 100644 index 60c9ba4d1..000000000 --- a/src/dark/machines/client/renders/RenderBlockEntity.java +++ /dev/null @@ -1,194 +0,0 @@ -package dark.machines.client.renders; - -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import org.lwjgl.opengl.GL11; - -import universalelectricity.core.vector.Vector3; -import dark.core.prefab.entities.EntityFakeBlock; - -public class RenderBlockEntity extends Render -{ - - public static RenderBlockEntity INSTANCE = new RenderBlockEntity(); - - private RenderBlockEntity() - { - } - - @Override - public void doRender(Entity entity, double i, double j, double k, float f, float f1) - { - doRenderBlock((EntityFakeBlock) entity, i, j, k); - } - - public void doRenderBlock(EntityFakeBlock entity, double i, double j, double k) - { - if (entity.isDead) - return; - - shadowSize = entity.shadowSize; - World world = entity.worldObj; - BlockRenderInfo util = new BlockRenderInfo(); - util.texture = entity.texture; - this.bindTexture(TextureMap.locationBlocksTexture); - - for (int iBase = 0; iBase < entity.iSize; ++iBase) - { - for (int jBase = 0; jBase < entity.jSize; ++jBase) - { - for (int kBase = 0; kBase < entity.kSize; ++kBase) - { - - util.min = new Vector3(); - util.max = new Vector3(); - - double remainX = entity.iSize - iBase; - double remainY = entity.jSize - jBase; - double remainZ = entity.kSize - kBase; - - util.max.x = (remainX > 1.0 ? 1.0 : remainX); - util.max.y = (remainY > 1.0 ? 1.0 : remainY); - util.max.z = (remainZ > 1.0 ? 1.0 : remainZ); - - GL11.glPushMatrix(); - GL11.glTranslatef((float) i, (float) j, (float) k); - GL11.glRotatef(entity.rotationX, 1, 0, 0); - GL11.glRotatef(entity.rotationY, 0, 1, 0); - GL11.glRotatef(entity.rotationZ, 0, 0, 1); - GL11.glTranslatef(iBase, jBase, kBase); - - int lightX, lightY, lightZ; - - lightX = (int) (Math.floor(entity.posX) + iBase); - lightY = (int) (Math.floor(entity.posY) + jBase); - lightZ = (int) (Math.floor(entity.posZ) + kBase); - - GL11.glDisable(2896 /* GL_LIGHTING */); - renderBlock(util, world, lightX, lightY, lightZ, false, true); - GL11.glEnable(2896 /* GL_LIGHTING */); - GL11.glPopMatrix(); - - } - } - } - } - - public void renderBlock(BlockRenderInfo block, IBlockAccess blockAccess, int x, int y, int z, boolean doLight, boolean doTessellating) - { - float f = 0.5F; - float f1 = 1.0F; - float f2 = 0.8F; - float f3 = 0.6F; - - renderBlocks.renderMaxX = block.max.x; - renderBlocks.renderMinX = block.min.x; - - renderBlocks.renderMaxY = block.max.y; - renderBlocks.renderMinY = block.min.y; - - renderBlocks.renderMaxZ = block.max.z; - renderBlocks.renderMinZ = block.min.z; - - renderBlocks.enableAO = false; - - Tessellator tessellator = Tessellator.instance; - - if (doTessellating) - { - tessellator.startDrawingQuads(); - } - - float f4 = 0, f5 = 0; - - if (doLight) - { - f4 = block.getBlockBrightness(blockAccess, x, y, z); - f5 = block.getBlockBrightness(blockAccess, x, y, z); - if (f5 < f4) - { - f5 = f4; - } - tessellator.setColorOpaque_F(f * f5, f * f5, f * f5); - } - - renderBlocks.renderFaceYNeg(null, 0, 0, 0, block.getBlockTextureFromSide(0)); - - if (doLight) - { - f5 = block.getBlockBrightness(blockAccess, x, y, z); - if (f5 < f4) - { - f5 = f4; - } - tessellator.setColorOpaque_F(f1 * f5, f1 * f5, f1 * f5); - } - - renderBlocks.renderFaceYPos(null, 0, 0, 0, block.getBlockTextureFromSide(1)); - - if (doLight) - { - f5 = block.getBlockBrightness(blockAccess, x, y, z); - if (f5 < f4) - { - f5 = f4; - } - tessellator.setColorOpaque_F(f2 * f5, f2 * f5, f2 * f5); - } - - renderBlocks.renderFaceZNeg(null, 0, 0, 0, block.getBlockTextureFromSide(2)); - - if (doLight) - { - f5 = block.getBlockBrightness(blockAccess, x, y, z); - if (f5 < f4) - { - f5 = f4; - } - tessellator.setColorOpaque_F(f2 * f5, f2 * f5, f2 * f5); - } - - renderBlocks.renderFaceZPos(null, 0, 0, 0, block.getBlockTextureFromSide(3)); - - if (doLight) - { - f5 = block.getBlockBrightness(blockAccess, x, y, z); - if (f5 < f4) - { - f5 = f4; - } - tessellator.setColorOpaque_F(f3 * f5, f3 * f5, f3 * f5); - } - - renderBlocks.renderFaceXNeg(null, 0, 0, 0, block.getBlockTextureFromSide(4)); - - if (doLight) - { - f5 = block.getBlockBrightness(blockAccess, x, y, z); - if (f5 < f4) - { - f5 = f4; - } - tessellator.setColorOpaque_F(f3 * f5, f3 * f5, f3 * f5); - } - - renderBlocks.renderFaceXPos(null, 0, 0, 0, block.getBlockTextureFromSide(5)); - - if (doTessellating) - { - tessellator.draw(); - } - } - - @Override - protected ResourceLocation getEntityTexture(Entity entity) - { - throw new UnsupportedOperationException("Not supported yet."); - } -} diff --git a/src/dark/machines/client/renders/RenderBlockFluid.java b/src/dark/machines/client/renders/RenderBlockFluid.java deleted file mode 100644 index 26dfa4af3..000000000 --- a/src/dark/machines/client/renders/RenderBlockFluid.java +++ /dev/null @@ -1,125 +0,0 @@ -package dark.machines.client.renders; - -import java.util.HashMap; -import java.util.Map; - -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GLAllocation; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.Icon; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -import org.lwjgl.opengl.GL11; - -public class RenderBlockFluid -{ - - private static final ResourceLocation BLOCK_TEXTURE = TextureMap.locationBlocksTexture; - - private static Map flowingRenderCache = new HashMap(); - private static Map stillRenderCache = new HashMap(); - - public static final int DISPLAY_STAGES = 100; - - private static final BlockRenderInfo liquidBlock = new BlockRenderInfo(); - - public static ResourceLocation getFluidSheet(FluidStack liquid) - { - return BLOCK_TEXTURE; - } - - public static Icon getFluidTexture(Fluid fluid, boolean flowing) - { - if (fluid == null) - { - return null; - } - Icon icon = flowing ? fluid.getFlowingIcon() : fluid.getStillIcon(); - if (icon == null) - { - icon = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno"); - } - return icon; - } - - public static void setColorForFluidStack(FluidStack fluidstack) - { - if (fluidstack == null) - { - return; - } - - int color = fluidstack.getFluid().getColor(fluidstack); - float red = (color >> 16 & 255) / 255.0F; - float green = (color >> 8 & 255) / 255.0F; - float blue = (color & 255) / 255.0F; - GL11.glColor4f(red, green, blue, 1); - } - - public static int[] getFluidDisplayLists(FluidStack fluidStack, World world, boolean flowing) - { - if (fluidStack == null) - { - return null; - } - Fluid fluid = fluidStack.getFluid(); - if (fluid == null) - { - return null; - } - Map cache = flowing ? flowingRenderCache : stillRenderCache; - int[] diplayLists = cache.get(fluid); - if (diplayLists != null) - { - return diplayLists; - } - - diplayLists = new int[DISPLAY_STAGES]; - - if (fluid.getBlockID() > 0) - { - liquidBlock.baseBlock = Block.blocksList[fluid.getBlockID()]; - liquidBlock.texture = getFluidTexture(fluidStack.getFluid(), flowing); - } - else - { - liquidBlock.baseBlock = Block.waterStill; - liquidBlock.texture = getFluidTexture(fluidStack.getFluid(), flowing); - } - - cache.put(fluid, diplayLists); - - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_CULL_FACE); - - for (int s = 0; s < DISPLAY_STAGES; ++s) - { - diplayLists[s] = GLAllocation.generateDisplayLists(1); - GL11.glNewList(diplayLists[s], 4864 /*GL_COMPILE*/); - - liquidBlock.min.x = 0.01f; - liquidBlock.min.y = 0; - liquidBlock.min.z = 0.01f; - - liquidBlock.max.x = 0.99f; - liquidBlock.max.y = (float) s / (float) DISPLAY_STAGES; - liquidBlock.max.z = 0.99f; - - RenderBlockEntity.INSTANCE.renderBlock(liquidBlock, world, 0, 0, 0, false, true); - - GL11.glEndList(); - } - - GL11.glColor4f(1, 1, 1, 1); - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glEnable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_LIGHTING); - - return diplayLists; - } -} diff --git a/src/dark/machines/client/renders/RenderTestCar.java b/src/dark/machines/client/renders/RenderTestCar.java index d42a7dcd0..81cf45c32 100644 --- a/src/dark/machines/client/renders/RenderTestCar.java +++ b/src/dark/machines/client/renders/RenderTestCar.java @@ -12,9 +12,9 @@ import com.dark.DarkCore; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import dark.core.prefab.entities.EntityAdvanced; import dark.machines.CoreMachine; import dark.machines.client.models.ModelTestCar; +import dark.machines.prefab.entities.EntityAdvanced; @SideOnly(Side.CLIENT) public class RenderTestCar extends Render diff --git a/src/dark/machines/deco/BlockColored.java b/src/dark/machines/deco/BlockColored.java index abd71ec54..ed98a1059 100644 --- a/src/dark/machines/deco/BlockColored.java +++ b/src/dark/machines/deco/BlockColored.java @@ -2,6 +2,8 @@ package dark.machines.deco; import java.util.List; +import com.dark.helpers.ColorCode; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; @@ -11,7 +13,6 @@ import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import dark.api.ColorCode; import dark.machines.CoreMachine; /** Prefab class to make any block have 16 separate color instances similar to wool block diff --git a/src/dark/machines/deco/ItemBlockColored.java b/src/dark/machines/deco/ItemBlockColored.java index fbd660a56..f127571a4 100644 --- a/src/dark/machines/deco/ItemBlockColored.java +++ b/src/dark/machines/deco/ItemBlockColored.java @@ -1,9 +1,10 @@ package dark.machines.deco; +import com.dark.helpers.ColorCode; + import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import dark.api.ColorCode; import dark.machines.CoreMachine; public class ItemBlockColored extends ItemBlock diff --git a/src/dark/machines/generators/TileEntitySolarPanel.java b/src/dark/machines/generators/TileEntitySolarPanel.java index bfba45f69..b4e7a8824 100644 --- a/src/dark/machines/generators/TileEntitySolarPanel.java +++ b/src/dark/machines/generators/TileEntitySolarPanel.java @@ -4,7 +4,7 @@ import java.util.EnumSet; import micdoodle8.mods.galacticraft.api.world.ISolarLevel; import net.minecraftforge.common.ForgeDirection; -import dark.core.prefab.machine.TileEntityGenerator; +import dark.machines.machines.TileEntityGenerator; public class TileEntitySolarPanel extends TileEntityGenerator { diff --git a/src/dark/core/basics/EnumTool.java b/src/dark/machines/items/EnumTool.java similarity index 50% rename from src/dark/core/basics/EnumTool.java rename to src/dark/machines/items/EnumTool.java index 65762b1a9..63b0f945d 100644 --- a/src/dark/core/basics/EnumTool.java +++ b/src/dark/machines/items/EnumTool.java @@ -1,9 +1,16 @@ -package dark.core.basics; +package dark.machines.items; import java.util.ArrayList; import java.util.List; +import com.dark.EnumMaterial; + import net.minecraft.block.material.Material; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import dark.machines.CoreRecipeLoader; /** Enum to store tools that can be created from the material sheet. * @@ -24,6 +31,10 @@ public enum EnumTool public final List effecticVsMaterials = new ArrayList(); public String name = "tool"; public boolean enabled = false; + public static final int toolCountPerMaterial = 10; + + @SideOnly(Side.CLIENT) + public Icon[] toolIcons; private EnumTool() { @@ -60,12 +71,56 @@ public enum EnumTool public static String getFullName(int meta) { - EnumMaterial mat = EnumMaterial.getToolMatFromMeta(meta); - EnumTool tool = EnumMaterial.getToolFromMeta(meta); + EnumMaterial mat = getToolMatFromMeta(meta); + EnumTool tool = getToolFromMeta(meta); if (mat != null && tool != null) { return mat.simpleName + tool.name; } return "CommonTool[" + meta + "]"; } + + public static ItemStack getTool(EnumTool tool, EnumMaterial mat) + { + return tool.getTool(mat); + } + + public ItemStack getTool(EnumMaterial mat) + { + ItemStack stack = null; + if (CoreRecipeLoader.itemDiggingTool instanceof ItemCommonTool) + { + stack = new ItemStack(CoreRecipeLoader.itemDiggingTool.itemID, 1, (mat.ordinal() * toolCountPerMaterial) + this.ordinal()); + } + return stack; + } + + public static EnumTool getToolFromMeta(int meta) + { + return EnumTool.values()[meta % toolCountPerMaterial]; + } + + public static EnumMaterial getToolMatFromMeta(int meta) + { + return EnumMaterial.values()[meta / toolCountPerMaterial]; + } + + public static Icon getToolIcon(int metadata) + { + int mat = getToolMatFromMeta(metadata).ordinal(); + int tool = getToolFromMeta(metadata).ordinal(); + if (mat < EnumMaterial.values().length) + { + if (EnumTool.values()[tool].toolIcons == null) + { + EnumTool.values()[tool].toolIcons = new Icon[EnumMaterial.values().length]; + } + if (tool < EnumTool.values()[tool].toolIcons.length) + { + return EnumTool.values()[tool].toolIcons[mat]; + } + } + return null; + } + } diff --git a/src/dark/core/basics/ItemBlockOre.java b/src/dark/machines/items/ItemBlockOre.java similarity index 86% rename from src/dark/core/basics/ItemBlockOre.java rename to src/dark/machines/items/ItemBlockOre.java index 7f7ea0b5b..db2cc567a 100644 --- a/src/dark/core/basics/ItemBlockOre.java +++ b/src/dark/machines/items/ItemBlockOre.java @@ -1,9 +1,10 @@ -package dark.core.basics; +package dark.machines.items; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import dark.core.basics.BlockOre.OreData; import dark.machines.CoreMachine; +import dark.machines.blocks.BlockOre; +import dark.machines.blocks.BlockOre.OreData; public class ItemBlockOre extends ItemBlock { diff --git a/src/dark/machines/items/ItemColoredDust.java b/src/dark/machines/items/ItemColoredDust.java index e958c0897..0aec88aad 100644 --- a/src/dark/machines/items/ItemColoredDust.java +++ b/src/dark/machines/items/ItemColoredDust.java @@ -8,11 +8,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import com.dark.DarkCore; +import com.dark.helpers.ColorCode; import com.dark.prefab.ItemBasic; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import dark.api.ColorCode; import dark.machines.CoreMachine; public class ItemColoredDust extends ItemBasic diff --git a/src/dark/core/basics/ItemCommonTool.java b/src/dark/machines/items/ItemCommonTool.java similarity index 88% rename from src/dark/core/basics/ItemCommonTool.java rename to src/dark/machines/items/ItemCommonTool.java index f41a22f17..ea9be2c6c 100644 --- a/src/dark/core/basics/ItemCommonTool.java +++ b/src/dark/machines/items/ItemCommonTool.java @@ -1,4 +1,4 @@ -package dark.core.basics; +package dark.machines.items; import java.awt.Color; import java.util.ArrayList; @@ -32,6 +32,8 @@ import net.minecraftforge.event.entity.player.UseHoeEvent; import net.minecraftforge.oredict.OreDictionary; import com.dark.DarkCore; +import com.dark.EnumMaterial; +import com.dark.EnumOrePart; import com.dark.IExtraInfo.IExtraItemInfo; import com.google.common.collect.Multimap; @@ -41,7 +43,7 @@ import dark.machines.CoreMachine; /** Flexible tool class that uses NBT to store damage and effect rather than metadata. Metadata * instead is used to store sub items allowing several different tools to exist within the same item - * + * * @author DarkGuardsman */ public class ItemCommonTool extends Item implements IExtraItemInfo { @@ -97,7 +99,7 @@ public class ItemCommonTool extends Item implements IExtraItemInfo } else { - EnumMaterial mat = EnumMaterial.getToolMatFromMeta(itemStack.getItemDamage()); + EnumMaterial mat = EnumTool.getToolMatFromMeta(itemStack.getItemDamage()); int currentDamage = itemStack.getTagCompound().getInteger(TOOL_DAMAGE); list.add("D: " + currentDamage + "/" + mat.maxUses); } @@ -130,7 +132,7 @@ public class ItemCommonTool extends Item implements IExtraItemInfo { return false; } - if (EnumMaterial.getToolFromMeta(itemStack.getItemDamage()) == EnumTool.HOE) + if (EnumTool.getToolFromMeta(itemStack.getItemDamage()) == EnumTool.HOE) { if (!player.canPlayerEdit(x, y, z, par7, itemStack)) { @@ -177,7 +179,7 @@ public class ItemCommonTool extends Item implements IExtraItemInfo @Override public EnumAction getItemUseAction(ItemStack par1ItemStack) { - if (EnumMaterial.getToolFromMeta(par1ItemStack.getItemDamage()) == EnumTool.SWORD) + if (EnumTool.getToolFromMeta(par1ItemStack.getItemDamage()) == EnumTool.SWORD) { return EnumAction.block; } @@ -187,7 +189,7 @@ public class ItemCommonTool extends Item implements IExtraItemInfo @Override public int getMaxItemUseDuration(ItemStack par1ItemStack) { - if (EnumMaterial.getToolFromMeta(par1ItemStack.getItemDamage()) == EnumTool.SWORD) + if (EnumTool.getToolFromMeta(par1ItemStack.getItemDamage()) == EnumTool.SWORD) { return 72000; } @@ -197,7 +199,7 @@ public class ItemCommonTool extends Item implements IExtraItemInfo @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { - if (EnumMaterial.getToolFromMeta(par1ItemStack.getItemDamage()) == EnumTool.SWORD) + if (EnumTool.getToolFromMeta(par1ItemStack.getItemDamage()) == EnumTool.SWORD) { par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); } @@ -211,7 +213,7 @@ public class ItemCommonTool extends Item implements IExtraItemInfo { return false; } - if (entity instanceof IShearable && EnumMaterial.getToolFromMeta(itemstack.getItemDamage()) == EnumTool.SHEAR) + if (entity instanceof IShearable && EnumTool.getToolFromMeta(itemstack.getItemDamage()) == EnumTool.SHEAR) { IShearable target = (IShearable) entity; if (target.isShearable(itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ)) @@ -241,7 +243,7 @@ public class ItemCommonTool extends Item implements IExtraItemInfo return false; } int id = player.worldObj.getBlockId(x, y, z); - if (Block.blocksList[id] instanceof IShearable && EnumMaterial.getToolFromMeta(itemstack.getItemDamage()) == EnumTool.SHEAR) + if (Block.blocksList[id] instanceof IShearable && EnumTool.getToolFromMeta(itemstack.getItemDamage()) == EnumTool.SHEAR) { IShearable target = (IShearable) Block.blocksList[id]; if (target.isShearable(itemstack, player.worldObj, x, y, z)) @@ -274,7 +276,7 @@ public class ItemCommonTool extends Item implements IExtraItemInfo { itemStack.setTagCompound(new NBTTagCompound()); } - EnumMaterial mat = EnumMaterial.getToolMatFromMeta(itemStack.getItemDamage()); + EnumMaterial mat = EnumTool.getToolMatFromMeta(itemStack.getItemDamage()); if (entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode) { return; @@ -336,20 +338,20 @@ public class ItemCommonTool extends Item implements IExtraItemInfo @Override public boolean hitEntity(ItemStack itemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { - this.damage(itemStack, EnumMaterial.getToolFromMeta(itemStack.getItemDamage()) == EnumTool.SWORD ? 1 : 2, par2EntityLivingBase); + this.damage(itemStack, EnumTool.getToolFromMeta(itemStack.getItemDamage()) == EnumTool.SWORD ? 1 : 2, par2EntityLivingBase); return true; } @Override public boolean onBlockDestroyed(ItemStack itemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) { - if (EnumMaterial.getToolFromMeta(itemStack.getItemDamage()) == EnumTool.SHEAR && par3 != Block.leaves.blockID && par3 != Block.web.blockID && par3 != Block.tallGrass.blockID && par3 != Block.vine.blockID && par3 != Block.tripWire.blockID && !(Block.blocksList[par3] instanceof IShearable)) + if (EnumTool.getToolFromMeta(itemStack.getItemDamage()) == EnumTool.SHEAR && par3 != Block.leaves.blockID && par3 != Block.web.blockID && par3 != Block.tallGrass.blockID && par3 != Block.vine.blockID && par3 != Block.tripWire.blockID && !(Block.blocksList[par3] instanceof IShearable)) { return false; } if (Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D) { - this.damage(itemStack, EnumMaterial.getToolFromMeta(itemStack.getItemDamage()) == EnumTool.SWORD ? 2 : 1, par7EntityLivingBase); + this.damage(itemStack, EnumTool.getToolFromMeta(itemStack.getItemDamage()) == EnumTool.SWORD ? 2 : 1, par7EntityLivingBase); } return true; @@ -388,8 +390,8 @@ public class ItemCommonTool extends Item implements IExtraItemInfo { return 0; } - EnumTool tool = EnumMaterial.getToolFromMeta(itemStack.getItemDamage()); - EnumMaterial mat = EnumMaterial.getToolMatFromMeta(itemStack.getItemDamage()); + EnumTool tool = EnumTool.getToolFromMeta(itemStack.getItemDamage()); + EnumMaterial mat = EnumTool.getToolMatFromMeta(itemStack.getItemDamage()); if (tool.effecticVsMaterials.contains(block.blockMaterial)) { return mat.materialEffectiveness + (tool == EnumTool.SHEAR && block.blockMaterial == Material.leaves ? 9f : 0f); @@ -419,8 +421,8 @@ public class ItemCommonTool extends Item implements IExtraItemInfo { return false; } - EnumTool tool = EnumMaterial.getToolFromMeta(itemStack.getItemDamage()); - EnumMaterial mat = EnumMaterial.getToolMatFromMeta(itemStack.getItemDamage()); + EnumTool tool = EnumTool.getToolFromMeta(itemStack.getItemDamage()); + EnumMaterial mat = EnumTool.getToolMatFromMeta(itemStack.getItemDamage()); if (tool.effecticVsMaterials.contains(block.blockMaterial)) { return true; @@ -450,30 +452,31 @@ public class ItemCommonTool extends Item implements IExtraItemInfo itemStack.setTagCompound(new NBTTagCompound()); } int damage = itemStack.getTagCompound().getInteger(TOOL_DAMAGE); - EnumMaterial mat = EnumMaterial.getToolMatFromMeta(itemStack.getItemDamage()); + EnumMaterial mat = EnumTool.getToolMatFromMeta(itemStack.getItemDamage()); return (damage / mat.maxUses) * 100; } @Override public Icon getIconFromDamage(int i) { - return EnumMaterial.getToolIcon(i); + return EnumTool.getToolIcon(i); } @SideOnly(Side.CLIENT) @Override public void registerIcons(IconRegister iconRegister) { - for (EnumMaterial mat : EnumMaterial.values()) + for (EnumTool tool : EnumTool.values()) { - if (mat.hasTools) + for (EnumMaterial mat : EnumMaterial.values()) { - mat.toolIcons = new Icon[EnumOrePart.values().length]; - for (EnumTool tool : EnumTool.values()) + if (mat.hasTools) { + tool.toolIcons = new Icon[EnumMaterial.values().length]; + if (tool.enabled) { - mat.toolIcons[tool.ordinal()] = iconRegister.registerIcon(CoreMachine.getInstance().PREFIX + "tool." + mat.simpleName + tool.name); + tool.toolIcons[mat.ordinal()] = iconRegister.registerIcon(CoreMachine.getInstance().PREFIX + "tool." + mat.simpleName + tool.name); } } } @@ -489,12 +492,11 @@ public class ItemCommonTool extends Item implements IExtraItemInfo { for (EnumTool tool : EnumTool.values()) { - ItemStack stack = EnumMaterial.getTool(tool, mat); + ItemStack stack = tool.getTool(mat); if (tool.enabled && stack != null) { this.onCreated(stack, null, null); par3List.add(stack); - } } } @@ -524,7 +526,7 @@ public class ItemCommonTool extends Item implements IExtraItemInfo { for (EnumTool tool : EnumTool.values()) { - ItemStack stack = EnumMaterial.getTool(tool, mat); + ItemStack stack = tool.getTool(mat); if (tool.enabled && stack != null) { OreDictionary.registerOre(EnumTool.getFullName(stack.getItemDamage()), stack); diff --git a/src/dark/machines/items/ItemFluidCan.java b/src/dark/machines/items/ItemFluidCan.java deleted file mode 100644 index 920720e09..000000000 --- a/src/dark/machines/items/ItemFluidCan.java +++ /dev/null @@ -1,92 +0,0 @@ -package dark.machines.items; - -import java.util.List; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; -import net.minecraft.util.StatCollector; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.ItemFluidContainer; -import universalelectricity.core.item.ElectricItemHelper; - -import com.dark.DarkCore; -import com.dark.IndustryTabs; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import dark.machines.CoreMachine; - -/** Small fluid can that is designed to store up to one bucket of fluid. Doesn't work like a bucket - * as it is sealed with a pressure cap. This can is designed to work with tools or machines only. - * - * @author DarkGuardsman */ -public class ItemFluidCan extends ItemFluidContainer -{ - public static final String FLUID_NBT = "FluidStack"; - - @SideOnly(Side.CLIENT) - public Icon[] icons; - - public ItemFluidCan() - { - super(CoreMachine.CONFIGURATION.getItem("FluidCan", DarkCore.getNextItemId()).getInt()); - this.setUnlocalizedName("FluidCan"); - this.setCreativeTab(IndustryTabs.tabHydraulic()); - this.setMaxStackSize(1); - this.setMaxDamage(100); - this.setNoRepair(); - this.capacity = FluidContainerRegistry.BUCKET_VOLUME * 2; - this.setContainerItem(this); - } - - @Override - public boolean doesContainerItemLeaveCraftingGrid(ItemStack par1ItemStack) - { - FluidStack fluidStack = this.drain(par1ItemStack, Integer.MAX_VALUE, false); - if (fluidStack != null) - { - return false; - } - return true; - } - - @Override - public String getItemDisplayName(ItemStack par1ItemStack) - { - String fluid = ""; - FluidStack fluidStack = this.drain(par1ItemStack, Integer.MAX_VALUE, false); - if (fluidStack != null) - { - fluid = fluidStack.getFluid().getLocalizedName(); - } - return ("" + (fluid + " " + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(par1ItemStack) + ".name"))).trim(); - } - - @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - FluidStack fluidStack = this.drain(par1ItemStack, Integer.MAX_VALUE, false); - if (fluidStack != null) - { - par3List.add("Volume: " + fluidStack.amount + "mb"); - } - } - - @Override - public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) - { - par3List.add(ElectricItemHelper.getUncharged(new ItemStack(this))); - - ItemStack waterCan = new ItemStack(this); - this.fill(waterCan, new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME), true); - par3List.add(waterCan); - - ItemStack lavaCan = new ItemStack(this); - this.fill(lavaCan, new FluidStack(FluidRegistry.LAVA, FluidContainerRegistry.BUCKET_VOLUME), true); - par3List.add(lavaCan); - } -} diff --git a/src/dark/machines/items/ItemReadoutTools.java b/src/dark/machines/items/ItemReadoutTools.java index a8952abb3..f0db0447a 100644 --- a/src/dark/machines/items/ItemReadoutTools.java +++ b/src/dark/machines/items/ItemReadoutTools.java @@ -22,12 +22,12 @@ import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit; import com.dark.DarkCore; import com.dark.fluid.FluidHelper; +import com.dark.interfaces.IToolReadOut; +import com.dark.interfaces.IToolReadOut.EnumTools; import com.dark.prefab.ItemBasic; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import dark.api.IToolReadOut; -import dark.api.IToolReadOut.EnumTools; import dark.machines.CoreMachine; public class ItemReadoutTools extends ItemBasic diff --git a/src/dark/machines/items/ItemStorageCan.java b/src/dark/machines/items/ItemStorageCan.java deleted file mode 100644 index a3035f2fd..000000000 --- a/src/dark/machines/items/ItemStorageCan.java +++ /dev/null @@ -1,9 +0,0 @@ -package dark.machines.items; - -/** Can that is used to store items such as food, parts, or solid fuels. - * - * @author DarkGuardsman */ -public class ItemStorageCan -{ - -} diff --git a/src/dark/core/prefab/machine/TileEntityGenerator.java b/src/dark/machines/machines/TileEntityGenerator.java similarity index 98% rename from src/dark/core/prefab/machine/TileEntityGenerator.java rename to src/dark/machines/machines/TileEntityGenerator.java index 8ce659d89..66504599c 100644 --- a/src/dark/core/prefab/machine/TileEntityGenerator.java +++ b/src/dark/machines/machines/TileEntityGenerator.java @@ -1,4 +1,4 @@ -package dark.core.prefab.machine; +package dark.machines.machines; import com.dark.prefab.TileEntityEnergyMachine; diff --git a/src/dark/core/prefab/LaserEntityDamageSource.java b/src/dark/machines/prefab/LaserEntityDamageSource.java similarity index 98% rename from src/dark/core/prefab/LaserEntityDamageSource.java rename to src/dark/machines/prefab/LaserEntityDamageSource.java index 6ed3e190e..53ab64c0a 100644 --- a/src/dark/core/prefab/LaserEntityDamageSource.java +++ b/src/dark/machines/prefab/LaserEntityDamageSource.java @@ -1,4 +1,4 @@ -package dark.core.prefab; +package dark.machines.prefab; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityCreeper; diff --git a/src/dark/core/prefab/ModPrefab.java b/src/dark/machines/prefab/ModPrefab.java similarity index 98% rename from src/dark/core/prefab/ModPrefab.java rename to src/dark/machines/prefab/ModPrefab.java index b82618636..dc9c9e62d 100644 --- a/src/dark/core/prefab/ModPrefab.java +++ b/src/dark/machines/prefab/ModPrefab.java @@ -1,4 +1,4 @@ -package dark.core.prefab; +package dark.machines.prefab; import java.util.Calendar; import java.util.Date; diff --git a/src/dark/core/prefab/TileDamageSource.java b/src/dark/machines/prefab/TileDamageSource.java similarity index 97% rename from src/dark/core/prefab/TileDamageSource.java rename to src/dark/machines/prefab/TileDamageSource.java index b9a75434d..b2f4f5e7f 100644 --- a/src/dark/core/prefab/TileDamageSource.java +++ b/src/dark/machines/prefab/TileDamageSource.java @@ -1,4 +1,4 @@ -package dark.core.prefab; +package dark.machines.prefab; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; diff --git a/src/dark/core/prefab/entities/EntityAdvanced.java b/src/dark/machines/prefab/entities/EntityAdvanced.java similarity index 99% rename from src/dark/core/prefab/entities/EntityAdvanced.java rename to src/dark/machines/prefab/entities/EntityAdvanced.java index f4e87c4f0..c25c273f7 100644 --- a/src/dark/core/prefab/entities/EntityAdvanced.java +++ b/src/dark/machines/prefab/entities/EntityAdvanced.java @@ -1,4 +1,4 @@ -package dark.core.prefab.entities; +package dark.machines.prefab.entities; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; diff --git a/src/dark/core/prefab/entities/EntityTestCar.java b/src/dark/machines/prefab/entities/EntityTestCar.java similarity index 93% rename from src/dark/core/prefab/entities/EntityTestCar.java rename to src/dark/machines/prefab/entities/EntityTestCar.java index 4dcf0071e..cd6cb47e2 100644 --- a/src/dark/core/prefab/entities/EntityTestCar.java +++ b/src/dark/machines/prefab/entities/EntityTestCar.java @@ -1,4 +1,4 @@ -package dark.core.prefab.entities; +package dark.machines.prefab.entities; import net.minecraft.world.World; import dark.machines.CoreRecipeLoader; diff --git a/src/dark/core/prefab/entities/EntityVehicle.java b/src/dark/machines/prefab/entities/EntityVehicle.java similarity index 99% rename from src/dark/core/prefab/entities/EntityVehicle.java rename to src/dark/machines/prefab/entities/EntityVehicle.java index 46aace065..a1ed129be 100644 --- a/src/dark/core/prefab/entities/EntityVehicle.java +++ b/src/dark/machines/prefab/entities/EntityVehicle.java @@ -1,4 +1,4 @@ -package dark.core.prefab.entities; +package dark.machines.prefab.entities; import java.util.List; diff --git a/src/dark/core/prefab/entities/ItemVehicleSpawn.java b/src/dark/machines/prefab/entities/ItemVehicleSpawn.java similarity index 99% rename from src/dark/core/prefab/entities/ItemVehicleSpawn.java rename to src/dark/machines/prefab/entities/ItemVehicleSpawn.java index ce07854d0..8601168d0 100644 --- a/src/dark/core/prefab/entities/ItemVehicleSpawn.java +++ b/src/dark/machines/prefab/entities/ItemVehicleSpawn.java @@ -1,4 +1,4 @@ -package dark.core.prefab.entities; +package dark.machines.prefab.entities; import java.util.List; diff --git a/src/dark/machines/transmit/TileEntityWire.java b/src/dark/machines/transmit/TileEntityWire.java index 5760fe5ff..f0721063c 100644 --- a/src/dark/machines/transmit/TileEntityWire.java +++ b/src/dark/machines/transmit/TileEntityWire.java @@ -1,7 +1,8 @@ package dark.machines.transmit; +import com.dark.helpers.ColorCode; + import universalelectricity.compatibility.TileEntityUniversalConductor; -import dark.api.ColorCode; public class TileEntityWire extends TileEntityUniversalConductor {