diff --git a/src/main/java/com/pahimar/ee3/EquivalentExchange3.java b/src/main/java/com/pahimar/ee3/EquivalentExchange3.java index acbcff5d..c6037bd3 100644 --- a/src/main/java/com/pahimar/ee3/EquivalentExchange3.java +++ b/src/main/java/com/pahimar/ee3/EquivalentExchange3.java @@ -1,18 +1,13 @@ package com.pahimar.ee3; -import com.pahimar.ee3.addon.AddonHandler; import com.pahimar.ee3.block.ModBlocks; -import com.pahimar.ee3.command.CommandHandler; -import com.pahimar.ee3.configuration.ConfigurationHandler; -import com.pahimar.ee3.handler.*; -import com.pahimar.ee3.helper.FluidHelper; -import com.pahimar.ee3.helper.LogHelper; -import com.pahimar.ee3.helper.VersionHelper; -import com.pahimar.ee3.imc.InterModCommsHandler; +import com.pahimar.ee3.handler.CraftingHandler; +import com.pahimar.ee3.handler.GuiHandler; import com.pahimar.ee3.item.ModItems; -import com.pahimar.ee3.lib.Reference; -import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.proxy.IProxy; +import com.pahimar.ee3.reference.EventHandlers; +import com.pahimar.ee3.reference.Reference; +import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; @@ -20,80 +15,32 @@ import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.*; import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent; import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; import net.minecraftforge.common.MinecraftForge; -import java.io.File; - -/** - * Equivalent-Exchange-3 - *

- * EquivalentExchange3 - * - * @author pahimar - */ -@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, certificateFingerprint = Reference.FINGERPRINT) +@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, certificateFingerprint = Reference.FINGERPRINT, version = "0.2") public class EquivalentExchange3 { - @Instance(Reference.MOD_ID) + @Instance public static EquivalentExchange3 instance; @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS) public static IProxy proxy; @EventHandler - @SuppressWarnings("unused") public void invalidFingerprint(FMLFingerprintViolationEvent event) { - // Report (log) to the user that the version of Equivalent Exchange 3 - // they are using has been changed/tampered with - if (Reference.FINGERPRINT.equals("@FINGERPRINT@")) - { - LogHelper.warn(Strings.NO_FINGERPRINT_MESSAGE); - } - else - { - LogHelper.error(Strings.INVALID_FINGERPRINT_MESSAGE); - } + } @EventHandler - @SuppressWarnings("unused") public void serverStarting(FMLServerStartingEvent event) { - // Initialize the custom commands - CommandHandler.initCommands(event); + } @EventHandler - @SuppressWarnings("unused") public void preInit(FMLPreInitializationEvent event) { - // set version number - event.getModMetadata().version = Reference.VERSION_NUMBER; - - // Initialize the configuration - ConfigurationHandler.init(event.getModConfigurationDirectory().getAbsolutePath() + File.separator + Reference.CHANNEL_NAME.toLowerCase() + File.separator); - - // Conduct the version check and log the result - VersionHelper.execute(); - - // Initialize the Version Check Tick Handler (Client only) - TickRegistry.registerTickHandler(new VersionCheckTickHandler(), Side.CLIENT); - - // Initialize the InterModCommunications Tick Handler (Server only) - TickRegistry.registerScheduledTickHandler(new InterModCommsHandler(), Side.SERVER); - - // Initialize the Render Tick Handler (Client only) - proxy.registerRenderTickHandler(); - - // Register the KeyBinding Handler (Client only) - proxy.registerKeyBindingHandler(); - - // Register the Sound Handler (Client only) - proxy.registerSoundHandler(); - // Initialize mod blocks ModBlocks.init(); @@ -102,58 +49,27 @@ public class EquivalentExchange3 } @EventHandler - @SuppressWarnings("unchecked, unused") public void init(FMLInitializationEvent event) { // Register the GUI Handler NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler()); - // Register the Item Pickup Handler - MinecraftForge.EVENT_BUS.register(new ItemEventHandler()); + // Register the Items Event Handler + FMLCommonHandler.instance().bus().register(EventHandlers.itemEventHandler); + MinecraftForge.EVENT_BUS.register(EventHandlers.itemEventHandler); - MinecraftForge.EVENT_BUS.register(new ActionRequestHandler()); - - MinecraftForge.EVENT_BUS.register(new WorldTransmutationHandler()); - - // Register the hook to initialize the EmcRegistry - MinecraftForge.EVENT_BUS.register(new WorldEventHandler()); - - // Register the ItemTooltipEvent Handler - proxy.registerItemTooltipHandler(); - - // Register the DrawBlockHighlight Handler - proxy.registerDrawBlockHighlightHandler(); - - // Initialize custom rendering and pre-load textures (Client only) - proxy.initRenderingAndTextures(); - - // Initialize our Crafting Handler CraftingHandler.init(); - - // Handle fluid registration - FluidHelper.registerFluids(); - - // Initialize mod tile entities - proxy.registerTileEntities(); - - // Register our fuels - GameRegistry.registerFuelHandler(new FuelHandler()); - - // Initialize addons (which work with IMC, and must be used in Init) - AddonHandler.init(); } @EventHandler - @SuppressWarnings("unused") public void postInit(FMLPostInitializationEvent event) { - // NOOP + } @EventHandler - @SuppressWarnings("unused") public void handleIMCMessages(IMCEvent event) { - InterModCommsHandler.processIMCMessages(event); + } } diff --git a/src/main/java/com/pahimar/ee3/addon/AddonEquivalentExchange3.java b/src/main/java/com/pahimar/ee3/addon/AddonEquivalentExchange3.java deleted file mode 100644 index 6df756aa..00000000 --- a/src/main/java/com/pahimar/ee3/addon/AddonEquivalentExchange3.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.pahimar.ee3.addon; - -import com.pahimar.ee3.block.ModBlocks; -import com.pahimar.ee3.item.ModItems; -import net.minecraft.item.ItemStack; - -public class AddonEquivalentExchange3 -{ - public static void init() - { - addRecipes(); - addPreAssignmentEmcValues(); - addPostAssignmentEmcValues(); - } - - public static void addRecipes() - { - /** - * Chalk - */ - AddonHandler.sendAddRecipe(new ItemStack(ModItems.chalk, 4), new ItemStack(ModBlocks.chalk)); - } - - private static void addPreAssignmentEmcValues() - { - // NOOP - } - - private static void addPostAssignmentEmcValues() - { - // NOOP - } -} diff --git a/src/main/java/com/pahimar/ee3/addon/AddonHandler.java b/src/main/java/com/pahimar/ee3/addon/AddonHandler.java deleted file mode 100644 index 90d1d599..00000000 --- a/src/main/java/com/pahimar/ee3/addon/AddonHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.pahimar.ee3.addon; - -import com.pahimar.ee3.api.RecipeMapping; -import com.pahimar.ee3.api.StackValueMapping; -import com.pahimar.ee3.emc.EmcValue; -import com.pahimar.ee3.imc.InterModCommsOperations; -import com.pahimar.ee3.lib.Reference; -import cpw.mods.fml.common.event.FMLInterModComms; - -import java.util.Arrays; -import java.util.List; - -/** - * Equivalent-Exchange-3 - *

- * AddonHandler - * - * @author pahimar - */ -public class AddonHandler -{ - public static void init() - { - AddonEquivalentExchange3.init(); - AddonIndustrialCraft2.init(); - } - - public static void sendAddRecipe(Object outputObject, Object... inputObjects) - { - List inputObjectsList = Arrays.asList(inputObjects); - FMLInterModComms.sendMessage(Reference.MOD_ID, InterModCommsOperations.RECIPE_ADD, new RecipeMapping(outputObject, inputObjectsList).toJson()); - } - - public static void sendPreValueAssignment(Object object, EmcValue emcValue) - { - sendPreValueAssignment(new StackValueMapping(object, emcValue)); - } - - public static void sendPreValueAssignment(StackValueMapping stackValueMapping) - { - if (stackValueMapping != null) - { - FMLInterModComms.sendMessage(Reference.MOD_ID, InterModCommsOperations.EMC_ASSIGN_VALUE_PRE, stackValueMapping.toJson()); - } - } - - public static void sendPostValueAssignment(Object object, EmcValue emcValue) - { - sendPostValueAssignment(new StackValueMapping(object, emcValue)); - } - - public static void sendPostValueAssignment(StackValueMapping stackValueMapping) - { - if (stackValueMapping != null) - { - FMLInterModComms.sendMessage(Reference.MOD_ID, InterModCommsOperations.EMC_ASSIGN_VALUE_POST, stackValueMapping.toJson()); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/addon/AddonIndustrialCraft2.java b/src/main/java/com/pahimar/ee3/addon/AddonIndustrialCraft2.java deleted file mode 100644 index 115b2041..00000000 --- a/src/main/java/com/pahimar/ee3/addon/AddonIndustrialCraft2.java +++ /dev/null @@ -1,233 +0,0 @@ -package com.pahimar.ee3.addon; - -import com.pahimar.ee3.api.OreStack; -import com.pahimar.ee3.api.WrappedStack; -import com.pahimar.ee3.emc.EmcValue; -import com.pahimar.ee3.helper.LogHelper; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidRegistry; - -import java.lang.reflect.InvocationTargetException; - -/** - * Equivalent-Exchange-3 - *

- * AddonIndustrialCraft2 - * - * @author pahimar - */ -public class AddonIndustrialCraft2 -{ - /** - * EmcValues for various IC2 things - */ - private static final EmcValue COPPER_EMC_VALUE = new EmcValue(72); - private static final EmcValue TIN_EMC_VALUE = new EmcValue(256); - private static final EmcValue LEAD_EMC_VALUE = new EmcValue(512); - private static final EmcValue SILVER_EMC_VALUE = new EmcValue(1024); - private static final EmcValue URANIUM_EMC_VALUE = new EmcValue(4096); - private static final EmcValue SULFUR_EMC_VALUE = new EmcValue(512); - private static final EmcValue LITHIUM_EMC_VALUE = new EmcValue(512); - private static final EmcValue SILICON_DIOXIDE_EMC_VALUE = new EmcValue(256); - private static final EmcValue RUBBER_WOOD_EMC_VALUE = new EmcValue(24); - - public static void init() - { - addRecipes(); - addPreAssignmentEmcValues(); - addPostAssignmentEmcValues(); - } - - private static void addRecipes() - { - /** - * Bronze - */ - AddonHandler.sendAddRecipe(new OreStack("dustBronze"), new OreStack("dustTin"), new OreStack("dustCopper", 3)); - AddonHandler.sendAddRecipe(new OreStack("ingotBronze"), new OreStack("dustBronze")); - AddonHandler.sendAddRecipe(new OreStack("plateBronze"), new OreStack("ingotBronze")); - AddonHandler.sendAddRecipe(new OreStack("blockBronze"), new OreStack("ingotBronze", 9)); - AddonHandler.sendAddRecipe(new OreStack("plateDenseBronze"), new OreStack("ingotBronze", 9)); - - /** - * Clay - */ - AddonHandler.sendAddRecipe(new OreStack("dustClay", 2), Block.blockClay); - - /** - * Coal - */ - AddonHandler.sendAddRecipe(new OreStack("dustCoal"), new ItemStack(Item.coal, 1)); - AddonHandler.sendAddRecipe(new OreStack("dustHydratedCoal"), new OreStack("dustCoal"), new WrappedStack(FluidRegistry.WATER)); - - /** - * Copper - */ - AddonHandler.sendAddRecipe(new OreStack("dustCopper"), new OreStack("oreCopper")); - AddonHandler.sendAddRecipe(new OreStack("dustTinyCopper", 9), new OreStack("dustCopper")); - AddonHandler.sendAddRecipe(new OreStack("crushedCopper"), new OreStack("dustCopper")); - AddonHandler.sendAddRecipe(new OreStack("crushedPurifiedCopper"), new OreStack("crushedCopper")); - AddonHandler.sendAddRecipe(new OreStack("ingotCopper"), new OreStack("dustCopper")); - AddonHandler.sendAddRecipe(new OreStack("plateCopper"), new OreStack("ingotCopper")); - AddonHandler.sendAddRecipe(new OreStack("blockCopper"), new OreStack("ingotCopper", 9)); - AddonHandler.sendAddRecipe(new OreStack("plateDenseCopper"), new OreStack("ingotCopper", 9)); - - /** - * Diamond - */ - AddonHandler.sendAddRecipe(new OreStack("dustDiamond"), Item.diamond); - - /** - * Gold - */ - AddonHandler.sendAddRecipe(new OreStack("crushedGold"), Block.oreGold); - AddonHandler.sendAddRecipe(new OreStack("crushedPurifiedGold"), new OreStack("crushedGold")); - AddonHandler.sendAddRecipe(new OreStack("dustGold"), new OreStack("crushedPurifiedGold")); - AddonHandler.sendAddRecipe(new OreStack("dustTinyGold", 9), Block.oreGold); - AddonHandler.sendAddRecipe(new OreStack("plateGold"), Item.ingotGold); - AddonHandler.sendAddRecipe(new OreStack("plateDenseGold"), new ItemStack(Item.ingotGold, 9)); - - /** - * Industrial Diamond - */ - AddonHandler.sendAddRecipe(new OreStack("gemDiamond"), Item.diamond); - - /** - * Iron - */ - AddonHandler.sendAddRecipe(new OreStack("crushedIron"), Block.oreIron); - AddonHandler.sendAddRecipe(new OreStack("crushedPurifiedIron"), new OreStack("crushedIron")); - AddonHandler.sendAddRecipe(new OreStack("dustIron"), new OreStack("crushedPurifiedIron")); - AddonHandler.sendAddRecipe(new OreStack("dustTinyIron", 9), Block.oreIron); - AddonHandler.sendAddRecipe(new OreStack("ingotRefinedIron"), Item.ingotIron); - AddonHandler.sendAddRecipe(new OreStack("plateIron"), Item.ingotIron); - AddonHandler.sendAddRecipe(new OreStack("plateRefinedIron"), new OreStack("ingotRefinedIron")); - AddonHandler.sendAddRecipe(new OreStack("plateDenseIron"), new ItemStack(Item.ingotIron, 9)); - - /** - * Lapis - */ - AddonHandler.sendAddRecipe(new OreStack("dustLapis"), new ItemStack(Item.dyePowder, 1, 4)); - AddonHandler.sendAddRecipe(new OreStack("plateLapis"), new OreStack("dustLapis")); - AddonHandler.sendAddRecipe(new OreStack("plateDenseLapis"), new OreStack("plateLapis", 9)); - - /** - * Lead - */ - AddonHandler.sendAddRecipe(new OreStack("crushedLead"), new OreStack("oreLead")); - AddonHandler.sendAddRecipe(new OreStack("crushedPurifiedLead"), new OreStack("crushedLead")); - AddonHandler.sendAddRecipe(new OreStack("dustLead"), new OreStack("crushedPurifiedLead")); - AddonHandler.sendAddRecipe(new OreStack("dustTinyLead", 9), new OreStack("dustLead")); - AddonHandler.sendAddRecipe(new OreStack("ingotLead"), new OreStack("dustLead")); - AddonHandler.sendAddRecipe(new OreStack("plateLead"), new OreStack("ingotLead")); - AddonHandler.sendAddRecipe(new OreStack("plateDenseLead"), new OreStack("ingotLead", 9)); - AddonHandler.sendAddRecipe(new OreStack("blockLead"), new OreStack("ingotLead", 9)); - - /** - * Lithium - */ - AddonHandler.sendAddRecipe(new OreStack("dustTinyLithium", 9), new OreStack("dustLithium")); - - /** - * Obsidian - */ - AddonHandler.sendAddRecipe(new OreStack("dustObsidian", 4), Block.obsidian); - AddonHandler.sendAddRecipe(new OreStack("plateObsidian"), new OreStack("dustObsidian")); - AddonHandler.sendAddRecipe(new OreStack("plateDenseObsidian"), new OreStack("plateObsidian", 9)); - - /** - * Silver - */ - AddonHandler.sendAddRecipe(new OreStack("crushedSilver"), new OreStack("oreSilver")); - AddonHandler.sendAddRecipe(new OreStack("crushedPurifiedSilver"), new OreStack("crushedSilver")); - AddonHandler.sendAddRecipe(new OreStack("dustSilver"), new OreStack("crushedPurifiedSilver")); - AddonHandler.sendAddRecipe(new OreStack("dustTinySilver", 9), new OreStack("dustSilver")); - AddonHandler.sendAddRecipe(new OreStack("ingotSilver"), new OreStack("dustSilver")); - - /** - * Sulfur - */ - AddonHandler.sendAddRecipe(new OreStack("dustTinySulfur", 9), new OreStack("dustSulfur")); - - /** - * Tin - */ - AddonHandler.sendAddRecipe(new OreStack("dustTin"), new OreStack("oreTin")); - AddonHandler.sendAddRecipe(new OreStack("dustTinyTin", 9), new OreStack("dustTin")); - AddonHandler.sendAddRecipe(new OreStack("crushedTin"), new OreStack("dustTin")); - AddonHandler.sendAddRecipe(new OreStack("crushedPurifiedTin"), new OreStack("crushedTin")); - AddonHandler.sendAddRecipe(new OreStack("ingotTin"), new OreStack("dustTin")); - AddonHandler.sendAddRecipe(new OreStack("plateTin"), new OreStack("ingotTin")); - AddonHandler.sendAddRecipe(new OreStack("blockTin"), new OreStack("ingotTin", 9)); - AddonHandler.sendAddRecipe(new OreStack("plateDenseTin"), new OreStack("ingotTin", 9)); - - /** - * Uranium - */ - AddonHandler.sendAddRecipe(new OreStack("crushedUranium"), new OreStack("oreUranium")); - AddonHandler.sendAddRecipe(new OreStack("crushedPurifiedUranium"), new OreStack("crushedUranium")); - AddonHandler.sendAddRecipe(new OreStack("blockUranium"), new OreStack("oreUranium", 9)); - - /** - * Tools - */ - AddonHandler.sendAddRecipe(new OreStack("craftingToolForgeHammer"), new ItemStack(Item.ingotIron, 5), new OreStack("stickWood", 2)); - AddonHandler.sendAddRecipe(new OreStack("craftingToolWireCutter"), new ItemStack(Item.ingotIron, 2), new OreStack("plateIron", 3)); - - /** - * Items - */ - AddonHandler.sendAddRecipe(new OreStack("itemRubber"), new OreStack("woodRubber")); - } - - private static void addPreAssignmentEmcValues() - { - AddonHandler.sendPreValueAssignment(new OreStack("oreCopper"), COPPER_EMC_VALUE); - AddonHandler.sendPreValueAssignment(new OreStack("oreTin"), TIN_EMC_VALUE); - AddonHandler.sendPreValueAssignment(new OreStack("oreLead"), LEAD_EMC_VALUE); - AddonHandler.sendPreValueAssignment(new OreStack("oreSilver"), SILVER_EMC_VALUE); - AddonHandler.sendPreValueAssignment(new OreStack("oreUranium"), URANIUM_EMC_VALUE); - AddonHandler.sendPreValueAssignment(new OreStack("dustSulfur"), SULFUR_EMC_VALUE); - AddonHandler.sendPreValueAssignment(new OreStack("dustLithium"), LITHIUM_EMC_VALUE); - AddonHandler.sendPreValueAssignment(new OreStack("dustSiliconDioxide"), SILICON_DIOXIDE_EMC_VALUE); - AddonHandler.sendPreValueAssignment(new OreStack("woodRubber"), RUBBER_WOOD_EMC_VALUE); - } - - private static void addPostAssignmentEmcValues() - { - - } - - public static Item grabIC2ItemByName(String name) - { - try - { - Object object = Class.forName("ic2.api.item.Items").getDeclaredMethod("getItem", String.class).invoke(null, name); - LogHelper.debug(object); - } - catch (NoSuchMethodException e) - { - e.printStackTrace(); - } - catch (ClassNotFoundException e) - { - e.printStackTrace(); - } - catch (InvocationTargetException e) - { - e.printStackTrace(); - } - catch (IllegalAccessException e) - { - e.printStackTrace(); - } - - return null; - } - - /*** - * TODO Investigate ways to scope out IC2 recipes and auto-add them - */ -} diff --git a/src/main/java/com/pahimar/ee3/api/EnergyStack.java b/src/main/java/com/pahimar/ee3/api/EnergyStack.java deleted file mode 100644 index a476d561..00000000 --- a/src/main/java/com/pahimar/ee3/api/EnergyStack.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.pahimar.ee3.api; - -import com.pahimar.ee3.lib.Compare; - -import java.util.Comparator; - -public class EnergyStack implements Comparable -{ - - public static final String VANILLA_SMELTING_ENERGY_NAME = "vanillaFuelValueUnits"; - public static final int VANILLA_SMELTING_ENERGY_THRESHOLD = 200; - - public String energyName; - public int stackSize; - - public EnergyStack(String energyName, int stackSize) - { - this.energyName = energyName; - this.stackSize = stackSize; - } - - public EnergyStack(String energyName) - { - this(energyName, 1); - } - - @Override - public String toString() - { - return String.format("%dxenergyStack.%s", stackSize, energyName); - } - - @Override - public boolean equals(Object object) - { - return object instanceof EnergyStack && (this.compareTo((EnergyStack) object) == Compare.EQUALS); - } - - public static boolean compareEnergyNames(EnergyStack energyStack1, EnergyStack energyStack2) - { - if (energyStack1 != null && energyStack2 != null) - { - if ((energyStack1.energyName != null) && (energyStack2.energyName != null)) - { - return energyStack1.energyName.equalsIgnoreCase(energyStack2.energyName); - } - } - - return false; - } - - @Override - public int compareTo(EnergyStack energyStack) - { - return comparator.compare(this, energyStack); - } - - public static int compare(EnergyStack energyStack1, EnergyStack energyStack2) - { - return comparator.compare(energyStack1, energyStack2); - } - - public static Comparator comparator = new Comparator() - { - @Override - public int compare(EnergyStack energyStack1, EnergyStack energyStack2) - { - if (energyStack1 != null) - { - if (energyStack2 != null) - { - if (energyStack1.energyName.equalsIgnoreCase(energyStack2.energyName)) - { - return energyStack1.stackSize - energyStack2.stackSize; - } - else - { - return energyStack1.energyName.compareToIgnoreCase(energyStack2.energyName); - } - } - else - { - return Compare.LESSER_THAN; - } - } - else - { - if (energyStack2 != null) - { - return Compare.GREATER_THAN; - } - else - { - return Compare.EQUALS; - } - } - } - }; -} diff --git a/src/main/java/com/pahimar/ee3/api/ICustomEmcValueProvider.java b/src/main/java/com/pahimar/ee3/api/ICustomEmcValueProvider.java deleted file mode 100644 index c046327e..00000000 --- a/src/main/java/com/pahimar/ee3/api/ICustomEmcValueProvider.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.pahimar.ee3.api; - -import com.pahimar.ee3.emc.EmcValue; -import net.minecraft.item.ItemStack; - -public interface ICustomEmcValueProvider -{ - public abstract EmcValue getEmcValue(ItemStack itemStack); -} diff --git a/src/main/java/com/pahimar/ee3/api/JsonItemStack.java b/src/main/java/com/pahimar/ee3/api/JsonItemStack.java deleted file mode 100644 index aeb0c702..00000000 --- a/src/main/java/com/pahimar/ee3/api/JsonItemStack.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.pahimar.ee3.api; - -public class JsonItemStack -{ - public int stackSize; - public int itemID; - public byte[] compressedStackTagCompound; - public int itemDamage; -} diff --git a/src/main/java/com/pahimar/ee3/api/OreStack.java b/src/main/java/com/pahimar/ee3/api/OreStack.java deleted file mode 100644 index 197955c0..00000000 --- a/src/main/java/com/pahimar/ee3/api/OreStack.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.pahimar.ee3.api; - -import com.google.gson.Gson; -import com.google.gson.JsonParseException; -import com.google.gson.JsonSyntaxException; -import com.pahimar.ee3.helper.LogHelper; -import com.pahimar.ee3.lib.Compare; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; - -public class OreStack implements Comparable -{ - // Gson serializer for serializing to/deserializing from json - private static final Gson gsonSerializer = new Gson(); - - private static final int ORE_DICTIONARY_NOT_FOUND = -1; - - public String oreName; - public int stackSize; - public static Comparator comparator = new Comparator() - { - - @Override - public int compare(OreStack oreStack1, OreStack oreStack2) - { - - if (oreStack1 != null) - { - if (oreStack2 != null) - { - if (oreStack1.oreName.equalsIgnoreCase(oreStack2.oreName)) - { - return oreStack1.stackSize - oreStack2.stackSize; - } - else - { - return oreStack1.oreName.compareToIgnoreCase(oreStack2.oreName); - } - } - else - { - return Compare.LESSER_THAN; - } - } - else - { - if (oreStack2 != null) - { - return Compare.GREATER_THAN; - } - else - { - return Compare.EQUALS; - } - } - } - }; - - public OreStack(String oreName, int stackSize) - { - this.oreName = oreName; - this.stackSize = stackSize; - } - - public OreStack(String oreName) - { - this(oreName, 1); - } - - public OreStack(ItemStack itemStack) - { - this(OreDictionary.getOreName(OreDictionary.getOreID(itemStack)), itemStack.stackSize); - } - - public static boolean compareOreNames(OreStack oreStack1, OreStack oreStack2) - { - if (oreStack1 != null && oreStack2 != null) - { - if ((oreStack1.oreName != null) && (oreStack2.oreName != null)) - { - return oreStack1.oreName.equalsIgnoreCase(oreStack2.oreName); - } - } - - return false; - } - - /** - * Deserializes a OreStack object from the given serialized json String - * - * @param jsonOreStack - * Json encoded String representing a OreStack object - * - * @return The OreStack that was encoded as json, or null if a valid OreStack could not be decoded from given String - */ - @SuppressWarnings("unused") - public static OreStack createFromJson(String jsonOreStack) - { - try - { - return gsonSerializer.fromJson(jsonOreStack, OreStack.class); - } - catch (JsonSyntaxException exception) - { - LogHelper.error(exception.getMessage()); - } - catch (JsonParseException exception) - { - LogHelper.error(exception.getMessage()); - } - - return null; - } - - public static OreStack getOreStackFromList(Object... objects) - { - return getOreStackFromList(Arrays.asList(objects)); - } - - public static OreStack getOreStackFromList(List objectList) - { - for (Object listElement : objectList) - { - if (listElement instanceof ItemStack) - { - ItemStack stack = (ItemStack) listElement; - - if (OreDictionary.getOreID(stack) != ORE_DICTIONARY_NOT_FOUND) - { - return new OreStack(stack); - } - } - } - - return null; - } - - public static int compare(OreStack oreStack1, OreStack oreStack2) - { - return comparator.compare(oreStack1, oreStack2); - } - - @Override - public String toString() - { - return String.format("%sxoreStack.%s", stackSize, oreName); - } - - @Override - public boolean equals(Object object) - { - return object instanceof OreStack && (comparator.compare(this, (OreStack) object) == Compare.EQUALS); - } - - @Override - public int compareTo(OreStack oreStack) - { - return comparator.compare(this, oreStack); - } - - /** - * Returns this OreStack as a json serialized String - * - * @return Json serialized String of this OreStack - */ - @SuppressWarnings("unused") - public String toJson() - { - return gsonSerializer.toJson(this); - } -} diff --git a/src/main/java/com/pahimar/ee3/api/RecipeMapping.java b/src/main/java/com/pahimar/ee3/api/RecipeMapping.java deleted file mode 100644 index 5319247b..00000000 --- a/src/main/java/com/pahimar/ee3/api/RecipeMapping.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.pahimar.ee3.api; - -import com.google.gson.*; -import com.pahimar.ee3.helper.LogHelper; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.List; - -public class RecipeMapping implements JsonSerializer, JsonDeserializer -{ - private static final Gson gsonSerializer = (new GsonBuilder()).registerTypeAdapter(RecipeMapping.class, new RecipeMapping()).create(); - - public final WrappedStack outputWrappedStack; - public final List inputWrappedStacks; - - private RecipeMapping() - { - outputWrappedStack = null; - inputWrappedStacks = null; - } - - public RecipeMapping(Object outputStack, List inputStacks) - { - this.outputWrappedStack = new WrappedStack(outputStack); - - List wrappedStacks = new ArrayList(); - for (Object object : inputStacks) - { - - WrappedStack wrappedStack = new WrappedStack(object); - - if (wrappedStack.getWrappedStack() != null) - { - wrappedStacks.add(wrappedStack); - } - else - { - LogHelper.warn(String.format("RecipeMapping with output: %s is containing a null WrappedStack " + - "input that will not be added to the input list.", outputWrappedStack.toString())); - } - } - - this.inputWrappedStacks = wrappedStacks; - } - - public static RecipeMapping createFromJson(String jsonRecipeMapping) - { - try - { - return gsonSerializer.fromJson(jsonRecipeMapping, RecipeMapping.class); - } - catch (JsonSyntaxException exception) - { - LogHelper.error(exception.getMessage()); - } - catch (JsonParseException exception) - { - LogHelper.error(exception.getMessage()); - } - - return null; - } - - public String toJson() - { - return gsonSerializer.toJson(this); - } - - @Override - public RecipeMapping deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException - { - if (!jsonElement.isJsonPrimitive()) - { - JsonObject jsonRecipeMapping = (JsonObject) jsonElement; - - WrappedStack outputStack = null; - List inputStacks = new ArrayList(); - - if (jsonRecipeMapping.get("outputWrappedStack") != null) - { - outputStack = new WrappedStack().deserialize(jsonRecipeMapping.get("outputWrappedStack").getAsJsonObject(), WrappedStack.class, context); - } - - if (jsonRecipeMapping.get("inputWrappedStacks") != null) - { - JsonArray jsonInputStacks = jsonRecipeMapping.get("inputWrappedStacks").getAsJsonArray(); - - for (int i = 0; i < jsonInputStacks.size(); i++) - { - WrappedStack inputStack = new WrappedStack().deserialize(jsonInputStacks.get(i).getAsJsonObject(), WrappedStack.class, context); - inputStacks.add(inputStack); - } - } - - return new RecipeMapping(outputStack, inputStacks); - } - - return null; - } - - @Override - public JsonElement serialize(RecipeMapping recipeMapping, Type type, JsonSerializationContext context) - { - JsonObject jsonRecipeMapping = new JsonObject(); - - Gson gsonWrappedStack = new Gson(); - - JsonArray jsonArray = new JsonArray(); - for (WrappedStack inputStack : recipeMapping.inputWrappedStacks) - { - jsonArray.add(gsonWrappedStack.toJsonTree(inputStack, WrappedStack.class)); - } - - jsonRecipeMapping.add("outputWrappedStack", gsonWrappedStack.toJsonTree(recipeMapping.outputWrappedStack, WrappedStack.class)); - jsonRecipeMapping.add("inputWrappedStacks", jsonArray); - - return jsonRecipeMapping; - } - - @Override - public String toString() - { - return String.format("RecipeMapping[Output: %s, Input: %s]", outputWrappedStack, inputWrappedStacks); - } -} diff --git a/src/main/java/com/pahimar/ee3/api/StackValueMapping.java b/src/main/java/com/pahimar/ee3/api/StackValueMapping.java deleted file mode 100644 index 459cf640..00000000 --- a/src/main/java/com/pahimar/ee3/api/StackValueMapping.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.pahimar.ee3.api; - -import com.google.gson.*; -import com.pahimar.ee3.emc.EmcValue; -import com.pahimar.ee3.helper.LogHelper; - -import java.lang.reflect.Type; - -public class StackValueMapping implements JsonSerializer, JsonDeserializer -{ - - private static final Gson gsonSerializer = (new GsonBuilder()).registerTypeAdapter(StackValueMapping.class, new StackValueMapping()).create(); - - public final WrappedStack wrappedStack; - public final EmcValue emcValue; - - public StackValueMapping() - { - wrappedStack = null; - emcValue = null; - } - - public StackValueMapping(Object object, EmcValue emcValue) - { - this.wrappedStack = new WrappedStack(object); - this.emcValue = emcValue; - } - - public static StackValueMapping createFromJson(String jsonStackValueMapping) - { - - try - { - return gsonSerializer.fromJson(jsonStackValueMapping, StackValueMapping.class); - } - catch (JsonSyntaxException exception) - { - LogHelper.error(exception.getMessage()); - } - catch (JsonParseException exception) - { - LogHelper.error(exception.getMessage()); - } - - return null; - } - - public String toJson() - { - return gsonSerializer.toJson(this); - } - - /* (non-Javadoc) - * @see com.google.gson.JsonSerializer#serialize(java.lang.Object, java.lang.reflect.Type, com.google.gson.JsonSerializationContext) - */ - @Override - public JsonElement serialize(StackValueMapping stackValueMapping, Type type, JsonSerializationContext context) - { - - JsonObject jsonStackValueMapping = new JsonObject(); - - Gson gsonWrappedStack = (new GsonBuilder()).registerTypeAdapter(WrappedStack.class, new WrappedStack()).create(); - Gson gsonEmcValue = (new GsonBuilder()).registerTypeAdapter(EmcValue.class, new EmcValue()).create(); - - jsonStackValueMapping.add("wrappedStack", gsonWrappedStack.toJsonTree(stackValueMapping.wrappedStack)); - jsonStackValueMapping.add("emcValue", gsonEmcValue.toJsonTree(stackValueMapping.emcValue)); - - return jsonStackValueMapping; - } - - /* (non-Javadoc) - * @see com.google.gson.JsonDeserializer#deserialize(com.google.gson.JsonElement, java.lang.reflect.Type, com.google.gson.JsonDeserializationContext) - */ - @Override - public StackValueMapping deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException - { - - if (!jsonElement.isJsonPrimitive()) - { - - JsonObject jsonStackValueMapping = (JsonObject) jsonElement; - - WrappedStack wrappedStack = null; - EmcValue emcValue = null; - - if (jsonStackValueMapping.get("wrappedStack") != null) - { - wrappedStack = new WrappedStack().deserialize(jsonStackValueMapping.get("wrappedStack").getAsJsonObject(), type, context); - } - - if (jsonStackValueMapping.get("emcValue") != null) - { - emcValue = new EmcValue().deserialize(jsonStackValueMapping.get("emcValue").getAsJsonObject(), type, context); - } - - if (wrappedStack != null && emcValue != null) - { - return new StackValueMapping(wrappedStack, emcValue); - } - else - { - return null; - } - } - - return null; - } -} diff --git a/src/main/java/com/pahimar/ee3/api/WrappedStack.java b/src/main/java/com/pahimar/ee3/api/WrappedStack.java deleted file mode 100644 index 087ecd52..00000000 --- a/src/main/java/com/pahimar/ee3/api/WrappedStack.java +++ /dev/null @@ -1,766 +0,0 @@ -package com.pahimar.ee3.api; - -import com.google.gson.*; -import com.pahimar.ee3.helper.FluidHelper; -import com.pahimar.ee3.helper.ItemHelper; -import com.pahimar.ee3.helper.LogHelper; -import com.pahimar.ee3.lib.Compare; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -import java.io.IOException; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; - -public class WrappedStack implements Comparable, JsonDeserializer, JsonSerializer -{ - private static final Gson gsonSerializer = (new GsonBuilder()).registerTypeAdapter(WrappedStack.class, new WrappedStack()).create(); - - @SuppressWarnings("unused") - private final String className; - - private int stackSize; - private final Object wrappedStack; - - /** - * - */ - public WrappedStack() - { - className = null; - stackSize = -1; - wrappedStack = null; - } - - public WrappedStack(Object object) - { - if (object instanceof Item) - { - object = new ItemStack((Item) object); - } - else if (object instanceof Block) - { - object = new ItemStack((Block) object); - } - else if (object instanceof Fluid) - { - object = new FluidStack((Fluid) object, 1000); - } - - if (object instanceof ItemStack) - { - ItemStack itemStack = ((ItemStack) object).copy(); - - className = ItemStack.class.getSimpleName(); - stackSize = itemStack.stackSize; - itemStack.stackSize = 1; - wrappedStack = itemStack; - } - else if (object instanceof OreStack) - { - OreStack oreStack = (OreStack) object; - - className = OreStack.class.getSimpleName(); - stackSize = oreStack.stackSize; - oreStack.stackSize = 1; - wrappedStack = oreStack; - } - else if (object instanceof ArrayList) - { - ArrayList objectList = (ArrayList) object; - - OreStack possibleOreStack = OreStack.getOreStackFromList(objectList); - - if (possibleOreStack != null) - { - className = OreStack.class.getSimpleName(); - stackSize = possibleOreStack.stackSize; - possibleOreStack.stackSize = 1; - wrappedStack = possibleOreStack; - } - else - { - stackSize = -1; - className = null; - wrappedStack = null; - } - } - else if (object instanceof EnergyStack) - { - EnergyStack energyStack = (EnergyStack) object; - - className = EnergyStack.class.getSimpleName(); - stackSize = energyStack.stackSize; - energyStack.stackSize = 1; - wrappedStack = energyStack; - } - else if (object instanceof FluidStack) - { - FluidStack fluidStack = ((FluidStack) object).copy(); - - className = FluidStack.class.getSimpleName(); - stackSize = fluidStack.amount; - fluidStack.amount = 1; - wrappedStack = fluidStack; - } - else if (object instanceof WrappedStack) - { - WrappedStack wrappedStackObject = (WrappedStack) object; - - if (wrappedStackObject.getWrappedStack() != null) - { - className = wrappedStackObject.wrappedStack.getClass().getSimpleName(); - this.stackSize = wrappedStackObject.stackSize; - this.wrappedStack = wrappedStackObject.wrappedStack; - } - else - { - className = null; - stackSize = -1; - wrappedStack = null; - } - } - else if (object instanceof String) - { - WrappedStack wrappedStack = createFromJson((String) object); - - if (wrappedStack != null && wrappedStack.getWrappedStack() != null) - { - className = wrappedStack.getWrappedStack().getClass().getSimpleName(); - stackSize = wrappedStack.stackSize; - this.wrappedStack = wrappedStack.wrappedStack; - } - else - { - className = null; - stackSize = -1; - this.wrappedStack = null; - } - } - else - { - className = null; - stackSize = -1; - wrappedStack = null; - } - } - - public WrappedStack(Object object, int stackSize) - { - if (object instanceof Item) - { - object = new ItemStack((Item) object); - } - else if (object instanceof Block) - { - object = new ItemStack((Block) object); - } - else if (object instanceof Fluid) - { - object = new FluidStack((Fluid) object, 1000); - } - - if (object instanceof ItemStack) - { - ItemStack itemStack = ((ItemStack) object).copy(); - - className = ItemStack.class.getSimpleName(); - this.stackSize = stackSize; - itemStack.stackSize = 1; - wrappedStack = itemStack; - } - else if (object instanceof OreStack) - { - OreStack oreStack = (OreStack) object; - - className = OreStack.class.getSimpleName(); - this.stackSize = stackSize; - oreStack.stackSize = 1; - wrappedStack = oreStack; - } - else if (object instanceof ArrayList) - { - ArrayList objectList = (ArrayList) object; - - OreStack possibleOreStack = OreStack.getOreStackFromList(objectList); - - if (possibleOreStack != null) - { - className = OreStack.class.getSimpleName(); - this.stackSize = stackSize; - possibleOreStack.stackSize = 1; - wrappedStack = possibleOreStack; - } - else - { - this.stackSize = -1; - className = null; - wrappedStack = null; - } - } - else if (object instanceof EnergyStack) - { - EnergyStack energyStack = (EnergyStack) object; - - className = EnergyStack.class.getSimpleName(); - this.stackSize = stackSize; - energyStack.stackSize = 1; - wrappedStack = energyStack; - } - else if (object instanceof FluidStack) - { - FluidStack fluidStack = (FluidStack) object; - - className = FluidStack.class.getSimpleName(); - this.stackSize = stackSize; - fluidStack.amount = 1; - wrappedStack = fluidStack; - } - else if (object instanceof WrappedStack) - { - WrappedStack wrappedStackObject = (WrappedStack) object; - - if (wrappedStackObject.getWrappedStack() != null) - { - className = wrappedStackObject.wrappedStack.getClass().getSimpleName(); - this.stackSize = stackSize; - this.wrappedStack = wrappedStackObject.wrappedStack; - } - else - { - className = null; - this.stackSize = -1; - wrappedStack = null; - } - } - else if (object instanceof String) - { - WrappedStack wrappedStack = createFromJson((String) object); - - if (wrappedStack != null && wrappedStack.getWrappedStack() != null) - { - className = wrappedStack.wrappedStack.getClass().getSimpleName(); - this.stackSize = stackSize; - this.wrappedStack = wrappedStack.wrappedStack; - } - else - { - className = null; - this.stackSize = -1; - this.wrappedStack = null; - } - } - else - { - className = null; - this.stackSize = -1; - wrappedStack = null; - } - } - - public int getStackSize() - { - - return stackSize; - } - - public void setStackSize(int stackSize) - { - - this.stackSize = stackSize; - } - - public Object getWrappedStack() - { - - return wrappedStack; - } - - public static WrappedStack createFromJson(String jsonWrappedObject) throws JsonParseException - { - try - { - return gsonSerializer.fromJson(jsonWrappedObject, WrappedStack.class); - } - catch (JsonSyntaxException exception) - { - LogHelper.error(exception.getMessage()); - } - catch (JsonParseException exception) - { - LogHelper.error(exception.getMessage()); - } - - return null; - } - - @SuppressWarnings("unused") - public String toJson() - { - return gsonSerializer.toJson(this); - } - - /* - * Sort order (class-wise) goes ItemStack, OreStack, EnergyStack, - * FluidStack, null - * @see java.lang.Comparable#compareTo(java.lang.Object) - */ - @Override - public int compareTo(WrappedStack wrappedStack) - { - return comparator.compare(this, wrappedStack); - } - - /** - * - */ - @Override - public int hashCode() - { - int hashCode = 1; - hashCode = (37 * hashCode) + stackSize; - - if (wrappedStack instanceof ItemStack) - { - hashCode = (37 * hashCode) + ((ItemStack) wrappedStack).itemID; - hashCode = (37 * hashCode) + ((ItemStack) wrappedStack).getItemDamage(); - - if (((ItemStack) wrappedStack).getTagCompound() != null) - { - hashCode = (37 * hashCode) + ((ItemStack) wrappedStack).getTagCompound().hashCode(); - } - } - else if (wrappedStack instanceof OreStack) - { - if (((OreStack) wrappedStack).oreName != null) - { - hashCode = (37 * hashCode) + ((OreStack) wrappedStack).oreName.hashCode(); - } - } - else if (wrappedStack instanceof EnergyStack) - { - if (((EnergyStack) wrappedStack).energyName != null) - { - hashCode = (37 * hashCode) + ((EnergyStack) wrappedStack).energyName.hashCode(); - } - } - else if (wrappedStack instanceof FluidStack) - { - hashCode = (37 * hashCode) + wrappedStack.hashCode(); - - if (((FluidStack) wrappedStack).tag != null) - { - hashCode = (37 * hashCode) + ((FluidStack) wrappedStack).tag.hashCode(); - } - } - - return hashCode; - } - - @Override - public boolean equals(Object object) - { - return object instanceof WrappedStack && (this.compareTo((WrappedStack) object) == Compare.EQUALS); - } - - /** - * @return a string representation of the object. - */ - @Override - public String toString() - { - - StringBuilder stringBuilder = new StringBuilder(); - - if (wrappedStack instanceof ItemStack) - { - ItemStack itemStack = (ItemStack) wrappedStack; - try - { - stringBuilder.append(String.format("%sxitemStack[%s:%s:%s:%s]", stackSize, itemStack.itemID, itemStack.getItemDamage(), itemStack.getUnlocalizedName(), itemStack.getItem().getClass().getCanonicalName())); - } - catch (ArrayIndexOutOfBoundsException e) - { - // NOOP - } - } - else if (wrappedStack instanceof OreStack) - { - OreStack oreStack = (OreStack) wrappedStack; - stringBuilder.append(String.format("%sxoreStack.%s", stackSize, oreStack.oreName)); - } - else if (wrappedStack instanceof EnergyStack) - { - EnergyStack energyStack = (EnergyStack) wrappedStack; - stringBuilder.append(String.format("%sxenergyStack.%s", stackSize, energyStack.energyName)); - } - else if (wrappedStack instanceof FluidStack) - { - FluidStack fluidStack = (FluidStack) wrappedStack; - stringBuilder.append(String.format("%sxfluidStack.%s", stackSize, fluidStack.getFluid().getName())); - } - else - { - stringBuilder.append("null"); - } - - return stringBuilder.toString(); - } - - public static boolean canBeWrapped(Object object) - { - if (object instanceof WrappedStack) - { - return true; - } - else if (object instanceof Item || object instanceof Block || object instanceof ItemStack) - { - return true; - } - else if (object instanceof OreStack) - { - return true; - } - else if (object instanceof List) - { - if (OreStack.getOreStackFromList((List) object) != null) - { - return true; - } - } - else if (object instanceof EnergyStack) - { - return true; - } - else if (object instanceof Fluid || object instanceof FluidStack) - { - return true; - } - - return false; - } - - @Override - public JsonElement serialize(WrappedStack wrappedStack, Type type, JsonSerializationContext context) - { - JsonObject jsonWrappedStack = new JsonObject(); - - Gson gsonWrappedStack = new Gson(); - - jsonWrappedStack.addProperty("className", wrappedStack.className); - jsonWrappedStack.addProperty("stackSize", wrappedStack.stackSize); - - if (wrappedStack.wrappedStack instanceof ItemStack) - { - JsonItemStack jsonItemStack = new JsonItemStack(); - jsonItemStack.itemID = ((ItemStack) wrappedStack.wrappedStack).itemID; - jsonItemStack.itemDamage = ((ItemStack) wrappedStack.wrappedStack).getItemDamage(); - jsonItemStack.stackSize = ((ItemStack) wrappedStack.wrappedStack).stackSize; - if (((ItemStack) wrappedStack.wrappedStack).stackTagCompound != null) - { - try - { - jsonItemStack.compressedStackTagCompound = CompressedStreamTools.compress(((ItemStack) wrappedStack.wrappedStack).stackTagCompound); - } - catch (IOException e) - { - e.printStackTrace(); - } - } - jsonWrappedStack.add("wrappedStack", gsonWrappedStack.toJsonTree(jsonItemStack, JsonItemStack.class)); - } - else if (wrappedStack.wrappedStack instanceof OreStack) - { - jsonWrappedStack.add("wrappedStack", gsonWrappedStack.toJsonTree(wrappedStack.wrappedStack, OreStack.class)); - } - else if (wrappedStack.wrappedStack instanceof EnergyStack) - { - jsonWrappedStack.add("wrappedStack", gsonWrappedStack.toJsonTree(wrappedStack.wrappedStack, EnergyStack.class)); - } - else if (wrappedStack.wrappedStack instanceof FluidStack) - { - jsonWrappedStack.add("wrappedStack", gsonWrappedStack.toJsonTree(wrappedStack.wrappedStack, FluidStack.class)); - } - - return jsonWrappedStack; - } - - /** - * - */ - @Override - public WrappedStack deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException - { - if (!jsonElement.isJsonPrimitive()) - { - JsonObject jsonWrappedStack = (JsonObject) jsonElement; - - int stackSize = -1; - String className = null; - Object stackObject = null; - - if (jsonWrappedStack.get("className") != null) - { - className = jsonWrappedStack.get("className").getAsString(); - } - - if (jsonWrappedStack.get("stackSize") != null) - { - stackSize = jsonWrappedStack.get("stackSize").getAsInt(); - } - - if (jsonWrappedStack.get("wrappedStack") != null && !jsonWrappedStack.get("wrappedStack").isJsonPrimitive()) - { - if (className != null) - { - if (className.equalsIgnoreCase(ItemStack.class.getSimpleName())) - { - JsonItemStack jsonItemStack = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), JsonItemStack.class); - ItemStack itemStack = null; - if (stackSize > 0) - { - itemStack = new ItemStack(jsonItemStack.itemID, stackSize, jsonItemStack.itemDamage); - if (jsonItemStack.compressedStackTagCompound != null) - { - try - { - itemStack.stackTagCompound = CompressedStreamTools.decompress(jsonItemStack.compressedStackTagCompound); - } - catch (IOException e) - { - e.printStackTrace(); - } - } - } - stackObject = itemStack; - } - else if (className.equalsIgnoreCase(OreStack.class.getSimpleName())) - { - OreStack oreStack = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), OreStack.class); - - if (stackSize > 0) - { - oreStack.stackSize = stackSize; - } - stackObject = oreStack; - } - else if (className.equalsIgnoreCase(EnergyStack.class.getSimpleName())) - { - EnergyStack energyStack = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), EnergyStack.class); - - if (stackSize > 0) - { - energyStack.stackSize = stackSize; - } - stackObject = energyStack; - } - else if (className.equalsIgnoreCase(FluidStack.class.getSimpleName())) - { - FluidStack fluidStack = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), FluidStack.class); - - if (stackSize > 0) - { - fluidStack.amount = stackSize; - } - stackObject = fluidStack; - } - } - } - - if (stackObject != null) - { - return new WrappedStack(stackObject); - } - else - { - throw new JsonParseException(String.format("Unable to parse a wrappable stack object from the provided json: %s", jsonElement.toString())); - } - } - else - { - throw new JsonParseException(String.format("Unable to parse a wrappable stack object from the provided json: %s", jsonElement.toString())); - } - } - - /** - * - */ - @Override - public WrappedStack deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException - { - if (!jsonElement.isJsonPrimitive()) - { - JsonObject jsonWrappedStack = (JsonObject) jsonElement; - - int stackSize = -1; - String className = null; - Object stackObject = null; - - if (jsonWrappedStack.get("className") != null) - { - className = jsonWrappedStack.get("className").getAsString(); - } - - if (jsonWrappedStack.get("stackSize") != null) - { - stackSize = jsonWrappedStack.get("stackSize").getAsInt(); - } - - if (jsonWrappedStack.get("wrappedStack") != null && !jsonWrappedStack.get("wrappedStack").isJsonPrimitive()) - { - if (className != null) - { - if (className.equalsIgnoreCase(ItemStack.class.getSimpleName())) - { - JsonItemStack jsonItemStack = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), JsonItemStack.class); - ItemStack itemStack = null; - if (stackSize > 0) - { - itemStack = new ItemStack(jsonItemStack.itemID, stackSize, jsonItemStack.itemDamage); - if (jsonItemStack.compressedStackTagCompound != null) - { - try - { - itemStack.stackTagCompound = CompressedStreamTools.decompress(jsonItemStack.compressedStackTagCompound); - } - catch (IOException e) - { - e.printStackTrace(); - } - } - } - stackObject = itemStack; - } - else if (className.equalsIgnoreCase(OreStack.class.getSimpleName())) - { - OreStack oreStack = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), OreStack.class); - - if (stackSize > 0) - { - oreStack.stackSize = stackSize; - } - stackObject = oreStack; - } - else if (className.equalsIgnoreCase(EnergyStack.class.getSimpleName())) - { - EnergyStack energyStack = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), EnergyStack.class); - - if (stackSize > 0) - { - energyStack.stackSize = stackSize; - } - stackObject = energyStack; - } - else if (className.equalsIgnoreCase(FluidStack.class.getSimpleName())) - { - FluidStack fluidStack = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), FluidStack.class); - - if (stackSize > 0) - { - fluidStack.amount = stackSize; - } - stackObject = fluidStack; - } - } - } - - if (stackObject != null) - { - return new WrappedStack(stackObject); - } - else - { - throw new JsonParseException(String.format("Unable to parse a wrappable stack object from the provided json: %s", jsonElement.toString())); - } - } - else - { - throw new JsonParseException(String.format("Unable to parse a wrappable stack object from the provided json: %s", jsonElement.toString())); - } - } - - public static Comparator comparator = new Comparator() - { - - @Override - public int compare(WrappedStack wrappedStack1, WrappedStack wrappedStack2) - { - - if (wrappedStack1.wrappedStack instanceof ItemStack) - { - if (wrappedStack2.wrappedStack instanceof ItemStack) - { - return ItemHelper.compare((ItemStack) wrappedStack1.wrappedStack, (ItemStack) wrappedStack2.wrappedStack); - } - else - { - return Compare.GREATER_THAN; - } - } - else if (wrappedStack1.wrappedStack instanceof OreStack) - { - if (wrappedStack2.wrappedStack instanceof ItemStack) - { - return Compare.LESSER_THAN; - } - else if (wrappedStack2.wrappedStack instanceof OreStack) - { - return OreStack.compare((OreStack) wrappedStack1.wrappedStack, (OreStack) wrappedStack2.wrappedStack); - } - else - { - return Compare.GREATER_THAN; - } - } - else if (wrappedStack1.wrappedStack instanceof EnergyStack) - { - if (wrappedStack2.wrappedStack instanceof ItemStack || wrappedStack2.wrappedStack instanceof OreStack) - { - return Compare.LESSER_THAN; - } - else if (wrappedStack2.wrappedStack instanceof EnergyStack) - { - return EnergyStack.compare((EnergyStack) wrappedStack1.wrappedStack, (EnergyStack) wrappedStack2.wrappedStack); - } - else - { - return Compare.GREATER_THAN; - } - } - else if (wrappedStack1.wrappedStack instanceof FluidStack) - { - if (wrappedStack2.wrappedStack instanceof ItemStack || wrappedStack2.wrappedStack instanceof OreStack || wrappedStack2.wrappedStack instanceof EnergyStack) - { - return Compare.LESSER_THAN; - } - else if (wrappedStack2.wrappedStack instanceof FluidStack) - { - return FluidHelper.compare((FluidStack) wrappedStack1.wrappedStack, (FluidStack) wrappedStack2.wrappedStack); - } - else - { - return Compare.GREATER_THAN; - } - } - else if (wrappedStack1.wrappedStack == null) - { - if (wrappedStack2.wrappedStack != null) - { - return Compare.LESSER_THAN; - } - else - { - return Compare.EQUALS; - } - } - - return Compare.EQUALS; - } - }; -} diff --git a/src/main/java/com/pahimar/ee3/block/BlockAlchemicalChest.java b/src/main/java/com/pahimar/ee3/block/BlockAlchemicalChest.java deleted file mode 100644 index 619fe6d1..00000000 --- a/src/main/java/com/pahimar/ee3/block/BlockAlchemicalChest.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.pahimar.ee3.block; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.lib.GuiIds; -import com.pahimar.ee3.lib.RenderIds; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.tileentity.TileAlchemicalChest; -import com.pahimar.ee3.tileentity.TileAlchemicalChestLarge; -import com.pahimar.ee3.tileentity.TileAlchemicalChestMedium; -import com.pahimar.ee3.tileentity.TileAlchemicalChestSmall; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import java.util.List; - -/** - * Equivalent-Exchange-3 - *

- * BlockAlchemicalChest - * - * @author pahimar - */ -public class BlockAlchemicalChest extends BlockEE implements ITileEntityProvider -{ - public BlockAlchemicalChest(int id) - { - super(id, Material.wood); - this.setHardness(2.5F); - this.setUnlocalizedName(Strings.ALCHEMICAL_CHEST_NAME); - this.setCreativeTab(EquivalentExchange3.tabsEE3); - this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); - } - - @Override - public TileEntity createNewTileEntity(World world) - { - return null; - } - - @Override - public TileEntity createTileEntity(World world, int metaData) - { - if (metaData == 0) - { - return new TileAlchemicalChestSmall(); - } - else if (metaData == 1) - { - return new TileAlchemicalChestMedium(); - } - else if (metaData == 2) - { - return new TileAlchemicalChestLarge(); - } - - return null; - } - - @SideOnly(Side.CLIENT) - public void getSubBlocks(int id, CreativeTabs creativeTabs, List list) - { - for (int meta = 0; meta < 3; meta++) - { - list.add(new ItemStack(id, 1, meta)); - } - } - - @Override - public int damageDropped(int metaData) - { - return metaData; - } - - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - - @Override - public int getRenderType() - { - - return RenderIds.alchemicalChestRender; - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) - { - if (player.isSneaking() || world.isBlockSolidOnSide(x, y + 1, z, ForgeDirection.DOWN)) - { - return true; - } - else - { - if (!world.isRemote && world.getBlockTileEntity(x, y, z) instanceof TileAlchemicalChest) - { - player.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_CHEST, world, x, y, z); - } - - return true; - } - } -} diff --git a/src/main/java/com/pahimar/ee3/block/BlockAlchemicalFuel.java b/src/main/java/com/pahimar/ee3/block/BlockAlchemicalFuel.java deleted file mode 100644 index a87b61ea..00000000 --- a/src/main/java/com/pahimar/ee3/block/BlockAlchemicalFuel.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.pahimar.ee3.block; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MathHelper; - -import java.util.List; - -public class BlockAlchemicalFuel extends BlockEE -{ - @SideOnly(Side.CLIENT) - private Icon[] blockTop, blockSide; - - public BlockAlchemicalFuel(int id) - { - super(id); - this.setUnlocalizedName(Strings.ALCHEMICAL_FUEL_BLOCK_NAME); - this.setCreativeTab(EquivalentExchange3.tabsEE3); - this.setHardness(5.0F); - this.setResistance(10.0F); - } - - @SideOnly(Side.CLIENT) - public void getSubBlocks(int id, CreativeTabs creativeTabs, List list) - { - for (int meta = 0; meta < Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES.length; meta++) - { - list.add(new ItemStack(id, 1, meta)); - } - } - - @Override - public int damageDropped(int metaData) - { - return metaData; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IconRegister iconRegister) - { - this.blockTop = new Icon[Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES.length]; - this.blockSide = new Icon[Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES.length]; - - for (int i = 0; i < Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES.length; i++) - { - blockTop[i] = iconRegister.registerIcon(String.format("%s.%s_top", getUnwrappedUnlocalizedName(this.getUnlocalizedName()), Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES[i])); - blockSide[i] = iconRegister.registerIcon(String.format("%s.%s_side", getUnwrappedUnlocalizedName(this.getUnlocalizedName()), Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES[i])); - } - } - - @Override - @SideOnly(Side.CLIENT) - public Icon getIcon(int side, int metaData) - { - metaData = MathHelper.clamp_int(metaData, 0, Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES.length - 1); - - if (ForgeDirection.getOrientation(side) == ForgeDirection.UP || ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) - { - return blockTop[metaData]; - } - else - { - return blockSide[metaData]; - } - } -} diff --git a/src/main/java/com/pahimar/ee3/block/BlockAlchemySquare.java b/src/main/java/com/pahimar/ee3/block/BlockAlchemySquare.java deleted file mode 100644 index bbcd47e9..00000000 --- a/src/main/java/com/pahimar/ee3/block/BlockAlchemySquare.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.pahimar.ee3.block; - -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class BlockAlchemySquare extends BlockEE implements ITileEntityProvider -{ - public BlockAlchemySquare(int id) - { - super(id); - } - - public TileEntity createNewTileEntity(World world) - { - return createTileEntity(world, 0); - } - - @Override - public TileEntity createTileEntity(World world, int metadata) - { - return null; - } -} diff --git a/src/main/java/com/pahimar/ee3/block/BlockAludelBase.java b/src/main/java/com/pahimar/ee3/block/BlockAludelBase.java deleted file mode 100644 index 30a5ebf6..00000000 --- a/src/main/java/com/pahimar/ee3/block/BlockAludelBase.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.pahimar.ee3.block; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.lib.GuiIds; -import com.pahimar.ee3.lib.Particles; -import com.pahimar.ee3.lib.RenderIds; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.tileentity.TileAludel; -import com.pahimar.ee3.tileentity.TileGlassBell; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.material.Material; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import java.util.Random; - -/** - * Equivalent-Exchange-3 - *

- * BlockAludel - * - * @author pahimar - */ -public class BlockAludelBase extends BlockEE implements ITileEntityProvider -{ - public BlockAludelBase(int id) - { - super(id, Material.anvil); - this.setUnlocalizedName(Strings.ALUDEL_NAME); - this.setCreativeTab(EquivalentExchange3.tabsEE3); - this.setBlockBounds(0.10F, 0.0F, 0.10F, 0.90F, 1.0F, 0.90F); - this.setHardness(5F); - } - - @Override - public TileEntity createNewTileEntity(World world) - { - return new TileAludel(); - } - - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - - @Override - public int getRenderType() - { - - return RenderIds.aludelRender; - } - - @Override - public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) - { - super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6); - TileEntity tileentity = par1World.getBlockTileEntity(par2, par3, par4); - return tileentity != null ? tileentity.receiveClientEvent(par5, par6) : false; - } - - @Override - public void breakBlock(World world, int x, int y, int z, int id, int meta) - { - if (world.getBlockTileEntity(x, y + 1, z) instanceof TileGlassBell) - { - world.markBlockForUpdate(x, y + 1, z); - world.updateAllLightTypes(x, y + 1, z); - } - - super.breakBlock(world, x, y, z, id, meta); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int faceHit, float par7, float par8, float par9) - { - if (player.isSneaking()) - { - return false; - } - else - { - if (!world.isRemote) - { - if (world.getBlockTileEntity(x, y, z) instanceof TileAludel && world.getBlockTileEntity(x, y + 1, z) instanceof TileGlassBell) - { - player.openGui(EquivalentExchange3.instance, GuiIds.ALUDEL, world, x, y, z); - } - } - - if (world.getBlockTileEntity(x, y, z) instanceof TileAludel && ModBlocks.glassBell.canPlaceBlockAt(world, x, y + 1, z) && faceHit == ForgeDirection.UP.ordinal()) - { - if (player.getHeldItem() != null && player.getHeldItem().itemID == ModBlocks.glassBell.blockID) - { - return false; - } - } - - return true; - } - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack) - { - super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack); - - if (world.getBlockTileEntity(x, y + 1, z) instanceof TileGlassBell) - { - TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y + 1, z); - - tileGlassBell.setOrientation(ForgeDirection.UP); - - if (world.getBlockTileEntity(x, y, z) instanceof TileAludel) - { - TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y, z); - - ItemStack itemStackGlassBell = tileGlassBell.getStackInSlot(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX); - - tileGlassBell.setInventorySlotContents(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX, null); - - tileAludel.setInventorySlotContents(TileAludel.INPUT_INVENTORY_INDEX, itemStackGlassBell); - - tileAludel.hasGlassBell = true; - } - } - } - - @Override - public void onNeighborBlockChange(World world, int x, int y, int z, int blockID) - { - TileAludel aludel = (TileAludel) world.getBlockTileEntity(x, y, z); - aludel.hasGlassBell = world.getBlockTileEntity(x, y + 1, z) instanceof TileGlassBell; - - super.onNeighborBlockChange(world, x, y, z, blockID); - } - - @Override - public int getLightValue(IBlockAccess world, int x, int y, int z) - { - if (world.getBlockTileEntity(x, y, z) instanceof TileAludel) - { - if (((TileAludel) world.getBlockTileEntity(x, y, z)).getState() == 1) - { - return 15; - } - } - - return super.getLightValue(world, x, y, z); - } - - @Override - public void randomDisplayTick(World world, int x, int y, int z, Random random) - { - TileEntity tile = world.getBlockTileEntity(x, y, z); - if (tile instanceof TileAludel) - { - if (((TileAludel) tile).getState() == 1) - { - switch (((TileAludel) tile).getOrientation()) - { - case NORTH: - world.spawnParticle(Particles.FLAME, (double) x + 0.5F, (double) y + 0.33F, (double) z + 0.175F, 0.0D, 0.0D, 0.0D); - break; - case SOUTH: - world.spawnParticle(Particles.FLAME, (double) x + 0.5F, (double) y + 0.33F, (double) z + 0.825F, 0.0D, 0.0D, 0.0D); - break; - case WEST: - world.spawnParticle(Particles.FLAME, (double) x + 0.175F, (double) y + 0.33F, (double) z + 0.5F, 0.0D, 0.0D, 0.0D); - break; - case EAST: - world.spawnParticle(Particles.FLAME, (double) x + 0.825F, (double) y + 0.33F, (double) z + 0.5F, 0.0D, 0.0D, 0.0D); - break; - } - - world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.5F, (double) y + 0.7F, (double) z + 0.0F, 0.0D, 0.05D, 0.0D); - world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.5F, (double) y + 0.7F, (double) z + 1.0F, 0.0D, 0.05D, 0.0D); - world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.0F, (double) y + 0.7F, (double) z + 0.5F, 0.0D, 0.05D, 0.0D); - world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 1.0F, (double) y + 0.7F, (double) z + 0.5F, 0.0D, 0.05D, 0.0D); - } - } - } -} diff --git a/src/main/java/com/pahimar/ee3/block/BlockCalcinator.java b/src/main/java/com/pahimar/ee3/block/BlockCalcinator.java deleted file mode 100644 index 1b4ce453..00000000 --- a/src/main/java/com/pahimar/ee3/block/BlockCalcinator.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.pahimar.ee3.block; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.lib.GuiIds; -import com.pahimar.ee3.lib.Particles; -import com.pahimar.ee3.lib.RenderIds; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.tileentity.TileCalcinator; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.material.Material; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import java.util.Random; - -/** - * Equivalent-Exchange-3 - *

- * BlockCalcinator - * - * @author pahimar - */ -public class BlockCalcinator extends BlockEE implements ITileEntityProvider -{ - public BlockCalcinator(int id) - { - super(id, Material.rock); - this.setUnlocalizedName(Strings.CALCINATOR_NAME); - this.setCreativeTab(EquivalentExchange3.tabsEE3); - this.setHardness(2.0F); - this.setBlockBounds(0.1F, 0.0F, 0.1F, 0.9F, 1.0F, 0.9F); - } - - @Override - public TileEntity createNewTileEntity(World world) - { - return new TileCalcinator(); - } - - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - - @Override - public int getLightValue(IBlockAccess world, int x, int y, int z) - { - if (world.getBlockTileEntity(x, y, z) instanceof TileCalcinator) - { - if (((TileCalcinator) world.getBlockTileEntity(x, y, z)).getState() == 1) - { - return 15; - } - } - - return super.getLightValue(world, x, y, z); - } - - @Override - public int getRenderType() - { - - return RenderIds.calcinatorRender; - } - - @Override - public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) - { - super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6); - TileEntity tileentity = par1World.getBlockTileEntity(par2, par3, par4); - return tileentity != null ? tileentity.receiveClientEvent(par5, par6) : false; - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) - { - if (player.isSneaking()) - { - return false; - } - else - { - if (!world.isRemote) - { - if (world.getBlockTileEntity(x, y, z) instanceof TileCalcinator) - { - player.openGui(EquivalentExchange3.instance, GuiIds.CALCINATOR, world, x, y, z); - } - } - - return true; - } - } - - @Override - public void randomDisplayTick(World world, int x, int y, int z, Random random) - { - if (world.getBlockTileEntity(x, y, z) instanceof TileCalcinator) - { - if (((TileCalcinator) world.getBlockTileEntity(x, y, z)).getState() == 1) - { - // Fire pot particles - world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.5F, (double) y + 0.4F, (double) ((z + 0.5F) + (random.nextFloat() * 0.5F - 0.3F)), 0.0D, 0.0D, 0.0D); - world.spawnParticle(Particles.FLAME, (double) x + 0.5F, (double) y + 0.4F, (double) z + 0.5F, 0.0D, 0.0D, 0.0D); - } - } - } -} diff --git a/src/main/java/com/pahimar/ee3/block/BlockChalk.java b/src/main/java/com/pahimar/ee3/block/BlockChalk.java deleted file mode 100644 index 6e387af4..00000000 --- a/src/main/java/com/pahimar/ee3/block/BlockChalk.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.pahimar.ee3.block; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.item.ModItems; -import com.pahimar.ee3.lib.Strings; -import net.minecraft.block.material.Material; - -import java.util.Random; - -public class BlockChalk extends BlockEE -{ - public BlockChalk(int id) - { - super(id, Material.clay); - this.setHardness(0.6F); - this.setUnlocalizedName(Strings.CHALK_NAME); - this.setCreativeTab(EquivalentExchange3.tabsEE3); - this.setStepSound(soundStoneFootstep); - } - - @Override - public int idDropped(int par1, Random random, int par2) - { - return ModItems.chalk.itemID; - } - - @Override - public int quantityDropped(Random random) - { - return (random.nextInt(4) + 1); - } -} diff --git a/src/main/java/com/pahimar/ee3/block/BlockEE.java b/src/main/java/com/pahimar/ee3/block/BlockEE.java deleted file mode 100644 index f23205bd..00000000 --- a/src/main/java/com/pahimar/ee3/block/BlockEE.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.pahimar.ee3.block; - -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.tileentity.TileEE; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import java.util.Random; - -public class BlockEE extends Block -{ - public BlockEE(int id) - { - this(id, Material.rock); - } - - public BlockEE(int id, Material material) - { - super(id, material); - } - - @Override - public String getUnlocalizedName() - { - return String.format("tile.%s%s", Strings.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName())); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IconRegister iconRegister) - { - blockIcon = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()))); - } - - protected String getUnwrappedUnlocalizedName(String unlocalizedName) - { - return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); - } - - @Override - public void breakBlock(World world, int x, int y, int z, int id, int meta) - { - dropInventory(world, x, y, z); - super.breakBlock(world, x, y, z, id, meta); - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack) - { - if (world.getBlockTileEntity(x, y, z) instanceof TileEE) - { - int direction = 0; - int facing = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - - if (facing == 0) - { - direction = ForgeDirection.NORTH.ordinal(); - } - else if (facing == 1) - { - direction = ForgeDirection.EAST.ordinal(); - } - else if (facing == 2) - { - direction = ForgeDirection.SOUTH.ordinal(); - } - else if (facing == 3) - { - direction = ForgeDirection.WEST.ordinal(); - } - - if (itemStack.hasDisplayName()) - { - ((TileEE) world.getBlockTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName()); - } - - ((TileEE) world.getBlockTileEntity(x, y, z)).setOrientation(direction); - } - } - - protected void dropInventory(World world, int x, int y, int z) - { - TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - - if (!(tileEntity instanceof IInventory)) - { - return; - } - - IInventory inventory = (IInventory) tileEntity; - - for (int i = 0; i < inventory.getSizeInventory(); i++) - { - - ItemStack itemStack = inventory.getStackInSlot(i); - - if (itemStack != null && itemStack.stackSize > 0) - { - Random rand = new Random(); - - float dX = rand.nextFloat() * 0.8F + 0.1F; - float dY = rand.nextFloat() * 0.8F + 0.1F; - float dZ = rand.nextFloat() * 0.8F + 0.1F; - - EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, new ItemStack(itemStack.itemID, itemStack.stackSize, itemStack.getItemDamage())); - - if (itemStack.hasTagCompound()) - { - entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy()); - } - - float factor = 0.05F; - entityItem.motionX = rand.nextGaussian() * factor; - entityItem.motionY = rand.nextGaussian() * factor + 0.2F; - entityItem.motionZ = rand.nextGaussian() * factor; - world.spawnEntityInWorld(entityItem); - itemStack.stackSize = 0; - } - } - } -} diff --git a/src/main/java/com/pahimar/ee3/block/BlockGlassBell.java b/src/main/java/com/pahimar/ee3/block/BlockGlassBell.java deleted file mode 100644 index 462cfa6d..00000000 --- a/src/main/java/com/pahimar/ee3/block/BlockGlassBell.java +++ /dev/null @@ -1,202 +0,0 @@ -package com.pahimar.ee3.block; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.lib.GuiIds; -import com.pahimar.ee3.lib.RenderIds; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.tileentity.TileAludel; -import com.pahimar.ee3.tileentity.TileEE; -import com.pahimar.ee3.tileentity.TileGlassBell; -import net.minecraft.block.Block; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.material.Material; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class BlockGlassBell extends BlockEE implements ITileEntityProvider -{ - public BlockGlassBell(int id) - { - super(id, Material.glass); - this.setUnlocalizedName(Strings.GLASS_BELL_NAME); - this.setCreativeTab(EquivalentExchange3.tabsEE3); - this.setHardness(1.0F); - } - - @Override - public TileEntity createNewTileEntity(World world) - { - return new TileGlassBell(); - } - - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - - @Override - public int getRenderType() - { - - return RenderIds.glassBell; - } - - @Override - public void breakBlock(World world, int x, int y, int z, int id, int meta) - { - dropInventory(world, x, y, z); - super.breakBlock(world, x, y, z, id, meta); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) - { - if (player.isSneaking()) - { - return false; - } - else - { - if (!world.isRemote) - { - if (world.getBlockTileEntity(x, y, z) instanceof TileGlassBell) - { - if (world.getBlockTileEntity(x, y - 1, z) instanceof TileAludel) - { - player.openGui(EquivalentExchange3.instance, GuiIds.ALUDEL, world, x, y - 1, z); - } - else - { - player.openGui(EquivalentExchange3.instance, GuiIds.GLASS_BELL, world, x, y, z); - } - } - } - - return true; - } - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack) - { - if (itemStack.hasDisplayName()) - { - ((TileEE) world.getBlockTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName()); - } - - if (world.getBlockTileEntity(x, y - 1, z) != null && world.getBlockTileEntity(x, y - 1, z) instanceof TileAludel) - { - ((TileEE) world.getBlockTileEntity(x, y, z)).setOrientation(ForgeDirection.UP); - } - else - { - ((TileEE) world.getBlockTileEntity(x, y, z)).setOrientation(world.getBlockMetadata(x, y, z)); - } - - world.setBlockMetadataWithNotify(x, y, z, 0, 3); - } - - @Override - public int onBlockPlaced(World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ, int metaData) - { - return sideHit; - } - - /** - * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world, - * x, y, z, startVec, endVec - */ - @Override - public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec) - { - if (world.getBlockTileEntity(x, y, z) instanceof TileGlassBell) - { - TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y, z); - - switch (tileGlassBell.getOrientation()) - { - case DOWN: - { - this.setBlockBounds(0.125F, 0.33F, 0.125F, 0.875F, 1.0F, 0.875F); - break; - } - case UP: - { - this.setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.66F, 0.875F); - break; - } - case NORTH: - { - this.setBlockBounds(0.125F, 0.125F, 0.33F, 0.875F, 0.875F, 1.0F); - break; - } - case SOUTH: - { - this.setBlockBounds(0.125F, 0.125F, 0.0F, 0.875F, 0.875F, 0.66F); - break; - } - case EAST: - { - this.setBlockBounds(0.0F, 0.125F, 0.125F, 0.66F, 0.875F, 0.875F); - break; - } - case WEST: - { - this.setBlockBounds(0.33F, 0.125F, 0.125F, 1.0F, 0.875F, 0.875F); - break; - } - case UNKNOWN: - { - break; - } - } - } - - return super.collisionRayTrace(world, x, y, z, startVec, endVec); - } - - @Override - public int getLightValue(IBlockAccess world, int x, int y, int z) - { - ItemStack itemStack; - - if (world.getBlockTileEntity(x, y, z) instanceof TileGlassBell) - { - TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y, z); - - if (world.getBlockTileEntity(x, y - 1, z) instanceof TileAludel) - { - TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y - 1, z); - - itemStack = tileAludel.getStackInSlot(TileAludel.INPUT_INVENTORY_INDEX); - - if (itemStack != null && itemStack.itemID < 4096) - { - return Block.lightValue[itemStack.itemID]; - } - } - - itemStack = tileGlassBell.getStackInSlot(TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX); - - if (itemStack != null && itemStack.itemID < 4096) - { - return Block.lightValue[itemStack.itemID]; - } - } - - return 0; - } -} diff --git a/src/main/java/com/pahimar/ee3/block/BlockInfusedCloth.java b/src/main/java/com/pahimar/ee3/block/BlockInfusedCloth.java deleted file mode 100644 index edd90555..00000000 --- a/src/main/java/com/pahimar/ee3/block/BlockInfusedCloth.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.pahimar.ee3.block; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.lib.Colours; -import com.pahimar.ee3.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.ItemStack; -import net.minecraft.world.IBlockAccess; - -import java.util.List; - -public class BlockInfusedCloth extends BlockEE -{ - public BlockInfusedCloth(int id) - { - super(id, Material.cloth); - this.setUnlocalizedName(Strings.INFUSED_CLOTH_NAME); - this.setCreativeTab(EquivalentExchange3.tabsEE3); - this.setStepSound(soundClothFootstep); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IconRegister iconRegister) - { - blockIcon = iconRegister.registerIcon("wool_colored_white"); - } - - @Override - public int damageDropped(int metaData) - { - return metaData; - } - - @SideOnly(Side.CLIENT) - public int colorMultiplier(IBlockAccess blockAccess, int x, int y, int z) - { - int metaData = blockAccess.getBlockMetadata(x, y, z); - - if (metaData == 0) - { - return Integer.parseInt(Colours.INFUSED_CLOTH_VERDANT, 16); - } - else if (metaData == 1) - { - return Integer.parseInt(Colours.INFUSED_CLOTH_AZURE, 16); - } - else if (metaData == 2) - { - return Integer.parseInt(Colours.INFUSED_CLOTH_MINIUM, 16); - } - else - { - return Integer.parseInt(Colours.PURE_WHITE, 16); - } - } - - @SideOnly(Side.CLIENT) - public int getRenderColor(int metaData) - { - if (metaData == 0) - { - return Integer.parseInt(Colours.INFUSED_CLOTH_VERDANT, 16); - } - else if (metaData == 1) - { - return Integer.parseInt(Colours.INFUSED_CLOTH_AZURE, 16); - } - else if (metaData == 2) - { - return Integer.parseInt(Colours.INFUSED_CLOTH_MINIUM, 16); - } - else - { - return Integer.parseInt(Colours.PURE_WHITE, 16); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(int id, CreativeTabs creativeTab, List list) - { - for (int meta = 0; meta < 3; ++meta) - { - list.add(new ItemStack(id, 1, meta)); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/block/BlockInfusedPlanks.java b/src/main/java/com/pahimar/ee3/block/BlockInfusedPlanks.java deleted file mode 100644 index 253e1f35..00000000 --- a/src/main/java/com/pahimar/ee3/block/BlockInfusedPlanks.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.pahimar.ee3.block; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.lib.Colours; -import com.pahimar.ee3.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.ItemStack; -import net.minecraft.world.IBlockAccess; - -import java.util.List; - -public class BlockInfusedPlanks extends BlockEE -{ - public BlockInfusedPlanks(int id) - { - super(id, Material.wood); - this.setUnlocalizedName(Strings.INFUSED_PLANKS_NAME); - this.setCreativeTab(EquivalentExchange3.tabsEE3); - this.setStepSound(soundWoodFootstep); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IconRegister iconRegister) - { - blockIcon = iconRegister.registerIcon("planks_oak"); - } - - @SideOnly(Side.CLIENT) - public int colorMultiplier(IBlockAccess blockAccess, int x, int y, int z) - { - int metaData = blockAccess.getBlockMetadata(x, y, z); - - if (metaData == 0) - { - return Integer.parseInt(Colours.INFUSED_PLANKS_VERDANT, 16); - } - else if (metaData == 1) - { - return Integer.parseInt(Colours.INFUSED_PLANKS_AZURE, 16); - } - else if (metaData == 2) - { - return Integer.parseInt(Colours.INFUSED_PLANKS_MINIUM, 16); - } - else - { - return Integer.parseInt(Colours.PURE_WHITE, 16); - } - } - - @Override - public int damageDropped(int metaData) - { - return metaData; - } - - @SideOnly(Side.CLIENT) - public int getRenderColor(int metaData) - { - if (metaData == 0) - { - return Integer.parseInt(Colours.INFUSED_PLANKS_VERDANT, 16); - } - else if (metaData == 1) - { - return Integer.parseInt(Colours.INFUSED_PLANKS_AZURE, 16); - } - else if (metaData == 2) - { - return Integer.parseInt(Colours.INFUSED_PLANKS_MINIUM, 16); - } - else - { - return Integer.parseInt(Colours.PURE_WHITE, 16); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(int id, CreativeTabs creativeTab, List list) - { - for (int meta = 0; meta < 3; ++meta) - { - list.add(new ItemStack(id, 1, meta)); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/block/BlockInfusedWood.java b/src/main/java/com/pahimar/ee3/block/BlockInfusedWood.java deleted file mode 100644 index 44dbae95..00000000 --- a/src/main/java/com/pahimar/ee3/block/BlockInfusedWood.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.pahimar.ee3.block; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.lib.Colours; -import com.pahimar.ee3.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.ItemStack; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import java.util.List; - -public class BlockInfusedWood extends BlockEE -{ - @SideOnly(Side.CLIENT) - private Icon logEnd, logSide; - - public BlockInfusedWood(int id) - { - super(id, Material.wood); - this.setUnlocalizedName(Strings.INFUSED_WOOD_NAME); - this.setCreativeTab(EquivalentExchange3.tabsEE3); - this.setStepSound(soundWoodFootstep); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IconRegister iconRegister) - { - logEnd = iconRegister.registerIcon("log_oak_top"); - logSide = iconRegister.registerIcon("log_oak"); - } - - @Override - public int damageDropped(int metaData) - { - return metaData & 3; - } - - @Override - @SideOnly(Side.CLIENT) - public Icon getIcon(int side, int metaData) - { - if (ForgeDirection.getOrientation(side) == ForgeDirection.UP || ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) - { - if (metaData >> 2 == 0) - { - return logEnd; - } - else - { - return logSide; - } - } - else if (ForgeDirection.getOrientation(side) == ForgeDirection.NORTH || ForgeDirection.getOrientation(side) == ForgeDirection.SOUTH) - { - if (metaData >> 2 == 2) - { - return logEnd; - } - else - { - return logSide; - } - } - else - { - if (metaData >> 2 == 1) - { - return logEnd; - } - else - { - return logSide; - } - } - } - - /** - * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata - */ - @Override - public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metaData) - { - int logType = metaData & 3; - byte rotation = 0; - - switch (side) - { - case 0: - case 1: - rotation = 0; - break; - case 2: - case 3: - rotation = 8; - break; - case 4: - case 5: - rotation = 4; - } - - int newMetaData = logType | rotation; - world.setBlockMetadataWithNotify(x, y, z, newMetaData, 3); - return newMetaData; - } - - @SideOnly(Side.CLIENT) - public int colorMultiplier(IBlockAccess blockAccess, int x, int y, int z) - { - int metaData = blockAccess.getBlockMetadata(x, y, z) & 3; - - if (metaData == 0) - { - return Integer.parseInt(Colours.INFUSED_WOOD_VERDANT, 16); - } - else if (metaData == 1) - { - return Integer.parseInt(Colours.INFUSED_WOOD_AZURE, 16); - } - else if (metaData == 2) - { - return Integer.parseInt(Colours.INFUSED_WOOD_MINIUM, 16); - } - else - { - return Integer.parseInt(Colours.PURE_WHITE, 16); - } - } - - @SideOnly(Side.CLIENT) - public int getRenderColor(int metaData) - { - int adjustedMetaData = metaData & 3; - if (adjustedMetaData == 0) - { - return Integer.parseInt(Colours.INFUSED_WOOD_VERDANT, 16); - } - else if (adjustedMetaData == 1) - { - return Integer.parseInt(Colours.INFUSED_WOOD_AZURE, 16); - } - else if (adjustedMetaData == 2) - { - return Integer.parseInt(Colours.INFUSED_WOOD_MINIUM, 16); - } - else - { - return Integer.parseInt(Colours.PURE_WHITE, 16); - } - } - - @Override - @SuppressWarnings("unchecked") - @SideOnly(Side.CLIENT) - public void getSubBlocks(int id, CreativeTabs creativeTab, List list) - { - for (int meta = 0; meta < 3; ++meta) - { - list.add(new ItemStack(id, 1, meta)); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/block/BlockResearchStation.java b/src/main/java/com/pahimar/ee3/block/BlockResearchStation.java deleted file mode 100644 index 06aac870..00000000 --- a/src/main/java/com/pahimar/ee3/block/BlockResearchStation.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.pahimar.ee3.block; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.lib.RenderIds; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.tileentity.TileResearchStation; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class BlockResearchStation extends BlockEE implements ITileEntityProvider -{ - public BlockResearchStation(int id) - { - super(id); - this.setUnlocalizedName(Strings.RESEARCH_STATION_NAME); - this.setCreativeTab(EquivalentExchange3.tabsEE3); - } - - @Override - public TileEntity createNewTileEntity(World world) - { - return new TileResearchStation(); - } - - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - - @Override - public int getRenderType() - { - - return RenderIds.calcinatorRender; - } -} diff --git a/src/main/java/com/pahimar/ee3/block/ModBlocks.java b/src/main/java/com/pahimar/ee3/block/ModBlocks.java index a2e86f46..44925017 100644 --- a/src/main/java/com/pahimar/ee3/block/ModBlocks.java +++ b/src/main/java/com/pahimar/ee3/block/ModBlocks.java @@ -1,55 +1,9 @@ package com.pahimar.ee3.block; -import com.pahimar.ee3.item.*; -import com.pahimar.ee3.lib.BlockIds; -import com.pahimar.ee3.lib.Strings; -import cpw.mods.fml.common.registry.GameRegistry; - -/** - * Equivalent-Exchange-3 - *

- * ModBlocks - * - * @author pahimar - */ public class ModBlocks { - public static BlockEE alchemicalChest; - public static BlockEE alchemicalFuel; - public static BlockEE alchemySquare; - public static BlockEE aludelBase; - public static BlockEE calcinator; - public static BlockEE chalk; - public static BlockEE glassBell; - public static BlockEE researchStation; - public static BlockEE infusedCloth; - public static BlockEE infusedWood; - public static BlockEE infusedPlanks; - public static void init() { - alchemicalChest = new BlockAlchemicalChest(BlockIds.ALCHEMICAL_CHEST); - alchemicalFuel = new BlockAlchemicalFuel(BlockIds.ALCHEMICAL_FUEL); - alchemySquare = new BlockAlchemySquare(BlockIds.ALCHEMY_SQUARE); - aludelBase = new BlockAludelBase(BlockIds.ALUDEL_BASE); - calcinator = new BlockCalcinator(BlockIds.CALCINATOR); - chalk = new BlockChalk(BlockIds.CHALK); - glassBell = new BlockGlassBell(BlockIds.GLASS_BELL); - researchStation = new BlockResearchStation((BlockIds.RESEARCH_STATION)); - infusedWood = new BlockInfusedWood(BlockIds.INFUSED_WOOD); - infusedCloth = new BlockInfusedCloth(BlockIds.INFUSED_CLOTH); - infusedPlanks = new BlockInfusedPlanks(BlockIds.INFUSED_PLANKS); - GameRegistry.registerBlock(alchemicalChest, ItemBlockAlchemicalChest.class, "block." + Strings.ALCHEMICAL_CHEST_NAME); - GameRegistry.registerBlock(alchemicalFuel, ItemBlockAlchemicalFuel.class, "block." + Strings.ALCHEMICAL_FUEL_NAME); - GameRegistry.registerBlock(alchemySquare, "block." + Strings.ALCHEMY_SQUARE_NAME); - GameRegistry.registerBlock(aludelBase, "block." + Strings.ALUDEL_NAME); - GameRegistry.registerBlock(calcinator, "block." + Strings.CALCINATOR_NAME); - GameRegistry.registerBlock(chalk, "block." + Strings.CHALK_NAME); - GameRegistry.registerBlock(glassBell, "block." + Strings.GLASS_BELL_NAME); - GameRegistry.registerBlock(researchStation, "block." + Strings.RESEARCH_STATION_NAME); - GameRegistry.registerBlock(infusedCloth, ItemBlockInfusedCloth.class, "block." + Strings.INFUSED_CLOTH_NAME); - GameRegistry.registerBlock(infusedWood, ItemBlockInfusedWood.class, "block." + Strings.INFUSED_WOOD_NAME); - GameRegistry.registerBlock(infusedPlanks, ItemBlockInfusedPlanks.class, "block." + Strings.INFUSED_PLANKS_NAME); } } diff --git a/src/main/java/com/pahimar/ee3/client/audio/SoundHandler.java b/src/main/java/com/pahimar/ee3/client/audio/SoundHandler.java deleted file mode 100644 index dd9065aa..00000000 --- a/src/main/java/com/pahimar/ee3/client/audio/SoundHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.pahimar.ee3.client.audio; - -import com.pahimar.ee3.helper.LogHelper; -import com.pahimar.ee3.lib.Sounds; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.client.event.sound.SoundLoadEvent; - -/** - * Equivalent-Exchange-3 - *

- * SoundHandler - * - * @author pahimar - */ -public class SoundHandler -{ - @SubscribeEvent - public void onSoundLoad(SoundLoadEvent event) - { - // FIXME Load custom sounds into Minecraft - // For each custom sound file we have defined in Sounds -// for (String soundFile : Sounds.soundFiles) -// { -// // Try to add the custom sound file to the pool of sounds -// try -// { -// event.manager.addSound(soundFile); -// } -// // If we cannot add the custom sound file to the pool, log the exception -// catch (Exception e) -// { -// LogHelper.warn("Failed loading sound file: " + soundFile); -// } -// } - } -} diff --git a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalBag.java b/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalBag.java deleted file mode 100644 index 376890b4..00000000 --- a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalBag.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.pahimar.ee3.client.gui.inventory; - -import com.pahimar.ee3.helper.ItemStackNBTHelper; -import com.pahimar.ee3.inventory.ContainerAlchemicalBag; -import com.pahimar.ee3.inventory.InventoryAlchemicalBag; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.lib.Textures; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import org.lwjgl.opengl.GL11; - -/** - * Equivalent-Exchange-3 - *

- * GuiAlchemicalBag - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class GuiAlchemicalBag extends GuiContainer -{ - private final ItemStack parentItemStack; - private final InventoryAlchemicalBag inventoryAlchemicalBag; - - public GuiAlchemicalBag(EntityPlayer entityPlayer, InventoryAlchemicalBag inventoryAlchemicalBag) - { - super(new ContainerAlchemicalBag(entityPlayer, inventoryAlchemicalBag)); - - this.parentItemStack = inventoryAlchemicalBag.parentItemStack; - this.inventoryAlchemicalBag = inventoryAlchemicalBag; - - if (this.parentItemStack.getItemDamage() == 0) - { - xSize = 230; - ySize = 186; - } - else if (this.parentItemStack.getItemDamage() == 1) - { - xSize = 230; - ySize = 240; - } - else if (this.parentItemStack.getItemDamage() == 2) - { - xSize = 248; - ySize = 256; - } - } - - @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { - if (this.parentItemStack.getItemDamage() == 0 || this.parentItemStack.getItemDamage() == 1) - { - fontRenderer.drawString(StatCollector.translateToLocal(inventoryAlchemicalBag.getInvName()), 8, 6, 4210752); - fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 35, ySize - 95 + 2, 4210752); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - if (this.parentItemStack.getItemDamage() == 0) - { - this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_BAG_SMALL); - } - else if (this.parentItemStack.getItemDamage() == 1) - { - this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_BAG_MEDIUM); - } - else if (this.parentItemStack.getItemDamage() == 2) - { - this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_BAG_LARGE); - } - - int xStart = (width - xSize) / 2; - int yStart = (height - ySize) / 2; - this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); - } - - @Override - public void onGuiClosed() - { - super.onGuiClosed(); - - if (mc.thePlayer != null) - { - for (ItemStack itemStack : mc.thePlayer.inventory.mainInventory) - { - if (itemStack != null) - { - if (ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) - { - ItemStackNBTHelper.removeTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN); - } - } - } - } - } -} diff --git a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalChest.java b/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalChest.java deleted file mode 100644 index c4d1b3ad..00000000 --- a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalChest.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.pahimar.ee3.client.gui.inventory; - -import com.pahimar.ee3.inventory.ContainerAlchemicalChest; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.lib.Textures; -import com.pahimar.ee3.tileentity.TileAlchemicalChest; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; -import org.lwjgl.opengl.GL11; - -/** - * Equivalent-Exchange-3 - *

- * GuiAlchemicalChest - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class GuiAlchemicalChest extends GuiContainer -{ - private TileAlchemicalChest tileAlchemicalChest; - - public GuiAlchemicalChest(InventoryPlayer inventoryPlayer, TileAlchemicalChest alchemicalChest) - { - super(new ContainerAlchemicalChest(inventoryPlayer, alchemicalChest)); - tileAlchemicalChest = alchemicalChest; - - if (this.tileAlchemicalChest.getState() == 0) - { - xSize = 230; - ySize = 186; - } - else if (this.tileAlchemicalChest.getState() == 1) - { - xSize = 230; - ySize = 240; - } - else if (this.tileAlchemicalChest.getState() == 2) - { - xSize = 248; - ySize = 256; - } - } - - @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { - if (tileAlchemicalChest.getState() == 0 || tileAlchemicalChest.getState() == 1) - { - fontRenderer.drawString(tileAlchemicalChest.isInvNameLocalized() ? tileAlchemicalChest.getInventoryname() : StatCollector.translateToLocal(tileAlchemicalChest.getInventoryname()), 8, 6, 4210752); - fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 35, ySize - 95 + 2, 4210752); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - if (tileAlchemicalChest.getState() == 0) - { - this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_CHEST_SMALL); - } - else if (tileAlchemicalChest.getState() == 1) - { - this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_CHEST_MEDIUM); - } - else if (tileAlchemicalChest.getState() == 2) - { - this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_CHEST_LARGE); - } - - int xStart = (width - xSize) / 2; - int yStart = (height - ySize) / 2; - this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAludel.java b/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAludel.java deleted file mode 100644 index 72f72d08..00000000 --- a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAludel.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.pahimar.ee3.client.gui.inventory; - -import com.pahimar.ee3.inventory.ContainerAludel; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.lib.Textures; -import com.pahimar.ee3.tileentity.TileAludel; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; -import org.lwjgl.opengl.GL11; - -/** - * Equivalent-Exchange-3 - *

- * GuiAludel - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class GuiAludel extends GuiContainer -{ - private TileAludel tileAludel; - - public GuiAludel(InventoryPlayer inventoryPlayer, TileAludel tileAludel) - { - super(new ContainerAludel(inventoryPlayer, tileAludel)); - this.tileAludel = tileAludel; - xSize = 176; - ySize = 187; - } - - @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { - String containerName = tileAludel.isInvNameLocalized() ? tileAludel.getInvName() : StatCollector.translateToLocal(tileAludel.getInvName()); - fontRenderer.drawString(containerName, xSize / 2 - fontRenderer.getStringWidth(containerName) / 2, 6, 4210752); - fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 8, ySize - 93, 4210752); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - this.mc.getTextureManager().bindTexture(Textures.GUI_ALUDEL); - - int xStart = (width - xSize) / 2; - int yStart = (height - ySize) / 2; - this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); - int scaleAdjustment; - - if (this.tileAludel.getState() == 1) - { - scaleAdjustment = this.tileAludel.getBurnTimeRemainingScaled(12); - this.drawTexturedModalRect(xStart + 45, yStart + 36 + 34 - scaleAdjustment, 176, 12 - scaleAdjustment, 14, scaleAdjustment + 2); - } - - scaleAdjustment = this.tileAludel.getCookProgressScaled(24); - this.drawTexturedModalRect(xStart + 76, yStart + 39, 176, 14, scaleAdjustment + 1, 16); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiCalcinator.java b/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiCalcinator.java deleted file mode 100644 index 101062a8..00000000 --- a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiCalcinator.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.pahimar.ee3.client.gui.inventory; - -import com.pahimar.ee3.inventory.ContainerCalcinator; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.lib.Textures; -import com.pahimar.ee3.tileentity.TileCalcinator; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; -import org.lwjgl.opengl.GL11; - -/** - * Equivalent-Exchange-3 - *

- * GuiCalcinator - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class GuiCalcinator extends GuiContainer -{ - private TileCalcinator tileCalcinator; - - public GuiCalcinator(InventoryPlayer player, TileCalcinator tileCalcinator) - { - super(new ContainerCalcinator(player, tileCalcinator)); - ySize = 176; - this.tileCalcinator = tileCalcinator; - } - - @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { - String containerName = tileCalcinator.isInvNameLocalized() ? tileCalcinator.getInvName() : StatCollector.translateToLocal(tileCalcinator.getInvName()); - fontRenderer.drawString(containerName, xSize / 2 - fontRenderer.getStringWidth(containerName) / 2, 6, 4210752); - fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 8, ySize - 96 + 2, 4210752); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - this.mc.getTextureManager().bindTexture(Textures.GUI_CALCINATOR); - - int xStart = (width - xSize) / 2; - int yStart = (height - ySize) / 2; - this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); - int scaleAdjustment; - - if (this.tileCalcinator.getState() == 1) - { - scaleAdjustment = this.tileCalcinator.getBurnTimeRemainingScaled(12); - this.drawTexturedModalRect(xStart + 57, yStart + 36 + 23 - scaleAdjustment, 176, 12 - scaleAdjustment, 14, scaleAdjustment + 2); - } - - scaleAdjustment = this.tileCalcinator.getCookProgressScaled(24); - this.drawTexturedModalRect(xStart + 83, yStart + 34, 176, 14, scaleAdjustment + 1, 16); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiGlassBell.java b/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiGlassBell.java deleted file mode 100644 index 0ef76e00..00000000 --- a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiGlassBell.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.pahimar.ee3.client.gui.inventory; - -import com.pahimar.ee3.inventory.ContainerGlassBell; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.lib.Textures; -import com.pahimar.ee3.tileentity.TileGlassBell; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; -import org.lwjgl.opengl.GL11; - -/** - * Equivalent-Exchange-3 - *

- * GuiGlassBell - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class GuiGlassBell extends GuiContainer -{ - - private TileGlassBell tileGlassBell; - - public GuiGlassBell(InventoryPlayer inventoryPlayer, TileGlassBell tileGlassBell) - { - - super(new ContainerGlassBell(inventoryPlayer, tileGlassBell)); - this.tileGlassBell = tileGlassBell; - xSize = 176; - ySize = 140; - } - - @Override - protected void drawGuiContainerForegroundLayer(int x, int y) - { - - String containerName = tileGlassBell.isInvNameLocalized() ? tileGlassBell.getInvName() : StatCollector.translateToLocal(tileGlassBell.getInvName()); - fontRenderer.drawString(containerName, xSize / 2 - fontRenderer.getStringWidth(containerName) / 2, 6, 4210752); - fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 8, ySize - 93, 4210752); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) - { - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(Textures.GUI_GLASS_BELL); - int xStart = (width - xSize) / 2; - int yStart = (height - ySize) / 2; - this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiPortableCrafting.java b/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiPortableCrafting.java deleted file mode 100644 index 2c0036fc..00000000 --- a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiPortableCrafting.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.pahimar.ee3.client.gui.inventory; - -import com.pahimar.ee3.helper.ItemStackNBTHelper; -import com.pahimar.ee3.inventory.ContainerPortableCrafting; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.lib.Textures; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import org.lwjgl.opengl.GL11; - -/** - * Equivalent-Exchange-3 - *

- * GuiPortableCrafting - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class GuiPortableCrafting extends GuiContainer -{ - - public GuiPortableCrafting(EntityPlayer player, World world, int x, int y, int z) - { - - super(new ContainerPortableCrafting(player.inventory, world, x, y, z)); - } - - /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) - */ - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) - { - - fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_PORTABLE_CRAFTING), 28, 6, 4210752); - fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 8, ySize - 96 + 2, 4210752); - } - - /** - * Draw the background layer for the GuiContainer (everything behind the items) - */ - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) - { - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(Textures.GUI_PORTABLE_CRAFTING); - int var5 = (width - xSize) / 2; - int var6 = (height - ySize) / 2; - this.drawTexturedModalRect(var5, var6, 0, 0, xSize, ySize); - } - - @Override - public void onGuiClosed() - { - - super.onGuiClosed(); - - if (mc.thePlayer != null) - { - for (ItemStack itemStack : mc.thePlayer.inventory.mainInventory) - { - if (itemStack != null) - { - if (ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN)) - { - ItemStackNBTHelper.removeTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN); - } - } - } - } - } -} diff --git a/src/main/java/com/pahimar/ee3/client/handler/DrawBlockHighlightHandler.java b/src/main/java/com/pahimar/ee3/client/handler/DrawBlockHighlightHandler.java deleted file mode 100644 index fdf15f69..00000000 --- a/src/main/java/com/pahimar/ee3/client/handler/DrawBlockHighlightHandler.java +++ /dev/null @@ -1,213 +0,0 @@ -package com.pahimar.ee3.client.handler; - -import com.pahimar.ee3.item.IChargeable; -import com.pahimar.ee3.lib.Textures; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.DrawBlockHighlightEvent; -import net.minecraftforge.common.util.ForgeDirection; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -/** - * Equivalent-Exchange-3 - *

- * DrawBlockHighlightHandler - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class DrawBlockHighlightHandler -{ - private static int pulse = 0; - private static boolean doInc = true; - - public static void renderPulsingQuad(ResourceLocation texture, float maxTransparency) - { - - float pulseTransparency = getPulseValue() * maxTransparency / 3000f; - - FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture); - Tessellator tessellator = Tessellator.instance; - - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(1, 1, 1, pulseTransparency); - - tessellator.startDrawingQuads(); - tessellator.setColorRGBA_F(1, 1, 1, pulseTransparency); - - tessellator.addVertexWithUV(-0.5D, 0.5D, 0F, 0, 1); - tessellator.addVertexWithUV(0.5D, 0.5D, 0F, 1, 1); - tessellator.addVertexWithUV(0.5D, -0.5D, 0F, 1, 0); - tessellator.addVertexWithUV(-0.5D, -0.5D, 0F, 0, 0); - - tessellator.draw(); - GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - } - - private static int getPulseValue() - { - - if (doInc) - { - pulse += 8; - } - else - { - pulse -= 8; - } - - if (pulse == 3000) - { - doInc = false; - } - - if (pulse == 0) - { - doInc = true; - } - - return pulse; - } - - @SubscribeEvent - public void onDrawBlockHighlightEvent(DrawBlockHighlightEvent event) - { - /** - * Disabling this until transmutation is done, since it's useless at the moment - - Minecraft minecraft = FMLClientHandler.instance().getClient(); - - if (event.currentItem != null) - { - if (event.currentItem.getItem() instanceof ITransmutationStone) - { - if (event.target.typeOfHit == EnumMovingObjectType.TILE) - { - TransmutationHelper.updateTargetBlock(event.player.worldObj, event.target.blockX, event.target.blockY, event.target.blockZ); - - if (Minecraft.isGuiEnabled() && minecraft.inGameHasFocus) - { - if (ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION) - { - drawInWorldTransmutationOverlay(event); - } - } - } - } - } - */ - } - - public void drawInWorldTransmutationOverlay(DrawBlockHighlightEvent event) - { - - double x = event.target.blockX + 0.5F; - double y = event.target.blockY + 0.5F; - double z = event.target.blockZ + 0.5F; - double iPX = event.player.prevPosX + (event.player.posX - event.player.prevPosX) * event.partialTicks; - double iPY = event.player.prevPosY + (event.player.posY - event.player.prevPosY) * event.partialTicks; - double iPZ = event.player.prevPosZ + (event.player.posZ - event.player.prevPosZ) * event.partialTicks; - - float xScale = 1; - float yScale = 1; - float zScale = 1; - float xShift = 0.1F; - float yShift = 0.1F; - float zShift = 0.1F; - int chargeLevel; - int itemChargeLevel = 0; - - if (event.currentItem.getItem() instanceof IChargeable) - { - itemChargeLevel = ((IChargeable) event.currentItem.getItem()).getCharge(event.currentItem); - } - chargeLevel = 1 + itemChargeLevel * 2; - - ForgeDirection sideHit = ForgeDirection.getOrientation(event.target.sideHit); - - switch (sideHit) - { - case UP: - { - xScale = chargeLevel + 0.1F; - zScale = chargeLevel + 0.1F; - xShift = 0; - zShift = 0; - break; - } - case DOWN: - { - xScale = chargeLevel + 0.1F; - zScale = chargeLevel + 0.1F; - xShift = 0; - yShift = -yShift; - zShift = 0; - break; - } - case NORTH: - { - xScale = chargeLevel + 0.1F; - yScale = chargeLevel + 0.1F; - xShift = 0; - yShift = 0; - zShift = -zShift; - break; - } - case SOUTH: - { - xScale = chargeLevel + 0.1F; - yScale = chargeLevel + 0.1F; - xShift = 0; - yShift = 0; - break; - } - case EAST: - { - yScale = chargeLevel + 0.1F; - zScale = chargeLevel + 0.1F; - yShift = 0; - zShift = 0; - break; - } - case WEST: - { - yScale = chargeLevel + 0.1F; - zScale = chargeLevel + 0.1F; - xShift = -xShift; - yShift = 0; - zShift = 0; - break; - } - default: - break; - } - - GL11.glDepthMask(false); - GL11.glDisable(GL11.GL_CULL_FACE); - - for (int i = 0; i < 6; i++) - { - ForgeDirection forgeDir = ForgeDirection.getOrientation(i); - int zCorrection = i == 2 ? -1 : 1; - GL11.glPushMatrix(); - GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift); - GL11.glScalef(1F * xScale, 1F * yScale, 1F * zScale); - GL11.glRotatef(90, forgeDir.offsetX, forgeDir.offsetY, forgeDir.offsetZ); - GL11.glTranslated(0, 0, 0.5f * zCorrection); - GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); - renderPulsingQuad(Textures.EFFECT_WORLD_TRANSMUTATION, 0.75F); - GL11.glPopMatrix(); - } - - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDepthMask(true); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/handler/ItemTooltipEventHandler.java b/src/main/java/com/pahimar/ee3/client/handler/ItemTooltipEventHandler.java deleted file mode 100644 index c3016bca..00000000 --- a/src/main/java/com/pahimar/ee3/client/handler/ItemTooltipEventHandler.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.pahimar.ee3.client.handler; - -import com.pahimar.ee3.api.WrappedStack; -import com.pahimar.ee3.emc.EmcRegistry; -import com.pahimar.ee3.emc.EmcValue; -import cpw.mods.fml.common.eventhandler.EventPriority; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; -import org.lwjgl.input.Keyboard; - -import java.text.DecimalFormat; - -/** - * Equivalent-Exchange-3 - *

- * ItemTooltipEventHandler - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class ItemTooltipEventHandler -{ - private static DecimalFormat emcDecimalFormat = new DecimalFormat("###,###,###,###,###.###"); - - @SuppressWarnings("unused") - @SubscribeEvent(priority = EventPriority.LOWEST) - public void handleItemTooltipEvent(ItemTooltipEvent event) - { - if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) - { - WrappedStack stack = new WrappedStack(event.itemStack); - - if (EmcRegistry.getInstance().hasEmcValue(stack)) - { - EmcValue emcValue = EmcRegistry.getInstance().getEmcValue(stack); - if (stack.getStackSize() > 1) - { - event.toolTip.add("EMC (Item): " + String.format("%s", emcDecimalFormat.format(emcValue.getValue()))); - event.toolTip.add("EMC (Stack): " + String.format("%s", emcDecimalFormat.format(stack.getStackSize() * emcValue.getValue()))); - } - else - { - event.toolTip.add("EMC: " + String.format("%s", emcDecimalFormat.format(stack.getStackSize() * emcValue.getValue()))); - } - } - else - { - event.toolTip.add("No EMC value"); - } - } - } -} diff --git a/src/main/java/com/pahimar/ee3/client/handler/KeyBindingHandler.java b/src/main/java/com/pahimar/ee3/client/handler/KeyBindingHandler.java deleted file mode 100644 index 8726480d..00000000 --- a/src/main/java/com/pahimar/ee3/client/handler/KeyBindingHandler.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.pahimar.ee3.client.handler; - -import com.pahimar.ee3.client.helper.KeyBindingHelper; -import com.pahimar.ee3.item.IKeyBound; -import com.pahimar.ee3.lib.Reference; -import com.pahimar.ee3.network.PacketTypeHandler; -import com.pahimar.ee3.network.packet.PacketKeyPressed; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.settings.KeyBinding; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -import java.util.EnumSet; - -/** - * Equivalent-Exchange-3 - *

- * KeyBindingHandler - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class KeyBindingHandler extends KeyBindingRegistry.KeyHandler -{ - public KeyBindingHandler() - { - super(KeyBindingHelper.gatherKeyBindings(), KeyBindingHelper.gatherIsRepeating()); - } - - @Override - public String getLabel() - { - return Reference.MOD_NAME + ": " + this.getClass().getSimpleName(); - } - - @Override - public void keyDown(EnumSet types, KeyBinding kb, boolean tickEnd, boolean isRepeat) - { - // Only operate at the end of the tick - if (tickEnd) - { - // If we are not in a GUI of any kind, continue execution - if (FMLClientHandler.instance().getClient().inGameHasFocus) - { - EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer; - if (player != null) - { - ItemStack currentItem = FMLClientHandler.instance().getClient().thePlayer.getCurrentEquippedItem(); - - if (currentItem != null) - { - if (currentItem.getItem() instanceof IKeyBound) - { - if (player.worldObj.isRemote) - { - PacketDispatcher.sendPacketToServer(PacketTypeHandler.populatePacket(new PacketKeyPressed(kb.keyDescription))); - } - else - { - ((IKeyBound) currentItem.getItem()).doKeyBindingAction(player, currentItem, kb.keyDescription); - } - } - } - } - } - } - } - - @Override - public void keyUp(EnumSet types, KeyBinding kb, boolean tickEnd) - { - - } - - @Override - public EnumSet ticks() - { - return EnumSet.of(TickType.CLIENT); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/handler/TransmutationTargetOverlayHandler.java b/src/main/java/com/pahimar/ee3/client/handler/TransmutationTargetOverlayHandler.java deleted file mode 100644 index d60af53c..00000000 --- a/src/main/java/com/pahimar/ee3/client/handler/TransmutationTargetOverlayHandler.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.pahimar.ee3.client.handler; - -import com.pahimar.ee3.client.helper.RenderUtils; -import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.helper.TransmutationHelper; -import com.pahimar.ee3.item.ITransmutationStone; -import com.pahimar.ee3.lib.Reference; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import java.util.EnumSet; - -/** - * Equivalent-Exchange-3 - *

- * TransmutationTargetOverlayHandler - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class TransmutationTargetOverlayHandler implements ITickHandler -{ - - private static void renderStoneHUD(Minecraft minecraft, EntityPlayer player, ItemStack stack, float partialTicks) - { - - float overlayScale = ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE; - float blockScale = overlayScale / 2; - float overlayOpacity = ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY; - - GL11.glPushMatrix(); - ScaledResolution sr = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight); - GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); - GL11.glMatrixMode(GL11.GL_PROJECTION); - GL11.glLoadIdentity(); - GL11.glOrtho(0.0D, sr.getScaledWidth_double(), sr.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D); - GL11.glMatrixMode(GL11.GL_MODELVIEW); - GL11.glLoadIdentity(); - GL11.glTranslatef(0.0F, 0.0F, -2000.0F); - - GL11.glPushMatrix(); - RenderHelper.enableGUIStandardItemLighting(); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glEnable(GL11.GL_COLOR_MATERIAL); - GL11.glEnable(GL11.GL_LIGHTING); - - int hudOverlayX = 0; - int hudOverlayY = 0; - int hudBlockX = 0; - int hudBlockY = 0; - - switch (ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION) - { - case 0: - { - hudOverlayX = 0; - hudBlockX = (int) (16 * overlayScale / 2 - 8); - hudOverlayY = 0; - hudBlockY = (int) (16 * overlayScale / 2 - 8); - break; - } - case 1: - { - hudOverlayX = (int) (sr.getScaledWidth() - 16 * overlayScale); - hudBlockX = (int) (sr.getScaledWidth() - 16 * overlayScale / 2 - 8); - hudOverlayY = 0; - hudBlockY = (int) (16 * overlayScale / 2 - 8); - break; - } - case 2: - { - hudOverlayX = 0; - hudBlockX = (int) (16 * overlayScale / 2 - 8); - hudOverlayY = (int) (sr.getScaledHeight() - 16 * overlayScale); - hudBlockY = (int) (sr.getScaledHeight() - 16 * overlayScale / 2 - 8); - break; - } - case 3: - { - hudOverlayX = (int) (sr.getScaledWidth() - 16 * overlayScale); - hudBlockX = (int) (sr.getScaledWidth() - 16 * overlayScale / 2 - 8); - hudOverlayY = (int) (sr.getScaledHeight() - 16 * overlayScale); - hudBlockY = (int) (sr.getScaledHeight() - 16 * overlayScale / 2 - 8); - break; - } - default: - { - break; - } - } - - RenderUtils.renderItemIntoGUI(minecraft.fontRenderer, stack, hudOverlayX, hudOverlayY, overlayOpacity, overlayScale); - - if (TransmutationHelper.targetBlockStack != null && TransmutationHelper.targetBlockStack.getItem() instanceof ItemBlock) - { - RenderUtils.renderRotatingBlockIntoGUI(minecraft.fontRenderer, TransmutationHelper.targetBlockStack, hudBlockX, hudBlockY, -90, blockScale); - } - - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - GL11.glPopMatrix(); - } - - @Override - public void tickStart(EnumSet type, Object... tickData) - { - - } - - @Override - public void tickEnd(EnumSet type, Object... tickData) - { - - Minecraft minecraft = FMLClientHandler.instance().getClient(); - EntityPlayer player = minecraft.thePlayer; - ItemStack currentItemStack; - - if (type.contains(TickType.RENDER)) - { - if (player != null) - { - currentItemStack = player.inventory.getCurrentItem(); - - if (Minecraft.isGuiEnabled() && minecraft.inGameHasFocus) - { - if (currentItemStack != null && currentItemStack.getItem() instanceof ITransmutationStone && ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION) - { - renderStoneHUD(minecraft, player, currentItemStack, (Float) tickData[0]); - } - } - } - } - } - - @Override - public EnumSet ticks() - { - - return EnumSet.of(TickType.CLIENT, TickType.RENDER); - } - - @Override - public String getLabel() - { - - return Reference.MOD_NAME + ": " + this.getClass().getSimpleName(); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/helper/ColourUtils.java b/src/main/java/com/pahimar/ee3/client/helper/ColourUtils.java deleted file mode 100644 index dcd42c2a..00000000 --- a/src/main/java/com/pahimar/ee3/client/helper/ColourUtils.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.pahimar.ee3.client.helper; - -public class ColourUtils -{ - public static byte[] convertIntColourToByteArray(int intColour) - { - byte[] colourByteArray = new byte[3]; - - colourByteArray[0] = (byte) (intColour >> 16 & 255); - colourByteArray[1] = (byte) (intColour >> 8 & 255); - colourByteArray[2] = (byte) (intColour & 255); - - return colourByteArray; - } - - public static float[] convertIntColourToFloatArray(int intColour) - { - float[] colourFloatArray = new float[3]; - - colourFloatArray[0] = ((intColour >> 16 & 0xFF) / 255F); - colourFloatArray[1] = ((intColour >> 8 & 0xFF) / 255F); - colourFloatArray[2] = ((intColour & 0xFF) / 255F); - - return colourFloatArray; - } - - public static byte[][] getByteBlendedColours(byte[] firstColour, byte[] secondColour, int steps) - { - if (firstColour.length == 3 && secondColour.length == 3 && steps > 0) - { - byte[][] blendedColours = new byte[steps + 2][3]; - - byte redDifference = (byte) (((secondColour[0] & 0xFF) - (firstColour[0] & 0xFF)) / steps); - byte greenDifference = (byte) (((secondColour[1] & 0xFF) - (firstColour[1] & 0xFF)) / steps); - byte blueDifference = (byte) (((secondColour[2] & 0xFF) - (firstColour[2] & 0xFF)) / steps); - - blendedColours[0] = firstColour; - for (int i = 1; i < blendedColours.length - 1; i++) - { - blendedColours[i][0] = (byte) (firstColour[0] + i * redDifference); - blendedColours[i][1] = (byte) (firstColour[1] + i * greenDifference); - blendedColours[i][2] = (byte) (firstColour[2] + i * blueDifference); - } - blendedColours[blendedColours.length - 1] = secondColour; - - return blendedColours; - } - - return null; - } - - public static float[][] getFloatBlendedColours(byte[] firstColour, byte[] secondColour, int steps) - { - byte[][] byteBlendedColours = getByteBlendedColours(firstColour, secondColour, steps); - - if (byteBlendedColours != null) - { - float[][] floatBlendedColours = new float[byteBlendedColours.length][3]; - - for (int i = 0; i < byteBlendedColours.length; i++) - { - floatBlendedColours[i][0] = (byteBlendedColours[i][0] & 0xFF) / 255F; - floatBlendedColours[i][1] = (byteBlendedColours[i][1] & 0xFF) / 255F; - floatBlendedColours[i][2] = (byteBlendedColours[i][2] & 0xFF) / 255F; - } - - return floatBlendedColours; - } - else - { - return null; - } - } - - public static float[][] getFloatBlendedColours(int firstColour, int secondColour, int steps) - { - byte[] firstColourByteArray = convertIntColourToByteArray(firstColour); - byte[] secondColourByteArray = convertIntColourToByteArray(secondColour); - - if (firstColourByteArray != null && secondColourByteArray != null) - { - return getFloatBlendedColours(firstColourByteArray, secondColourByteArray, steps); - } - else - { - return null; - } - } -} diff --git a/src/main/java/com/pahimar/ee3/client/helper/KeyBindingHelper.java b/src/main/java/com/pahimar/ee3/client/helper/KeyBindingHelper.java deleted file mode 100644 index ffccc50c..00000000 --- a/src/main/java/com/pahimar/ee3/client/helper/KeyBindingHelper.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.pahimar.ee3.client.helper; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.settings.KeyBinding; - -import java.util.ArrayList; - -/** - * Equivalent-Exchange-3 - *

- * KeyBindingHelper - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class KeyBindingHelper -{ - private static ArrayList keyBindingsList; - private static ArrayList isRepeatingList; - - public static void addKeyBinding(String name, int value) - { - if (keyBindingsList == null) - { - keyBindingsList = new ArrayList(); - } - - keyBindingsList.add(new KeyBinding(name, value)); - } - - public static void addIsRepeating(boolean value) - { - if (isRepeatingList == null) - { - isRepeatingList = new ArrayList(); - } - - isRepeatingList.add(value); - } - - public static KeyBinding[] gatherKeyBindings() - { - return keyBindingsList.toArray(new KeyBinding[keyBindingsList.size()]); - } - - public static boolean[] gatherIsRepeating() - { - boolean[] isRepeating = new boolean[isRepeatingList.size()]; - - for (int x = 0; x < isRepeating.length; x++) - { - isRepeating[x] = isRepeatingList.get(x); - } - - return isRepeating; - } -} diff --git a/src/main/java/com/pahimar/ee3/client/helper/RenderUtils.java b/src/main/java/com/pahimar/ee3/client/helper/RenderUtils.java deleted file mode 100644 index 674e4920..00000000 --- a/src/main/java/com/pahimar/ee3/client/helper/RenderUtils.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.pahimar.ee3.client.helper; - -import com.pahimar.ee3.lib.Textures; -import cpw.mods.fml.client.FMLClientHandler; -import net.minecraft.block.Block; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import org.lwjgl.opengl.GL11; - -/** - * Equivalent-Exchange-3 - *

- * RenderUtils - * - * @author pahimar - */ -//@SideOnly(Side.CLIENT) -public class RenderUtils -{ - private static int rotationAngle = 0; - - public static void renderRotatingBlockIntoGUI(FontRenderer fontRenderer, ItemStack stack, int x, int y, float zLevel, float scale) - { - RenderBlocks renderBlocks = new RenderBlocks(); - - Block block = Block.blocksList[stack.itemID]; - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.VANILLA_BLOCK_TEXTURE_SHEET); - GL11.glPushMatrix(); - GL11.glTranslatef(x - 2, y + 3, -3.0F + zLevel); - GL11.glScalef(10.0F, 10.0F, 10.0F); - GL11.glTranslatef(1.0F, 0.5F, 1.0F); - GL11.glScalef(1.0F * scale, 1.0F * scale, -1.0F); - GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(0F + rotationAngle, 0.0F, 1.0F, 0.0F); - rotationAngle = (rotationAngle + 1) % 360; - - int var10 = Item.itemsList[stack.itemID].getColorFromItemStack(stack, 0); - float var16 = (var10 >> 16 & 255) / 255.0F; - float var12 = (var10 >> 8 & 255) / 255.0F; - float var13 = (var10 & 255) / 255.0F; - - GL11.glColor4f(var16, var12, var13, 1.0F); - - GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); - renderBlocks.useInventoryTint = true; - renderBlocks.renderBlockAsItem(block, stack.getItemDamage(), 1.0F); - renderBlocks.useInventoryTint = true; - GL11.glPopMatrix(); - } - - public static void renderItemIntoGUI(FontRenderer fontRenderer, ItemStack itemStack, int x, int y, float opacity, float scale) - { - Icon icon = itemStack.getIconIndex(); - GL11.glDisable(GL11.GL_LIGHTING); - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.VANILLA_ITEM_TEXTURE_SHEET); - int overlayColour = itemStack.getItem().getColorFromItemStack(itemStack, 0); - float red = (overlayColour >> 16 & 255) / 255.0F; - float green = (overlayColour >> 8 & 255) / 255.0F; - float blue = (overlayColour & 255) / 255.0F; - GL11.glColor4f(red, green, blue, opacity); - drawTexturedQuad(x, y, icon, 16 * scale, 16 * scale, -90); - GL11.glEnable(GL11.GL_LIGHTING); - } - - public static void drawTexturedQuad(int x, int y, Icon icon, float width, float height, double zLevel) - { - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(x, y + height, zLevel, icon.getMinU(), icon.getMaxV()); - tessellator.addVertexWithUV(x + width, y + height, zLevel, icon.getMaxU(), icon.getMaxV()); - tessellator.addVertexWithUV(x + width, y, zLevel, icon.getMaxU(), icon.getMinV()); - tessellator.addVertexWithUV(x, y, zLevel, icon.getMinU(), icon.getMinV()); - tessellator.draw(); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/model/ModelAludel.java b/src/main/java/com/pahimar/ee3/client/model/ModelAludel.java deleted file mode 100644 index 0b4f8e2e..00000000 --- a/src/main/java/com/pahimar/ee3/client/model/ModelAludel.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.pahimar.ee3.client.model; - -import com.pahimar.ee3.lib.Models; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraftforge.client.model.AdvancedModelLoader; -import net.minecraftforge.client.model.IModelCustom; - -/** - * Equivalent-Exchange-3 - *

- * ModelAludel - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class ModelAludel -{ - private IModelCustom modelAludel; - - public ModelAludel() - { - modelAludel = AdvancedModelLoader.loadModel(Models.ALUDEL); - } - - public void render() - { - modelAludel.renderPart("Base"); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/model/ModelCalcinator.java b/src/main/java/com/pahimar/ee3/client/model/ModelCalcinator.java deleted file mode 100644 index 140e53d6..00000000 --- a/src/main/java/com/pahimar/ee3/client/model/ModelCalcinator.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.pahimar.ee3.client.model; - -import com.pahimar.ee3.lib.Models; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraftforge.client.model.AdvancedModelLoader; -import net.minecraftforge.client.model.IModelCustom; - -/** - * ModelCalcinator - *

- * Model for the Calcinator - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class ModelCalcinator -{ - private IModelCustom modelCalcinator; - - public ModelCalcinator() - { - modelCalcinator = AdvancedModelLoader.loadModel(Models.CALCINATOR); - } - - public void render() - { - modelCalcinator.renderAll(); - } - - public void renderPart(String partName) - { - modelCalcinator.renderPart(partName); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/model/ModelGlassBell.java b/src/main/java/com/pahimar/ee3/client/model/ModelGlassBell.java deleted file mode 100644 index 4c9347ad..00000000 --- a/src/main/java/com/pahimar/ee3/client/model/ModelGlassBell.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.pahimar.ee3.client.model; - -import com.pahimar.ee3.lib.Models; -import net.minecraftforge.client.model.AdvancedModelLoader; -import net.minecraftforge.client.model.IModelCustom; - -public class ModelGlassBell -{ - private IModelCustom modelGlassBell; - - public ModelGlassBell() - { - modelGlassBell = AdvancedModelLoader.loadModel(Models.GLASS_BELL); - } - - public void render() - { - modelGlassBell.renderPart("Bell"); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/model/ModelResearchStation.java b/src/main/java/com/pahimar/ee3/client/model/ModelResearchStation.java deleted file mode 100644 index f67bb7d5..00000000 --- a/src/main/java/com/pahimar/ee3/client/model/ModelResearchStation.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.pahimar.ee3.client.model; - -import com.pahimar.ee3.lib.Models; -import net.minecraftforge.client.model.AdvancedModelLoader; -import net.minecraftforge.client.model.IModelCustom; - -public class ModelResearchStation -{ - private IModelCustom modelResearchStation; - - public ModelResearchStation() - { - modelResearchStation = AdvancedModelLoader.loadModel(Models.RESEARCH_STATION); - } - - public void render() - { - modelResearchStation.renderAll(); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/renderer/item/ItemAlchemicalChestRenderer.java b/src/main/java/com/pahimar/ee3/client/renderer/item/ItemAlchemicalChestRenderer.java deleted file mode 100644 index c160d998..00000000 --- a/src/main/java/com/pahimar/ee3/client/renderer/item/ItemAlchemicalChestRenderer.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.pahimar.ee3.client.renderer.item; - -import com.pahimar.ee3.lib.Textures; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.model.ModelChest; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; - -/** - * Equivalent-Exchange-3 - *

- * ItemAlchemicalChestRenderer - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class ItemAlchemicalChestRenderer implements IItemRenderer -{ - private final ModelChest modelChest; - - public ItemAlchemicalChestRenderer() - { - modelChest = new ModelChest(); - } - - @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) - { - switch (type) - { - case ENTITY: - { - renderAlchemicalChest(0.5F, 0.5F, 0.5F, item.getItemDamage()); - break; - } - case EQUIPPED: - { - renderAlchemicalChest(1.0F, 1.0F, 1.0F, item.getItemDamage()); - break; - } - case EQUIPPED_FIRST_PERSON: - { - renderAlchemicalChest(1.0F, 1.0F, 1.0F, item.getItemDamage()); - break; - } - case INVENTORY: - { - renderAlchemicalChest(0.0F, 0.075F, 0.0F, item.getItemDamage()); - break; - } - default: - break; - } - } - - private void renderAlchemicalChest(float x, float y, float z, int metaData) - { - if (metaData == 0) - { - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_SMALL); - } - else if (metaData == 1) - { - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_MEDIUM); - } - else if (metaData == 2) - { - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_LARGE); - } - - GL11.glPushMatrix(); //start - GL11.glTranslatef(x, y, z); //size - GL11.glRotatef(180, 1, 0, 0); - GL11.glRotatef(-90, 0, 1, 0); - modelChest.renderAll(); - GL11.glPopMatrix(); //end - } -} diff --git a/src/main/java/com/pahimar/ee3/client/renderer/item/ItemAludelRenderer.java b/src/main/java/com/pahimar/ee3/client/renderer/item/ItemAludelRenderer.java deleted file mode 100644 index 55f70b4d..00000000 --- a/src/main/java/com/pahimar/ee3/client/renderer/item/ItemAludelRenderer.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.pahimar.ee3.client.renderer.item; - -import com.pahimar.ee3.client.model.ModelAludel; -import com.pahimar.ee3.lib.Textures; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; - -/** - * Equivalent-Exchange-3 - *

- * ItemAludelRenderer - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class ItemAludelRenderer implements IItemRenderer -{ - private final ModelAludel modelAludel; - - public ItemAludelRenderer() - { - modelAludel = new ModelAludel(); - } - - @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) - { - switch (type) - { - case ENTITY: - { - renderAludel(-0.5F, -0.38F, 0.5F); - return; - } - case EQUIPPED: - { - renderAludel(0.0F, 0.0F, 1.0F); - return; - } - case EQUIPPED_FIRST_PERSON: - { - renderAludel(0.0F, 0.0F, 1.0F); - return; - } - case INVENTORY: - { - renderAludel(-1.0F, -0.9F, 0.0F); - return; - } - default: - } - } - - private void renderAludel(float x, float y, float z) - { - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - - // Scale, Translate, Rotate - GL11.glScalef(1F, 1F, 1F); - GL11.glTranslatef(x, y, z); - GL11.glRotatef(-90F, 1F, 0, 0); - - // Bind texture - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALUDEL); - - // Render - modelAludel.render(); - - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/renderer/item/ItemCalcinatorRenderer.java b/src/main/java/com/pahimar/ee3/client/renderer/item/ItemCalcinatorRenderer.java deleted file mode 100644 index 6416be26..00000000 --- a/src/main/java/com/pahimar/ee3/client/renderer/item/ItemCalcinatorRenderer.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.pahimar.ee3.client.renderer.item; - -import com.pahimar.ee3.client.model.ModelCalcinator; -import com.pahimar.ee3.lib.Textures; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; - -/** - * Equivalent-Exchange-3 - *

- * ItemCalcinatorRenderer - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class ItemCalcinatorRenderer implements IItemRenderer -{ - private final ModelCalcinator modelCalcinator; - - public ItemCalcinatorRenderer() - { - modelCalcinator = new ModelCalcinator(); - } - - @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) - { - switch (type) - { - case ENTITY: - { - renderCalcinator(-0.5F, 0.0F, 0.5F); - return; - } - case EQUIPPED: - { - renderCalcinator(0.0F, 0.0F, 1.0F); - return; - } - case EQUIPPED_FIRST_PERSON: - { - renderCalcinator(0.0F, 0.0F, 1.0F); - return; - } - case INVENTORY: - { - renderCalcinator(0.0F, -0.1F, 1.0F); - return; - } - default: - { - } - } - } - - private void renderCalcinator(float x, float y, float z) - { - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - - // Scale, Translate, Rotate - GL11.glScalef(1F, 1F, 1F); - GL11.glTranslatef(x, y, z); - GL11.glRotatef(-90F, 1F, 0, 0); - - // Bind texture - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_CALCINATOR_IDLE); - - // Render - modelCalcinator.renderPart("Calcinator"); - - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/renderer/item/ItemGlassBellRenderer.java b/src/main/java/com/pahimar/ee3/client/renderer/item/ItemGlassBellRenderer.java deleted file mode 100644 index 63d4217d..00000000 --- a/src/main/java/com/pahimar/ee3/client/renderer/item/ItemGlassBellRenderer.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.pahimar.ee3.client.renderer.item; - -import com.pahimar.ee3.client.model.ModelGlassBell; -import com.pahimar.ee3.lib.Textures; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; - -/** - * Equivalent-Exchange-3 - *

- * ItemGlassBellRenderer - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class ItemGlassBellRenderer implements IItemRenderer -{ - private final ModelGlassBell modelGlassBell; - - public ItemGlassBellRenderer() - { - modelGlassBell = new ModelGlassBell(); - } - - @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) - { - switch (type) - { - case ENTITY: - { - renderGlassBell(-0.5F, -1.2F, 0.5F); - return; - } - case EQUIPPED: - { - renderGlassBell(-0.2F, -0.85F, 0.8F); - return; - } - case EQUIPPED_FIRST_PERSON: - { - renderGlassBell(-0.2F, -0.85F, 0.8F); - return; - } - case INVENTORY: - { - renderGlassBell(-1.0F, -1.675F, 0.0F); - return; - } - default: - { - } - } - } - - private void renderGlassBell(float x, float y, float z) - { - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - - // Scale, Translate, Rotate - GL11.glScalef(1.4F, 1.4F, 1.4F); - GL11.glTranslatef(x, y, z); - GL11.glRotatef(-90F, 1F, 0, 0); - - // Bind texture - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_GLASS_BELL); - - // Render - modelGlassBell.render(); - - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/renderer/item/ItemResearchStationRenderer.java b/src/main/java/com/pahimar/ee3/client/renderer/item/ItemResearchStationRenderer.java deleted file mode 100644 index d43d9737..00000000 --- a/src/main/java/com/pahimar/ee3/client/renderer/item/ItemResearchStationRenderer.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.pahimar.ee3.client.renderer.item; - -import com.pahimar.ee3.client.model.ModelResearchStation; -import com.pahimar.ee3.lib.Textures; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; - -@SideOnly(Side.CLIENT) -public class ItemResearchStationRenderer implements IItemRenderer -{ - private final ModelResearchStation modelResearchStation; - - public ItemResearchStationRenderer() - { - modelResearchStation = new ModelResearchStation(); - } - - @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) - { - switch (type) - { - case ENTITY: - { - renderCalcinator(-0.5F, 0.0F, 0.5F); - return; - } - case EQUIPPED: - { - renderCalcinator(0.0F, 0.0F, 1.0F); - return; - } - case EQUIPPED_FIRST_PERSON: - { - renderCalcinator(0.0F, 0.0F, 1.0F); - return; - } - case INVENTORY: - { - renderCalcinator(0.0F, -0.1F, 1.0F); - return; - } - default: - { - } - } - } - - private void renderCalcinator(float x, float y, float z) - { - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - - // Scale, Translate, Rotate - GL11.glScalef(1.0F, 1.0F, 1.0F); - GL11.glTranslatef(x, y, z); - - // Bind texture - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_RESEARCH_STATION); - - // Render - modelResearchStation.render(); - - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } -} diff --git a/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityAlchemicalChestRenderer.java b/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityAlchemicalChestRenderer.java deleted file mode 100644 index 0844bb53..00000000 --- a/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityAlchemicalChestRenderer.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.pahimar.ee3.client.renderer.tileentity; - -import com.pahimar.ee3.lib.Textures; -import com.pahimar.ee3.tileentity.TileAlchemicalChest; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.model.ModelChest; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -/** - * Equivalent-Exchange-3 - *

- * TileEntityAlchemicalChestRenderer - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class TileEntityAlchemicalChestRenderer extends TileEntitySpecialRenderer -{ - private final ModelChest modelChest = new ModelChest(); - - @Override - public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) - { - if (tileEntity instanceof TileAlchemicalChest) - { - TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) tileEntity; - ForgeDirection direction = null; - - if (tileAlchemicalChest.getWorldObj() != null) - { - direction = tileAlchemicalChest.getOrientation(); - } - - if (tileAlchemicalChest.getState() == 0) - { - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_SMALL); - } - else if (tileAlchemicalChest.getState() == 1) - { - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_MEDIUM); - } - else if (tileAlchemicalChest.getState() == 2) - { - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_LARGE); - } - - GL11.glPushMatrix(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F); - GL11.glScalef(1.0F, -1.0F, -1.0F); - GL11.glTranslatef(0.5F, 0.5F, 0.5F); - short angle = 0; - - if (direction != null) - { - if (direction == ForgeDirection.NORTH) - { - angle = 180; - } - else if (direction == ForgeDirection.SOUTH) - { - angle = 0; - } - else if (direction == ForgeDirection.WEST) - { - angle = 90; - } - else if (direction == ForgeDirection.EAST) - { - angle = -90; - } - } - - GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - float adjustedLidAngle = tileAlchemicalChest.prevLidAngle + (tileAlchemicalChest.lidAngle - tileAlchemicalChest.prevLidAngle) * tick; - adjustedLidAngle = 1.0F - adjustedLidAngle; - adjustedLidAngle = 1.0F - adjustedLidAngle * adjustedLidAngle * adjustedLidAngle; - modelChest.chestLid.rotateAngleX = -(adjustedLidAngle * (float) Math.PI / 2.0F); - modelChest.renderAll(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - GL11.glPopMatrix(); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityAludelRenderer.java b/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityAludelRenderer.java deleted file mode 100644 index 1a6e5d2e..00000000 --- a/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityAludelRenderer.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.pahimar.ee3.client.renderer.tileentity; - -import com.pahimar.ee3.client.model.ModelAludel; -import com.pahimar.ee3.lib.Textures; -import com.pahimar.ee3.tileentity.TileAludel; -import com.pahimar.ee3.tileentity.TileGlassBell; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; -import org.lwjgl.opengl.GL11; - -/** - * Equivalent-Exchange-3 - *

- * TileEntityAludelRenderer - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class TileEntityAludelRenderer extends TileEntitySpecialRenderer -{ - private final ModelAludel modelAludel = new ModelAludel(); - private final RenderItem customRenderItem; - - public TileEntityAludelRenderer() - { - customRenderItem = new RenderItem() - { - @Override - public boolean shouldBob() - { - return false; - } - }; - - customRenderItem.setRenderManager(RenderManager.instance); - } - - @Override - public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) - { - if (tileEntity instanceof TileAludel) - { - TileAludel tileAludel = (TileAludel) tileEntity; - - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - - // Scale, Translate, Rotate - scaleTranslateRotate(x, y, z, tileAludel.getOrientation()); - - // Bind texture - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALUDEL); - - // Render - modelAludel.render(); - - GL11.glPopMatrix(); - - /** - * Render the ghost item inside of the Aludel, slowly spinning - */ - GL11.glPushMatrix(); - - TileEntity tileGlassBell = tileAludel.getWorldObj().getTileEntity(tileAludel.xCoord, tileAludel.yCoord + 1, tileAludel.zCoord); - - if (tileGlassBell instanceof TileGlassBell) - { - if (tileAludel.outputItemStack != null) - { - float scaleFactor = getGhostItemScaleFactor(tileAludel.outputItemStack); - float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL); - - EntityItem ghostEntityItem = new EntityItem(tileAludel.getWorldObj()); - ghostEntityItem.hoverStart = 0.0F; - ghostEntityItem.setEntityItemStack(tileAludel.outputItemStack); - - GL11.glTranslatef((float) x + 0.5F, (float) y + 1.25F, (float) z + 0.5F); - GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); - GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F); - - customRenderItem.doRenderItem(ghostEntityItem, 0, 0, 0, 0, 0); - } - } - - GL11.glPopMatrix(); - - GL11.glEnable(GL11.GL_LIGHTING); - } - } - - private void scaleTranslateRotate(double x, double y, double z, ForgeDirection orientation) - { - if (orientation == ForgeDirection.NORTH) - { - GL11.glTranslated(x + 1, y, z); - GL11.glRotatef(180F, 0F, 1F, 0F); - GL11.glRotatef(-90F, 1F, 0F, 0F); - } - else if (orientation == ForgeDirection.EAST) - { - GL11.glTranslated(x + 1, y, z + 1); - GL11.glRotatef(90F, 0F, 1F, 0F); - GL11.glRotatef(-90F, 1F, 0F, 0F); - } - else if (orientation == ForgeDirection.SOUTH) - { - GL11.glTranslated(x, y, z + 1); - GL11.glRotatef(0F, 0F, 1F, 0F); - GL11.glRotatef(-90F, 1F, 0F, 0F); - } - else if (orientation == ForgeDirection.WEST) - { - GL11.glTranslated(x, y, z); - GL11.glRotatef(-90F, 0F, 1F, 0F); - GL11.glRotatef(-90F, 1F, 0F, 0F); - } - } - - private float getGhostItemScaleFactor(ItemStack itemStack) - { - float scaleFactor = 1.0F; - - if (itemStack != null) - { - if (itemStack.getItem() instanceof ItemBlock) - { - switch (customRenderItem.getMiniBlockCount(itemStack)) - { - case 1: - return 0.90F; - case 2: - return 0.90F; - case 3: - return 0.90F; - case 4: - return 0.90F; - case 5: - return 0.80F; - default: - return 0.90F; - } - } - else - { - switch (customRenderItem.getMiniItemCount(itemStack)) - { - case 1: - return 0.65F; - case 2: - return 0.65F; - case 3: - return 0.65F; - case 4: - return 0.65F; - default: - return 0.65F; - } - } - } - - return scaleFactor; - } -} diff --git a/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityCalcinatorRenderer.java b/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityCalcinatorRenderer.java deleted file mode 100644 index 44e00c1d..00000000 --- a/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityCalcinatorRenderer.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.pahimar.ee3.client.renderer.tileentity; - -import com.pahimar.ee3.client.helper.ColourUtils; -import com.pahimar.ee3.client.model.ModelCalcinator; -import com.pahimar.ee3.lib.Colours; -import com.pahimar.ee3.lib.Textures; -import com.pahimar.ee3.tileentity.TileCalcinator; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; -import org.lwjgl.opengl.GL11; - -/** - * Equivalent-Exchange-3 - *

- * TileEntityCalcinatorRenderer - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class TileEntityCalcinatorRenderer extends TileEntitySpecialRenderer -{ - private final ModelCalcinator modelCalcinator = new ModelCalcinator(); - - @Override - public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) - { - if (tileEntity instanceof TileCalcinator) - { - TileCalcinator tileCalcinator = (TileCalcinator) tileEntity; - - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - - // Scale, Translate, Rotate - GL11.glScalef(1.0F, 1.0F, 1.0F); - GL11.glTranslatef((float) x + 0.5F, (float) y + 0.0F, (float) z + 1.2F); - GL11.glRotatef(45F, 0F, 1F, 0F); - GL11.glRotatef(-90F, 1F, 0F, 0F); - - // Bind texture - if (tileCalcinator.getState() == 1) - { - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_CALCINATOR_ACTIVE); - } - else - { - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_CALCINATOR_IDLE); - } - - // Render - modelCalcinator.renderPart("Calcinator"); - - int dustStackSize = tileCalcinator.leftStackSize + tileCalcinator.rightStackSize; - - if (dustStackSize > 0) - { - GL11.glPushMatrix(); - - // Reverse previous rotation to get back into a workable frame of reference - GL11.glRotatef(90F, 1F, 0F, 0F); - GL11.glRotatef(-45F, 0F, 1F, 0F); - - float[] dustColour = getBlendedDustColour(tileCalcinator.leftStackSize, tileCalcinator.leftStackMeta, tileCalcinator.rightStackSize, tileCalcinator.rightStackMeta); - - GL11.glColor4f(dustColour[0], dustColour[1], dustColour[2], 1F); - - if (dustStackSize <= 32) - { - GL11.glScalef(0.25F, 0.25F, 0.25F); - GL11.glTranslatef(0.0F, 2.20F, -2.1125F); - } - else if (dustStackSize <= 64) - { - GL11.glScalef(0.5F, 0.5F, 0.5F); - GL11.glTranslatef(-0.0125F, 0.75F, -0.7125F); - } - - // Reapply previous rotation to get it back to a viewable state - GL11.glRotatef(45F, 0F, 1F, 0F); - GL11.glRotatef(-90F, 1F, 0F, 0F); - - // Render the dust in the Calcinator bowl - modelCalcinator.renderPart("Dust"); - GL11.glPopMatrix(); - } - - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } - } - - private static float[] getBlendedDustColour(int leftStackSize, int leftStackMeta, int rightStackSize, int rightStackMeta) - { - int totalDustStacksSize = leftStackSize + rightStackSize; - - if (totalDustStacksSize > 0) - { - int leftStackColour = Integer.parseInt(Colours.DUST_COLOURS[MathHelper.clamp_int(leftStackMeta, 0, Colours.DUST_COLOURS.length)], 16); - int rightStackColour = Integer.parseInt(Colours.DUST_COLOURS[MathHelper.clamp_int(rightStackMeta, 0, Colours.DUST_COLOURS.length)], 16); - - float leftStackRatio = leftStackSize * 1f / totalDustStacksSize; - float rightStackRatio = rightStackSize * 1f / totalDustStacksSize; - - float[][] blendedColours = ColourUtils.getFloatBlendedColours(leftStackColour, rightStackColour, 32); - - if (blendedColours.length > 0) - { - if (Float.compare(leftStackRatio, rightStackRatio) > 0) - { - return blendedColours[Math.round((1 - leftStackRatio) * (blendedColours.length - 1))]; - } - else - { - return blendedColours[Math.round(rightStackRatio * (blendedColours.length - 1))]; - } - } - } - - return new float[]{1F, 1F, 1F}; - } -} diff --git a/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityGlassBellRenderer.java b/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityGlassBellRenderer.java deleted file mode 100644 index cdfdd04c..00000000 --- a/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityGlassBellRenderer.java +++ /dev/null @@ -1,294 +0,0 @@ -package com.pahimar.ee3.client.renderer.tileentity; - -import com.pahimar.ee3.client.model.ModelGlassBell; -import com.pahimar.ee3.lib.Textures; -import com.pahimar.ee3.tileentity.TileGlassBell; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; -import org.lwjgl.opengl.GL11; - -/** - * Equivalent-Exchange-3 - *

- * TileEntityGlassBellRenderer - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) -public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer -{ - private final ModelGlassBell modelGlassBell = new ModelGlassBell(); - private final RenderItem customRenderItem; - - public TileEntityGlassBellRenderer() - { - customRenderItem = new RenderItem() - { - @Override - public boolean shouldBob() - { - - return false; - } - }; - - customRenderItem.setRenderManager(RenderManager.instance); - } - - @Override - public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) - { - if (tileEntity instanceof TileGlassBell) - { - TileGlassBell tileGlassBell = (TileGlassBell) tileEntity; - - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_CULL_FACE); - - /** - * Render the Glass Bell - */ - GL11.glPushMatrix(); - - // Scale, Translate, Rotate - renderGlassBellByOrientation(x, y, z, tileGlassBell.getOrientation()); - - // Bind texture - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_GLASS_BELL); - - modelGlassBell.render(); - - GL11.glPopMatrix(); - - /** - * Render the ghost item inside of the Glass Bell, slowly spinning - */ - GL11.glPushMatrix(); - - if (tileGlassBell.outputItemStack != null) - { - float scaleFactor = getGhostItemScaleFactor(tileGlassBell.outputItemStack); - float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL); - - EntityItem ghostEntityItem = new EntityItem(tileGlassBell.getWorldObj()); - ghostEntityItem.hoverStart = 0.0F; - ghostEntityItem.setEntityItemStack(tileGlassBell.outputItemStack); - - translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), x, y, z, tileGlassBell.getOrientation()); - GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); - GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F); - - customRenderItem.doRenderItem(ghostEntityItem, 0, 0, 0, 0, 0); - } - - GL11.glPopMatrix(); - - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glEnable(GL11.GL_LIGHTING); - } - } - - private void renderGlassBellByOrientation(double x, double y, double z, ForgeDirection forgeDirection) - { - switch (forgeDirection) - { - case DOWN: - { - GL11.glScalef(1.0F, 1.0F, 1.0F); - GL11.glTranslatef((float) x + 0.0F, (float) y + 2.0F, (float) z + 0.0F); - GL11.glRotatef(90F, 1F, 0F, 0F); - return; - } - case UP: - { - GL11.glScalef(1.0F, 1.0F, 1.0F); - GL11.glTranslatef((float) x + 0.0F, (float) y + -1.0F, (float) z + 1.0F); - GL11.glRotatef(-90F, 1F, 0F, 0F); - return; - } - case NORTH: - { - GL11.glScalef(1.0F, 1.0F, 1.0F); - GL11.glTranslatef((float) x + 1.0F, (float) y + 0.0F, (float) z + 2.0F); - GL11.glRotatef(180F, 0F, 1F, 0F); - return; - } - case SOUTH: - { - GL11.glScalef(1.0F, 1.0F, 1.0F); - GL11.glTranslatef((float) x + 0.0F, (float) y + 0.0F, (float) z + -1.0F); - return; - } - case EAST: - { - GL11.glScalef(1.0F, 1.0F, 1.0F); - GL11.glTranslatef((float) x + -1.0F, (float) y + 1.0F, (float) z + 1.0F); - GL11.glRotatef(-90F, 0F, 0F, 1F); - GL11.glRotatef(-90F, 1F, 0F, 0F); - return; - } - case WEST: - { - GL11.glScalef(1.0F, 1.0F, 1.0F); - GL11.glTranslatef((float) x + 2.0F, (float) y + 0.0F, (float) z + 1.0F); - GL11.glRotatef(90F, 0F, 0F, 1F); - GL11.glRotatef(-90F, 1F, 0F, 0F); - return; - } - case UNKNOWN: - { - return; - } - default: - { - } - } - } - - private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) - { - if (ghostItemStack != null) - { - if (ghostItemStack.getItem() instanceof ItemBlock) - { - switch (forgeDirection) - { - case DOWN: - { - GL11.glTranslatef((float) x + 0.5F, (float) y + 0.7F, (float) z + 0.5F); - return; - } - case UP: - { - GL11.glTranslatef((float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F); - return; - } - case NORTH: - { - GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F); - return; - } - case SOUTH: - { - GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F); - return; - } - case EAST: - { - GL11.glTranslatef((float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F); - return; - } - case WEST: - { - GL11.glTranslatef((float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F); - return; - } - case UNKNOWN: - { - return; - } - default: - { - } - } - } - else - { - switch (forgeDirection) - { - case DOWN: - { - GL11.glTranslatef((float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F); - return; - } - case UP: - { - GL11.glTranslatef((float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F); - return; - } - case NORTH: - { - GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F); - return; - } - case SOUTH: - { - GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F); - return; - } - case EAST: - { - GL11.glTranslatef((float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F); - return; - } - case WEST: - { - GL11.glTranslatef((float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F); - return; - } - case UNKNOWN: - { - return; - } - default: - { - } - } - } - } - } - - private float getGhostItemScaleFactor(ItemStack itemStack) - { - float scaleFactor = 1.0F; - - if (itemStack != null) - { - if (itemStack.getItem() instanceof ItemBlock) - { - switch (customRenderItem.getMiniBlockCount(itemStack)) - { - case 1: - return 0.90F; - case 2: - return 0.90F; - case 3: - return 0.90F; - case 4: - return 0.90F; - case 5: - return 0.80F; - default: - return 0.90F; - } - } - else - { - switch (customRenderItem.getMiniItemCount(itemStack)) - { - case 1: - return 0.65F; - case 2: - return 0.65F; - case 3: - return 0.65F; - case 4: - return 0.65F; - default: - return 0.65F; - } - } - } - - return scaleFactor; - } -} diff --git a/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityResearchStationRenderer.java b/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityResearchStationRenderer.java deleted file mode 100644 index 3404488b..00000000 --- a/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityResearchStationRenderer.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.pahimar.ee3.client.renderer.tileentity; - -import com.pahimar.ee3.client.model.ModelResearchStation; -import com.pahimar.ee3.lib.Textures; -import com.pahimar.ee3.tileentity.TileResearchStation; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import org.lwjgl.opengl.GL11; - -@SideOnly(Side.CLIENT) -public class TileEntityResearchStationRenderer extends TileEntitySpecialRenderer -{ - private final ModelResearchStation modelResearchStation = new ModelResearchStation(); - - @Override - public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) - { - if (tileEntity instanceof TileResearchStation) - { - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - - // Scale, Translate, Rotate - GL11.glScalef(1.0F, 1.0F, 1.0F); - GL11.glTranslatef((float) x + 0.0F, (float) y + 0.0F, (float) z + 1.0F); - - // Bind texture - FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_RESEARCH_STATION); - - // Render - modelResearchStation.render(); - - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/client/settings/Keybindings.java b/src/main/java/com/pahimar/ee3/client/settings/Keybindings.java deleted file mode 100644 index ee5e3d1c..00000000 --- a/src/main/java/com/pahimar/ee3/client/settings/Keybindings.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.pahimar.ee3.client.settings; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.settings.KeyBinding; - -@SideOnly(Side.CLIENT) -public class Keybindings -{ - public KeyBinding keyBindCharge = new KeyBinding("key.charge", 47, "key.categories.ee3"); - public KeyBinding keyBindExtra = new KeyBinding("key.extra", 46, "key.categories.ee3"); - public KeyBinding keyBindRelease = new KeyBinding("key.release", 19, "key.categories.ee3"); - public KeyBinding keyBindToggle = new KeyBinding("key.toggle", 34, "key.categories.ee3"); -} diff --git a/src/main/java/com/pahimar/ee3/command/CommandEE.java b/src/main/java/com/pahimar/ee3/command/CommandEE.java deleted file mode 100644 index 200f8b0e..00000000 --- a/src/main/java/com/pahimar/ee3/command/CommandEE.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.pahimar.ee3.command; - -import com.pahimar.ee3.lib.Commands; -import net.minecraft.command.CommandBase; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.command.WrongUsageException; - -import java.util.List; - -/** - * Equivalent-Exchange-3 - *

- * CommandEE - * - * @author pahimar - */ -public class CommandEE extends CommandBase -{ - - @Override - public String getCommandName() - { - - return Commands.COMMAND_EE3; - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender commandSender) - { - - return true; - } - - @Override - @SuppressWarnings("rawtypes") - public List addTabCompletionOptions(ICommandSender commandSender, String[] args) - { - - switch (args.length) - { - case 1: - { - return getListOfStringsMatchingLastWord(args, Commands.COMMAND_OVERLAY, Commands.COMMAND_PARTICLES, Commands.COMMAND_SOUNDS, Commands.COMMAND_VERSION); - } - case 2: - { - if (args[0].equalsIgnoreCase(Commands.COMMAND_OVERLAY)) - { - return getListOfStringsMatchingLastWord(args, Commands.COMMAND_ON, Commands.COMMAND_OFF, Commands.COMMAND_POSITION, Commands.COMMAND_SCALE, Commands.COMMAND_OPACITY); - } - else if (args[0].equalsIgnoreCase(Commands.COMMAND_PARTICLES)) - { - return getListOfStringsMatchingLastWord(args, Commands.COMMAND_ON, Commands.COMMAND_OFF); - } - else if (args[0].equalsIgnoreCase(Commands.COMMAND_SOUNDS)) - { - return getListOfStringsMatchingLastWord(args, Commands.COMMAND_ALL, Commands.COMMAND_SELF, Commands.COMMAND_OFF); - } - else if (args[0].equalsIgnoreCase(Commands.COMMAND_VERSION)) - { - return getListOfStringsMatchingLastWord(args, Commands.COMMAND_CHANGELOG); - } - } - case 3: - { - if (args[0].equalsIgnoreCase(Commands.COMMAND_OVERLAY)) - { - if (args[1].equalsIgnoreCase(Commands.COMMAND_POSITION)) - { - return getListOfStringsMatchingLastWord(args, Commands.COMMAND_TOP, Commands.COMMAND_BOTTOM); - } - } - } - case 4: - { - if (args[0].equalsIgnoreCase(Commands.COMMAND_OVERLAY)) - { - if (args[1].equalsIgnoreCase(Commands.COMMAND_POSITION)) - { - if (args[2].equalsIgnoreCase(Commands.COMMAND_TOP) || args[2].equalsIgnoreCase(Commands.COMMAND_BOTTOM)) - { - return getListOfStringsMatchingLastWord(args, Commands.COMMAND_LEFT, Commands.COMMAND_RIGHT); - } - } - } - } - default: - { - return null; - } - } - } - - @Override - public void processCommand(ICommandSender commandSender, String[] args) - { - - if (args.length > 0) - { - String commandName = args[0]; - System.arraycopy(args, 1, args, 0, args.length - 1); - - if (commandName.equalsIgnoreCase(Commands.COMMAND_OVERLAY)) - { - CommandOverlay.processCommand(commandSender, args); - } - else if (commandName.equalsIgnoreCase(Commands.COMMAND_PARTICLES)) - { - CommandParticles.processCommand(commandSender, args); - } - else if (commandName.equalsIgnoreCase(Commands.COMMAND_SOUNDS)) - { - CommandSounds.processCommand(commandSender, args); - } - else if (commandName.equalsIgnoreCase(Commands.COMMAND_VERSION)) - { - CommandVersion.processCommand(commandSender, args); - } - else - { - throw new WrongUsageException(Commands.COMMAND_EE3_USAGE); - } - } - else - { - throw new WrongUsageException(Commands.COMMAND_EE3_USAGE); - } - } - - @Override - public String getCommandUsage(ICommandSender icommandsender) - { - - // TODO Auto-generated method stub - return null; - } - - @Override - public int compareTo(Object obj) - { - if (obj instanceof ICommand) - { - return this.compareTo((ICommand) obj); - } - else - { - return 0; - } - } -} diff --git a/src/main/java/com/pahimar/ee3/command/CommandHandler.java b/src/main/java/com/pahimar/ee3/command/CommandHandler.java deleted file mode 100644 index 8ef7568e..00000000 --- a/src/main/java/com/pahimar/ee3/command/CommandHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.pahimar.ee3.command; - -import cpw.mods.fml.common.event.FMLServerStartingEvent; - -/** - * Equivalent-Exchange-3 - *

- * CommandHandler - * - * @author pahimar - */ -public class CommandHandler -{ - - public static void initCommands(FMLServerStartingEvent event) - { - - event.registerServerCommand(new CommandEE()); - } -} diff --git a/src/main/java/com/pahimar/ee3/command/CommandOverlay.java b/src/main/java/com/pahimar/ee3/command/CommandOverlay.java deleted file mode 100644 index 6cec2cc9..00000000 --- a/src/main/java/com/pahimar/ee3/command/CommandOverlay.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.pahimar.ee3.command; - -import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.configuration.GeneralConfiguration; -import com.pahimar.ee3.lib.Commands; -import net.minecraft.command.ICommandSender; -import net.minecraft.command.WrongUsageException; - -/** - * Equivalent-Exchange-3 - *

- * CommandOverlay - * - * @author pahimar - */ -public class CommandOverlay -{ - - public static void processCommand(ICommandSender commandSender, String[] args) - { - - if (args.length > 0) - { - String subCommand = args[0]; - - if (subCommand.equalsIgnoreCase(Commands.COMMAND_ON)) - { - processOnCommand(commandSender); - } - else if (subCommand.equalsIgnoreCase(Commands.COMMAND_OFF)) - { - processOffCommand(commandSender); - } - else if (subCommand.equalsIgnoreCase(Commands.COMMAND_OPACITY)) - { - processOpacityCommand(commandSender, args); - } - else if (subCommand.equalsIgnoreCase(Commands.COMMAND_SCALE)) - { - processScaleCommand(commandSender, args); - } - else if (subCommand.equalsIgnoreCase(Commands.COMMAND_POSITION)) - { - processPositionCommand(commandSender, args); - } - else - { - throw new WrongUsageException(Commands.COMMAND_OVERLAY_USAGE); - } - } - else - { - throw new WrongUsageException(Commands.COMMAND_OVERLAY_USAGE); - } - } - - private static void processOnCommand(ICommandSender commandSender) - { - - ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION = true; - GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, "true"); - commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_OVERLAY_TURNED_ON)); - } - - private static void processOffCommand(ICommandSender commandSender) - { - - ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION = false; - GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, "false"); - commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_OVERLAY_TURNED_OFF)); - } - - private static void processScaleCommand(ICommandSender commandSender, String[] args) - { - - if (args.length > 2 && args.length < 4) - { - try - { - float scale = Float.parseFloat(args[1]); - - if (scale <= 0F) - { - throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT, Commands.COMMAND_OVERLAY_SCALE_USAGE); - } - else - { - ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = scale; - GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_CONFIGNAME, args[1]); - commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_OVERLAY_SCALE_UPDATED)); - } - } - catch (Exception e) - { - throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT, Commands.COMMAND_OVERLAY_SCALE_USAGE); - } - } - else - { - throw new WrongUsageException(Commands.COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT, Commands.COMMAND_OVERLAY_SCALE_USAGE); - } - } - - private static void processOpacityCommand(ICommandSender commandSender, String[] args) - { - - if (args.length > 2 && args.length < 4) - { - try - { - float opacity = Float.parseFloat(args[1]); - - if (opacity < 0F || opacity > 1F) - { - throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT, Commands.COMMAND_OVERLAY_OPACITY_USAGE); - } - else - { - ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY = opacity; - GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_CONFIGNAME, args[1]); - commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_OVERLAY_OPACITY_UPDATED)); - } - } - catch (Exception e) - { - throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT, Commands.COMMAND_OVERLAY_OPACITY_USAGE); - } - } - else - { - throw new WrongUsageException(Commands.COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT, Commands.COMMAND_OVERLAY_OPACITY_USAGE); - } - } - - private static void processPositionCommand(ICommandSender commandSender, String[] args) - { - - String yPosition, xPosition; - - if (args.length > 2 && args.length < 5) - { - yPosition = args[1]; - xPosition = args[2]; - - if (yPosition.equalsIgnoreCase(Commands.COMMAND_TOP) && xPosition.equalsIgnoreCase(Commands.COMMAND_LEFT)) - { - ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = 0; - GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, "0"); - commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_OVERLAY_POSITION_TOP_LEFT)); - } - else if (yPosition.equalsIgnoreCase(Commands.COMMAND_TOP) && xPosition.equalsIgnoreCase(Commands.COMMAND_RIGHT)) - { - ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = 1; - GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, "1"); - commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_OVERLAY_POSITION_TOP_RIGHT)); - } - else if (yPosition.equalsIgnoreCase(Commands.COMMAND_BOTTOM) && xPosition.equalsIgnoreCase(Commands.COMMAND_LEFT)) - { - ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = 2; - GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, "2"); - commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_OVERLAY_POSITION_BOTTOM_LEFT)); - } - else if (yPosition.equalsIgnoreCase(Commands.COMMAND_BOTTOM) && xPosition.equalsIgnoreCase(Commands.COMMAND_RIGHT)) - { - ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = 3; - GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, "3"); - commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_OVERLAY_POSITION_BOTTOM_RIGHT)); - } - else - { - throw new WrongUsageException(Commands.COMMAND_OVERLAY_POSITION_USAGE); - } - } - else - { - throw new WrongUsageException(Commands.COMMAND_OVERLAY_POSITION_USAGE); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/command/CommandParticles.java b/src/main/java/com/pahimar/ee3/command/CommandParticles.java deleted file mode 100644 index b9814f35..00000000 --- a/src/main/java/com/pahimar/ee3/command/CommandParticles.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.pahimar.ee3.command; - -import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.configuration.GeneralConfiguration; -import com.pahimar.ee3.lib.Commands; -import net.minecraft.command.ICommandSender; -import net.minecraft.command.WrongUsageException; - -/** - * Equivalent-Exchange-3 - *

- * CommandParticles - * - * @author pahimar - */ -public class CommandParticles -{ - - public static void processCommand(ICommandSender commandSender, String[] args) - { - - String subCommand; - - if (args.length > 0) - { - subCommand = args[0]; - - if (subCommand.toLowerCase().equals(Commands.COMMAND_ON)) - { - processOnCommand(commandSender); - } - else if (subCommand.toLowerCase().equals(Commands.COMMAND_OFF)) - { - processOffCommand(commandSender); - } - else - { - throw new WrongUsageException(Commands.COMMAND_PARTICLES_USAGE); - } - } - else - { - throw new WrongUsageException(Commands.COMMAND_PARTICLES_USAGE); - } - } - - private static void processOnCommand(ICommandSender commandSender) - { - - ConfigurationSettings.ENABLE_PARTICLE_FX = true; - GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, "true"); - commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_PARTICLES_TURNED_ON)); - } - - private static void processOffCommand(ICommandSender commandSender) - { - - ConfigurationSettings.ENABLE_PARTICLE_FX = false; - GeneralConfiguration.set(GeneralConfiguration.CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, "false"); - commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_PARTICLES_TURNED_OFF)); - } -} diff --git a/src/main/java/com/pahimar/ee3/command/CommandSounds.java b/src/main/java/com/pahimar/ee3/command/CommandSounds.java deleted file mode 100644 index d24e7554..00000000 --- a/src/main/java/com/pahimar/ee3/command/CommandSounds.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.pahimar.ee3.command; - -import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.configuration.GeneralConfiguration; -import com.pahimar.ee3.lib.Commands; -import net.minecraft.command.ICommandSender; -import net.minecraft.command.WrongUsageException; - -/** - * Equivalent-Exchange-3 - *

- * CommandSounds - * - * @author pahimar - */ -public class CommandSounds -{ - - public static void processCommand(ICommandSender commandSender, String[] args) - { - - String subCommand; - - if (args.length > 0) - { - subCommand = args[0]; - - if (subCommand.toLowerCase().equals(Commands.COMMAND_ALL)) - { - processAllCommand(commandSender); - } - else if (subCommand.toLowerCase().equals(Commands.COMMAND_SELF)) - { - processSelfCommand(commandSender); - } - else if (subCommand.toLowerCase().equals(Commands.COMMAND_OFF)) - { - processOffCommand(commandSender); - } - else - { - throw new WrongUsageException(Commands.COMMAND_SOUNDS_USAGE); - } - } - else - { - throw new WrongUsageException(Commands.COMMAND_SOUNDS_USAGE); - } - } - - private static void processAllCommand(ICommandSender commandSender) - { - - ConfigurationSettings.ENABLE_SOUNDS = Commands.ALL; - GeneralConfiguration.set(GeneralConfiguration.CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, Commands.ALL); - commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_SOUNDS_SET_TO_ALL)); - } - - private static void processSelfCommand(ICommandSender commandSender) - { - - ConfigurationSettings.ENABLE_SOUNDS = Commands.SELF; - GeneralConfiguration.set(GeneralConfiguration.CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, Commands.SELF); - commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_SOUNDS_SET_TO_SELF)); - } - - private static void processOffCommand(ICommandSender commandSender) - { - - ConfigurationSettings.ENABLE_SOUNDS = Commands.OFF; - GeneralConfiguration.set(GeneralConfiguration.CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, Commands.OFF); - commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(Commands.COMMAND_SOUNDS_TURNED_OFF)); - } -} diff --git a/src/main/java/com/pahimar/ee3/command/CommandVersion.java b/src/main/java/com/pahimar/ee3/command/CommandVersion.java deleted file mode 100644 index 95e5ce8d..00000000 --- a/src/main/java/com/pahimar/ee3/command/CommandVersion.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.pahimar.ee3.command; - -import com.pahimar.ee3.helper.VersionHelper; -import com.pahimar.ee3.lib.Commands; -import net.minecraft.command.ICommandSender; -import net.minecraft.command.WrongUsageException; - -/** - * Equivalent-Exchange-3 - *

- * CommandVersion - * - * @author pahimar - */ -public class CommandVersion -{ - - public static void processCommand(ICommandSender commandSender, String[] args) - { - - String subCommand; - - if (args.length > 0) - { - subCommand = args[0]; - - if (subCommand.toLowerCase().equals(Commands.COMMAND_VERSION)) - { - processVersionCommand(commandSender); - } - else if (subCommand.toLowerCase().equals(Commands.COMMAND_CHANGELOG)) - { - processChangelogCommand(commandSender); - } - else - { - throw new WrongUsageException(Commands.COMMAND_VERSION_USAGE); - } - } - else - { - throw new WrongUsageException(Commands.COMMAND_VERSION_USAGE); - } - } - - private static void processVersionCommand(ICommandSender commandSender) - { - - commandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(VersionHelper.getResultMessage())); - } - - private static void processChangelogCommand(ICommandSender commandSender) - { - - } -} diff --git a/src/main/java/com/pahimar/ee3/configuration/BlockConfiguration.java b/src/main/java/com/pahimar/ee3/configuration/BlockConfiguration.java deleted file mode 100644 index d0626ae1..00000000 --- a/src/main/java/com/pahimar/ee3/configuration/BlockConfiguration.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.pahimar.ee3.configuration; - -import com.pahimar.ee3.lib.BlockIds; -import com.pahimar.ee3.lib.Reference; -import com.pahimar.ee3.lib.Strings; -import cpw.mods.fml.common.FMLLog; - -import java.io.File; -import java.util.logging.Level; - -public class BlockConfiguration -{ - protected static void init(File configFile) - { - Configuration blockConfiguration = new Configuration(configFile); - - try - { - blockConfiguration.load(); - - BlockIds.ALCHEMICAL_FUEL = blockConfiguration.getBlock(Strings.ALCHEMICAL_FUEL_NAME, BlockIds.ALCHEMICAL_FUEL_DEFAULT).getInt(BlockIds.ALCHEMICAL_FUEL_DEFAULT); - BlockIds.CHALK = blockConfiguration.getBlock(Strings.CHALK_NAME, BlockIds.CHALK_DEFAULT).getInt(BlockIds.CHALK_DEFAULT); - BlockIds.ALCHEMY_SQUARE = blockConfiguration.getBlock(Strings.ALCHEMY_SQUARE_NAME, BlockIds.ALCHEMY_SQUARE_DEFAULT).getInt(BlockIds.ALCHEMY_SQUARE_DEFAULT); - BlockIds.CALCINATOR = blockConfiguration.getBlock(Strings.CALCINATOR_NAME, BlockIds.CALCINATOR_DEFAULT).getInt(BlockIds.CALCINATOR_DEFAULT); - BlockIds.ALUDEL_BASE = blockConfiguration.getBlock(Strings.ALUDEL_NAME, BlockIds.ALUDEL_BASE_DEFAULT).getInt(BlockIds.ALUDEL_BASE_DEFAULT); - BlockIds.ALCHEMICAL_CHEST = blockConfiguration.getBlock(Strings.ALCHEMICAL_CHEST_NAME, BlockIds.ALCHEMICAL_CHEST_DEFAULT).getInt(BlockIds.ALCHEMICAL_CHEST_DEFAULT); - BlockIds.GLASS_BELL = blockConfiguration.getBlock(Strings.GLASS_BELL_NAME, BlockIds.GLASS_BELL_DEFAULT).getInt(BlockIds.GLASS_BELL_DEFAULT); - BlockIds.RESEARCH_STATION = blockConfiguration.getBlock(Strings.RESEARCH_STATION_NAME, BlockIds.RESEARCH_STATION_DEFAULT).getInt(BlockIds.RESEARCH_STATION_DEFAULT); - BlockIds.INFUSED_CLOTH = blockConfiguration.getBlock(Strings.INFUSED_CLOTH_NAME, BlockIds.INFUSED_CLOTH_DEFAULT).getInt(BlockIds.INFUSED_CLOTH_DEFAULT); - BlockIds.INFUSED_WOOD = blockConfiguration.getBlock(Strings.INFUSED_WOOD_NAME, BlockIds.INFUSED_WOOD_DEFAULT).getInt(BlockIds.INFUSED_WOOD_DEFAULT); - BlockIds.INFUSED_PLANKS = blockConfiguration.getBlock(Strings.INFUSED_PLANKS_NAME, BlockIds.INFUSED_PLANKS_DEFAULT).getInt(BlockIds.INFUSED_PLANKS_DEFAULT); - } - catch (Exception e) - { - FMLLog.log(Level.SEVERE, e, Reference.MOD_NAME + " has had a problem loading its block configuration"); - } - finally - { - blockConfiguration.save(); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/configuration/ConfigurationHandler.java b/src/main/java/com/pahimar/ee3/configuration/ConfigurationHandler.java deleted file mode 100644 index 9fde6029..00000000 --- a/src/main/java/com/pahimar/ee3/configuration/ConfigurationHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.pahimar.ee3.configuration; - -import net.minecraftforge.common.config.Configuration; - -import java.io.File; - -/** - * Equivalent-Exchange-3 - *

- * ConfigurationHandler - * - * @author pahimar - */ -public class ConfigurationHandler -{ - public static final String CATEGORY_TRANSMUTATION = "transmutation"; - public static Configuration configuration; - - public static void init(String configPath) - { - - GeneralConfiguration.init(new File(configPath + "general.properties")); - BlockConfiguration.init(new File(configPath + "block.properties")); - ItemConfiguration.init(new File(configPath + "item.properties")); - TransmutationConfiguration.init(new File(configPath + "transmutation.properties")); - } -} diff --git a/src/main/java/com/pahimar/ee3/configuration/ConfigurationSettings.java b/src/main/java/com/pahimar/ee3/configuration/ConfigurationSettings.java deleted file mode 100644 index 6eddfce6..00000000 --- a/src/main/java/com/pahimar/ee3/configuration/ConfigurationSettings.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.pahimar.ee3.configuration; - -import com.pahimar.ee3.lib.Strings; -import org.lwjgl.input.Keyboard; - -/** - * Equivalent-Exchange-3 - *

- * ConfigurationSettings - * - * @author pahimar - */ -public class ConfigurationSettings -{ - - /* - * Version check related settings - */ - public static boolean DISPLAY_VERSION_RESULT; - public static final String DISPLAY_VERSION_RESULT_CONFIGNAME = "version_check.display_results"; - public static final boolean DISPLAY_VERSION_RESULT_DEFAULT = true; - - public static String LAST_DISCOVERED_VERSION; - public static final String LAST_DISCOVERED_VERSION_CONFIGNAME = "version_check.last_discovered_version"; - public static final String LAST_DISCOVERED_VERSION_DEFAULT = ""; - - public static String LAST_DISCOVERED_VERSION_TYPE; - public static final String LAST_DISCOVERED_VERSION_TYPE_CONFIGNAME = "version_check.last_discovered_version_type"; - public static final String LAST_DISCOVERED_VERSION_TYPE_DEFAULT = ""; - - /* - * Audio config settings - */ - public static String ENABLE_SOUNDS; - public static final String ENABLE_SOUNDS_CONFIGNAME = "sounds.enabled"; - public static final String ENABLE_SOUNDS_DEFAULT = "all"; - - /* - * Graphic config settings - */ - // Whether or not EE3 particle fx are enabled - public static boolean ENABLE_PARTICLE_FX; - public static final String ENABLE_PARTICLE_FX_CONFIGNAME = "particle_fx.enabled"; - public static final boolean ENABLE_PARTICLE_FX_DEFAULT = true; - - // Whether or not the in world transmutation overlays are enabled - public static boolean ENABLE_OVERLAY_WORLD_TRANSMUTATION; - public static final String ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME = "world_transmutation_overlay.enabled"; - public static final boolean ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT = true; - - public static int TARGET_BLOCK_OVERLAY_POSITION; - public static final String TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME = "block_overlay_position"; - public static final int TARGET_BLOCK_OVERLAY_POSITION_DEFAULT = 3; - - public static float TARGET_BLOCK_OVERLAY_OPACITY; - public static final String TARGET_BLOCK_OVERLAY_OPACITY_CONFIGNAME = "block_overlay_opacity"; - public static final float TARGET_BLOCK_OVERLAY_OPACITY_DEFAULT = 0.75F; - - public static float TARGET_BLOCK_OVERLAY_SCALE; - public static final String TARGET_BLOCK_OVERLAY_SCALE_CONFIGNAME = "block_overlay_scale"; - public static final float TARGET_BLOCK_OVERLAY_SCALE_DEFAULT = 2.5F; - - /* - * Block related config settings - */ - - /* - * Item related config settings - */ - // The maximum durability for the Minium Stone - public static int MINIUM_STONE_MAX_DURABILITY; - public static final String MINIUM_STONE_MAX_DURABILITY_CONFIGNAME = Strings.MINIUM_STONE_NAME; - public static final int MINIUM_STONE_MAX_DURABILITY_DEFAULT = 1521; - - // The maximum durability for the Philosophers Stone - public static int PHILOSOPHERS_STONE_MAX_DURABILITY; - public static final String PHILOSOPHERS_STONE_MAX_DURABILITY_CONFIGNAME = Strings.PHILOSOPHERS_STONE_NAME; - public static final int PHILOSOPHERS_STONE_MAX_DURABILITY_DEFAULT = 10001; - - /* - * Keybinding related config settings - */ - // Extra key - public static final String KEYBINDING_EXTRA = "key.extra"; - public static final int KEYBINDING_EXTRA_DEFAULT = Keyboard.KEY_C; - - // Release key - public static final String KEYBINDING_RELEASE = "key.release"; - public static final int KEYBINDING_RELEASE_DEFAULT = Keyboard.KEY_R; - - // Toggle key - public static final String KEYBINDING_TOGGLE = "key.toggle"; - public static final int KEYBINDING_TOGGLE_DEFAULT = Keyboard.KEY_G; - - // Charge key - public static final String KEYBINDING_CHARGE = "key.charge"; - public static final int KEYBINDING_CHARGE_DEFAULT = Keyboard.KEY_V; - - /* - * Transmutation related config settings - */ - // The durability cost for each item transmutation - public static int TRANSMUTE_COST_ITEM; - public static final String TRANSMUTE_COST_ITEM_CONFIGNAME = Strings.TRANSMUTATION_COST_ITEM; - public static final int TRANSMUTE_COST_ITEM_DEFAULT = 1; - - // The durability cost for each block transmutation - public static int TRANSMUTE_COST_BLOCK; - public static final String TRANSMUTE_COST_BLOCK_CONFIGNAME = Strings.TRANSMUTATION_COST_BLOCK; - public static final int TRANSMUTE_COST_BLOCK_DEFAULT = 1; - - // The durability cost for each mob transmutation - public static int TRANSMUTE_COST_MOB; - public static final String TRANSMUTE_COST_MOB_CONFIGNAME = Strings.TRANSMUTATION_COST_MOB; - public static final int TRANSMUTE_COST_MOB_DEFAULT = 1; -} diff --git a/src/main/java/com/pahimar/ee3/configuration/GeneralConfiguration.java b/src/main/java/com/pahimar/ee3/configuration/GeneralConfiguration.java deleted file mode 100644 index 87feaa35..00000000 --- a/src/main/java/com/pahimar/ee3/configuration/GeneralConfiguration.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.pahimar.ee3.configuration; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.lib.Reference; -import cpw.mods.fml.common.FMLLog; -import net.minecraftforge.common.config.Configuration; -import org.apache.logging.log4j.Level; - -import java.io.File; - -public class GeneralConfiguration -{ - public static final String CATEGORY_KEYBIND = "keybindings"; - public static final String CATEGORY_GRAPHICS = "graphics"; - public static final String CATEGORY_AUDIO = "audio"; - private static Configuration generalConfiguration; - - protected static void init(File configFile) - { - - generalConfiguration = new Configuration(configFile); - - try - { - generalConfiguration.load(); - - /* Version check */ - ConfigurationSettings.DISPLAY_VERSION_RESULT = generalConfiguration.get(Configuration.CATEGORY_GENERAL, ConfigurationSettings.DISPLAY_VERSION_RESULT_CONFIGNAME, ConfigurationSettings.DISPLAY_VERSION_RESULT_DEFAULT).getBoolean(ConfigurationSettings.DISPLAY_VERSION_RESULT_DEFAULT); - ConfigurationSettings.LAST_DISCOVERED_VERSION = generalConfiguration.get(Configuration.CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_CONFIGNAME, ConfigurationSettings.LAST_DISCOVERED_VERSION_DEFAULT).getString(); - ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE = generalConfiguration.get(Configuration.CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE_CONFIGNAME, ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE_DEFAULT).getString(); - - /* Graphics */ - ConfigurationSettings.ENABLE_PARTICLE_FX = generalConfiguration.get(CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT).getBoolean(ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT); - ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION = generalConfiguration.get(CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT).getBoolean(ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT); - ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = generalConfiguration.get(CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_DEFAULT).getInt(ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_DEFAULT); - try - { - ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = Float.parseFloat(generalConfiguration.get(CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_CONFIGNAME, ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_DEFAULT).getString()); - - if (ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE <= 0F) - { - ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_DEFAULT; - } - } - catch (Exception e) - { - ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_DEFAULT; - } - try - { - ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY = Float.parseFloat(generalConfiguration.get(CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_CONFIGNAME, ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_DEFAULT).getString()); - - if (ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY < 0F || ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY > 1F) - { - ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY = ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_DEFAULT; - } - } - catch (Exception e) - { - ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY = ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_DEFAULT; - } - - /* Audio */ - ConfigurationSettings.ENABLE_SOUNDS = generalConfiguration.get(CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, ConfigurationSettings.ENABLE_SOUNDS_DEFAULT).getString(); - - /* KeyBindings */ - generalConfiguration.addCustomCategoryComment(CATEGORY_KEYBIND, "Keybindings for Equivalent Exchange 3. See http://www.minecraftwiki.net/wiki/Key_codes for mapping of key codes to keyboard keys"); - EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_EXTRA, generalConfiguration.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_EXTRA, ConfigurationSettings.KEYBINDING_EXTRA_DEFAULT).getInt(ConfigurationSettings.KEYBINDING_EXTRA_DEFAULT)); - EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_CHARGE, generalConfiguration.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_CHARGE, ConfigurationSettings.KEYBINDING_CHARGE_DEFAULT).getInt(ConfigurationSettings.KEYBINDING_CHARGE_DEFAULT)); - EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_TOGGLE, generalConfiguration.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_TOGGLE, ConfigurationSettings.KEYBINDING_TOGGLE_DEFAULT).getInt(ConfigurationSettings.KEYBINDING_TOGGLE_DEFAULT)); - EquivalentExchange3.proxy.setKeyBinding(ConfigurationSettings.KEYBINDING_RELEASE, generalConfiguration.get(CATEGORY_KEYBIND, ConfigurationSettings.KEYBINDING_RELEASE, ConfigurationSettings.KEYBINDING_RELEASE_DEFAULT).getInt(ConfigurationSettings.KEYBINDING_RELEASE_DEFAULT)); - } - catch (Exception e) - { - FMLLog.log(Level.ERROR, e, Reference.MOD_NAME + " has had a problem loading its general configuration"); - } - finally - { - generalConfiguration.save(); - } - } - - public static void set(String categoryName, String propertyName, String newValue) - { - - generalConfiguration.load(); - if (generalConfiguration.getCategoryNames().contains(categoryName)) - { - if (generalConfiguration.getCategory(categoryName).containsKey(propertyName)) - { - generalConfiguration.getCategory(categoryName).get(propertyName).set(newValue); - } - } - generalConfiguration.save(); - } -} diff --git a/src/main/java/com/pahimar/ee3/configuration/ItemConfiguration.java b/src/main/java/com/pahimar/ee3/configuration/ItemConfiguration.java deleted file mode 100644 index 99ab9820..00000000 --- a/src/main/java/com/pahimar/ee3/configuration/ItemConfiguration.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.pahimar.ee3.configuration; - -import com.pahimar.ee3.lib.ItemIds; -import com.pahimar.ee3.lib.Reference; -import com.pahimar.ee3.lib.Strings; -import cpw.mods.fml.common.FMLLog; -import net.minecraftforge.common.config.Configuration; -import org.apache.logging.log4j.Level; - -import java.io.File; - -public class ItemConfiguration -{ - private static final String CATEGORY_DURABILITY = "durability"; - private static Configuration itemConfiguration; - - protected static void init(File configFile) - { - itemConfiguration = new Configuration(configFile); - - try - { - itemConfiguration.load(); - - /* Item configs */ - ItemIds.MINIUM_SHARD = itemConfiguration.getItem(Strings.MINIUM_SHARD_NAME, ItemIds.MINIUM_SHARD_DEFAULT).getInt(ItemIds.MINIUM_SHARD_DEFAULT); - ItemIds.INERT_STONE = itemConfiguration.getItem(Strings.INERT_STONE_NAME, ItemIds.INERT_STONE_DEFAULT).getInt(ItemIds.INERT_STONE_DEFAULT); - ItemIds.MINIUM_STONE = itemConfiguration.getItem(Strings.MINIUM_STONE_NAME, ItemIds.MINIUM_STONE_DEFAULT).getInt(ItemIds.MINIUM_STONE_DEFAULT); - ItemIds.PHILOSOPHERS_STONE = itemConfiguration.getItem(Strings.PHILOSOPHERS_STONE_NAME, ItemIds.PHILOSOPHERS_STONE_DEFAULT).getInt(ItemIds.PHILOSOPHERS_STONE_DEFAULT); - ItemIds.ALCHEMICAL_DUST = itemConfiguration.getItem(Strings.ALCHEMICAL_DUST_NAME, ItemIds.ALCHEMICAL_DUST_DEFAULT).getInt(ItemIds.ALCHEMICAL_DUST_DEFAULT); - ItemIds.ALCHEMICAL_BAG = itemConfiguration.getItem(Strings.ALCHEMICAL_BAG_NAME, ItemIds.ALCHEMICAL_BAG_DEFAULT).getInt(ItemIds.ALCHEMICAL_BAG_DEFAULT); - ItemIds.CHALK = itemConfiguration.getItem(Strings.CHALK_NAME, ItemIds.CHALK_DEFAULT).getInt(ItemIds.CHALK_DEFAULT); - ItemIds.DIVINING_ROD = itemConfiguration.getItem(Strings.DIVINING_ROD_NAME, ItemIds.DIVINING_ROD_DEFAULT).getInt(ItemIds.DIVINING_ROD_DEFAULT); - ItemIds.ALCHEMICAL_FUEL = itemConfiguration.getItem(Strings.ALCHEMICAL_FUEL_NAME, ItemIds.ALCHEMICAL_FUEL_DEFAULT).getInt(ItemIds.ALCHEMICAL_FUEL_DEFAULT); - ItemIds.ALCHEMICAL_UPGRADE = itemConfiguration.getItem(Strings.ALCHEMICAL_UPGRADE_NAME, ItemIds.ALCHEMICAL_UPGRADE_DEFAULT).getInt(ItemIds.ALCHEMICAL_UPGRADE_DEFAULT); - - /* Item durability configs */ - ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY = itemConfiguration.get(CATEGORY_DURABILITY, ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_CONFIGNAME, ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_DEFAULT).getInt(ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY_DEFAULT); - ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY = itemConfiguration.get(CATEGORY_DURABILITY, ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY_CONFIGNAME, ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY_DEFAULT).getInt(ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY_DEFAULT); - } - catch (Exception e) - { - FMLLog.log(Level.ERROR, e, Reference.MOD_NAME + " has had a problem loading its item configuration"); - } - finally - { - itemConfiguration.save(); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/configuration/TransmutationConfiguration.java b/src/main/java/com/pahimar/ee3/configuration/TransmutationConfiguration.java deleted file mode 100644 index c3d5401f..00000000 --- a/src/main/java/com/pahimar/ee3/configuration/TransmutationConfiguration.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.pahimar.ee3.configuration; - -import com.pahimar.ee3.lib.Reference; -import cpw.mods.fml.common.FMLLog; -import net.minecraftforge.common.config.Configuration; -import org.apache.logging.log4j.Level; - -import java.io.File; - -public class TransmutationConfiguration -{ - private static final String CATEGORY_TRANSMUTATION = "transmutation"; - private static Configuration transmutationConfiguration; - - protected static void init(File configFile) - { - - transmutationConfiguration = new Configuration(configFile); - - try - { - transmutationConfiguration.load(); - - /* Transmutation configs */ - ConfigurationSettings.TRANSMUTE_COST_ITEM = transmutationConfiguration.get(CATEGORY_TRANSMUTATION, ConfigurationSettings.TRANSMUTE_COST_ITEM_CONFIGNAME, ConfigurationSettings.TRANSMUTE_COST_ITEM_DEFAULT).getInt(ConfigurationSettings.TRANSMUTE_COST_ITEM_DEFAULT); - ConfigurationSettings.TRANSMUTE_COST_BLOCK = transmutationConfiguration.get(CATEGORY_TRANSMUTATION, ConfigurationSettings.TRANSMUTE_COST_BLOCK_CONFIGNAME, ConfigurationSettings.TRANSMUTE_COST_BLOCK_DEFAULT).getInt(ConfigurationSettings.TRANSMUTE_COST_BLOCK_DEFAULT); - ConfigurationSettings.TRANSMUTE_COST_MOB = transmutationConfiguration.get(CATEGORY_TRANSMUTATION, ConfigurationSettings.TRANSMUTE_COST_MOB_CONFIGNAME, ConfigurationSettings.TRANSMUTE_COST_MOB_DEFAULT).getInt(ConfigurationSettings.TRANSMUTE_COST_MOB_DEFAULT); - } - catch (Exception e) - { - FMLLog.log(Level.ERROR, e, Reference.MOD_NAME + " has had a problem loading its transmutation configuration"); - } - finally - { - transmutationConfiguration.save(); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/creativetab/CreativeTab.java b/src/main/java/com/pahimar/ee3/creativetab/CreativeTab.java new file mode 100644 index 00000000..0083f4b3 --- /dev/null +++ b/src/main/java/com/pahimar/ee3/creativetab/CreativeTab.java @@ -0,0 +1,27 @@ +package com.pahimar.ee3.creativetab; + +import com.pahimar.ee3.reference.Reference; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; +import net.minecraft.item.Item; + +public class CreativeTab +{ + public static final CreativeTabs EE3_TAB = new CreativeTabs(Reference.MOD_ID) + { + @Override + public Item getTabIconItem() + { + return Items.baked_potato; + } + + @Override + @SideOnly(Side.CLIENT) + public String getTranslatedTabLabel() + { + return "Equivalent Exchange 3"; + } + }; +} diff --git a/src/main/java/com/pahimar/ee3/creativetab/CreativeTabEE3.java b/src/main/java/com/pahimar/ee3/creativetab/CreativeTabEE3.java deleted file mode 100644 index 40b02c12..00000000 --- a/src/main/java/com/pahimar/ee3/creativetab/CreativeTabEE3.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.pahimar.ee3.creativetab; - -import com.pahimar.ee3.lib.Reference; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; - -/** - * Equivalent-Exchange-3 - *

- * CreativeTabEE3 - * - * @author pahimar - */ -public class CreativeTabEE3 -{ - public static final CreativeTabs tabEE3 = new CreativeTabs(Reference.MOD_ID) - { - @Override - public Item getTabIconItem() - { - return null; - } - }; -} diff --git a/src/main/java/com/pahimar/ee3/emc/EmcComponent.java b/src/main/java/com/pahimar/ee3/emc/EmcComponent.java deleted file mode 100644 index 35ae5ce3..00000000 --- a/src/main/java/com/pahimar/ee3/emc/EmcComponent.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.pahimar.ee3.emc; - -public class EmcComponent implements Comparable -{ - - public final EmcType type; - public final int weight; - - public EmcComponent(EmcType type, int weight) - { - - this.type = type; - - if (weight > 0) - { - this.weight = weight; - } - else - { - this.weight = -1; - } - } - - public EmcComponent(EmcType type) - { - - this(type, 1); - } - - @Override - public boolean equals(Object object) - { - - if (!(object instanceof EmcComponent)) - { - return false; - } - - EmcComponent emcComponent = (EmcComponent) object; - - return ((this.type == emcComponent.type) && (this.weight == emcComponent.weight)); - } - - @Override - public String toString() - { - return String.format("", type, weight); - } - - @Override - public int compareTo(EmcComponent emcComponent) - { - - if (emcComponent != null) - { - if (this.type == emcComponent.type) - { - return (this.weight - emcComponent.weight); - } - else - { - return this.type.compareTo(emcComponent.type); - } - } - else - { - return 1; - } - } -} diff --git a/src/main/java/com/pahimar/ee3/emc/EmcRegistry.java b/src/main/java/com/pahimar/ee3/emc/EmcRegistry.java deleted file mode 100644 index a6bc4ce7..00000000 --- a/src/main/java/com/pahimar/ee3/emc/EmcRegistry.java +++ /dev/null @@ -1,512 +0,0 @@ -package com.pahimar.ee3.emc; - -import com.google.common.collect.ImmutableSortedMap; -import com.pahimar.ee3.api.OreStack; -import com.pahimar.ee3.api.WrappedStack; -import com.pahimar.ee3.helper.EmcHelper; -import com.pahimar.ee3.lib.Compare; -import com.pahimar.ee3.recipe.RecipeRegistry; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.*; - -public class EmcRegistry -{ - private static EmcRegistry emcRegistry = null; - - private ImmutableSortedMap stackMappings; - private ImmutableSortedMap> valueMappings; - - private EmcRegistry() - { - } - - public static EmcRegistry getInstance() - { - if (emcRegistry == null) - { - emcRegistry = new EmcRegistry(); - emcRegistry.init(); - } - - return emcRegistry; - } - - private void init() - { - HashMap stackValueMap = new HashMap(); - - /* - * Default values - */ - Map defaultValuesMap = EmcValuesDefault.getDefaultValueMap(); - for (WrappedStack keyStack : defaultValuesMap.keySet()) - { - EmcValue factoredEmcValue = null; - WrappedStack factoredKeyStack = null; - - if (keyStack != null && keyStack.getWrappedStack() != null && keyStack.getStackSize() > 0) - { - if (defaultValuesMap.get(keyStack) != null && Float.compare(defaultValuesMap.get(keyStack).getValue(), 0f) > Compare.EQUALS) - { - factoredEmcValue = EmcHelper.factorEmcValue(defaultValuesMap.get(keyStack), keyStack.getStackSize()); - factoredKeyStack = new WrappedStack(keyStack, 1); - } - } - - if (factoredEmcValue != null) - { - if (stackValueMap.containsKey(factoredKeyStack)) - { - if (factoredEmcValue.compareTo(stackValueMap.get(factoredKeyStack)) == Compare.LESSER_THAN) - { - stackValueMap.put(factoredKeyStack, factoredEmcValue); - } - } - else - { - stackValueMap.put(factoredKeyStack, factoredEmcValue); - } - } - } - - /* - * IMC Pre-assigned values - */ - Map preAssignedValuesMap = EmcValuesIMC.getPreAssignedValues(); - for (WrappedStack keyStack : preAssignedValuesMap.keySet()) - { - EmcValue factoredEmcValue = null; - WrappedStack factoredKeyStack = null; - - if (keyStack != null && keyStack.getWrappedStack() != null && keyStack.getStackSize() > 0) - { - if (preAssignedValuesMap.get(keyStack) != null && Float.compare(preAssignedValuesMap.get(keyStack).getValue(), 0f) > Compare.EQUALS) - { - factoredEmcValue = EmcHelper.factorEmcValue(preAssignedValuesMap.get(keyStack), keyStack.getStackSize()); - factoredKeyStack = new WrappedStack(keyStack, 1); - } - } - - if (factoredEmcValue != null) - { - if (stackValueMap.containsKey(factoredKeyStack)) - { - if (factoredEmcValue.compareTo(stackValueMap.get(factoredKeyStack)) == Compare.LESSER_THAN) - { - stackValueMap.put(factoredKeyStack, factoredEmcValue); - } - } - else - { - stackValueMap.put(factoredKeyStack, factoredEmcValue); - } - } - } - - /* - * Auto-assignment - */ - // Initialize the maps for the first pass to happen - ImmutableSortedMap.Builder stackMappingsBuilder = ImmutableSortedMap.naturalOrder(); - stackMappingsBuilder.putAll(stackValueMap); - stackMappings = stackMappingsBuilder.build(); - Map computedStackValues = computeStackMappings(); - - // Initialize the pass counter - int passNumber = 0; - - while ((computedStackValues.size() > 0) && (passNumber < 16)) - { - // Increment the pass counter - passNumber++; - - // Set the values for getEmcValue calls in the auto-assignment computation - stackMappingsBuilder = ImmutableSortedMap.naturalOrder(); - stackMappingsBuilder.putAll(stackValueMap); - stackMappings = stackMappingsBuilder.build(); - - // Compute stack mappings from existing stack mappings - computedStackValues = computeStackMappings(); - for (WrappedStack keyStack : computedStackValues.keySet()) - { - EmcValue factoredEmcValue = null; - WrappedStack factoredKeyStack = null; - - if (keyStack != null && keyStack.getWrappedStack() != null && keyStack.getStackSize() > 0) - { - if (computedStackValues.get(keyStack) != null && Float.compare(computedStackValues.get(keyStack).getValue(), 0f) > Compare.EQUALS) - { - factoredEmcValue = EmcHelper.factorEmcValue(computedStackValues.get(keyStack), keyStack.getStackSize()); - factoredKeyStack = new WrappedStack(keyStack, 1); - } - } - - if (factoredEmcValue != null) - { - if (stackValueMap.containsKey(factoredKeyStack)) - { - if (factoredEmcValue.compareTo(stackValueMap.get(factoredKeyStack)) == Compare.LESSER_THAN) - { - stackValueMap.put(factoredKeyStack, factoredEmcValue); - } - } - else - { - stackValueMap.put(factoredKeyStack, factoredEmcValue); - } - } - } - } - - /* - * IMC Post-assigned values - */ - Map postAssignedValuesMap = EmcValuesIMC.getPostAssignedValues(); - for (WrappedStack keyStack : postAssignedValuesMap.keySet()) - { - EmcValue factoredEmcValue = null; - WrappedStack factoredKeyStack = null; - - if (keyStack != null && keyStack.getWrappedStack() != null && keyStack.getStackSize() > 0) - { - if (postAssignedValuesMap.get(keyStack) != null && Float.compare(postAssignedValuesMap.get(keyStack).getValue(), 0f) > Compare.EQUALS) - { - factoredEmcValue = EmcHelper.factorEmcValue(postAssignedValuesMap.get(keyStack), keyStack.getStackSize()); - factoredKeyStack = new WrappedStack(keyStack, 1); - } - } - - // Post auto assignment values are meant to override all over values, so we just take the value given - if (factoredEmcValue != null) - { - stackValueMap.put(factoredKeyStack, factoredEmcValue); - } - } - - /** - * Finalize the stack to value map - */ - stackMappingsBuilder = ImmutableSortedMap.naturalOrder(); - stackMappingsBuilder.putAll(stackValueMap); - stackMappings = stackMappingsBuilder.build(); - - /* - * Value map resolution - */ - SortedMap> tempValueMappings = new TreeMap>(); - - for (WrappedStack stack : stackMappings.keySet()) - { - if (stack != null) - { - EmcValue value = stackMappings.get(stack); - - if (value != null) - { - if (tempValueMappings.containsKey(value)) - { - if (!(tempValueMappings.get(value).contains(stack))) - { - tempValueMappings.get(value).add(stack); - } - } - else - { - tempValueMappings.put(value, new ArrayList(Arrays.asList(stack))); - } - } - } - } - - valueMappings = ImmutableSortedMap.copyOf(tempValueMappings); - } - - private Map computeStackMappings() - { - Map computedStackMap = new HashMap(); - - for (WrappedStack recipeOutput : RecipeRegistry.getInstance().getRecipeMappings().keySet()) - { - if (!hasEmcValue(recipeOutput.getWrappedStack(), false) && !computedStackMap.containsKey(recipeOutput)) - { - EmcValue lowestValue = null; - - for (List recipeInputs : RecipeRegistry.getInstance().getRecipeMappings().get(recipeOutput)) - { - EmcValue computedValue = EmcHelper.computeEmcValueFromList(recipeInputs); - computedValue = EmcHelper.factorEmcValue(computedValue, recipeOutput.getStackSize()); - - if (computedValue != null) - { - if (computedValue.compareTo(lowestValue) < 0) - { - lowestValue = computedValue; - } - } - } - - if ((lowestValue != null) && (lowestValue.getValue() > 0f)) - { - computedStackMap.put(new WrappedStack(recipeOutput.getWrappedStack()), lowestValue); - } - } - } - - return computedStackMap; - } - - public boolean hasEmcValue(Object object, boolean strict) - { - if (WrappedStack.canBeWrapped(object)) - { - WrappedStack stack = new WrappedStack(object); - - if (emcRegistry.stackMappings.containsKey(new WrappedStack(stack.getWrappedStack()))) - { - return true; - } - else - { - if (!strict) - { - if (stack.getWrappedStack() instanceof ItemStack) - { - ItemStack wrappedItemStack = (ItemStack) stack.getWrappedStack(); - - // If its an OreDictionary item, scan its siblings for values - if (OreDictionary.getOreID(wrappedItemStack) != -1) - { - - OreStack oreStack = new OreStack(wrappedItemStack); - - if (emcRegistry.stackMappings.containsKey(new WrappedStack(oreStack))) - { - return true; - } - else - { - for (ItemStack itemStack : OreDictionary.getOres(OreDictionary.getOreID(wrappedItemStack))) - { - if (emcRegistry.stackMappings.containsKey(new WrappedStack(itemStack))) - { - return true; - } - } - } - } - // Else, scan for if there is a wildcard value for it - else - { - for (WrappedStack valuedStack : emcRegistry.stackMappings.keySet()) - { - if (valuedStack.getWrappedStack() instanceof ItemStack) - { - ItemStack valuedItemStack = (ItemStack) valuedStack.getWrappedStack(); - - if (valuedItemStack.itemID == wrappedItemStack.itemID) - { - if (valuedItemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE || wrappedItemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) - { - return true; - } - else if (wrappedItemStack.getItem().isDamageable() && wrappedItemStack.isItemDamaged()) - { - return true; - } - } - } - } - } - } - else if (stack.getWrappedStack() instanceof OreStack) - { - OreStack oreStack = (OreStack)stack.getWrappedStack(); - for (ItemStack oreItemStack : OreDictionary.getOres(oreStack.oreName)) - { - if (emcRegistry.stackMappings.containsKey(new WrappedStack(oreItemStack))) - { - return true; - } - } - } - } - } - } - - return false; - } - - public boolean hasEmcValue(Object object) - { - return hasEmcValue(object, false); - } - - public EmcValue getEmcValue(Object object, boolean strict) - { - if (WrappedStack.canBeWrapped(object)) - { - WrappedStack stack = new WrappedStack(object); - - if (emcRegistry.stackMappings.containsKey(new WrappedStack(stack.getWrappedStack()))) - { - return emcRegistry.stackMappings.get(new WrappedStack(stack.getWrappedStack())); - } - else - { - if (!strict) - { - if (stack.getWrappedStack() instanceof ItemStack) - { - EmcValue lowestValue = null; - ItemStack wrappedItemStack = (ItemStack) stack.getWrappedStack(); - - if (OreDictionary.getOreID(wrappedItemStack) != -1) - { - OreStack oreStack = new OreStack(wrappedItemStack); - - if (emcRegistry.stackMappings.containsKey(new WrappedStack(oreStack))) - { - return emcRegistry.stackMappings.get(new WrappedStack(oreStack)); - } - else - { - for (ItemStack itemStack : OreDictionary.getOres(OreDictionary.getOreID(wrappedItemStack))) - { - if (emcRegistry.stackMappings.containsKey(new WrappedStack(itemStack))) - { - if (lowestValue == null) - { - lowestValue = emcRegistry.stackMappings.get(new WrappedStack(itemStack)); - } - else - { - EmcValue itemValue = emcRegistry.stackMappings.get(new WrappedStack(itemStack)); - - if (itemValue.compareTo(lowestValue) < 0) - { - lowestValue = itemValue; - } - } - } - } - - return lowestValue; - } - } - else - { - for (WrappedStack valuedStack : emcRegistry.stackMappings.keySet()) - { - if (valuedStack.getWrappedStack() instanceof ItemStack) - { - ItemStack valuedItemStack = (ItemStack) valuedStack.getWrappedStack(); - - if (valuedItemStack.itemID == wrappedItemStack.itemID) - { - if (valuedItemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE || wrappedItemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) - { - EmcValue stackValue = emcRegistry.stackMappings.get(valuedStack); - - if (stackValue.compareTo(lowestValue) < 0) - { - lowestValue = stackValue; - } - } - else if (wrappedItemStack.getItem().isDamageable() && wrappedItemStack.isItemDamaged()) - { - EmcValue stackValue = new EmcValue(emcRegistry.stackMappings.get(valuedStack).getValue() * (1 - (wrappedItemStack.getItemDamage() * 1.0F / wrappedItemStack.getMaxDamage()))); - - if (stackValue.compareTo(lowestValue) < 0) - { - lowestValue = stackValue; - } - } - } - } - } - - return lowestValue; - } - } - else if (stack.getWrappedStack() instanceof OreStack) - { - OreStack oreStack = (OreStack)stack.getWrappedStack(); - for (ItemStack oreItemStack : OreDictionary.getOres(oreStack.oreName)) - { - if (emcRegistry.stackMappings.containsKey(new WrappedStack(oreItemStack))) - { - return emcRegistry.stackMappings.get(new WrappedStack(oreItemStack)); - } - } - } - } - } - } - - return null; - } - - public EmcValue getEmcValue(Object object) - { - return getEmcValue(object, false); - } - - @SuppressWarnings("unused") - public List getStacksInRange(int start, int finish) - { - return getStacksInRange(new EmcValue(start), new EmcValue(finish)); - } - - public List getStacksInRange(float start, float finish) - { - return getStacksInRange(new EmcValue(start), new EmcValue(finish)); - } - - public List getStacksInRange(EmcValue start, EmcValue finish) - { - List stacksInRange = new ArrayList(); - - SortedMap> tailMap = emcRegistry.valueMappings.tailMap(start); - SortedMap> headMap = emcRegistry.valueMappings.headMap(finish); - - SortedMap> smallerMap; - SortedMap> biggerMap; - - if (!tailMap.isEmpty() && !headMap.isEmpty()) - { - - if (tailMap.size() <= headMap.size()) - { - smallerMap = tailMap; - biggerMap = headMap; - } - else - { - smallerMap = headMap; - biggerMap = tailMap; - } - - for (EmcValue value : smallerMap.keySet()) - { - if (biggerMap.containsKey(value)) - { - stacksInRange.addAll(emcRegistry.valueMappings.get(value)); - } - } - } - - return stacksInRange; - } - - public ImmutableSortedMap getStackToEmcValueMap() - { - return stackMappings; - } - - public ImmutableSortedMap> getEmcValueToStackMap() - { - return valueMappings; - } -} diff --git a/src/main/java/com/pahimar/ee3/emc/EmcType.java b/src/main/java/com/pahimar/ee3/emc/EmcType.java deleted file mode 100644 index 19a6d201..00000000 --- a/src/main/java/com/pahimar/ee3/emc/EmcType.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.pahimar.ee3.emc; - -public enum EmcType -{ - OMNI, CORPOREAL, KINETIC, TEMPORAL, ESSENTIA, AMORPHOUS, VOID; - - public static final EmcType[] TYPES = EmcType.values(); - - public static final EmcType DEFAULT = EmcType.CORPOREAL; -} diff --git a/src/main/java/com/pahimar/ee3/emc/EmcValue.java b/src/main/java/com/pahimar/ee3/emc/EmcValue.java deleted file mode 100644 index a0271678..00000000 --- a/src/main/java/com/pahimar/ee3/emc/EmcValue.java +++ /dev/null @@ -1,320 +0,0 @@ -package com.pahimar.ee3.emc; - -import com.google.gson.*; -import com.pahimar.ee3.helper.LogHelper; -import com.pahimar.ee3.lib.Compare; - -import java.lang.reflect.Type; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -/** - * Equivalent-Exchange-3 - *

- * EMCEntry - * - * @author pahimar - */ -public class EmcValue implements Comparable, JsonDeserializer, JsonSerializer -{ - // Gson serializer for serializing to/deserializing from json - private static final Gson gsonSerializer = (new GsonBuilder()).registerTypeAdapter(EmcValue.class, new EmcValue()).create(); - private static final int PRECISION = 4; - - public final float[] components; - - public EmcValue() - { - this(new float[EmcType.TYPES.length]); - } - - public EmcValue(int value) - { - this((float) value); - } - - public EmcValue(float value) - { - this(value, EmcType.DEFAULT); - } - - public EmcValue(float value, EmcComponent component) - { - this(value, component.type); - } - - public EmcValue(int value, EmcType emcType) - { - this((float) value, emcType); - } - - public EmcValue(float value, EmcType emcType) - { - this(value, Arrays.asList(new EmcComponent(emcType))); - } - - public EmcValue(float[] components) - { - if (components.length == EmcType.TYPES.length) - { -// this.components = components; - this.components = new float[components.length]; - for (int i = 0; i < this.components.length; i++) - { - BigDecimal bigComponent = BigDecimal.valueOf(components[i]).setScale(PRECISION, BigDecimal.ROUND_HALF_DOWN); - this.components[i] = bigComponent.floatValue(); - } - } - else - { - this.components = null; - } - } - - public EmcValue(int value, List componentList) - { - this((float) value, componentList); - } - - public EmcValue(float value, List componentList) - { - this.components = new float[EmcType.TYPES.length]; - - List collatedComponents = collateComponents(componentList); - - int totalComponents = 0; - - for (EmcComponent component : collatedComponents) - { - if (component.weight > 0) - { - totalComponents += component.weight; - } - } - - if (totalComponents > 0) - { - for (EmcComponent component : collatedComponents) - { - if (component.weight > 0) - { - this.components[component.type.ordinal()] = value * (component.weight * 1F / totalComponents); - } - } - } - else - { - this.components[EmcType.DEFAULT.ordinal()] = value; - } - - for (int i = 0; i < this.components.length; i++) - { - BigDecimal bigComponent = BigDecimal.valueOf(this.components[i]).setScale(PRECISION, BigDecimal.ROUND_HALF_DOWN); - this.components[i] = bigComponent.floatValue(); - } - } - - /** - * Deserializes an EmcValue object from the given serialized json String - * - * @param jsonEmcValue - * Json encoded String representing a EmcValue object - * - * @return The EmcValue that was encoded as json, or null if a valid EmcValue could not be decoded from given String - */ - @SuppressWarnings("unused") - public static EmcValue createFromJson(String jsonEmcValue) - { - try - { - return gsonSerializer.fromJson(jsonEmcValue, EmcValue.class); - } - catch (JsonSyntaxException exception) - { - LogHelper.error(exception.getMessage()); - } - catch (JsonParseException exception) - { - LogHelper.error(exception.getMessage()); - } - - return null; - } - - private static List collateComponents(List uncollatedComponents) - { - Integer[] componentCount = new Integer[EmcType.TYPES.length]; - - for (EmcComponent emcComponent : uncollatedComponents) - { - if (componentCount[emcComponent.type.ordinal()] == null) - { - componentCount[emcComponent.type.ordinal()] = 0; - } - - if (emcComponent.weight >= 0) - { - componentCount[emcComponent.type.ordinal()] = componentCount[emcComponent.type.ordinal()] + emcComponent.weight; - } - } - - List collatedComponents = new ArrayList(); - - for (int i = 0; i < EmcType.TYPES.length; i++) - { - if (componentCount[i] != null) - { - collatedComponents.add(new EmcComponent(EmcType.TYPES[i], componentCount[i])); - } - } - - Collections.sort(collatedComponents); - - return collatedComponents; - } - - private static int compareComponents(float[] first, float[] second) - { - if (first.length == EmcType.TYPES.length && second.length == EmcType.TYPES.length) - { - - for (EmcType emcType : EmcType.TYPES) - { - if (Float.compare(first[emcType.ordinal()], second[emcType.ordinal()]) != Compare.EQUALS) - { - return Float.compare(first[emcType.ordinal()], second[emcType.ordinal()]); - } - } - - return Compare.EQUALS; - } - else - { - throw new ArrayIndexOutOfBoundsException(); - } - } - - public float getValue() - { - float sumSubValues = 0; - - for (float subValue : this.components) - { - if (subValue > 0) - { - sumSubValues += subValue; - } - } - - return sumSubValues; - } - - @Override - public boolean equals(Object object) - { - return object instanceof EmcValue && (compareTo((EmcValue) object) == 0); - } - - @Override - public String toString() - { - StringBuilder stringBuilder = new StringBuilder(); - - stringBuilder.append("["); - for (EmcType emcType : EmcType.TYPES) - { - if (components[emcType.ordinal()] > 0) - { - stringBuilder.append(String.format(" %s:%s ", emcType, components[emcType.ordinal()])); - } - } - stringBuilder.append("]"); - - return stringBuilder.toString(); - } - - @Override - public int hashCode() - { - int hashCode = 1; - - hashCode = 37 * hashCode + Float.floatToIntBits(getValue()); - for (float subValue : components) - { - hashCode = 37 * hashCode + Float.floatToIntBits(subValue); - } - - return hashCode; - } - - @Override - public int compareTo(EmcValue emcValue) - { - if (emcValue != null) - { - return compareComponents(this.components, emcValue.components); - } - else - { - return Compare.LESSER_THAN; - } - } - - /** - * Returns this EmcValue as a json serialized String - * - * @return Json serialized String of this EmcValue - */ - public String toJson() - { - return gsonSerializer.toJson(this); - } - - @Override - public JsonElement serialize(EmcValue emcValue, Type type, JsonSerializationContext context) - { - JsonObject jsonEmcValue = new JsonObject(); - - for (EmcType emcType : EmcType.TYPES) - { - jsonEmcValue.addProperty(emcType.toString(), emcValue.components[emcType.ordinal()]); - } - - return jsonEmcValue; - } - - @Override - public EmcValue deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException - { - - float[] emcValueComponents = new float[EmcType.TYPES.length]; - JsonObject jsonEmcValue = (JsonObject) jsonElement; - - for (EmcType emcType : EmcType.TYPES) - { - if ((jsonEmcValue.get(emcType.toString()) != null) && (jsonEmcValue.get(emcType.toString()).isJsonPrimitive())) - { - try - { - emcValueComponents[emcType.ordinal()] = jsonEmcValue.get(emcType.toString()).getAsFloat(); - } - catch (UnsupportedOperationException exception) - { - LogHelper.error(exception.getMessage()); - } - } - } - - EmcValue emcValue = new EmcValue(emcValueComponents); - - if (emcValue.getValue() > 0f) - { - return emcValue; - } - - return null; - } -} diff --git a/src/main/java/com/pahimar/ee3/emc/EmcValuesDefault.java b/src/main/java/com/pahimar/ee3/emc/EmcValuesDefault.java deleted file mode 100644 index bf5dba6b..00000000 --- a/src/main/java/com/pahimar/ee3/emc/EmcValuesDefault.java +++ /dev/null @@ -1,201 +0,0 @@ -package com.pahimar.ee3.emc; - -import com.pahimar.ee3.api.OreStack; -import com.pahimar.ee3.api.WrappedStack; -import com.pahimar.ee3.item.ModItems; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.HashMap; -import java.util.Map; - -public class EmcValuesDefault -{ - private static EmcValuesDefault emcDefaultValues = null; - private Map valueMap; - - private EmcValuesDefault() - { - valueMap = new HashMap(); - } - - private static void lazyInit() - { - if (emcDefaultValues == null) - { - emcDefaultValues = new EmcValuesDefault(); - emcDefaultValues.init(); - } - } - - private void init() - { - // OreDictionary assignment - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.cobblestone))), new EmcValue(1)); - for (int meta = 0; meta < 16; meta++) - { - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Item.dyePowder, 1, meta))), new EmcValue(8)); - } - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.wood))), new EmcValue(32)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreDiamond))), new EmcValue(8192)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreEmerald))), new EmcValue(8192)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreGold))), new EmcValue(2048)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreIron))), new EmcValue(256)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreLapis))), new EmcValue(864)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreNetherQuartz))), new EmcValue(256)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreRedstone))), new EmcValue(32)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreRedstoneGlowing))), new EmcValue(32)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.planks))), new EmcValue(8)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Item.record11))), new EmcValue(2048)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.woodSingleSlab))), new EmcValue(4)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.stairsWoodOak))), new EmcValue(12)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Item.stick))), new EmcValue(4)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.stone))), new EmcValue(1)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.leaves))), new EmcValue(1)); - valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.sapling))), new EmcValue(32)); - - // Fluids - valueMap.put(new WrappedStack(FluidRegistry.WATER), new EmcValue(1)); - valueMap.put(new WrappedStack(FluidRegistry.LAVA), new EmcValue(64)); - valueMap.put(new WrappedStack(FluidRegistry.getFluid("milk")), new EmcValue(64)); - - /* Building Blocks */ - valueMap.put(new WrappedStack(Block.stone), new EmcValue(1)); - valueMap.put(new WrappedStack(Block.grass), new EmcValue(1)); - valueMap.put(new WrappedStack(Block.dirt), new EmcValue(1)); - valueMap.put(new WrappedStack(Block.cobblestone), new EmcValue(1)); - // Bedrock (7:0) - valueMap.put(new WrappedStack(Block.sand), new EmcValue(1)); - valueMap.put(new WrappedStack(Block.gravel), new EmcValue(4)); - valueMap.put(new WrappedStack(Block.oreCoal), new EmcValue(32)); - // Sponge (19:0) - valueMap.put(new WrappedStack(Block.glass), new EmcValue(1)); - valueMap.put(new WrappedStack(Block.sandStone), new EmcValue(4)); - valueMap.put(new WrappedStack(Block.cobblestoneMossy), new EmcValue(1)); - valueMap.put(new WrappedStack(Block.obsidian), new EmcValue(64)); - valueMap.put(new WrappedStack(Block.ice), new EmcValue(1)); - valueMap.put(new WrappedStack(Block.pumpkin), new EmcValue(144)); - valueMap.put(new WrappedStack(Block.netherrack), new EmcValue(1)); - valueMap.put(new WrappedStack(Block.slowSand), new EmcValue(49)); - valueMap.put(new WrappedStack(new ItemStack(Block.stoneBrick, 1, 1)), new EmcValue(1)); - valueMap.put(new WrappedStack(new ItemStack(Block.stoneBrick, 1, OreDictionary.WILDCARD_VALUE)), new EmcValue(1)); - valueMap.put(new WrappedStack(Block.mycelium), new EmcValue(1)); - valueMap.put(new WrappedStack(Block.whiteStone), new EmcValue(1)); - valueMap.put(new WrappedStack(Block.hardenedClay), new EmcValue(256)); - - /* Decoration Blocks */ - valueMap.put(new WrappedStack(Block.web), new EmcValue(12)); - valueMap.put(new WrappedStack(new ItemStack(Block.tallGrass.blockID, 1, OreDictionary.WILDCARD_VALUE)), new EmcValue(1)); - valueMap.put(new WrappedStack(Block.deadBush), new EmcValue(1)); - valueMap.put(new WrappedStack(Block.plantYellow), new EmcValue(16)); - valueMap.put(new WrappedStack(Block.plantRed), new EmcValue(16)); - valueMap.put(new WrappedStack(Block.mushroomBrown), new EmcValue(32)); - valueMap.put(new WrappedStack(Block.mushroomRed), new EmcValue(32)); - valueMap.put(new WrappedStack(Block.snow), new EmcValue(0.5f)); - valueMap.put(new WrappedStack(Block.cactus), new EmcValue(8)); - // Stone Monster Egg (97:0) - // Cobblestone Monster Egg (97:1) - // Stone Brick Monster Egg (97:2) - valueMap.put(new WrappedStack(Block.vine), new EmcValue(8)); - valueMap.put(new WrappedStack(Block.waterlily), new EmcValue(16)); - // End Portal (120:0) - // Skeleton Skull (397:0) - // Wither Skeleton Skull (391:1) - // Zombie Head (397:2) - // Head (397:3) - // Creeper Head (397:4) - - /* Redstone */ - valueMap.put(new WrappedStack(Item.redstone), new EmcValue(32)); - - /* Transportation */ - valueMap.put(new WrappedStack(Item.saddle), new EmcValue(192)); - - /* Miscellaneous */ - valueMap.put(new WrappedStack(Item.snowball), new EmcValue(0.25f)); - valueMap.put(new WrappedStack(Item.slimeBall), new EmcValue(24)); - valueMap.put(new WrappedStack(Item.bone), new EmcValue(24)); - valueMap.put(new WrappedStack(Item.enderPearl), new EmcValue(1024)); - // Bottle o'Enchanting (384:0) - // Firework Star (402:0) - - /* Foodstuffs */ - valueMap.put(new WrappedStack(Item.appleRed), new EmcValue(128)); - valueMap.put(new WrappedStack(Item.porkRaw), new EmcValue(64)); - valueMap.put(new WrappedStack(Item.porkCooked), new EmcValue(64)); - valueMap.put(new WrappedStack(Item.fishRaw), new EmcValue(64)); - valueMap.put(new WrappedStack(Item.fishCooked), new EmcValue(64)); - valueMap.put(new WrappedStack(Item.melon), new EmcValue(16)); - valueMap.put(new WrappedStack(Item.beefRaw), new EmcValue(64)); - valueMap.put(new WrappedStack(Item.beefCooked), new EmcValue(64)); - valueMap.put(new WrappedStack(Item.chickenRaw), new EmcValue(64)); - valueMap.put(new WrappedStack(Item.chickenCooked), new EmcValue(64)); - valueMap.put(new WrappedStack(Item.rottenFlesh), new EmcValue(24)); - valueMap.put(new WrappedStack(Item.spiderEye), new EmcValue(128)); - valueMap.put(new WrappedStack(Item.carrot), new EmcValue(24)); - valueMap.put(new WrappedStack(Item.potato), new EmcValue(24)); - valueMap.put(new WrappedStack(Item.bakedPotato), new EmcValue(64)); - valueMap.put(new WrappedStack(Item.poisonousPotato), new EmcValue(24)); - - /* Tools */ - // Name Tag (421:0) - - /* Combat */ - // Chain Helmet (302:0) - // Chain Chestplate (303:0) - // Chain Leggings (304:0) - // Chain Boots (305:0) - - /* Brewing */ - valueMap.put(new WrappedStack(Item.ghastTear), new EmcValue(4096)); - - /* Materials */ - valueMap.put(new WrappedStack(new ItemStack(Item.coal, 1, 0)), new EmcValue(32)); - valueMap.put(new WrappedStack(new ItemStack(Item.coal, 1, 1)), new EmcValue(32)); - valueMap.put(new WrappedStack(Item.diamond), new EmcValue(8192)); - valueMap.put(new WrappedStack(Item.ingotIron), new EmcValue(256)); - valueMap.put(new WrappedStack(Item.ingotGold), new EmcValue(2048)); - valueMap.put(new WrappedStack(Item.silk), new EmcValue(12)); - valueMap.put(new WrappedStack(Item.feather), new EmcValue(48)); - valueMap.put(new WrappedStack(Item.gunpowder), new EmcValue(192)); - valueMap.put(new WrappedStack(Item.seeds), new EmcValue(16)); - valueMap.put(new WrappedStack(Item.wheat), new EmcValue(24)); - valueMap.put(new WrappedStack(Item.flint), new EmcValue(4)); - valueMap.put(new WrappedStack(Item.leather), new EmcValue(64)); - valueMap.put(new WrappedStack(Item.brick), new EmcValue(64)); - valueMap.put(new WrappedStack(Item.clay), new EmcValue(64)); - valueMap.put(new WrappedStack(Item.reed), new EmcValue(32)); - valueMap.put(new WrappedStack(Item.egg), new EmcValue(32)); - valueMap.put(new WrappedStack(Item.glowstone), new EmcValue(384)); - valueMap.put(new WrappedStack(new ItemStack(Item.dyePowder, 1, 4)), new EmcValue(864)); - valueMap.put(new WrappedStack(Item.blazeRod), new EmcValue(1536)); - valueMap.put(new WrappedStack(Item.netherStalkSeeds), new EmcValue(24)); - valueMap.put(new WrappedStack(Item.emerald), new EmcValue(8192)); - valueMap.put(new WrappedStack(Item.netherStar), new EmcValue(24576)); - valueMap.put(new WrappedStack(Item.netherrackBrick), new EmcValue(1)); - valueMap.put(new WrappedStack(Item.netherQuartz), new EmcValue(256)); - - /* Equivalent Exchange 3 */ - /** - * Alchemical Dusts - */ - valueMap.put(new WrappedStack(new ItemStack(ModItems.alchemicalDust, 1, 0)), new EmcValue(1)); - valueMap.put(new WrappedStack(new ItemStack(ModItems.alchemicalDust, 1, 1)), new EmcValue(64)); - valueMap.put(new WrappedStack(new ItemStack(ModItems.alchemicalDust, 1, 2)), new EmcValue(2048)); - valueMap.put(new WrappedStack(new ItemStack(ModItems.alchemicalDust, 1, 3)), new EmcValue(8192)); - - /** - * Minium Shard - */ - valueMap.put(new WrappedStack(new ItemStack(ModItems.miniumShard)), new EmcValue(8192)); - } - - public static Map getDefaultValueMap() - { - lazyInit(); - return emcDefaultValues.valueMap; - } -} diff --git a/src/main/java/com/pahimar/ee3/emc/EmcValuesIMC.java b/src/main/java/com/pahimar/ee3/emc/EmcValuesIMC.java deleted file mode 100644 index 67502a27..00000000 --- a/src/main/java/com/pahimar/ee3/emc/EmcValuesIMC.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.pahimar.ee3.emc; - -import com.pahimar.ee3.api.WrappedStack; - -import java.util.Map; -import java.util.TreeMap; - -/** - * Equivalent-Exchange-3 - *

- * EmcIMCValues - * - * @author pahimar - */ -public class EmcValuesIMC -{ - - private static Map preAssignedValueMap = new TreeMap(); - private static Map postAssignedValueMap = new TreeMap(); - - public static Map getPreAssignedValues() - { - return preAssignedValueMap; - } - - public static Map getPostAssignedValues() - { - return postAssignedValueMap; - } - - public static void addPreAssignedValued(WrappedStack wrappedStack, EmcValue emcValue) - { - if (wrappedStack != null) - { - if (!preAssignedValueMap.containsKey(wrappedStack)) - { - preAssignedValueMap.put(wrappedStack, emcValue); - } - else - { - // TODO Log that we already have a value for that - } - } - else - { - // TODO Logging - } - } - - public static void addPostAssignedValued(WrappedStack wrappedStack, EmcValue emcValue) - { - - if (wrappedStack != null) - { - if (!postAssignedValueMap.containsKey(wrappedStack)) - { - postAssignedValueMap.put(wrappedStack, emcValue); - } - else - { - // TODO Log that we already have a value for that - } - } - else - { - // TODO Logging - } - } -} diff --git a/src/main/java/com/pahimar/ee3/event/ActionEvent.java b/src/main/java/com/pahimar/ee3/event/ActionEvent.java deleted file mode 100644 index fc9f0e18..00000000 --- a/src/main/java/com/pahimar/ee3/event/ActionEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.pahimar.ee3.event; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Equivalent-Exchange-3 - *

- * ActionEvent - * - * @author pahimar - */ -public class ActionEvent extends Event -{ - - public final byte actionType; - public final EntityPlayer player; - public final World world; - public final int x, y, z; - public final boolean hasActionOccured; - public final String data; - public ItemStack itemStack; - public ActionResult actionResult; - - public ActionEvent(byte actionType, ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, boolean hasActionOccured, String data) - { - - this.actionType = actionType; - this.itemStack = itemStack; - this.player = player; - this.world = world; - this.x = x; - this.y = y; - this.z = z; - this.hasActionOccured = hasActionOccured; - this.data = data; - } - - public enum ActionResult - { - SUCCESS, DEFAULT, FAILURE - } -} diff --git a/src/main/java/com/pahimar/ee3/event/ActionRequestEvent.java b/src/main/java/com/pahimar/ee3/event/ActionRequestEvent.java deleted file mode 100644 index 45fa61ad..00000000 --- a/src/main/java/com/pahimar/ee3/event/ActionRequestEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.pahimar.ee3.event; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.event.entity.player.PlayerEvent; - -/** - * Equivalent-Exchange-3 - *

- * ActionRequestEvent - * - * @author pahimar - */ -@Cancelable -public class ActionRequestEvent extends PlayerEvent -{ - - public final ActionEvent modEvent; - public final int x, y, z; - public final int sideHit; - public Result allowEvent; - - public ActionRequestEvent(EntityPlayer player, ActionEvent modEvent, int x, int y, int z, int sideHit) - { - - super(player); - this.modEvent = modEvent; - this.x = x; - this.y = y; - this.z = z; - this.sideHit = sideHit; - if (sideHit == -1) - { - allowEvent = DENY; - } - } - - @Override - public void setCanceled(boolean cancel) - { - - super.setCanceled(cancel); - allowEvent = cancel ? DENY : allowEvent == DENY ? DENY : DEFAULT; - } -} diff --git a/src/main/java/com/pahimar/ee3/event/WorldTransmutationEvent.java b/src/main/java/com/pahimar/ee3/event/WorldTransmutationEvent.java deleted file mode 100644 index cba59050..00000000 --- a/src/main/java/com/pahimar/ee3/event/WorldTransmutationEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.pahimar.ee3.event; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Equivalent-Exchange-3 - *

- * WorldTransmutationEvent - * - * @author pahimar - */ -public class WorldTransmutationEvent extends ActionEvent -{ - - public int targetID, targetMeta; - - public WorldTransmutationEvent(byte actionType, ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, boolean hasActionOccured, String data) - { - - super(actionType, itemStack, player, world, x, y, z, hasActionOccured, data); - targetID = Integer.parseInt(data.substring(0, data.indexOf(":"))); - targetMeta = Integer.parseInt(data.substring(data.indexOf(":") + 1)); - actionResult = ActionResult.DEFAULT; - } -} diff --git a/src/main/java/com/pahimar/ee3/handler/ActionRequestHandler.java b/src/main/java/com/pahimar/ee3/handler/ActionRequestHandler.java deleted file mode 100644 index c2da2db7..00000000 --- a/src/main/java/com/pahimar/ee3/handler/ActionRequestHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.pahimar.ee3.handler; - -import com.pahimar.ee3.event.ActionRequestEvent; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; - -/** - * Equivalent-Exchange-3 - *

- * ActionRequestHandler - * - * @author pahimar - */ -public class ActionRequestHandler -{ - @SubscribeEvent - public void onModActionEvent(ActionRequestEvent event) - { - - } -} diff --git a/src/main/java/com/pahimar/ee3/handler/CraftingHandler.java b/src/main/java/com/pahimar/ee3/handler/CraftingHandler.java index 42160614..418ee0dc 100644 --- a/src/main/java/com/pahimar/ee3/handler/CraftingHandler.java +++ b/src/main/java/com/pahimar/ee3/handler/CraftingHandler.java @@ -1,109 +1,21 @@ package com.pahimar.ee3.handler; -import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.helper.ItemStackNBTHelper; -import com.pahimar.ee3.item.ItemAlchemicalBag; import com.pahimar.ee3.item.crafting.RecipesAlchemicalBagDyes; -import com.pahimar.ee3.item.crafting.RecipesTransmutationStones; -import com.pahimar.ee3.item.crafting.RecipesVanilla; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.recipe.RecipesAludel; -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent; import net.minecraft.item.crafting.CraftingManager; -/** - * Equivalent-Exchange-3 - *

- * CraftingHandler - * - * @author pahimar - */ -public class CraftingHandler implements ICraftingHandler +public class CraftingHandler { public static void init() { - // Register the Crafting Handler - GameRegistry.registerCraftingHandler(new CraftingHandler()); - // Add in the ability to dye Alchemical Bags CraftingManager.getInstance().getRecipeList().add(new RecipesAlchemicalBagDyes()); - - // Register our recipes - RecipesVanilla.init(); - RecipesTransmutationStones.init(); - RecipesAludel.getInstance(); } - @Override - public void onCrafting(EntityPlayer player, ItemStack itemStack, IInventory craftMatrix) - { - if (player.worldObj.isRemote) - { - doPortableCrafting(player, craftMatrix); - } - - if (!player.worldObj.isRemote) - { - // Set the UUID on an Alchemical Bag when picked up from crafting - if (itemStack.getItem() instanceof ItemAlchemicalBag) - { - ItemStackNBTHelper.setUUID(itemStack); - } - } - } - - @Override - public void onSmelting(EntityPlayer player, ItemStack itemStack) + @SubscribeEvent + public void onItemCraftedEvent(PlayerEvent.ItemCraftedEvent event) { } - - /** - * Check to see if the crafting is occurring from the portable crafting interface. If so, do durability damage to - * the appropriate transmutation stone that was used for portable crafting. - * - * @param player - * The player that is completing the crafting - * @param craftMatrix - * The contents of the crafting matrix - */ - private void doPortableCrafting(EntityPlayer player, IInventory craftMatrix) - { - ItemStack openStone = null; - - for (ItemStack itemStack : player.inventory.mainInventory) - { - if (itemStack != null) - { - if (ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) - { - openStone = itemStack; - } - } - } - - ItemStack itemStack; - if (openStone != null) - { - for (int i = 0; i < craftMatrix.getSizeInventory(); i++) - { - itemStack = craftMatrix.getStackInSlot(i); - if (itemStack != null) - { - if (ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) - { - openStone = itemStack; - } - } - } - } - - if (openStone != null) - { - openStone.damageItem(ConfigurationSettings.TRANSMUTE_COST_ITEM, player); - } - } } diff --git a/src/main/java/com/pahimar/ee3/handler/EquivalencyHandler.java b/src/main/java/com/pahimar/ee3/handler/EquivalencyHandler.java deleted file mode 100644 index e9dbc373..00000000 --- a/src/main/java/com/pahimar/ee3/handler/EquivalencyHandler.java +++ /dev/null @@ -1,309 +0,0 @@ -package com.pahimar.ee3.handler; - -import com.pahimar.ee3.helper.GeneralHelper; -import com.pahimar.ee3.helper.LogHelper; -import net.minecraft.item.ItemStack; - -import java.util.ArrayList; - -/** - * Equivalent-Exchange-3 - *

- * EquivalencyHandler - * - * @author pahimar - */ -public class EquivalencyHandler -{ - - private static final EquivalencyHandler instance = new EquivalencyHandler(); - - private static ArrayList> equivalencyList = new ArrayList>(); - - public static EquivalencyHandler instance() - { - - return instance; - } - - public ArrayList> getAllLists() - { - - return equivalencyList; - } - - public void addObjects(Object obj1, Object obj2) - { - - ItemStack stack1 = GeneralHelper.convertObjectToItemStack(obj1); - ItemStack stack2 = GeneralHelper.convertObjectToItemStack(obj2); - - ArrayList currentList = new ArrayList(); - - Integer stack1Index = getIndexInList(stack1); - Integer stack2Index = getIndexInList(stack2); - - if (stack1Index != null && stack2Index != null) - { - } - else if (stack1Index != null && stack2Index == null) - { - currentList = equivalencyList.get(stack1Index.intValue()); - currentList.add(stack2); - equivalencyList.set(stack1Index, currentList); - } - else if (stack1Index == null && stack2Index != null) - { - currentList = equivalencyList.get(stack2Index.intValue()); - currentList.add(stack1); - equivalencyList.set(stack2Index, currentList); - } - else if (stack1Index == null && stack2Index == null) - { - currentList.add(stack1); - currentList.add(stack2); - equivalencyList.add(currentList); - } - } - - public void addObjects(Object... objList) - { - - if (objList.length < 2) - { - return; - } - - for (int i = 0; i < objList.length - 1; i++) - { - addObjects(objList[i], objList[i + 1]); - } - } - - public Integer getIndexInList(Object obj) - { - - ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj); - ArrayList currentList; - int i = 0; - - while (i < equivalencyList.size()) - { - currentList = equivalencyList.get(i); - for (ItemStack currentStack : currentList) - { - if (ItemStack.areItemStacksEqual(checkStack, currentStack)) - { - return i; - } - } - ++i; - } - - return null; - } - - public Integer getIndexInList(int id, int meta) - { - - ArrayList currentList; - int i = 0; - - while (i < equivalencyList.size()) - { - currentList = equivalencyList.get(i); - for (ItemStack currentStack : currentList) - { - if (id == currentStack.itemID && meta == currentStack.getItemDamage()) - { - return i; - } - } - ++i; - } - - return null; - } - - public ArrayList getEquivalencyList(Object obj) - { - - ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj); - - if (checkStack == null) - { - return null; - } - - for (ArrayList list : equivalencyList) - { - for (ItemStack currentStack : list) - { - if (ItemStack.areItemStacksEqual(checkStack, currentStack)) - { - return list; - } - } - } - - return null; - } - - public ArrayList getEquivalencyList(int id, int meta) - { - - for (ArrayList list : equivalencyList) - { - for (ItemStack currentStack : list) - { - if (id == currentStack.itemID && meta == currentStack.getItemDamage()) - { - return list; - } - } - } - - return null; - } - - public ItemStack getNextInList(Object obj) - { - - ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj); - - if (checkStack != null) - { - return getNextInList(checkStack.itemID, checkStack.getItemDamage()); - } - - return null; - } - - public ItemStack getNextInList(int id, int meta) - { - - ArrayList list = getEquivalencyList(id, meta); - - ItemStack currentStack; - ItemStack returnStack = null; - int i = 0; - - if (list != null) - { - if (list.size() == 1) - { - return list.get(i); - } - - while (i < list.size()) - { - currentStack = list.get(i); - - if (id == currentStack.itemID && meta == currentStack.getItemDamage()) - { - returnStack = list.get((i + 1) % list.size()); - break; - } - - ++i; - } - } - - return returnStack; - } - - public ItemStack getPrevInList(Object obj) - { - - ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj); - - if (checkStack != null) - { - return getPrevInList(checkStack.itemID, checkStack.getItemDamage()); - } - - return null; - } - - public ItemStack getPrevInList(int id, int meta) - { - - ArrayList list = getEquivalencyList(id, meta); - - ItemStack currentStack; - ItemStack returnStack = null; - int i = 0; - - if (list != null) - { - if (list.size() == 1) - { - return list.get(i); - } - - while (i < list.size()) - { - currentStack = list.get(i); - - if (id == currentStack.itemID && meta == currentStack.getItemDamage()) - { - int index = (i - 1 + list.size()) % list.size(); - returnStack = list.get(index); - break; - } - - ++i; - } - } - - return returnStack; - } - - public boolean areEquivalent(Object obj1, Object obj2) - { - if (getEquivalencyList(obj1) != null && getEquivalencyList(obj2) != null) - { - return GeneralHelper.convertObjectToItemStack(obj1).itemID == GeneralHelper.convertObjectToItemStack(obj2).itemID && GeneralHelper.convertObjectToItemStack(obj1).getItemDamage() == GeneralHelper.convertObjectToItemStack(obj2).getItemDamage() || getEquivalencyList(obj1).equals(getEquivalencyList(obj2)); - } - else - { - return false; - } - } - - /* Ignores stack size for world transmutation */ - public boolean areWorldEquivalent(Object obj1, Object obj2) - { - - ItemStack first = GeneralHelper.convertObjectToItemStack(obj1); - if (first == null) - { - return false; - } - ItemStack second = GeneralHelper.convertObjectToItemStack(obj2); - if (second == null) - { - return false; - } - - if (getEquivalencyList(first.itemID, first.getItemDamage()) != null && getEquivalencyList(second.itemID, second.getItemDamage()) != null) - { - return first.itemID == second.itemID && first.getItemDamage() == second.getItemDamage() || getEquivalencyList(first.itemID, first.getItemDamage()).equals(getEquivalencyList(second.itemID, second.getItemDamage())); - } - else - { - return false; - } - } - - public void debug() - { - - int i = 0; - for (ArrayList list : equivalencyList) - { - LogHelper.info("equivalencyList[" + i + "]: " + list.toString()); - ++i; - } - } -} diff --git a/src/main/java/com/pahimar/ee3/handler/FuelHandler.java b/src/main/java/com/pahimar/ee3/handler/FuelHandler.java deleted file mode 100644 index a91a1071..00000000 --- a/src/main/java/com/pahimar/ee3/handler/FuelHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.pahimar.ee3.handler; - -import com.pahimar.ee3.block.ModBlocks; -import com.pahimar.ee3.item.ModItems; -import cpw.mods.fml.common.IFuelHandler; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntityFurnace; - -public class FuelHandler implements IFuelHandler -{ - private static final ItemStack ALCHEMICAL_COAL_STACK = new ItemStack(ModItems.alchemicalFuel, 1, 0); - private static final ItemStack MOBIUS_FUEL_STACK = new ItemStack(ModItems.alchemicalFuel, 1, 1); - private static final ItemStack AETERNALIS_FUEL_STACK = new ItemStack(ModItems.alchemicalFuel, 1, 2); - - private static final ItemStack ALCHEMICAL_COAL_BLOCK_STACK = new ItemStack(ModBlocks.alchemicalFuel, 1, 0); - private static final ItemStack MOBIUS_FUEL_BLOCK_STACK = new ItemStack(ModBlocks.alchemicalFuel, 1, 1); - private static final ItemStack AETERNALIS_FUEL_BLOCK_STACK = new ItemStack(ModBlocks.alchemicalFuel, 1, 2); - - @Override - public int getBurnTime(ItemStack fuel) - { - /** - * Alchemical Coal - */ - if (fuel.itemID == ALCHEMICAL_COAL_STACK.itemID && fuel.getItemDamage() == ALCHEMICAL_COAL_STACK.getItemDamage()) - { - return 8 * TileEntityFurnace.getItemBurnTime(new ItemStack(Item.coal)); - } - else if (fuel.itemID == ALCHEMICAL_COAL_BLOCK_STACK.itemID && fuel.getItemDamage() == ALCHEMICAL_COAL_BLOCK_STACK.getItemDamage()) - { - return 9 * getBurnTime(ALCHEMICAL_COAL_STACK); - } - /** - * Mobius Fuel - */ - else if (fuel.itemID == MOBIUS_FUEL_STACK.itemID && fuel.getItemDamage() == MOBIUS_FUEL_STACK.getItemDamage()) - { - return 8 * getBurnTime(ALCHEMICAL_COAL_STACK); - } - else if (fuel.itemID == MOBIUS_FUEL_BLOCK_STACK.itemID && fuel.getItemDamage() == MOBIUS_FUEL_BLOCK_STACK.getItemDamage()) - { - return 9 * getBurnTime(MOBIUS_FUEL_STACK); - } - /** - * Aeternalis Fuel - */ - else if (fuel.itemID == AETERNALIS_FUEL_STACK.itemID && fuel.getItemDamage() == AETERNALIS_FUEL_STACK.getItemDamage()) - { - return 8 * getBurnTime(MOBIUS_FUEL_STACK); - } - else if (fuel.itemID == AETERNALIS_FUEL_BLOCK_STACK.itemID && fuel.getItemDamage() == AETERNALIS_FUEL_BLOCK_STACK.getItemDamage()) - { - return 9 * getBurnTime(AETERNALIS_FUEL_STACK); - } - - return 0; - } -} diff --git a/src/main/java/com/pahimar/ee3/handler/GuiHandler.java b/src/main/java/com/pahimar/ee3/handler/GuiHandler.java index b96292d6..52f4b7fa 100644 --- a/src/main/java/com/pahimar/ee3/handler/GuiHandler.java +++ b/src/main/java/com/pahimar/ee3/handler/GuiHandler.java @@ -1,12 +1,5 @@ package com.pahimar.ee3.handler; -import com.pahimar.ee3.client.gui.inventory.*; -import com.pahimar.ee3.inventory.*; -import com.pahimar.ee3.lib.GuiIds; -import com.pahimar.ee3.tileentity.TileAlchemicalChest; -import com.pahimar.ee3.tileentity.TileAludel; -import com.pahimar.ee3.tileentity.TileCalcinator; -import com.pahimar.ee3.tileentity.TileGlassBell; import cpw.mods.fml.common.network.IGuiHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; @@ -16,70 +9,12 @@ public class GuiHandler implements IGuiHandler @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - if (ID == GuiIds.PORTABLE_CRAFTING) - { - return new ContainerPortableCrafting(player.inventory, world, x, y, z); - } - else if (ID == GuiIds.CALCINATOR) - { - TileCalcinator tileCalcinator = (TileCalcinator) world.getTileEntity(x, y, z); - return new ContainerCalcinator(player.inventory, tileCalcinator); - } - else if (ID == GuiIds.ALCHEMICAL_CHEST) - { - TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) world.getTileEntity(x, y, z); - return new ContainerAlchemicalChest(player.inventory, tileAlchemicalChest); - } - else if (ID == GuiIds.ALCHEMICAL_BAG) - { - return new ContainerAlchemicalBag(player, new InventoryAlchemicalBag(player.getHeldItem())); - } - else if (ID == GuiIds.ALUDEL) - { - TileAludel tileAludel = (TileAludel) world.getTileEntity(x, y, z); - return new ContainerAludel(player.inventory, tileAludel); - } - else if (ID == GuiIds.GLASS_BELL) - { - TileGlassBell tileGlassBell = (TileGlassBell) world.getTileEntity(x, y, z); - return new ContainerGlassBell(player.inventory, tileGlassBell); - } - return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - if (ID == GuiIds.PORTABLE_CRAFTING) - { - return new GuiPortableCrafting(player, world, x, y, z); - } - else if (ID == GuiIds.CALCINATOR) - { - TileCalcinator tileCalcinator = (TileCalcinator) world.getTileEntity(x, y, z); - return new GuiCalcinator(player.inventory, tileCalcinator); - } - else if (ID == GuiIds.ALCHEMICAL_CHEST) - { - TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) world.getTileEntity(x, y, z); - return new GuiAlchemicalChest(player.inventory, tileAlchemicalChest); - } - else if (ID == GuiIds.ALCHEMICAL_BAG) - { - return new GuiAlchemicalBag(player, new InventoryAlchemicalBag(player.getHeldItem())); - } - else if (ID == GuiIds.ALUDEL) - { - TileAludel tileAludel = (TileAludel) world.getTileEntity(x, y, z); - return new GuiAludel(player.inventory, tileAludel); - } - else if (ID == GuiIds.GLASS_BELL) - { - TileGlassBell tileGlassBell = (TileGlassBell) world.getTileEntity(x, y, z); - return new GuiGlassBell(player.inventory, tileGlassBell); - } - return null; } } diff --git a/src/main/java/com/pahimar/ee3/handler/ItemEventHandler.java b/src/main/java/com/pahimar/ee3/handler/ItemEventHandler.java index f83c5904..89deb2ea 100644 --- a/src/main/java/com/pahimar/ee3/handler/ItemEventHandler.java +++ b/src/main/java/com/pahimar/ee3/handler/ItemEventHandler.java @@ -1,76 +1,39 @@ package com.pahimar.ee3.handler; -import com.pahimar.ee3.helper.ItemStackNBTHelper; -import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.util.NBTHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent; import net.minecraft.entity.item.EntityItem; import net.minecraftforge.event.entity.item.ItemTossEvent; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.event.entity.player.PlayerDropsEvent; -/** - * Equivalent-Exchange-3 - *

- * ItemEventHandler - * - * @author pahimar - */ public class ItemEventHandler { @SubscribeEvent - @SuppressWarnings("unused") - public void onItemPickup(EntityItemPickupEvent event) + public void onItemTossEvent(ItemTossEvent itemTossEvent) { - if (ItemStackNBTHelper.hasTag(event.item.getEntityItem(), Strings.NBT_ITEM_CRAFTING_GUI_OPEN)) - { - ItemStackNBTHelper.removeTag(event.item.getEntityItem(), Strings.NBT_ITEM_CRAFTING_GUI_OPEN); - } - else if (ItemStackNBTHelper.hasTag(event.item.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) - { - ItemStackNBTHelper.removeTag(event.item.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN); - } - else if (ItemStackNBTHelper.hasTag(event.item.getEntityItem(), Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) - { - ItemStackNBTHelper.removeTag(event.item.getEntityItem(), Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN); - } + NBTHelper.clearStatefulNBTTags(itemTossEvent.entityItem.getEntityItem()); } @SubscribeEvent - @SuppressWarnings("unused") - public void onItemToss(ItemTossEvent event) + public void onItemPickupEvent(PlayerEvent.ItemPickupEvent itemPickupEvent) { - if (ItemStackNBTHelper.hasTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_CRAFTING_GUI_OPEN)) - { - ItemStackNBTHelper.removeTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_CRAFTING_GUI_OPEN); - } - else if (ItemStackNBTHelper.hasTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) - { - ItemStackNBTHelper.removeTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN); - } - else if (ItemStackNBTHelper.hasTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) - { - ItemStackNBTHelper.removeTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN); - } + NBTHelper.clearStatefulNBTTags(itemPickupEvent.pickedUp.getEntityItem()); } @SubscribeEvent - @SuppressWarnings("unused") - public void onPlayerDrop(PlayerDropsEvent event) + public void onEntityItemPickupEvent(EntityItemPickupEvent entityItemPickupEvent) { - for (EntityItem entityItem : event.drops) + NBTHelper.clearStatefulNBTTags(entityItemPickupEvent.item.getEntityItem()); + } + + @SubscribeEvent + public void onPlayerDropsEvent(PlayerDropsEvent playerDropsEvent) + { + for (EntityItem entityItem : playerDropsEvent.drops) { - if (ItemStackNBTHelper.hasTag(entityItem.getEntityItem(), Strings.NBT_ITEM_CRAFTING_GUI_OPEN)) - { - ItemStackNBTHelper.removeTag(entityItem.getEntityItem(), Strings.NBT_ITEM_CRAFTING_GUI_OPEN); - } - else if (ItemStackNBTHelper.hasTag(entityItem.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) - { - ItemStackNBTHelper.removeTag(entityItem.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN); - } - else if (ItemStackNBTHelper.hasTag(entityItem.getEntityItem(), Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) - { - ItemStackNBTHelper.removeTag(entityItem.getEntityItem(), Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN); - } + NBTHelper.clearStatefulNBTTags(entityItem.getEntityItem()); } } } diff --git a/src/main/java/com/pahimar/ee3/handler/VersionCheckTickHandler.java b/src/main/java/com/pahimar/ee3/handler/VersionCheckTickHandler.java deleted file mode 100644 index c2620ac1..00000000 --- a/src/main/java/com/pahimar/ee3/handler/VersionCheckTickHandler.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.pahimar.ee3.handler; - -import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.configuration.GeneralConfiguration; -import com.pahimar.ee3.helper.VersionHelper; -import com.pahimar.ee3.lib.Reference; -import cpw.mods.fml.client.FMLClientHandler; - -import java.util.EnumSet; - -/** - * Equivalent-Exchange-3 - *

- * VersionCheckTickHandler - * - * @author pahimar - */ -public class VersionCheckTickHandler implements ITickHandler -{ - - private static boolean initialized = false; - - @Override - public void tickStart(EnumSet type, Object... tickData) - { - - } - - @Override - public void tickEnd(EnumSet type, Object... tickData) - { - - if (ConfigurationSettings.DISPLAY_VERSION_RESULT) - { - if (!initialized) - { - for (TickType tickType : type) - { - if (tickType == TickType.CLIENT) - { - if (FMLClientHandler.instance().getClient().currentScreen == null) - { - if (VersionHelper.getResult() != VersionHelper.UNINITIALIZED || VersionHelper.getResult() != VersionHelper.FINAL_ERROR) - { - - initialized = true; - - if (VersionHelper.getResult() == VersionHelper.OUTDATED) - { - FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(VersionHelper.getResultMessageForClient()); - GeneralConfiguration.set(Configuration.CATEGORY_GENERAL, ConfigurationSettings.DISPLAY_VERSION_RESULT_CONFIGNAME, "false"); - } - } - } - } - } - } - } - } - - @Override - public EnumSet ticks() - { - - return EnumSet.of(TickType.CLIENT); - } - - @Override - public String getLabel() - { - - return Reference.MOD_NAME + ": " + this.getClass().getSimpleName(); - } -} diff --git a/src/main/java/com/pahimar/ee3/handler/WorldEventHandler.java b/src/main/java/com/pahimar/ee3/handler/WorldEventHandler.java deleted file mode 100644 index 47aa0797..00000000 --- a/src/main/java/com/pahimar/ee3/handler/WorldEventHandler.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.pahimar.ee3.handler; - -import com.pahimar.ee3.helper.EmcInitializationHelper; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.event.world.WorldEvent; - -public class WorldEventHandler -{ - @SubscribeEvent - public void onWorldLoaded(WorldEvent.Load event) - { - EmcInitializationHelper.initEmcRegistry(); - } -} diff --git a/src/main/java/com/pahimar/ee3/handler/WorldTransmutationHandler.java b/src/main/java/com/pahimar/ee3/handler/WorldTransmutationHandler.java deleted file mode 100644 index 8b421218..00000000 --- a/src/main/java/com/pahimar/ee3/handler/WorldTransmutationHandler.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.pahimar.ee3.handler; - -import com.google.common.eventbus.Subscribe; -import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.event.ActionEvent; -import com.pahimar.ee3.event.ActionEvent.ActionResult; -import com.pahimar.ee3.event.ActionRequestEvent; -import com.pahimar.ee3.event.WorldTransmutationEvent; -import com.pahimar.ee3.helper.TransmutationHelper; -import com.pahimar.ee3.lib.ActionTypes; -import com.pahimar.ee3.lib.ItemUpdateTypes; -import com.pahimar.ee3.lib.Particles; -import com.pahimar.ee3.lib.Sounds; -import com.pahimar.ee3.network.PacketTypeHandler; -import com.pahimar.ee3.network.packet.PacketItemUpdate; -import com.pahimar.ee3.network.packet.PacketSoundEvent; -import com.pahimar.ee3.network.packet.PacketSpawnParticle; -import cpw.mods.fml.common.eventhandler.Event; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Equivalent-Exchange-3 - *

- * WorldTransmutationHandler - * - * @author pahimar - */ -public class WorldTransmutationHandler -{ - - public static void handleWorldTransmutation(EntityPlayer thePlayer, int originX, int originY, int originZ, byte rangeX, byte rangeY, byte rangeZ, byte sideHit, String data) - { - - ActionRequestEvent actionRequestEvent; - ActionEvent actionEvent; - - int lowerBoundX = -1 * rangeX / 2; - int upperBoundX = -1 * lowerBoundX; - int lowerBoundY = -1 * rangeY / 2; - int upperBoundY = -1 * lowerBoundY; - int lowerBoundZ = -1 * rangeZ / 2; - int upperBoundZ = -1 * lowerBoundZ; - boolean anySuccess = false; - - double xShift = 0; - double yShift = 0; - double zShift = 0; - - int xSign = 1; - int ySign = 1; - int zSign = 1; - - switch (ForgeDirection.getOrientation(sideHit)) - { - case UP: - { - yShift = 1.5D; - break; - } - case DOWN: - { - yShift = 0.1D; - ySign = -1; - break; - } - case NORTH: - { - zShift = 1D; - zSign = -1; - break; - } - case SOUTH: - { - zShift = 1D; - break; - } - case EAST: - { - xShift = 1D; - break; - } - case WEST: - { - xShift = 1D; - xSign = -1; - break; - } - case UNKNOWN: - { - break; - } - default: - break; - } - - for (int x = lowerBoundX; x <= upperBoundX; x++) - { - for (int y = lowerBoundY; y <= upperBoundY; y++) - { - for (int z = lowerBoundZ; z <= upperBoundZ; z++) - { - - actionEvent = new WorldTransmutationEvent(ActionTypes.TRANSMUTATION, thePlayer.getCurrentEquippedItem(), thePlayer, thePlayer.worldObj, originX + x, originY + y, originZ + z, false, data); - - if (actionEvent != null) - { - actionRequestEvent = new ActionRequestEvent(thePlayer, actionEvent, originX + x, originY + y, originZ + z, sideHit); - MinecraftForge.EVENT_BUS.post(actionRequestEvent); - - if (actionRequestEvent.allowEvent != Event.Result.DENY) - { - MinecraftForge.EVENT_BUS.post(actionEvent); - } - - if (actionEvent.actionResult == ActionResult.SUCCESS) - { - if (!anySuccess) - { - anySuccess = true; - } - - PacketDispatcher.sendPacketToAllAround(originX + x, originY + y, originZ + z, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSpawnParticle(Particles.LARGE_SMOKE, originX + x + xShift * xSign, originY + y + yShift * ySign, originZ + z + zShift * zSign, 0D * xSign, 0.05D * ySign, 0D * zSign))); - PacketDispatcher.sendPacketToAllAround(originX + x, originY + y, originZ + z, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSpawnParticle(Particles.LARGE_EXPLODE, originX + x + xShift * xSign, originY + y + yShift * ySign, originZ + z + zShift * zSign, 0D * xSign, 0.15D * ySign, 0D * zSign))); - } - else if (actionEvent.actionResult == ActionResult.FAILURE) - { - if (!(actionEvent.world.getBlockId(originX + x, originY + y, originZ + z) == 0)) - { - // TODO Fancy particle motion - PacketDispatcher.sendPacketToAllAround(originX + x, originY + y, originZ + z, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSpawnParticle(Particles.RED_DUST, originX + x + xShift * xSign, originY + y + yShift * ySign, originZ + z + zShift * zSign, 0D * xSign, 0.05D * ySign, 0D * zSign))); - PacketDispatcher.sendPacketToAllAround(originX + x, originY + y, originZ + z, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSpawnParticle(Particles.WITCH_MAGIC, originX + x + xShift * xSign, originY + y + yShift * ySign, originZ + z + zShift * zSign, 0D * xSign, 0.05D * ySign, 0D * zSign))); - } - } - } - } - } - } - - if (anySuccess) - { - PacketDispatcher.sendPacketToAllAround(originX, originY, originZ, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSoundEvent(thePlayer.username, Sounds.TRANSMUTE, originX, originY, originZ, 0.5F, 1.0F))); - } - else - { - PacketDispatcher.sendPacketToAllAround(originX, originY, originZ, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSoundEvent(thePlayer.username, Sounds.FAIL, originX, originY, originZ, 1.5F, 1.5F))); - } - } - - @SubscribeEvent - public void onWorldTransmutationEvent(WorldTransmutationEvent event) - { - - int id = event.world.getBlockId(event.x, event.y, event.z); - int meta = event.world.getBlockMetadata(event.x, event.y, event.z); - boolean result = false; - - Block currentBlock = Block.blocksList[id]; - - if (currentBlock != null) - { - meta = currentBlock.damageDropped(meta); - } - - ItemStack worldStack = new ItemStack(id, 1, meta); - ItemStack targetStack = new ItemStack(event.targetID, 1, event.targetMeta); - - if (!worldStack.isItemEqual(targetStack)) - { - if (EquivalencyHandler.instance().areWorldEquivalent(worldStack, targetStack)) - { - if (event.itemStack != null) - { - if (event.itemStack.getItemDamage() <= event.itemStack.getMaxDamage()) - { - result = TransmutationHelper.transmuteInWorld(event.world, event.player, event.player.getCurrentEquippedItem(), event.x, event.y, event.z, event.targetID, event.targetMeta); - } - } - } - } - - if (result) - { - event.actionResult = ActionResult.SUCCESS; - - int currentSlot = event.player.inventory.currentItem; - event.itemStack.damageItem(ConfigurationSettings.TRANSMUTE_COST_BLOCK, event.player); - - if (event.itemStack.stackSize < 1) - { - event.player.inventory.setInventorySlotContents(currentSlot, null); - PacketDispatcher.sendPacketToPlayer(PacketTypeHandler.populatePacket(new PacketItemUpdate((byte) currentSlot, ItemUpdateTypes.DESTROYED)), (Player) event.player); - event.player.worldObj.playSoundAtEntity(event.player, "random.break", 0.8F, 0.8F + event.player.worldObj.rand.nextFloat() * 0.4F); - } - } - else - { - event.actionResult = ActionResult.FAILURE; - } - } -} diff --git a/src/main/java/com/pahimar/ee3/helper/CraftingHelper.java b/src/main/java/com/pahimar/ee3/helper/CraftingHelper.java deleted file mode 100644 index 255a1142..00000000 --- a/src/main/java/com/pahimar/ee3/helper/CraftingHelper.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.pahimar.ee3.helper; - -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -public class CraftingHelper -{ - public static void addShapedOreRecipe(ItemStack outputItemStack, Object... objectInputs) - { - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(outputItemStack, objectInputs)); - } - - public static void addShapelessOreRecipe(ItemStack outputItemStack, Object... objectInputs) - { - CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(outputItemStack, objectInputs)); - } -} diff --git a/src/main/java/com/pahimar/ee3/helper/DebugHelper.java b/src/main/java/com/pahimar/ee3/helper/DebugHelper.java deleted file mode 100644 index 337f89fc..00000000 --- a/src/main/java/com/pahimar/ee3/helper/DebugHelper.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.pahimar.ee3.helper; - -import com.pahimar.ee3.api.OreStack; -import com.pahimar.ee3.api.WrappedStack; -import com.pahimar.ee3.emc.EmcRegistry; -import com.pahimar.ee3.emc.EmcValue; -import com.pahimar.ee3.recipe.RecipeRegistry; -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class DebugHelper -{ - - public static void printOreDictionaryContents() - { - List oreNames = Arrays.asList(OreDictionary.getOreNames()); - Collections.sort(oreNames); - - for (String oreName : oreNames) - { - for (ItemStack itemStack : OreDictionary.getOres(oreName)) - { - LogHelper.debug(String.format("%s: %s", oreName, ItemHelper.toString(itemStack))); - } - } - } - - public static void printOreStacksWithoutEmcValues() - { - List oreNames = Arrays.asList(OreDictionary.getOreNames()); - Collections.sort(oreNames); - - for (String oreName : oreNames) - { - if (!EmcRegistry.getInstance().hasEmcValue(new OreStack(oreName))) - { - LogHelper.debug(String.format("OreStack '%s' requires an EmcValue", oreName)); - } - } - } - - public static void printRecipeRegistryContents() - { - List outputStacks = new ArrayList(RecipeRegistry.getInstance().getRecipeMappings().keySet()); - Collections.sort(outputStacks); - - for (WrappedStack outputStack : outputStacks) - { - for (List inputStacks : RecipeRegistry.getInstance().getRecipeMappings().get(outputStack)) - { - LogHelper.debug(String.format("%s <--- %s", outputStack, inputStacks)); - } - } - } - - public static void printItemsWithoutEmcValues() - { - printItemsWithoutEmcValues(null); - } - - public static void printItemsWithoutEmcValues(String modid) - { - for (WrappedStack wrappedStack : RecipeRegistry.getInstance().getDiscoveredStacks()) - { - if (!EmcRegistry.getInstance().hasEmcValue(wrappedStack)) - { - if (wrappedStack.getWrappedStack() instanceof ItemStack) - { - ItemStack itemStack = (ItemStack) wrappedStack.getWrappedStack(); - GameRegistry.UniqueIdentifier uniqueIdentifier = GameRegistry.findUniqueIdentifierFor(itemStack.getItem()); - if (uniqueIdentifier != null) - { - if (modid != null) - { - if (uniqueIdentifier.modId.equalsIgnoreCase(modid)) - { - LogHelper.debug(String.format("Mod '%s': Object '%s' is lacking an EmcValue", uniqueIdentifier.modId, wrappedStack)); - } - } - else - { - LogHelper.debug(String.format("Mod '%s': Object '%s' is lacking an EmcValue", uniqueIdentifier.modId, wrappedStack)); - } - } - } - } - } - } - - public static void printStackToEmcValueMappings() - { - LogHelper.debug(String.format("There are %s entries in the Stack to EmcValue map", EmcRegistry.getInstance().getStackToEmcValueMap().keySet().size())); - for (WrappedStack wrappedStack : EmcRegistry.getInstance().getStackToEmcValueMap().keySet()) - { - LogHelper.debug(String.format("EmcValue for stack '%s': %s", wrappedStack, EmcRegistry.getInstance().getStackToEmcValueMap().get(wrappedStack))); - } - } - - public static void printEmcValueToStackMappings() - { - LogHelper.debug(String.format("There are %s entries in the EmcValue to Stack map", EmcRegistry.getInstance().getEmcValueToStackMap().keySet().size())); - for (EmcValue emcValue : EmcRegistry.getInstance().getEmcValueToStackMap().keySet()) - { - LogHelper.debug(String.format("Stacks(s) for EmcValue '%s': %s", emcValue, EmcRegistry.getInstance().getEmcValueToStackMap().get(emcValue))); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/helper/EmcHelper.java b/src/main/java/com/pahimar/ee3/helper/EmcHelper.java deleted file mode 100644 index 861668f2..00000000 --- a/src/main/java/com/pahimar/ee3/helper/EmcHelper.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.pahimar.ee3.helper; - -import com.pahimar.ee3.api.WrappedStack; -import com.pahimar.ee3.emc.EmcRegistry; -import com.pahimar.ee3.emc.EmcType; -import com.pahimar.ee3.emc.EmcValue; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; - -import java.util.ArrayList; -import java.util.List; - -public class EmcHelper -{ - - public static List filterStacksByEmc(List unfilteredStacks, EmcValue filterValue) - { - List filteredStacks = new ArrayList(); - - for (WrappedStack stack : unfilteredStacks) - { - if (EmcRegistry.getInstance().hasEmcValue(stack)) - { - EmcValue value = EmcRegistry.getInstance().getEmcValue(stack); - boolean satisfiesFilter = true; - float[] valueSubValues = value.components; - float[] filterValueSubValues = filterValue.components; - - for (int i = 0; i < valueSubValues.length; i++) - { - if (Float.compare(valueSubValues[i], filterValueSubValues[i]) < 0) - { - satisfiesFilter = false; - } - } - - if (satisfiesFilter) - { - filteredStacks.add(stack); - } - } - } - - return filteredStacks; - } - - @SuppressWarnings("unused") - public static List filterStacksByEmcAndRange(float start, float end, EmcValue filterValue) - { - return filterStacksByEmc(EmcRegistry.getInstance().getStacksInRange(start, end), filterValue); - } - - public static EmcValue computeEmcValueFromList(List wrappedStacks) - { - float[] computedSubValues = new float[EmcType.TYPES.length]; - - for (WrappedStack wrappedStack : wrappedStacks) - { - EmcValue wrappedStackValue; - int stackSize = -1; - if (wrappedStack.getWrappedStack() instanceof ItemStack) - { - ItemStack itemStack = (ItemStack) wrappedStack.getWrappedStack(); - - // Check if we are dealing with a potential fluid - if (FluidContainerRegistry.getFluidForFilledItem(itemStack) != null) - { - if (itemStack.getItem().getContainerItemStack(itemStack) != null) - { - stackSize = FluidContainerRegistry.getFluidForFilledItem(itemStack).amount; - wrappedStackValue = EmcRegistry.getInstance().getEmcValue(FluidContainerRegistry.getFluidForFilledItem(itemStack)); - } - else - { - wrappedStackValue = EmcRegistry.getInstance().getEmcValue(wrappedStack); - } - } - // If we are dealing with a "tool" (container item), assume it's value is 0 (since it won't be used up in the recipe) - else if (itemStack.getItem() != null && itemStack.getItem().getContainerItemStack(itemStack) != null) - { - wrappedStackValue = new EmcValue(0); - } - else - { - wrappedStackValue = EmcRegistry.getInstance().getEmcValue(wrappedStack); - } - } - else - { - wrappedStackValue = EmcRegistry.getInstance().getEmcValue(wrappedStack); - } - - if (wrappedStackValue != null) - { - if (stackSize == -1) - { - stackSize = wrappedStack.getStackSize(); - } - - for (EmcType emcType : EmcType.TYPES) - { - computedSubValues[emcType.ordinal()] += wrappedStackValue.components[emcType.ordinal()] * stackSize; - } - } - else - { - return null; - } - } - - return new EmcValue(computedSubValues); - } - - public static EmcValue factorEmcValue(EmcValue emcValue, int factor) - { - return factorEmcValue(emcValue, (float) factor); - } - - public static EmcValue factorEmcValue(EmcValue emcValue, float factor) - { - - if ((Float.compare(factor, 0f) != 0) && (emcValue != null)) - { - float[] factorSubValues = emcValue.components; - - for (int i = 0; i < factorSubValues.length; i++) - { - factorSubValues[i] = factorSubValues[i] * 1f / factor; - } - - return new EmcValue(factorSubValues); - } - else - { - return emcValue; - } - } -} diff --git a/src/main/java/com/pahimar/ee3/helper/EmcInitializationHelper.java b/src/main/java/com/pahimar/ee3/helper/EmcInitializationHelper.java deleted file mode 100644 index abd569ed..00000000 --- a/src/main/java/com/pahimar/ee3/helper/EmcInitializationHelper.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.pahimar.ee3.helper; - -import com.pahimar.ee3.emc.EmcRegistry; - -public class EmcInitializationHelper implements Runnable -{ - private static EmcInitializationHelper instance = new EmcInitializationHelper(); - - @Override - public void run() - { - long startTime = System.currentTimeMillis(); - EmcRegistry.getInstance(); - long duration = System.currentTimeMillis() - startTime; - if (duration > 10) - { - LogHelper.info(String.format("DynEmc system initialized after %s ms", duration)); - } - } - - public static void initEmcRegistry() - { - new Thread(instance).start(); - } -} diff --git a/src/main/java/com/pahimar/ee3/helper/FluidHelper.java b/src/main/java/com/pahimar/ee3/helper/FluidHelper.java deleted file mode 100644 index dd4c84a2..00000000 --- a/src/main/java/com/pahimar/ee3/helper/FluidHelper.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.pahimar.ee3.helper; - -import com.pahimar.ee3.lib.Compare; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import java.util.Comparator; - -public class FluidHelper -{ - - public static void registerFluids() - { - // Register Milk in the FluidRegistry if it hasn't already been done - if (!FluidRegistry.isFluidRegistered("milk")) - { - Fluid milk = new Fluid("milk") - { - @Override - public String getLocalizedName() - { - return StatCollector.translateToLocal("item.milk.name"); - } - }.setUnlocalizedName(Item.bucketMilk.getUnlocalizedName()); - FluidRegistry.registerFluid(milk); - FluidContainerRegistry.registerFluidContainer(new FluidStack(milk, 1000), new ItemStack(Item.bucketMilk), new ItemStack(Item.bucketEmpty)); - } - } - - public static int compare(FluidStack fluidStack1, FluidStack fluidStack2) - { - return comparator.compare(fluidStack1, fluidStack2); - } - - public static String toString(FluidStack fluidStack) - { - - if (fluidStack != null) - { - return String.format("%sxfluidStack.%s", fluidStack.amount, fluidStack.getFluid().getName()); - } - - return "fluidStack[null]"; - } - - public static Comparator comparator = new Comparator() - { - - public int compare(FluidStack fluidStack1, FluidStack fluidStack2) - { - - if (fluidStack1 != null) - { - if (fluidStack2 != null) - { - if (fluidStack1.fluidID == fluidStack2.fluidID) - { - if (fluidStack1.amount == fluidStack2.amount) - { - if (fluidStack1.tag != null) - { - if (fluidStack2.tag != null) - { - return (fluidStack1.tag.hashCode() - fluidStack2.tag.hashCode()); - } - else - { - return Compare.LESSER_THAN; - } - } - else - { - if (fluidStack2.tag != null) - { - return Compare.GREATER_THAN; - } - else - { - return Compare.EQUALS; - } - } - } - else - { - return (fluidStack1.amount - fluidStack2.amount); - } - } - else - { - return (fluidStack1.fluidID - fluidStack2.fluidID); - } - } - else - { - return Compare.LESSER_THAN; - } - } - else - { - if (fluidStack2 != null) - { - return Compare.GREATER_THAN; - } - else - { - return Compare.EQUALS; - } - } - } - }; -} diff --git a/src/main/java/com/pahimar/ee3/helper/GeneralHelper.java b/src/main/java/com/pahimar/ee3/helper/GeneralHelper.java deleted file mode 100644 index 670f68aa..00000000 --- a/src/main/java/com/pahimar/ee3/helper/GeneralHelper.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.pahimar.ee3.helper; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import java.util.ArrayList; - -/** - * Equivalent-Exchange-3 - *

- * GeneralHelper - * - * @author pahimar - */ -public class GeneralHelper -{ - - public static ItemStack convertObjectToItemStack(Object obj) - { - - if (obj instanceof Item) - { - return new ItemStack((Item) obj); - } - else if (obj instanceof Block) - { - return new ItemStack((Block) obj); - } - else if (obj instanceof ItemStack) - { - return (ItemStack) obj; - } - else - { - return null; - } - } - - public static Object[] convertSingleStackToPluralStacks(ItemStack stack) - { - - ArrayList list = new ArrayList(); - ItemStack currentStack; - - for (int i = 0; i < stack.stackSize; i++) - { - currentStack = new ItemStack(stack.itemID, 1, stack.getItemDamage()); - list.add(currentStack); - } - - return list.toArray(); - } -} diff --git a/src/main/java/com/pahimar/ee3/helper/ItemHelper.java b/src/main/java/com/pahimar/ee3/helper/ItemHelper.java deleted file mode 100644 index 6977d3b6..00000000 --- a/src/main/java/com/pahimar/ee3/helper/ItemHelper.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.pahimar.ee3.helper; - -import com.pahimar.ee3.lib.Colours; -import com.pahimar.ee3.lib.Strings; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.Comparator; - -/** - * Equivalent-Exchange-3 - *

- * ItemDropHelper - * - * @author pahimar - */ -public class ItemHelper -{ - private static double rand; - - /** - * Compares two ItemStacks for equality, testing itemID, metaData, stackSize, and their NBTTagCompounds (if they are - * present) - * - * @param first - * The first ItemStack being tested for equality - * @param second - * The second ItemStack being tested for equality - * - * @return true if the two ItemStacks are equivalent, false otherwise - */ - public static boolean equals(ItemStack first, ItemStack second) - { - return (comparator.compare(first, second) == 0); - } - - public static int compare(ItemStack itemStack1, ItemStack itemStack2) - { - return comparator.compare(itemStack1, itemStack2); - } - - public static String toString(ItemStack itemStack) - { - if (itemStack != null) - { - return String.format("%sxitemStack[%s:%s:%s:%s]", itemStack.stackSize, itemStack.itemID, itemStack.getItemDamage(), itemStack.getUnlocalizedName(), itemStack.getItem().getClass().getCanonicalName()); - } - - return "null"; - } - - public static boolean hasColor(ItemStack itemStack) - { - return itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey(Strings.NBT_ITEM_DISPLAY) && itemStack.getTagCompound().getCompoundTag(Strings.NBT_ITEM_DISPLAY).hasKey(Strings.NBT_ITEM_COLOR); - } - - public static int getColor(ItemStack itemStack) - { - NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); - - if (nbtTagCompound == null) - { - return Integer.parseInt(Colours.PURE_WHITE, 16); - } - else - { - NBTTagCompound displayTagCompound = nbtTagCompound.getCompoundTag(Strings.NBT_ITEM_DISPLAY); - return displayTagCompound == null ? Integer.parseInt(Colours.PURE_WHITE, 16) : displayTagCompound.hasKey(Strings.NBT_ITEM_COLOR) ? displayTagCompound.getInteger(Strings.NBT_ITEM_COLOR) : Integer.parseInt(Colours.PURE_WHITE, 16); - } - } - - public static void setColor(ItemStack itemStack, int color) - { - if (itemStack != null) - { - NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); - - if (nbtTagCompound == null) - { - nbtTagCompound = new NBTTagCompound(); - itemStack.setTagCompound(nbtTagCompound); - } - - NBTTagCompound colourTagCompound = nbtTagCompound.getCompoundTag(Strings.NBT_ITEM_DISPLAY); - - if (!nbtTagCompound.hasKey(Strings.NBT_ITEM_DISPLAY)) - { - nbtTagCompound.setCompoundTag(Strings.NBT_ITEM_DISPLAY, colourTagCompound); - } - - colourTagCompound.setInteger(Strings.NBT_ITEM_COLOR, color); - } - } - - public static Comparator comparator = new Comparator() - { - public int compare(ItemStack itemStack1, ItemStack itemStack2) - { - if (itemStack1 != null && itemStack2 != null) - { - // Sort on itemID - if (itemStack1.itemID == itemStack2.itemID) - { - - // Then sort on meta - if (itemStack1.getItemDamage() == itemStack2.getItemDamage()) - { - - // Then sort on NBT - if (itemStack1.hasTagCompound() && itemStack2.hasTagCompound()) - { - - // Then sort on stack size - if (itemStack1.getTagCompound().equals(itemStack2.getTagCompound())) - { - return (itemStack1.stackSize - itemStack2.stackSize); - } - else - { - return (itemStack1.getTagCompound().hashCode() - itemStack2.getTagCompound().hashCode()); - } - } - else if (!(itemStack1.hasTagCompound()) && itemStack2.hasTagCompound()) - { - return -1; - } - else if (itemStack1.hasTagCompound() && !(itemStack2.hasTagCompound())) - { - return 1; - } - else - { - return (itemStack1.stackSize - itemStack2.stackSize); - } - } - else - { - return (itemStack1.getItemDamage() - itemStack2.getItemDamage()); - } - } - else - { - return (itemStack1.itemID - itemStack2.itemID); - } - } - else if (itemStack1 != null && itemStack2 == null) - { - return -1; - } - else if (itemStack1 == null && itemStack2 != null) - { - return 1; - } - else - { - return 0; - } - } - }; -} diff --git a/src/main/java/com/pahimar/ee3/helper/RecipeHelper.java b/src/main/java/com/pahimar/ee3/helper/RecipeHelper.java deleted file mode 100644 index 0fda0ca1..00000000 --- a/src/main/java/com/pahimar/ee3/helper/RecipeHelper.java +++ /dev/null @@ -1,222 +0,0 @@ -package com.pahimar.ee3.helper; - -import com.pahimar.ee3.api.EnergyStack; -import com.pahimar.ee3.api.OreStack; -import com.pahimar.ee3.api.WrappedStack; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * Equivalent-Exchange-3 - *

- * RecipeHelper - * - * @author pahimar - */ -public class RecipeHelper -{ - - /** - * Returns a list of elements that constitute the input in a crafting recipe - * - * @param recipe - * The IRecipe being examined - * - * @return List of elements that constitute the input of the given IRecipe. Could be an ItemStack or an Arraylist - */ - public static ArrayList getRecipeInputs(IRecipe recipe) - { - - ArrayList recipeInputs = new ArrayList(); - - if (recipe instanceof ShapedRecipes) - { - - ShapedRecipes shapedRecipe = (ShapedRecipes) recipe; - - for (int i = 0; i < shapedRecipe.recipeItems.length; i++) - { - - if (shapedRecipe.recipeItems[i] instanceof ItemStack) - { - - ItemStack itemStack = shapedRecipe.recipeItems[i].copy(); - - if (itemStack.stackSize > 1) - { - itemStack.stackSize = 1; - } - - recipeInputs.add(new WrappedStack(itemStack)); - } - } - } - else if (recipe instanceof ShapelessRecipes) - { - - ShapelessRecipes shapelessRecipe = (ShapelessRecipes) recipe; - - for (Object object : shapelessRecipe.recipeItems) - { - - if (object instanceof ItemStack) - { - - ItemStack itemStack = ((ItemStack) object).copy(); - - if (itemStack.stackSize > 1) - { - itemStack.stackSize = 1; - } - - recipeInputs.add(new WrappedStack(itemStack)); - } - } - } - else if (recipe instanceof ShapedOreRecipe) - { - - ShapedOreRecipe shapedOreRecipe = (ShapedOreRecipe) recipe; - - for (int i = 0; i < shapedOreRecipe.getInput().length; i++) - { - - /* - * If the element is a list, then it is an OreStack - */ - if (shapedOreRecipe.getInput()[i] instanceof ArrayList) - { - WrappedStack oreStack = new WrappedStack(shapedOreRecipe.getInput()[i]); - - if (oreStack.getWrappedStack() instanceof OreStack) - { - recipeInputs.add(oreStack); - } - } - else if (shapedOreRecipe.getInput()[i] instanceof ItemStack) - { - - ItemStack itemStack = ((ItemStack) shapedOreRecipe.getInput()[i]).copy(); - - if (itemStack.stackSize > 1) - { - itemStack.stackSize = 1; - } - - recipeInputs.add(new WrappedStack(itemStack)); - } - } - } - else if (recipe instanceof ShapelessOreRecipe) - { - - ShapelessOreRecipe shapelessOreRecipe = (ShapelessOreRecipe) recipe; - - for (Object object : shapelessOreRecipe.getInput()) - { - - if (object instanceof ArrayList) - { - recipeInputs.add(new WrappedStack(object)); - } - else if (object instanceof ItemStack) - { - - ItemStack itemStack = ((ItemStack) object).copy(); - - if (itemStack.stackSize > 1) - { - itemStack.stackSize = 1; - } - - recipeInputs.add(new WrappedStack(itemStack)); - } - } - } - - return recipeInputs; - } - - /** - * Collates an uncollated, unsorted List of Objects into a sorted, collated List of WrappedStacks - * - * @param uncollatedStacks - * List of objects for collating - * - * @return A sorted, collated List of WrappedStacks - */ - public static List collateInputStacks(List uncollatedStacks) - { - - List collatedStacks = new ArrayList(); - - WrappedStack stack; - boolean found; - - for (Object object : uncollatedStacks) - { - - found = false; - - if (WrappedStack.canBeWrapped(object)) - { - - stack = new WrappedStack(object); - - if (collatedStacks.isEmpty()) - { - collatedStacks.add(stack); - } - else - { - - for (WrappedStack collatedStack : collatedStacks) - { - if (collatedStack.getWrappedStack() != null) - { - if (stack.getWrappedStack() instanceof ItemStack && collatedStack.getWrappedStack() instanceof ItemStack) - { - if (ItemHelper.equals((ItemStack) stack.getWrappedStack(), (ItemStack) collatedStack.getWrappedStack())) - { - collatedStack.setStackSize(collatedStack.getStackSize() + stack.getStackSize()); - found = true; - } - } - else if (stack.getWrappedStack() instanceof OreStack && collatedStack.getWrappedStack() instanceof OreStack) - { - if (OreStack.compareOreNames((OreStack) stack.getWrappedStack(), (OreStack) collatedStack.getWrappedStack())) - { - collatedStack.setStackSize(collatedStack.getStackSize() + stack.getStackSize()); - found = true; - } - } - else if (stack.getWrappedStack() instanceof EnergyStack && collatedStack.getWrappedStack() instanceof EnergyStack) - { - if (EnergyStack.compareEnergyNames((EnergyStack) stack.getWrappedStack(), (EnergyStack) collatedStack.getWrappedStack())) - { - collatedStack.setStackSize(collatedStack.getStackSize() + stack.getStackSize()); - found = true; - } - } - } - } - - if (!found) - { - collatedStacks.add(stack); - } - } - } - } - Collections.sort(collatedStacks); - return collatedStacks; - } -} diff --git a/src/main/java/com/pahimar/ee3/helper/ResourceLocationHelper.java b/src/main/java/com/pahimar/ee3/helper/ResourceLocationHelper.java deleted file mode 100644 index 47676f07..00000000 --- a/src/main/java/com/pahimar/ee3/helper/ResourceLocationHelper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.pahimar.ee3.helper; - -import com.pahimar.ee3.lib.Reference; -import net.minecraft.util.ResourceLocation; - -public class ResourceLocationHelper -{ - public static ResourceLocation getResourceLocation(String modId, String path) - { - return new ResourceLocation(modId, path); - } - - public static ResourceLocation getResourceLocation(String path) - { - return getResourceLocation(Reference.MOD_ID.toLowerCase(), path); - } -} diff --git a/src/main/java/com/pahimar/ee3/helper/TransmutationHelper.java b/src/main/java/com/pahimar/ee3/helper/TransmutationHelper.java deleted file mode 100644 index 5f0ff463..00000000 --- a/src/main/java/com/pahimar/ee3/helper/TransmutationHelper.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.pahimar.ee3.helper; - -import com.pahimar.ee3.handler.EquivalencyHandler; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import java.util.ArrayList; - -/** - * Equivalent-Exchange-3 - *

- * TransmutationHelper - * - * @author pahimar - */ -public class TransmutationHelper -{ - - public static ItemStack previousBlockStack = null; - public static ItemStack currentBlockStack = null; - public static ItemStack targetBlockStack = null; - - public static boolean transmuteInWorld(World world, EntityPlayer player, ItemStack stack, int x, int y, int z, int targetID, int targetMeta) - { - - if (Block.blocksList[targetID] != null) - { - world.setBlock(x, y, z, targetID, targetMeta, 2); - return true; - } - - return false; - } - - public static String formatTargetBlockInfo(ItemStack targetBlock) - { - - if (targetBlock != null) - { - return TransmutationHelper.targetBlockStack.itemID + ":" + TransmutationHelper.targetBlockStack.getItemDamage(); - } - else - { - return ""; - } - } - - public static void updateTargetBlock(World world, int x, int y, int z) - { - - int id = world.getBlockId(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - Block currentBlock = Block.blocksList[id]; - - if (currentBlock != null) - { - meta = currentBlock.damageDropped(meta); - - currentBlockStack = new ItemStack(id, 1, meta); - - if (previousBlockStack == null) - { - previousBlockStack = currentBlockStack; - targetBlockStack = getNextBlock(currentBlockStack.itemID, currentBlockStack.getItemDamage()); - } - else - { - if (!EquivalencyHandler.instance().areEquivalent(TransmutationHelper.previousBlockStack, currentBlockStack)) - { - previousBlockStack = currentBlockStack; - targetBlockStack = getNextBlock(currentBlockStack.itemID, currentBlockStack.getItemDamage()); - } - } - } - } - - public static ItemStack getNextBlock(int id, int meta) - { - - ArrayList list = EquivalencyHandler.instance().getEquivalencyList(id, meta); - - ItemStack nextStack = null; - - if (list != null) - { - return getNextBlock(id, meta, id, meta); - } - return nextStack; - } - - private static ItemStack getNextBlock(int id, int meta, int origId, int origMeta) - { - - ArrayList list = EquivalencyHandler.instance().getEquivalencyList(id, meta); - - ItemStack nextStack = null; - - if (list != null) - { - nextStack = EquivalencyHandler.instance().getNextInList(id, meta); - nextStack.stackSize = 1; - - /* - * If the current item is the same as the original one we started - * with, then we have recursed through the entire list and not found - * a next block so return the original. This is the "base case" for - * the recursion. - */ - if (nextStack.itemID == origId && nextStack.getItemDamage() == origMeta) - { - return nextStack; - } - else - { - if (nextStack.getItem() instanceof ItemBlock) - { - return nextStack; - } - else - { - return getNextBlock(nextStack.itemID, nextStack.getItemDamage(), origId, origMeta); - } - } - } - - // In the event the list is null, return null - return nextStack; - } - - public static ItemStack getPreviousBlock(int itemID, int meta) - { - - ArrayList list = EquivalencyHandler.instance().getEquivalencyList(itemID, meta); - - ItemStack prevStack = null; - - if (list != null) - { - return getPreviousBlock(itemID, meta, itemID, meta); - } - return prevStack; - } - - private static ItemStack getPreviousBlock(int id, int meta, int origId, int origMeta) - { - - ArrayList list = EquivalencyHandler.instance().getEquivalencyList(id, meta); - - ItemStack prevStack = null; - if (list != null) - { - prevStack = EquivalencyHandler.instance().getPrevInList(id, meta); - prevStack.stackSize = 1; - - if (prevStack.itemID == origId && prevStack.getItemDamage() == origMeta) - { - return prevStack; - } - else - { - if (prevStack.getItem() instanceof ItemBlock) - { - return prevStack; - } - else - { - return getPreviousBlock(prevStack.itemID, prevStack.getItemDamage(), origId, origMeta); - } - } - } - - // In the event the list is null, return null - return prevStack; - } -} diff --git a/src/main/java/com/pahimar/ee3/helper/VersionHelper.java b/src/main/java/com/pahimar/ee3/helper/VersionHelper.java deleted file mode 100644 index e19100f5..00000000 --- a/src/main/java/com/pahimar/ee3/helper/VersionHelper.java +++ /dev/null @@ -1,235 +0,0 @@ -package com.pahimar.ee3.helper; - -import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.configuration.GeneralConfiguration; -import com.pahimar.ee3.lib.Colours; -import com.pahimar.ee3.lib.Reference; -import com.pahimar.ee3.lib.Strings; -import cpw.mods.fml.common.Loader; -import net.minecraft.util.StatCollector; - -import java.io.InputStream; -import java.net.URL; -import java.util.Properties; - -/** - * Equivalent-Exchange-3 - *

- * VersionHelper - * - * @author pahimar - */ -public class VersionHelper implements Runnable -{ - - // TODO Switch how versions are looked up from xml to json (for changelog support) - - // All possible results of the remote version number check - public static final byte UNINITIALIZED = 0; - // Var to hold the result of the remote version check, initially set to uninitialized - private static byte result = UNINITIALIZED; - public static final byte CURRENT = 1; - public static final byte OUTDATED = 2; - public static final byte ERROR = 3; - public static final byte FINAL_ERROR = 4; - public static final byte MC_VERSION_NOT_FOUND = 5; - // The (publicly available) remote version number authority file - private static final String REMOTE_VERSION_XML_FILE = "https://raw.github.com/pahimar/Equivalent-Exchange-3/master/version.xml"; - public static Properties remoteVersionProperties = new Properties(); - public static String remoteVersion = null; - public static String remoteUpdateLocation = null; - private static VersionHelper instance = new VersionHelper(); - - /** - * Checks the version of the currently running instance of the mod against the remote version authority, and sets - * the result of the check appropriately - */ - public static void checkVersion() - { - - InputStream remoteVersionRepoStream = null; - result = UNINITIALIZED; - - try - { - URL remoteVersionURL = new URL(REMOTE_VERSION_XML_FILE); - remoteVersionRepoStream = remoteVersionURL.openStream(); - remoteVersionProperties.loadFromXML(remoteVersionRepoStream); - - String remoteVersionProperty = remoteVersionProperties.getProperty(Loader.instance().getMCVersionString()); - - if (remoteVersionProperty != null) - { - String[] remoteVersionTokens = remoteVersionProperty.split("\\|"); - - if (remoteVersionTokens.length >= 2) - { - remoteVersion = remoteVersionTokens[0]; - remoteUpdateLocation = remoteVersionTokens[1]; - } - else - { - result = ERROR; - } - - if (remoteVersion != null) - { - if (!ConfigurationSettings.LAST_DISCOVERED_VERSION.equalsIgnoreCase(remoteVersion)) - { - GeneralConfiguration.set(Configuration.CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_CONFIGNAME, remoteVersion); - } - - if (remoteVersion.equalsIgnoreCase(getVersionForCheck())) - { - result = CURRENT; - } - else - { - result = OUTDATED; - } - } - } - else - { - result = MC_VERSION_NOT_FOUND; - } - } - catch (Exception e) - { - // NOOP - } - finally - { - if (result == UNINITIALIZED) - { - result = ERROR; - } - - try - { - if (remoteVersionRepoStream != null) - { - remoteVersionRepoStream.close(); - } - } - catch (Exception ex) - { - // NOOP - } - } - } - - private static String getVersionForCheck() - { - - String[] versionTokens = Reference.VERSION_NUMBER.split(" "); - - if (versionTokens.length >= 1) - { - return versionTokens[0]; - } - else - { - return Reference.VERSION_NUMBER; - } - } - - public static void logResult() - { - - if (result == CURRENT || result == OUTDATED) - { - LogHelper.info(getResultMessage()); - } - else - { - LogHelper.warn(getResultMessage()); - } - } - - public static String getResultMessage() - { - - if (result == UNINITIALIZED) - { - return StatCollector.translateToLocal(Strings.UNINITIALIZED_MESSAGE); - } - else if (result == CURRENT) - { - return StatCollector.translateToLocalFormatted(Strings.CURRENT_MESSAGE, Reference.MOD_NAME, Loader.instance().getMCVersionString()); - } - else if (result == OUTDATED && remoteVersion != null && remoteUpdateLocation != null) - { - return StatCollector.translateToLocalFormatted(Strings.OUTDATED_MESSAGE, Reference.MOD_NAME, remoteVersion, Loader.instance().getMCVersionString(), remoteUpdateLocation); - } - else if (result == ERROR) - { - return StatCollector.translateToLocal(Strings.GENERAL_ERROR_MESSAGE); - } - else if (result == FINAL_ERROR) - { - return StatCollector.translateToLocal(Strings.FINAL_ERROR_MESSAGE); - } - else if (result == MC_VERSION_NOT_FOUND) - { - return StatCollector.translateToLocalFormatted(Strings.MC_VERSION_NOT_FOUND, Reference.MOD_NAME, Loader.instance().getMCVersionString()); - } - else - { - result = ERROR; - return StatCollector.translateToLocal(Strings.GENERAL_ERROR_MESSAGE); - } - } - - public static String getResultMessageForClient() - { - - return StatCollector.translateToLocalFormatted(Strings.OUTDATED_MESSAGE, Colours.TEXT_COLOUR_PREFIX_YELLOW + Reference.MOD_NAME + Colours.TEXT_COLOUR_PREFIX_WHITE, Colours.TEXT_COLOUR_PREFIX_YELLOW + VersionHelper.remoteVersion + Colours.TEXT_COLOUR_PREFIX_WHITE, Colours.TEXT_COLOUR_PREFIX_YELLOW + Loader.instance().getMCVersionString() + Colours.TEXT_COLOUR_PREFIX_WHITE, Colours.TEXT_COLOUR_PREFIX_YELLOW + VersionHelper.remoteUpdateLocation + Colours.TEXT_COLOUR_PREFIX_WHITE); - } - - public static byte getResult() - { - - return result; - } - - public static void execute() - { - new Thread(instance).start(); - } - - @Override - public void run() - { - - int count = 0; - - LogHelper.info(StatCollector.translateToLocalFormatted(Strings.VERSION_CHECK_INIT_LOG_MESSAGE, REMOTE_VERSION_XML_FILE)); - - try - { - while (count < Reference.VERSION_CHECK_ATTEMPTS - 1 && (result == UNINITIALIZED || result == ERROR)) - { - - checkVersion(); - count++; - logResult(); - - if (result == UNINITIALIZED || result == ERROR) - { - Thread.sleep(10000); - } - } - - if (result == ERROR) - { - result = FINAL_ERROR; - logResult(); - } - } - catch (InterruptedException e) - { - e.printStackTrace(); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/imc/InterModCommsHandler.java b/src/main/java/com/pahimar/ee3/imc/InterModCommsHandler.java deleted file mode 100644 index 286aca84..00000000 --- a/src/main/java/com/pahimar/ee3/imc/InterModCommsHandler.java +++ /dev/null @@ -1,329 +0,0 @@ -package com.pahimar.ee3.imc; - -import com.google.common.collect.ImmutableList; -import com.google.gson.Gson; -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.api.OreStack; -import com.pahimar.ee3.api.RecipeMapping; -import com.pahimar.ee3.api.StackValueMapping; -import com.pahimar.ee3.api.WrappedStack; -import com.pahimar.ee3.emc.EmcRegistry; -import com.pahimar.ee3.emc.EmcValue; -import com.pahimar.ee3.emc.EmcValuesIMC; -import com.pahimar.ee3.lib.Reference; -import com.pahimar.ee3.recipe.RecipesIMC; -import cpw.mods.fml.common.event.FMLInterModComms; -import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent; -import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.EnumSet; -import java.util.List; - -public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler -{ - private static Gson gson = new Gson(); - - // TODO Logging - - public static void processIMCMessages(IMCEvent event) - { - for (IMCMessage imcMessage : event.getMessages()) - { - processIMCMessage(imcMessage); - } - } - - public static void processIMCMessage(IMCMessage imcMessage) - { - String requestedOperation = imcMessage.key; - - if (requestedOperation.equalsIgnoreCase(InterModCommsOperations.RECIPE_ADD)) - { - processAddRecipeMessage(imcMessage); - } - else if (requestedOperation.equalsIgnoreCase(InterModCommsOperations.EMC_ASSIGN_VALUE_PRE)) - { - processPreAssignEmcValueMessage(imcMessage); - } - else if (requestedOperation.equalsIgnoreCase(InterModCommsOperations.EMC_ASSIGN_VALUE_POST)) - { - processPostAssignEmcValueMessage(imcMessage); - } - else if (requestedOperation.equalsIgnoreCase(InterModCommsOperations.EMC_HAS_VALUE)) - { - processHasEmcValueMessage(imcMessage); - } - else if (requestedOperation.equalsIgnoreCase(InterModCommsOperations.EMC_GET_VALUE)) - { - processGetEmcValueMessage(imcMessage); - } - else if (requestedOperation.equalsIgnoreCase(InterModCommsOperations.EMC_SIMPLE_ASSIGN_VALUE_PRE)) - { - processSimplePreAssignEmcValueMessage(imcMessage); - } - else if (requestedOperation.equalsIgnoreCase(InterModCommsOperations.EMC_SIMPLE_ASSIGN_VALUE_POST)) - { - processSimplePostAssignEmcValueMessage(imcMessage); - } - } - - private static void processAddRecipeMessage(IMCMessage imcMessage) - { - if (imcMessage.getMessageType() == String.class) - { - RecipeMapping recipeMapping = RecipeMapping.createFromJson(imcMessage.getStringValue()); - - if (recipeMapping != null) - { - - WrappedStack outputWrappedStack = recipeMapping.outputWrappedStack; - List inputWrappedStacks = recipeMapping.inputWrappedStacks; - - RecipesIMC.addRecipe(outputWrappedStack, inputWrappedStacks); - } - else - { - // TODO Log that the message payloads json was invalid - } - } - else - { - // TODO Log that the message payload is of an invalid type - } - } - - private static void processPreAssignEmcValueMessage(IMCMessage imcMessage) - { - if (imcMessage.getMessageType() == String.class) - { - StackValueMapping stackValueMapping = StackValueMapping.createFromJson(imcMessage.getStringValue()); - - if (stackValueMapping != null) - { - WrappedStack wrappedStack = stackValueMapping.wrappedStack; - EmcValue emcValue = new EmcValue(stackValueMapping.emcValue.getValue()); - - EmcValuesIMC.addPreAssignedValued(wrappedStack, emcValue); - } - else - { - // TODO Log that the message payloads json was invalid - } - } - else - { - // TODO Log that the message payload is of an invalid type - } - } - - private static void processPostAssignEmcValueMessage(IMCMessage imcMessage) - { - if (imcMessage.getMessageType() == String.class) - { - StackValueMapping stackValueMapping = StackValueMapping.createFromJson(imcMessage.getStringValue()); - - if (stackValueMapping != null) - { - WrappedStack wrappedStack = stackValueMapping.wrappedStack; - EmcValue emcValue = new EmcValue(stackValueMapping.emcValue.getValue()); - - EmcValuesIMC.addPostAssignedValued(wrappedStack, emcValue); - } - else - { - // TODO Log that the message payloads json was invalid - } - } - else - { - // TODO Log that the message payload is of an invalid type - } - } - - private static void processHasEmcValueMessage(IMCMessage imcMessage) - { - if (imcMessage.getMessageType() == String.class) - { - WrappedStack wrappedStack = WrappedStack.createFromJson(imcMessage.getStringValue()); - - if (wrappedStack != null) - { - FMLInterModComms.sendRuntimeMessage( - EquivalentExchange3.instance, - imcMessage.getSender(), - InterModCommsOperations.EMC_RETURN_HAS_VALUE, - String.format("%s==%s", imcMessage.getStringValue(), String.valueOf(EmcRegistry.getInstance().hasEmcValue(wrappedStack)))); - } - else - { - // TODO Log that the message payloads json was invalid - } - } - else if (imcMessage.getMessageType() == ItemStack.class) - { - ItemStack itemStack = imcMessage.getItemStackValue(); - - if (itemStack != null) - { - FMLInterModComms.sendRuntimeMessage( - EquivalentExchange3.instance, - imcMessage.getSender(), - InterModCommsOperations.EMC_RETURN_HAS_VALUE, - String.format("%s==%s", gson.toJson(itemStack), String.valueOf(EmcRegistry.getInstance().hasEmcValue(itemStack)))); - } - else - { - // TODO Logging - } - } - else - { - // TODO Log that the message payload is of an invalid type - } - } - - private static void processGetEmcValueMessage(IMCMessage imcMessage) - { - if (imcMessage.getMessageType() == String.class) - { - WrappedStack wrappedStack = WrappedStack.createFromJson(imcMessage.getStringValue()); - - if (wrappedStack != null) - { - FMLInterModComms.sendRuntimeMessage( - EquivalentExchange3.instance, - imcMessage.getSender(), - InterModCommsOperations.EMC_RETURN_GET_VALUE, - String.format("%s==%s", imcMessage.getStringValue(), EmcRegistry.getInstance().getEmcValue(wrappedStack).toJson())); - } - else - { - // TODO Log that the message payloads json was invalid - } - } - else if (imcMessage.getMessageType() == ItemStack.class) - { - /* - * Reply back to the mod that queried for the existance of an EmcValue for the given ItemStack - */ - ItemStack itemStack = imcMessage.getItemStackValue(); - - FMLInterModComms.sendRuntimeMessage( - EquivalentExchange3.instance, - imcMessage.getSender(), - InterModCommsOperations.EMC_RETURN_GET_VALUE, - String.format("%s==%s", gson.toJson(itemStack), EmcRegistry.getInstance().getEmcValue(itemStack).toJson())); - } - else - { - // TODO Log that the message payload is of an invalid type - } - } - - private static void processSimplePreAssignEmcValueMessage(IMCMessage imcMessage) - { - NBTTagCompound tagCompound = imcMessage.getNBTValue(); - if (tagCompound.hasKey("emcValue")) - { - WrappedStack wrappedStack; - EmcValue emcValue = new EmcValue(tagCompound.getFloat("emcValue")); - - if (tagCompound.hasKey("itemStack")) - { - wrappedStack = new WrappedStack(ItemStack.loadItemStackFromNBT(tagCompound.getCompoundTag("itemStack"))); - } - else if (tagCompound.hasKey("oreName")) - { - wrappedStack = new WrappedStack(new OreStack(tagCompound.getString("oreName"))); - } - else - { - // TODO log that the message didn't contain either a itemstack or a ore dictionary name - return; - } - - EmcValuesIMC.addPreAssignedValued(wrappedStack, emcValue); - } - else - { - // TODO log that no EMC value was sent in the message - } - } - - private static void processSimplePostAssignEmcValueMessage(IMCMessage imcMessage) - { - NBTTagCompound tagCompound = imcMessage.getNBTValue(); - if (tagCompound.hasKey("emcValue")) - { - WrappedStack wrappedStack; - EmcValue emcValue = new EmcValue(tagCompound.getFloat("emcValue")); - - if (tagCompound.hasKey("itemStack")) - { - wrappedStack = new WrappedStack(ItemStack.loadItemStackFromNBT(tagCompound.getCompoundTag("itemStack"))); - } - else if (tagCompound.hasKey("oreName")) - { - wrappedStack = new WrappedStack(new OreStack(tagCompound.getString("oreName"))); - } - else - { - // TODO log that the message didn't contain either a itemstack or a ore dictionary name - return; - } - - EmcValuesIMC.addPostAssignedValued(wrappedStack, emcValue); - } - else - { - // TODO log that no EMC value was sent in the message - } - } - - /** - * Runtime fetching and processing of IMC messages - */ - @Override - public void tickStart(EnumSet type, Object... tickData) - { - - } - - @Override - public void tickEnd(EnumSet type, Object... tickData) - { - for (TickType tickType : type) - { - if (tickType == TickType.SERVER) - { - ImmutableList runtimeIMCMessages = FMLInterModComms.fetchRuntimeMessages(EquivalentExchange3.instance); - - for (IMCMessage imcMessage : runtimeIMCMessages) - { - InterModCommsHandler.processIMCMessage(imcMessage); - } - } - } - } - - @Override - public EnumSet ticks() - { - return EnumSet.of(TickType.SERVER); - } - - @Override - public String getLabel() - { - return Reference.MOD_NAME + ": " + this.getClass().getSimpleName(); - } - - @Override - public int nextTickSpacing() - { - - return Reference.ONE_SECOND_IN_TICKS; - } -} diff --git a/src/main/java/com/pahimar/ee3/imc/InterModCommsOperations.java b/src/main/java/com/pahimar/ee3/imc/InterModCommsOperations.java deleted file mode 100644 index dddc8599..00000000 --- a/src/main/java/com/pahimar/ee3/imc/InterModCommsOperations.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.pahimar.ee3.imc; - -public class InterModCommsOperations -{ - - // Interacting with the Recipe Registry - public static final String RECIPE_ADD = "recipe-add"; - - // Interacting with the EMC value mappings - public static final String EMC_ASSIGN_VALUE_PRE = "emc-assign-value-pre"; - public static final String EMC_ASSIGN_VALUE_POST = "emc-assign-value-post"; - public static final String EMC_HAS_VALUE = "emc-has-value"; - public static final String EMC_RETURN_HAS_VALUE = "emc-return-has-value"; - public static final String EMC_GET_VALUE = "emc-get-value"; - public static final String EMC_RETURN_GET_VALUE = "emc-return-get-value"; - public static final String EMC_SIMPLE_ASSIGN_VALUE_PRE = "emc-simple-assign-value-pre"; - public static final String EMC_SIMPLE_ASSIGN_VALUE_POST = "emc-simple-assign-value-post"; -} diff --git a/src/main/java/com/pahimar/ee3/inventory/ContainerAlchemicalBag.java b/src/main/java/com/pahimar/ee3/inventory/ContainerAlchemicalBag.java deleted file mode 100644 index e503665b..00000000 --- a/src/main/java/com/pahimar/ee3/inventory/ContainerAlchemicalBag.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.pahimar.ee3.inventory; - -import com.pahimar.ee3.helper.ItemStackNBTHelper; -import com.pahimar.ee3.item.ItemAlchemicalBag; -import com.pahimar.ee3.lib.Strings; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -/** - * Equivalent-Exchange-3 - *

- * ContainerAlchemicalBag - * - * @author pahimar - */ -public class ContainerAlchemicalBag extends Container -{ - private final EntityPlayer entityPlayer; - private final InventoryAlchemicalBag inventoryAlchemicalBag; - - private int bagInventoryRows; - private int bagInventoryColumns; - - // Small Bag - public static final int SMALL_BAG_INVENTORY_ROWS = 4; - public static final int SMALL_BAG_INVENTORY_COLUMNS = 12; - - // Medium Bag - public static final int MEDIUM_BAG_INVENTORY_ROWS = 7; - public static final int MEDIUM_BAG_INVENTORY_COLUMNS = 12; - - // Large Bag - public static final int LARGE_BAG_INVENTORY_ROWS = 9; - public static final int LARGE_BAG_INVENTORY_COLUMNS = 13; - - // Player Inventory - private final int PLAYER_INVENTORY_ROWS = 3; - private final int PLAYER_INVENTORY_COLUMNS = 9; - - public ContainerAlchemicalBag(EntityPlayer entityPlayer, InventoryAlchemicalBag inventoryAlchemicalBag) - { - this.entityPlayer = entityPlayer; - this.inventoryAlchemicalBag = inventoryAlchemicalBag; - - if (inventoryAlchemicalBag.parentItemStack.getItemDamage() == 0) - { - bagInventoryRows = SMALL_BAG_INVENTORY_ROWS; - bagInventoryColumns = SMALL_BAG_INVENTORY_COLUMNS; - } - else if (inventoryAlchemicalBag.parentItemStack.getItemDamage() == 1) - { - bagInventoryRows = MEDIUM_BAG_INVENTORY_ROWS; - bagInventoryColumns = MEDIUM_BAG_INVENTORY_COLUMNS; - } - else if (inventoryAlchemicalBag.parentItemStack.getItemDamage() == 2) - { - bagInventoryRows = LARGE_BAG_INVENTORY_ROWS; - bagInventoryColumns = LARGE_BAG_INVENTORY_COLUMNS; - } - - // Add the Alchemical Chest slots to the container - for (int bagRowIndex = 0; bagRowIndex < bagInventoryRows; ++bagRowIndex) - { - for (int bagColumnIndex = 0; bagColumnIndex < bagInventoryColumns; ++bagColumnIndex) - { - if (inventoryAlchemicalBag.parentItemStack.getItemDamage() == 0) - { - this.addSlotToContainer(new SlotAlchemicalBag(this, inventoryAlchemicalBag, entityPlayer, bagColumnIndex + bagRowIndex * bagInventoryColumns, 8 + bagColumnIndex * 18, 18 + bagRowIndex * 18)); - } - else if (inventoryAlchemicalBag.parentItemStack.getItemDamage() == 1) - { - this.addSlotToContainer(new SlotAlchemicalBag(this, inventoryAlchemicalBag, entityPlayer, bagColumnIndex + bagRowIndex * bagInventoryColumns, 8 + bagColumnIndex * 18, 18 + bagRowIndex * 18)); - } - else if (inventoryAlchemicalBag.parentItemStack.getItemDamage() == 2) - { - this.addSlotToContainer(new SlotAlchemicalBag(this, inventoryAlchemicalBag, entityPlayer, bagColumnIndex + bagRowIndex * bagInventoryColumns, 8 + bagColumnIndex * 18, 8 + bagRowIndex * 18)); - } - } - } - - // Add the player's inventory slots to the container - for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex) - { - for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex) - { - if (inventoryAlchemicalBag.parentItemStack.getItemDamage() == 0) - { - this.addSlotToContainer(new Slot(entityPlayer.inventory, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 35 + inventoryColumnIndex * 18, 104 + inventoryRowIndex * 18)); - } - else if (inventoryAlchemicalBag.parentItemStack.getItemDamage() == 1) - { - this.addSlotToContainer(new Slot(entityPlayer.inventory, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 35 + inventoryColumnIndex * 18, 158 + inventoryRowIndex * 18)); - } - else if (inventoryAlchemicalBag.parentItemStack.getItemDamage() == 2) - { - this.addSlotToContainer(new Slot(entityPlayer.inventory, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 44 + inventoryColumnIndex * 18, 174 + inventoryRowIndex * 18)); - } - } - } - - // Add the player's action bar slots to the container - for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex) - { - if (inventoryAlchemicalBag.parentItemStack.getItemDamage() == 0) - { - this.addSlotToContainer(new Slot(entityPlayer.inventory, actionBarSlotIndex, 35 + actionBarSlotIndex * 18, 162)); - } - else if (inventoryAlchemicalBag.parentItemStack.getItemDamage() == 1) - { - this.addSlotToContainer(new Slot(entityPlayer.inventory, actionBarSlotIndex, 35 + actionBarSlotIndex * 18, 216)); - } - else if (inventoryAlchemicalBag.parentItemStack.getItemDamage() == 2) - { - this.addSlotToContainer(new Slot(entityPlayer.inventory, actionBarSlotIndex, 44 + actionBarSlotIndex * 18, 232)); - } - } - } - - @Override - public boolean canInteractWith(EntityPlayer var1) - { - return true; - } - - @Override - public void onContainerClosed(EntityPlayer entityPlayer) - { - super.onContainerClosed(entityPlayer); - - if (!entityPlayer.worldObj.isRemote) - { - // We can probably do this better now considering the InventoryAlchemicalBag has a findParent method - InventoryPlayer invPlayer = entityPlayer.inventory; - for (ItemStack itemStack : invPlayer.mainInventory) - { - if (itemStack != null) - { - if (ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) - { - ItemStackNBTHelper.removeTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN); - } - } - } - - saveInventory(entityPlayer); - } - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) - { - ItemStack newItemStack = null; - Slot slot = (Slot) inventorySlots.get(slotIndex); - - if (slot != null && slot.getHasStack()) - { - ItemStack itemStack = slot.getStack(); - newItemStack = itemStack.copy(); - - // Attempt to shift click something from the bag inventory into the player inventory - if (slotIndex < bagInventoryRows * bagInventoryColumns) - { - if (!this.mergeItemStack(itemStack, bagInventoryRows * bagInventoryColumns, inventorySlots.size(), false)) - { - return null; - } - } - // Special case if we are dealing with an Alchemical Bag being shift clicked - else if (itemStack.getItem() instanceof ItemAlchemicalBag) - { - // Attempt to shift click a bag from the player inventory into the hot bar inventory - if (slotIndex < (bagInventoryRows * bagInventoryColumns) + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS)) - { - if (!this.mergeItemStack(itemStack, (bagInventoryRows * bagInventoryColumns) + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS), inventorySlots.size(), false)) - { - return null; - } - } - // Attempt to shift click a bag from the hot bar inventory into the player inventory - else if (!this.mergeItemStack(itemStack, bagInventoryRows * bagInventoryColumns, (bagInventoryRows * bagInventoryColumns) + (PLAYER_INVENTORY_ROWS * PLAYER_INVENTORY_COLUMNS), false)) - { - return null; - } - } - // Attempt to shift click a non-Alchemical Bag into the bag inventory - else if (!this.mergeItemStack(itemStack, 0, bagInventoryRows * bagInventoryColumns, false)) - { - return null; - } - - - if (itemStack.stackSize == 0) - { - slot.putStack(null); - } - else - { - slot.onSlotChanged(); - } - } - - return newItemStack; - } - - public void saveInventory(EntityPlayer entityPlayer) - { - inventoryAlchemicalBag.onGuiSaved(entityPlayer); - } -} diff --git a/src/main/java/com/pahimar/ee3/inventory/ContainerAlchemicalChest.java b/src/main/java/com/pahimar/ee3/inventory/ContainerAlchemicalChest.java deleted file mode 100644 index dd74ad7c..00000000 --- a/src/main/java/com/pahimar/ee3/inventory/ContainerAlchemicalChest.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.pahimar.ee3.inventory; - -import com.pahimar.ee3.tileentity.TileAlchemicalChest; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -/** - * Equivalent-Exchange-3 - *

- * ContainerAlchemicalChest - * - * @author pahimar - */ -public class ContainerAlchemicalChest extends Container -{ - private TileAlchemicalChest tileAlchemicalChest; - - private int chestInventoryRows; - private int chestInventoryColumns; - - // Small Chest - public static final int SMALL_CHEST_INVENTORY_ROWS = 4; - public static final int SMALL_CHEST_INVENTORY_COLUMNS = 12; - public static final int SMALL_INVENTORY_SIZE = SMALL_CHEST_INVENTORY_ROWS * SMALL_CHEST_INVENTORY_COLUMNS; - - // Medium Chest - public static final int MEDIUM_CHEST_INVENTORY_ROWS = 7; - public static final int MEDIUM_CHEST_INVENTORY_COLUMNS = 12; - public static final int MEDIUM_INVENTORY_SIZE = MEDIUM_CHEST_INVENTORY_ROWS * MEDIUM_CHEST_INVENTORY_COLUMNS; - - // Large Chest - public static final int LARGE_CHEST_INVENTORY_ROWS = 9; - public static final int LARGE_CHEST_INVENTORY_COLUMNS = 13; - public static final int LARGE_INVENTORY_SIZE = LARGE_CHEST_INVENTORY_ROWS * LARGE_CHEST_INVENTORY_COLUMNS; - - // Player Inventory - private final int PLAYER_INVENTORY_ROWS = 3; - private final int PLAYER_INVENTORY_COLUMNS = 9; - - public ContainerAlchemicalChest(InventoryPlayer inventoryPlayer, TileAlchemicalChest tileAlchemicalChest) - { - this.tileAlchemicalChest = tileAlchemicalChest; - tileAlchemicalChest.openChest(); - - if (this.tileAlchemicalChest.getState() == 0) - { - chestInventoryRows = SMALL_CHEST_INVENTORY_ROWS; - chestInventoryColumns = SMALL_CHEST_INVENTORY_COLUMNS; - } - else if (this.tileAlchemicalChest.getState() == 1) - { - chestInventoryRows = MEDIUM_CHEST_INVENTORY_ROWS; - chestInventoryColumns = MEDIUM_CHEST_INVENTORY_COLUMNS; - } - else if (this.tileAlchemicalChest.getState() == 2) - { - chestInventoryRows = LARGE_CHEST_INVENTORY_ROWS; - chestInventoryColumns = LARGE_CHEST_INVENTORY_COLUMNS; - } - - // Add the Alchemical Chest slots to the container - for (int chestRowIndex = 0; chestRowIndex < chestInventoryRows; ++chestRowIndex) - { - for (int chestColumnIndex = 0; chestColumnIndex < chestInventoryColumns; ++chestColumnIndex) - { - if (this.tileAlchemicalChest.getState() == 0) - { - this.addSlotToContainer(new Slot(tileAlchemicalChest, chestColumnIndex + chestRowIndex * chestInventoryColumns, 8 + chestColumnIndex * 18, 18 + chestRowIndex * 18)); - } - else if (this.tileAlchemicalChest.getState() == 1) - { - this.addSlotToContainer(new Slot(tileAlchemicalChest, chestColumnIndex + chestRowIndex * chestInventoryColumns, 8 + chestColumnIndex * 18, 18 + chestRowIndex * 18)); - } - else if (this.tileAlchemicalChest.getState() == 2) - { - this.addSlotToContainer(new Slot(tileAlchemicalChest, chestColumnIndex + chestRowIndex * chestInventoryColumns, 8 + chestColumnIndex * 18, 8 + chestRowIndex * 18)); - } - } - } - - // Add the player's inventory slots to the container - for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex) - { - for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex) - { - if (this.tileAlchemicalChest.getState() == 0) - { - this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 35 + inventoryColumnIndex * 18, 104 + inventoryRowIndex * 18)); - } - else if (this.tileAlchemicalChest.getState() == 1) - { - this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 35 + inventoryColumnIndex * 18, 158 + inventoryRowIndex * 18)); - } - else if (this.tileAlchemicalChest.getState() == 2) - { - this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 44 + inventoryColumnIndex * 18, 174 + inventoryRowIndex * 18)); - } - } - } - - // Add the player's action bar slots to the container - for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex) - { - if (this.tileAlchemicalChest.getState() == 0) - { - this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 35 + actionBarSlotIndex * 18, 162)); - } - else if (this.tileAlchemicalChest.getState() == 1) - { - this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 35 + actionBarSlotIndex * 18, 216)); - } - else if (this.tileAlchemicalChest.getState() == 2) - { - this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 44 + actionBarSlotIndex * 18, 232)); - } - } - } - - @Override - public boolean canInteractWith(EntityPlayer var1) - { - return true; - } - - /** - * Callback for when the crafting gui is closed. - */ - @Override - public void onContainerClosed(EntityPlayer entityPlayer) - { - super.onContainerClosed(entityPlayer); - tileAlchemicalChest.closeChest(); - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) - { - ItemStack newItemStack = null; - Slot slot = (Slot) inventorySlots.get(slotIndex); - - if (slot != null && slot.getHasStack()) - { - ItemStack itemStack = slot.getStack(); - newItemStack = itemStack.copy(); - - if (slotIndex < chestInventoryRows * chestInventoryColumns) - { - if (!this.mergeItemStack(itemStack, chestInventoryRows * chestInventoryColumns, inventorySlots.size(), false)) - { - return null; - } - } - else if (!this.mergeItemStack(itemStack, 0, chestInventoryRows * chestInventoryColumns, false)) - { - return null; - } - - if (itemStack.stackSize == 0) - { - slot.putStack(null); - } - else - { - slot.onSlotChanged(); - } - } - - return newItemStack; - } -} diff --git a/src/main/java/com/pahimar/ee3/inventory/ContainerAludel.java b/src/main/java/com/pahimar/ee3/inventory/ContainerAludel.java deleted file mode 100644 index a00b44c7..00000000 --- a/src/main/java/com/pahimar/ee3/inventory/ContainerAludel.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.pahimar.ee3.inventory; - -import com.pahimar.ee3.item.ItemAlchemicalDust; -import com.pahimar.ee3.tileentity.TileAludel; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntityFurnace; - -/** - * Equivalent-Exchange-3 - *

- * ContainerAludel - * - * @author pahimar - */ -public class ContainerAludel extends Container -{ - private TileAludel tileAludel; - private final int PLAYER_INVENTORY_ROWS = 3; - private final int PLAYER_INVENTORY_COLUMNS = 9; - private int lastDeviceCookTime; - private int lastFuelBurnTime; - private int lastItemCookTime; - - public ContainerAludel(InventoryPlayer inventoryPlayer, TileAludel tileAludel) - { - this.tileAludel = tileAludel; - - this.addSlotToContainer(new Slot(tileAludel, TileAludel.FUEL_INVENTORY_INDEX, 44, 74)); - this.addSlotToContainer(new Slot(tileAludel, TileAludel.INPUT_INVENTORY_INDEX, 44, 18)); - this.addSlotToContainer(new Slot(tileAludel, TileAludel.DUST_INVENTORY_INDEX, 44, 39)); - this.addSlotToContainer(new SlotAludelOutput(tileAludel, TileAludel.OUTPUT_INVENTORY_INDEX, 120, 39)); - - // Add the player's inventory slots to the container - for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex) - { - for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex) - { - this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 106 + inventoryRowIndex * 18)); - } - } - - // Add the player's action bar slots to the container - for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex) - { - this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 164)); - } - } - - @Override - public boolean canInteractWith(EntityPlayer var1) - { - return true; - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) - { - ItemStack itemStack = null; - Slot slot = (Slot) inventorySlots.get(slotIndex); - - if (slot != null && slot.getHasStack()) - { - ItemStack slotItemStack = slot.getStack(); - itemStack = slotItemStack.copy(); - - /** - * If we are shift-clicking an item out of the Aludel's container, - * attempt to put it in the first available slot in the player's - * inventory - */ - if (slotIndex < TileAludel.INVENTORY_SIZE) - { - if (!this.mergeItemStack(slotItemStack, TileAludel.INVENTORY_SIZE, inventorySlots.size(), false)) - { - return null; - } - } - else - { - /** - * If the stack being shift-clicked into the Aludel's container - * is a fuel, first try to put it in the fuel slot. If it cannot - * be merged into the fuel slot, try to put it in the input - * slot. - */ - if (TileEntityFurnace.isItemFuel(slotItemStack)) - { - if (!this.mergeItemStack(slotItemStack, TileAludel.FUEL_INVENTORY_INDEX, TileAludel.OUTPUT_INVENTORY_INDEX, false)) - { - return null; - } - } - - /** - * If the stack being shift-clicked into the Aludel's container - * is a dust, first try to put it in the dust slot. If it cannot - * be merged into the dust slot, try to put it in the input - * slot. - */ - else if (slotItemStack.getItem() instanceof ItemAlchemicalDust) - { - if (!this.mergeItemStack(slotItemStack, TileAludel.DUST_INVENTORY_INDEX, TileAludel.OUTPUT_INVENTORY_INDEX, false)) - { - return null; - } - } - - /** - * Finally, attempt to put stack into the input slot - */ - else if (!this.mergeItemStack(slotItemStack, TileAludel.INPUT_INVENTORY_INDEX, TileAludel.DUST_INVENTORY_INDEX, false)) - { - return null; - } - } - - if (slotItemStack.stackSize == 0) - { - slot.putStack(null); - } - else - { - slot.onSlotChanged(); - } - } - - return itemStack; - } - - @Override - public void addCraftingToCrafters(ICrafting iCrafting) - { - super.addCraftingToCrafters(iCrafting); - iCrafting.sendProgressBarUpdate(this, 0, this.tileAludel.deviceCookTime); - iCrafting.sendProgressBarUpdate(this, 1, this.tileAludel.fuelBurnTime); - iCrafting.sendProgressBarUpdate(this, 2, this.tileAludel.itemCookTime); - } - - @Override - public void detectAndSendChanges() - { - super.detectAndSendChanges(); - - for (Object crafter : this.crafters) - { - ICrafting icrafting = (ICrafting) crafter; - - if (this.lastDeviceCookTime != this.tileAludel.deviceCookTime) - { - icrafting.sendProgressBarUpdate(this, 0, this.tileAludel.deviceCookTime); - } - - if (this.lastFuelBurnTime != this.tileAludel.fuelBurnTime) - { - icrafting.sendProgressBarUpdate(this, 1, this.tileAludel.fuelBurnTime); - } - - if (this.lastItemCookTime != this.tileAludel.itemCookTime) - { - icrafting.sendProgressBarUpdate(this, 2, this.tileAludel.itemCookTime); - } - } - - this.lastDeviceCookTime = this.tileAludel.deviceCookTime; - this.lastFuelBurnTime = this.tileAludel.fuelBurnTime; - this.lastItemCookTime = this.tileAludel.itemCookTime; - } - - @SideOnly(Side.CLIENT) - public void updateProgressBar(int valueType, int updatedValue) - { - if (valueType == 0) - { - this.tileAludel.deviceCookTime = updatedValue; - } - - if (valueType == 1) - { - this.tileAludel.fuelBurnTime = updatedValue; - } - - if (valueType == 2) - { - this.tileAludel.itemCookTime = updatedValue; - } - } -} diff --git a/src/main/java/com/pahimar/ee3/inventory/ContainerCalcinator.java b/src/main/java/com/pahimar/ee3/inventory/ContainerCalcinator.java deleted file mode 100644 index 2f00181f..00000000 --- a/src/main/java/com/pahimar/ee3/inventory/ContainerCalcinator.java +++ /dev/null @@ -1,183 +0,0 @@ -package com.pahimar.ee3.inventory; - -import com.pahimar.ee3.tileentity.TileCalcinator; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntityFurnace; - -/** - * Equivalent-Exchange-3 - *

- * ContainerCalcinator - * - * @author pahimar - */ -public class ContainerCalcinator extends Container -{ - private TileCalcinator calcinator; - private int lastCookTime; // How much longer the Calcinator will burn - private int lastBurnTime; // The fuel value for the currently burning fuel - private int lastItemCookTime; // How long the current item has been "cooking" - - public ContainerCalcinator(InventoryPlayer inventoryPlayer, TileCalcinator calcinator) - { - this.calcinator = calcinator; - - // Add the fuel slot to the container - this.addSlotToContainer(new Slot(calcinator, TileCalcinator.FUEL_INVENTORY_INDEX, 56, 62)); - - // Add the input slot to the container - this.addSlotToContainer(new Slot(calcinator, TileCalcinator.INPUT_INVENTORY_INDEX, 56, 17)); - - // Add the output results slot to the container - this.addSlotToContainer(new SlotCalcinator(calcinator, TileCalcinator.OUTPUT_LEFT_INVENTORY_INDEX, 116, 35)); - this.addSlotToContainer(new SlotCalcinator(calcinator, TileCalcinator.OUTPUT_RIGHT_INVENTORY_INDEX, 136, 35)); - - // Add the player's inventory slots to the container - for (int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) - { - for (int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) - { - this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 94 + inventoryRowIndex * 18)); - } - } - - // Add the player's action bar slots to the container - for (int actionBarSlotIndex = 0; actionBarSlotIndex < 9; ++actionBarSlotIndex) - { - this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 152)); - } - } - - @Override - public boolean canInteractWith(EntityPlayer player) - { - return true; - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) - { - ItemStack itemStack = null; - Slot slot = (Slot) inventorySlots.get(slotIndex); - - if (slot != null && slot.getHasStack()) - { - - ItemStack slotItemStack = slot.getStack(); - itemStack = slotItemStack.copy(); - - /** - * If we are shift-clicking an item out of the Aludel's container, - * attempt to put it in the first available slot in the player's - * inventory - */ - if (slotIndex < TileCalcinator.INVENTORY_SIZE) - { - if (!this.mergeItemStack(slotItemStack, TileCalcinator.INVENTORY_SIZE, inventorySlots.size(), false)) - { - return null; - } - } - else - { - /** - * If the stack being shift-clicked into the Aludel's container - * is a fuel, first try to put it in the fuel slot. If it cannot - * be merged into the fuel slot, try to put it in the input - * slot. - */ - if (TileEntityFurnace.isItemFuel(slotItemStack)) - { - if (!this.mergeItemStack(slotItemStack, TileCalcinator.FUEL_INVENTORY_INDEX, TileCalcinator.OUTPUT_LEFT_INVENTORY_INDEX, false)) - { - return null; - } - } - - /** - * Finally, attempt to put stack into the input slot - */ - else if (!this.mergeItemStack(slotItemStack, TileCalcinator.INPUT_INVENTORY_INDEX, TileCalcinator.OUTPUT_LEFT_INVENTORY_INDEX, false)) - { - return null; - } - } - - if (slotItemStack.stackSize == 0) - { - slot.putStack(null); - } - else - { - slot.onSlotChanged(); - } - } - - return itemStack; - } - - @Override - public void addCraftingToCrafters(ICrafting iCrafting) - { - super.addCraftingToCrafters(iCrafting); - iCrafting.sendProgressBarUpdate(this, 0, this.calcinator.deviceCookTime); - iCrafting.sendProgressBarUpdate(this, 1, this.calcinator.fuelBurnTime); - iCrafting.sendProgressBarUpdate(this, 2, this.calcinator.itemCookTime); - } - - @Override - public void detectAndSendChanges() - { - super.detectAndSendChanges(); - - for (Object crafter : this.crafters) - { - ICrafting icrafting = (ICrafting) crafter; - - if (this.lastCookTime != this.calcinator.deviceCookTime) - { - icrafting.sendProgressBarUpdate(this, 0, this.calcinator.deviceCookTime); - } - - if (this.lastBurnTime != this.calcinator.fuelBurnTime) - { - icrafting.sendProgressBarUpdate(this, 1, this.calcinator.fuelBurnTime); - } - - if (this.lastItemCookTime != this.calcinator.itemCookTime) - { - icrafting.sendProgressBarUpdate(this, 2, this.calcinator.itemCookTime); - } - } - - this.lastCookTime = this.calcinator.deviceCookTime; - this.lastBurnTime = this.calcinator.fuelBurnTime; - this.lastItemCookTime = this.calcinator.itemCookTime; - } - - @SideOnly(Side.CLIENT) - public void updateProgressBar(int valueType, int updatedValue) - { - if (valueType == 0) - { - this.calcinator.deviceCookTime = updatedValue; - } - - if (valueType == 1) - { - this.calcinator.fuelBurnTime = updatedValue; - } - - if (valueType == 2) - { - this.calcinator.itemCookTime = updatedValue; - } - } -} diff --git a/src/main/java/com/pahimar/ee3/inventory/ContainerGlassBell.java b/src/main/java/com/pahimar/ee3/inventory/ContainerGlassBell.java deleted file mode 100644 index 7e634ac5..00000000 --- a/src/main/java/com/pahimar/ee3/inventory/ContainerGlassBell.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.pahimar.ee3.inventory; - -import com.pahimar.ee3.tileentity.TileGlassBell; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -/** - * Equivalent-Exchange-3 - *

- * ContainerGlassBell - * - * @author pahimar - */ -public class ContainerGlassBell extends Container -{ - - private final int PLAYER_INVENTORY_ROWS = 3; - private final int PLAYER_INVENTORY_COLUMNS = 9; - - public ContainerGlassBell(InventoryPlayer inventoryPlayer, TileGlassBell tileGlassBell) - { - - this.addSlotToContainer(new Slot(tileGlassBell, TileGlassBell.DISPLAY_SLOT_INVENTORY_INDEX, 80, 22)); - - // Add the player's inventory slots to the container - for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex) - { - for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex) - { - this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 58 + inventoryRowIndex * 18)); - } - } - - // Add the player's action bar slots to the container - for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex) - { - this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 116)); - } - } - - @Override - public boolean canInteractWith(EntityPlayer var1) - { - - return true; - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) - { - - ItemStack itemStack = null; - Slot slot = (Slot) inventorySlots.get(slotIndex); - - if (slot != null && slot.getHasStack()) - { - ItemStack slotItemStack = slot.getStack(); - itemStack = slotItemStack.copy(); - - if (slotIndex < TileGlassBell.INVENTORY_SIZE) - { - - if (!this.mergeItemStack(slotItemStack, 1, inventorySlots.size(), true)) - { - return null; - } - } - else - { - if (!this.mergeItemStack(slotItemStack, 0, TileGlassBell.INVENTORY_SIZE, false)) - { - return null; - } - } - - if (slotItemStack.stackSize == 0) - { - slot.putStack(null); - } - else - { - slot.onSlotChanged(); - } - } - - return itemStack; - } -} diff --git a/src/main/java/com/pahimar/ee3/inventory/ContainerPortableCrafting.java b/src/main/java/com/pahimar/ee3/inventory/ContainerPortableCrafting.java deleted file mode 100644 index 488334be..00000000 --- a/src/main/java/com/pahimar/ee3/inventory/ContainerPortableCrafting.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.pahimar.ee3.inventory; - -import com.pahimar.ee3.helper.ItemStackNBTHelper; -import com.pahimar.ee3.lib.Strings; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ContainerWorkbench; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Equivalent-Exchange-3 - *

- * ContainerPortableCrafting - * - * @author pahimar - */ -public class ContainerPortableCrafting extends ContainerWorkbench -{ - public ContainerPortableCrafting(InventoryPlayer inventoryPlayer, World world, int x, int y, int z) - { - super(inventoryPlayer, world, x, y, z); - } - - @Override - public boolean canInteractWith(EntityPlayer var1) - { - return true; - } - - @Override - public void onContainerClosed(EntityPlayer player) - { - super.onContainerClosed(player); - - if (!player.worldObj.isRemote) - { - InventoryPlayer invPlayer = player.inventory; - for (ItemStack itemStack : invPlayer.mainInventory) - { - if (itemStack != null) - { - if (ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN)) - { - ItemStackNBTHelper.removeTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN); - } - } - } - } - } -} diff --git a/src/main/java/com/pahimar/ee3/inventory/INBTTaggable.java b/src/main/java/com/pahimar/ee3/inventory/INBTTaggable.java deleted file mode 100644 index c203e44e..00000000 --- a/src/main/java/com/pahimar/ee3/inventory/INBTTaggable.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.pahimar.ee3.inventory; - -import net.minecraft.nbt.NBTTagCompound; - -public interface INBTTaggable -{ - void readFromNBT(NBTTagCompound nbtTagCompound); - - void writeToNBT(NBTTagCompound nbtTagCompound); -} diff --git a/src/main/java/com/pahimar/ee3/inventory/InventoryAlchemicalBag.java b/src/main/java/com/pahimar/ee3/inventory/InventoryAlchemicalBag.java deleted file mode 100644 index 7a13d4b8..00000000 --- a/src/main/java/com/pahimar/ee3/inventory/InventoryAlchemicalBag.java +++ /dev/null @@ -1,259 +0,0 @@ -package com.pahimar.ee3.inventory; - -import com.pahimar.ee3.helper.ItemStackNBTHelper; -import com.pahimar.ee3.lib.Strings; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -import java.util.UUID; - -public class InventoryAlchemicalBag implements IInventory, INBTTaggable -{ - public ItemStack parentItemStack; - protected ItemStack[] inventory; - protected String customName; - - public InventoryAlchemicalBag(ItemStack itemStack) - { - parentItemStack = itemStack; - - int size; - if (itemStack.getItemDamage() == 1) - { - size = ContainerAlchemicalBag.MEDIUM_BAG_INVENTORY_ROWS * ContainerAlchemicalBag.MEDIUM_BAG_INVENTORY_COLUMNS; - } - else if (itemStack.getItemDamage() == 2) - { - size = ContainerAlchemicalBag.LARGE_BAG_INVENTORY_ROWS * ContainerAlchemicalBag.LARGE_BAG_INVENTORY_COLUMNS; - } - else - { - size = ContainerAlchemicalBag.SMALL_BAG_INVENTORY_ROWS * ContainerAlchemicalBag.SMALL_BAG_INVENTORY_COLUMNS; - } - - inventory = new ItemStack[size]; - - readFromNBT(itemStack.getTagCompound()); - } - - public void onGuiSaved(EntityPlayer entityPlayer) - { - parentItemStack = findParentItemStack(entityPlayer); - - if (parentItemStack != null) - { - save(); - } - } - - public ItemStack findParentItemStack(EntityPlayer entityPlayer) - { - if (ItemStackNBTHelper.hasUUID(parentItemStack)) - { - UUID parentItemStackUUID = new UUID(parentItemStack.getTagCompound().getLong(Strings.NBT_ITEM_UUID_MOST_SIG), parentItemStack.getTagCompound().getLong(Strings.NBT_ITEM_UUID_LEAST_SIG)); - for (int i = 0; i < entityPlayer.inventory.getSizeInventory(); i++) - { - ItemStack itemStack = entityPlayer.inventory.getStackInSlot(i); - - if (ItemStackNBTHelper.hasUUID(itemStack)) - { - if (itemStack.getTagCompound().getLong(Strings.NBT_ITEM_UUID_MOST_SIG) == parentItemStackUUID.getMostSignificantBits() && itemStack.getTagCompound().getLong(Strings.NBT_ITEM_UUID_LEAST_SIG) == parentItemStackUUID.getLeastSignificantBits()) - { - return itemStack; - } - } - } - } - - return null; - } - - public boolean matchesUUID(UUID uuid) - { - return ItemStackNBTHelper.hasUUID(parentItemStack) && parentItemStack.getTagCompound().getLong(Strings.NBT_ITEM_UUID_LEAST_SIG) == uuid.getLeastSignificantBits() && parentItemStack.getTagCompound().getLong(Strings.NBT_ITEM_UUID_MOST_SIG) == uuid.getMostSignificantBits(); - } - - public void save() - { - NBTTagCompound nbtTagCompound = parentItemStack.getTagCompound(); - - if (nbtTagCompound == null) - { - nbtTagCompound = new NBTTagCompound(); - - UUID uuid = UUID.randomUUID(); - nbtTagCompound.setLong(Strings.NBT_ITEM_UUID_MOST_SIG, uuid.getMostSignificantBits()); - nbtTagCompound.setLong(Strings.NBT_ITEM_UUID_LEAST_SIG, uuid.getLeastSignificantBits()); - } - - writeToNBT(nbtTagCompound); - parentItemStack.setTagCompound(nbtTagCompound); - } - - @Override - public int getSizeInventory() - { - return inventory.length; - } - - @Override - public ItemStack getStackInSlot(int slotIndex) - { - return inventory[slotIndex]; - } - - @Override - public ItemStack decrStackSize(int slotIndex, int decrementAmount) - { - ItemStack itemStack = getStackInSlot(slotIndex); - if (itemStack != null) - { - if (itemStack.stackSize <= decrementAmount) - { - setInventorySlotContents(slotIndex, null); - } - else - { - itemStack = itemStack.splitStack(decrementAmount); - if (itemStack.stackSize == 0) - { - setInventorySlotContents(slotIndex, null); - } - } - } - - return itemStack; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slotIndex) - { - if (inventory[slotIndex] != null) - { - ItemStack itemStack = inventory[slotIndex]; - inventory[slotIndex] = null; - return itemStack; - } - else - { - return null; - } - } - - @Override - public void setInventorySlotContents(int slotIndex, ItemStack itemStack) - { - inventory[slotIndex] = itemStack; - } - - @Override - public String getInventoryName() - { - return this.hasCustomName() ? this.getCustomName() : Strings.CONTAINER_ALCHEMICAL_BAG_NAME; - } - - @Override - public boolean hasCustomInventoryName() - { - return true; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public void markDirty() - { - // NOOP - } - - @Override - public boolean isUseableByPlayer(EntityPlayer entityPlayer) - { - return true; - } - - @Override - public void openInventory() - { - // NOOP - } - - @Override - public void closeInventory() - { - // NOOP - } - - @Override - public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) - { - return true; - } - - @Override - public void readFromNBT(NBTTagCompound nbtTagCompound) - { - if (nbtTagCompound != null && nbtTagCompound.hasKey("Items")) - { - // Read in the ItemStacks in the inventory from NBT - if (nbtTagCompound.hasKey("Items")) - { - NBTTagList tagList = nbtTagCompound.getTagList("Items", 10); - inventory = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < tagList.tagCount(); ++i) - { - NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); - byte slotIndex = tagCompound.getByte("Slot"); - if (slotIndex >= 0 && slotIndex < inventory.length) - { - inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); - } - } - } - - // Read in any custom name for the inventory - if (nbtTagCompound.hasKey("display") && nbtTagCompound.getTag("display").getClass().equals(NBTTagCompound.class)) - { - if (nbtTagCompound.getCompoundTag("display").hasKey("Name")) - { - customName = nbtTagCompound.getCompoundTag("display").getString("Name"); - } - } - } - } - - @Override - public void writeToNBT(NBTTagCompound nbtTagCompound) - { - // Write the ItemStacks in the inventory to NBT - NBTTagList tagList = new NBTTagList(); - for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) - { - if (inventory[currentIndex] != null) - { - NBTTagCompound tagCompound = new NBTTagCompound(); - tagCompound.setByte("Slot", (byte) currentIndex); - inventory[currentIndex].writeToNBT(tagCompound); - tagList.appendTag(tagCompound); - } - } - nbtTagCompound.setTag("Items", tagList); - } - - public boolean hasCustomName() - { - return customName != null && customName.length() > 0; - } - - public String getCustomName() - { - return customName; - } -} diff --git a/src/main/java/com/pahimar/ee3/inventory/SlotAlchemicalBag.java b/src/main/java/com/pahimar/ee3/inventory/SlotAlchemicalBag.java deleted file mode 100644 index 4fa3071e..00000000 --- a/src/main/java/com/pahimar/ee3/inventory/SlotAlchemicalBag.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.pahimar.ee3.inventory; - -import com.pahimar.ee3.item.ItemAlchemicalBag; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotAlchemicalBag extends Slot -{ - private final EntityPlayer entityPlayer; - private ContainerAlchemicalBag containerAlchemicalBag; - - public SlotAlchemicalBag(ContainerAlchemicalBag containerAlchemicalBag, IInventory inventory, EntityPlayer entityPlayer, int x, int y, int z) - { - super(inventory, x, y, z); - this.entityPlayer = entityPlayer; - this.containerAlchemicalBag = containerAlchemicalBag; - } - - @Override - public void onSlotChange(ItemStack itemStack1, ItemStack itemStack2) - { - super.onSlotChange(itemStack1, itemStack2); - containerAlchemicalBag.saveInventory(entityPlayer); - } - - /** - * Check if the stack is a valid item for this slot. Always true beside for the armor slots. - */ - @Override - public boolean isItemValid(ItemStack itemStack) - { - return itemStack.getItem() instanceof ItemAlchemicalBag ? false : true; - } -} diff --git a/src/main/java/com/pahimar/ee3/inventory/SlotAludelOutput.java b/src/main/java/com/pahimar/ee3/inventory/SlotAludelOutput.java deleted file mode 100644 index 486c9919..00000000 --- a/src/main/java/com/pahimar/ee3/inventory/SlotAludelOutput.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.pahimar.ee3.inventory; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotAludelOutput extends Slot -{ - public SlotAludelOutput(IInventory inventory, int x, int y, int z) - { - super(inventory, x, y, z); - } - - @Override - public boolean isItemValid(ItemStack par1ItemStack) - { - return false; - } - - @Override - public void onPickupFromSlot(EntityPlayer entityPlayer, ItemStack itemStack) - { - super.onPickupFromSlot(entityPlayer, itemStack); - } -} diff --git a/src/main/java/com/pahimar/ee3/inventory/SlotCalcinator.java b/src/main/java/com/pahimar/ee3/inventory/SlotCalcinator.java deleted file mode 100644 index 8cd3dae6..00000000 --- a/src/main/java/com/pahimar/ee3/inventory/SlotCalcinator.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.pahimar.ee3.inventory; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -/** - * Equivalent-Exchange-3 - *

- * SlotCalcinator - * - * @author pahimar - */ -public class SlotCalcinator extends Slot -{ - public SlotCalcinator(IInventory inventory, int x, int y, int z) - { - super(inventory, x, y, z); - } - - @Override - public boolean isItemValid(ItemStack par1ItemStack) - { - return false; - } - - @Override - public void onPickupFromSlot(EntityPlayer entityPlayer, ItemStack itemStack) - { - super.onPickupFromSlot(entityPlayer, itemStack); - } -} diff --git a/src/main/java/com/pahimar/ee3/item/IChargeable.java b/src/main/java/com/pahimar/ee3/item/IChargeable.java deleted file mode 100644 index ca42a648..00000000 --- a/src/main/java/com/pahimar/ee3/item/IChargeable.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.pahimar.ee3.item; - -import net.minecraft.item.ItemStack; - -/** - * Equivalent-Exchange-3 - *

- * IChargeable - * - * @author pahimar - */ -public interface IChargeable -{ - public abstract short getCharge(ItemStack stack); - - public abstract void setCharge(ItemStack stack, short charge); - - public abstract void increaseCharge(ItemStack stack); - - public abstract void decreaseCharge(ItemStack stack); -} diff --git a/src/main/java/com/pahimar/ee3/item/IDyeable.java b/src/main/java/com/pahimar/ee3/item/IDyeable.java index a6990650..2570528a 100644 --- a/src/main/java/com/pahimar/ee3/item/IDyeable.java +++ b/src/main/java/com/pahimar/ee3/item/IDyeable.java @@ -11,4 +11,4 @@ public interface IDyeable public abstract void setColor(ItemStack itemStack, int color); public abstract void removeColor(ItemStack itemStack); -} +} \ No newline at end of file diff --git a/src/main/java/com/pahimar/ee3/item/IKeyBound.java b/src/main/java/com/pahimar/ee3/item/IKeyBound.java deleted file mode 100644 index cf871369..00000000 --- a/src/main/java/com/pahimar/ee3/item/IKeyBound.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.pahimar.ee3.item; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -/** - * Equivalent-Exchange-3 - *

- * IKeyBound - * - * @author pahimar - */ -public interface IKeyBound -{ - public abstract void doKeyBindingAction(EntityPlayer thePlayer, ItemStack itemStack, String keyBinding); -} diff --git a/src/main/java/com/pahimar/ee3/item/ITransmutationStone.java b/src/main/java/com/pahimar/ee3/item/ITransmutationStone.java deleted file mode 100644 index 253ce7c2..00000000 --- a/src/main/java/com/pahimar/ee3/item/ITransmutationStone.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.pahimar.ee3.item; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Equivalent-Exchange-3 - *

- * ITransmutationStone - * - * @author pahimar - */ -public interface ITransmutationStone -{ - public abstract void openPortableCraftingGUI(EntityPlayer thePlayer, ItemStack itemStack); - - public abstract void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit); -} diff --git a/src/main/java/com/pahimar/ee3/item/ItemAlchemicalBag.java b/src/main/java/com/pahimar/ee3/item/ItemAlchemicalBag.java index 48b742db..02df8324 100644 --- a/src/main/java/com/pahimar/ee3/item/ItemAlchemicalBag.java +++ b/src/main/java/com/pahimar/ee3/item/ItemAlchemicalBag.java @@ -1,89 +1,38 @@ package com.pahimar.ee3.item; import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.helper.ItemHelper; -import com.pahimar.ee3.helper.ItemStackNBTHelper; -import com.pahimar.ee3.lib.Colours; -import com.pahimar.ee3.lib.GuiIds; -import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.reference.Colors; +import com.pahimar.ee3.reference.GuiIds; +import com.pahimar.ee3.reference.Names; +import com.pahimar.ee3.reference.Textures; +import com.pahimar.ee3.util.ColorHelper; +import com.pahimar.ee3.util.NBTHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import java.util.List; -/** - * Equivalent-Exchange-3 - *

- * ItemAlchemicalBag - * - * @author pahimar - */ public class ItemAlchemicalBag extends ItemEE implements IDyeable { private static final String[] ALCHEMICAL_BAG_ICONS = {"open", "closed", "symbolTier1", "symbolTier2", "symbolTier3"}; @SideOnly(Side.CLIENT) - private Icon[] icons; + private IIcon[] icons; - public ItemAlchemicalBag(int id) + public ItemAlchemicalBag() { - super(id); + super(); this.setHasSubtypes(true); - this.setUnlocalizedName(Strings.ALCHEMICAL_BAG_NAME); - } - - @Override - @SuppressWarnings({"rawtypes", "unchecked"}) - @SideOnly(Side.CLIENT) - public void getSubItems(int id, CreativeTabs creativeTab, List list) - { - for (int meta = 0; meta < 3; ++meta) - { - list.add(new ItemStack(id, 1, meta)); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IconRegister iconRegister) - { - icons = new Icon[ALCHEMICAL_BAG_ICONS.length]; - - for (int i = 0; i < ALCHEMICAL_BAG_ICONS.length; ++i) - { - icons[i] = iconRegister.registerIcon(Strings.RESOURCE_PREFIX + Strings.ALCHEMICAL_BAG_NAME + "." + ALCHEMICAL_BAG_ICONS[i]); - } - } - - @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) - { - if (!world.isRemote) - { - // Set a UUID on the Alchemical Bag, if one doesn't exist already - ItemStackNBTHelper.setUUID(itemStack); - ItemStackNBTHelper.setBoolean(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN, true); - entityPlayer.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_BAG, entityPlayer.worldObj, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ); - } - -// if (world.isRemote) -// { -// entityPlayer.sendChatToPlayer(ChatMessageComponent.createFromText("Pahimar: Sorry not ready yet!")); -// } - - return itemStack; - } - - @Override - public boolean getShareTag() - { - return true; + this.setUnlocalizedName(Names.Items.ALCHEMICAL_BAG); } @Override @@ -94,11 +43,23 @@ public class ItemAlchemicalBag extends ItemEE implements IDyeable } @Override - public Icon getIcon(ItemStack itemStack, int renderPass) + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) + { + icons = new IIcon[ALCHEMICAL_BAG_ICONS.length]; + + for (int i = 0; i < ALCHEMICAL_BAG_ICONS.length; i++) + { + icons[i] = iconRegister.registerIcon(Textures.RESOURCE_PREFIX + Names.Items.ALCHEMICAL_BAG + "." + ALCHEMICAL_BAG_ICONS[i]); + } + } + + @Override + public IIcon getIcon(ItemStack itemStack, int renderPass) { if (renderPass == 0) { - if (ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) + if (NBTHelper.hasTag(itemStack, Names.NBT.ALCHEMICAL_BAG_GUI_OPEN)) { return icons[0]; } @@ -113,6 +74,36 @@ public class ItemAlchemicalBag extends ItemEE implements IDyeable } } + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs creativeTab, List list) + { + for (int meta = 0; meta < 3; ++meta) + { + list.add(new ItemStack(this, 1, meta)); + } + } + + @Override + public boolean getShareTag() + { + return true; + } + + @Override + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) + { + if (!world.isRemote) + { + // Set a UUID on the Alchemical Bag, if one doesn't exist already + NBTHelper.setUUID(itemStack); + NBTHelper.setBoolean(itemStack, Names.NBT.ALCHEMICAL_BAG_GUI_OPEN, true); + entityPlayer.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_BAG, entityPlayer.worldObj, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ); + } + + return itemStack; + } + @Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack itemStack, int renderPass) @@ -121,7 +112,7 @@ public class ItemAlchemicalBag extends ItemEE implements IDyeable if (bagColor < 0) { - bagColor = Integer.parseInt(Colours.PURE_WHITE, 16); + bagColor = Integer.parseInt(Colors.PURE_WHITE, 16); } return bagColor; @@ -130,13 +121,13 @@ public class ItemAlchemicalBag extends ItemEE implements IDyeable @Override public boolean hasColor(ItemStack itemStack) { - return ItemHelper.hasColor(itemStack); + return ColorHelper.hasColor(itemStack); } @Override public int getColor(ItemStack itemStack) { - return ItemHelper.getColor(itemStack); + return ColorHelper.getColor(itemStack); } @Override @@ -146,7 +137,7 @@ public class ItemAlchemicalBag extends ItemEE implements IDyeable { if (itemStack.getItem() instanceof ItemAlchemicalBag) { - ItemHelper.setColor(itemStack, color); + ColorHelper.setColor(itemStack, color); } } } @@ -160,11 +151,11 @@ public class ItemAlchemicalBag extends ItemEE implements IDyeable if (nbtTagCompound != null) { - NBTTagCompound displayTagCompound = nbtTagCompound.getCompoundTag(Strings.NBT_ITEM_DISPLAY); + NBTTagCompound displayTagCompound = nbtTagCompound.getCompoundTag(Names.NBT.DISPLAY); - if (displayTagCompound.hasKey(Strings.NBT_ITEM_COLOR)) + if (displayTagCompound.hasKey(Names.NBT.COLOR)) { - displayTagCompound.removeTag(Strings.NBT_ITEM_COLOR); + displayTagCompound.removeTag(Names.NBT.COLOR); } } } diff --git a/src/main/java/com/pahimar/ee3/item/ItemAlchemicalDust.java b/src/main/java/com/pahimar/ee3/item/ItemAlchemicalDust.java index 8ebbc35c..172ac7a2 100644 --- a/src/main/java/com/pahimar/ee3/item/ItemAlchemicalDust.java +++ b/src/main/java/com/pahimar/ee3/item/ItemAlchemicalDust.java @@ -1,31 +1,38 @@ package com.pahimar.ee3.item; -import com.pahimar.ee3.lib.Colours; -import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.reference.Colors; +import com.pahimar.ee3.reference.Names; +import com.pahimar.ee3.reference.Textures; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import java.util.ArrayList; import java.util.List; -/** - * Equivalent-Exchange-3 - *

- * ItemAlchemicalDust - * - * @author pahimar - */ public class ItemAlchemicalDust extends ItemEE { - public ItemAlchemicalDust(int id) + public ItemAlchemicalDust() { - super(id); + super(); + this.maxStackSize = 64; this.setHasSubtypes(true); - maxStackSize = 64; + this.setUnlocalizedName(Names.Items.ALCHEMICAL_DUST); + } + + public static List getAlchemicalDusts() + { + List alchemicalDustStacks = new ArrayList(); + + for (int meta = 0; meta < Names.Items.ALCHEMICAL_DUST_SUBTYPES.length; meta++) + { + alchemicalDustStacks.add(new ItemStack(ModItems.itemAlchemicalDust, 1, meta)); + } + + return alchemicalDustStacks; } @Override @@ -34,84 +41,43 @@ public class ItemAlchemicalDust extends ItemEE { if (itemStack.getItemDamage() == 0) { - return Integer.parseInt(Colours.DUST_ASH, 16); + return Integer.parseInt(Colors.DUST_ASH, 16); } else if (itemStack.getItemDamage() == 1) { - return Integer.parseInt(Colours.DUST_VERDANT, 16); + return Integer.parseInt(Colors.DUST_VERDANT, 16); } else if (itemStack.getItemDamage() == 2) { - return Integer.parseInt(Colours.DUST_AZURE, 16); + return Integer.parseInt(Colors.DUST_AZURE, 16); } else if (itemStack.getItemDamage() == 3) { - return Integer.parseInt(Colours.DUST_MINIUM, 16); + return Integer.parseInt(Colors.DUST_MINIUM, 16); } - return Integer.parseInt(Colours.PURE_WHITE, 16); + return Integer.parseInt(Colors.PURE_WHITE, 16); } @Override public String getUnlocalizedName() { - return String.format("item.%s%s", Strings.RESOURCE_PREFIX, Strings.ALCHEMICAL_DUST_NAME); + return String.format("item.%s%s", Textures.RESOURCE_PREFIX, Names.Items.ALCHEMICAL_DUST); } @Override public String getUnlocalizedName(ItemStack itemStack) { - return String.format("item.%s%s.%s", Strings.RESOURCE_PREFIX, Strings.ALCHEMICAL_DUST_NAME, Strings.ALCHEMICAL_DUST_SUBTYPE_NAMES[MathHelper.clamp_int(itemStack.getItemDamage(), 0, Strings.ALCHEMICAL_DUST_SUBTYPE_NAMES.length - 1)]); + return String.format("item.%s%s.%s", Textures.RESOURCE_PREFIX, Names.Items.ALCHEMICAL_DUST, Names.Items.ALCHEMICAL_DUST_SUBTYPES[MathHelper.clamp_int(itemStack.getItemDamage(), 0, Names.Items.ALCHEMICAL_DUST_SUBTYPES.length - 1)]); } @Override - public String getItemDisplayName(ItemStack itemStack) - { - switch (MathHelper.clamp_int(itemStack.getItemDamage(), 0, Strings.ALCHEMICAL_DUST_SUBTYPE_NAMES.length - 1)) - { - case 0: - { - return EnumChatFormatting.GRAY + super.getItemDisplayName(itemStack); - } - case 1: - { - return EnumChatFormatting.GREEN + super.getItemDisplayName(itemStack); - } - case 2: - { - return EnumChatFormatting.BLUE + super.getItemDisplayName(itemStack); - } - case 3: - { - return EnumChatFormatting.RED + super.getItemDisplayName(itemStack); - } - default: - { - return EnumChatFormatting.WHITE + super.getItemDisplayName(itemStack); - } - } - } - - @Override - @SuppressWarnings({"rawtypes", "unchecked"}) @SideOnly(Side.CLIENT) - public void getSubItems(int id, CreativeTabs creativeTab, List list) + public void getSubItems(Item item, CreativeTabs creativeTab, List list) { - for (int meta = 0; meta < Strings.ALCHEMICAL_DUST_SUBTYPE_NAMES.length; ++meta) + for (int meta = 0; meta < Names.Items.ALCHEMICAL_DUST_SUBTYPES.length; ++meta) { - list.add(new ItemStack(id, 1, meta)); + list.add(new ItemStack(this, 1, meta)); } } - - public static List getAlchemicalDusts() - { - List alchemicalDustStacks = new ArrayList(); - - for (int meta = 0; meta < Strings.ALCHEMICAL_DUST_SUBTYPE_NAMES.length; meta++) - { - alchemicalDustStacks.add(new ItemStack(ModItems.alchemicalDust, 1, meta)); - } - - return alchemicalDustStacks; - } } diff --git a/src/main/java/com/pahimar/ee3/item/ItemAlchemicalFuel.java b/src/main/java/com/pahimar/ee3/item/ItemAlchemicalFuel.java index 63a1c7fb..e4c2e9e4 100644 --- a/src/main/java/com/pahimar/ee3/item/ItemAlchemicalFuel.java +++ b/src/main/java/com/pahimar/ee3/item/ItemAlchemicalFuel.java @@ -1,59 +1,5 @@ package com.pahimar.ee3.item; -import com.pahimar.ee3.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MathHelper; - -import java.util.List; - public class ItemAlchemicalFuel extends ItemEE { - @SideOnly(Side.CLIENT) - private Icon[] icons; - - public ItemAlchemicalFuel(int id) - { - super(id); - this.setHasSubtypes(true); - this.maxStackSize = 64; - } - - @Override - public String getUnlocalizedName(ItemStack itemStack) - { - return String.format("item.%s%s.%s", Strings.RESOURCE_PREFIX, Strings.ALCHEMICAL_FUEL_NAME, Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES[MathHelper.clamp_int(itemStack.getItemDamage(), 0, Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES.length - 1)]); - } - - @Override - @SideOnly(Side.CLIENT) - public Icon getIconFromDamage(int meta) - { - return icons[MathHelper.clamp_int(meta, 0, Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES.length - 1)]; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IconRegister iconRegister) - { - icons = new Icon[Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES.length]; - - for (int i = 0; i < Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES.length; ++i) - { - icons[i] = iconRegister.registerIcon(String.format("%s%s.%s", Strings.RESOURCE_PREFIX, Strings.ALCHEMICAL_FUEL_NAME, Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES[i])); - } - } - - @Override - @SuppressWarnings({"rawtypes", "unchecked"}) - @SideOnly(Side.CLIENT) - public void getSubItems(int id, CreativeTabs creativeTab, List list) - { - for (int meta = 0; meta < Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES.length; ++meta) - { - list.add(new ItemStack(id, 1, meta)); - } - } } diff --git a/src/main/java/com/pahimar/ee3/item/ItemAlchemicalInventoryUpgrade.java b/src/main/java/com/pahimar/ee3/item/ItemAlchemicalInventoryUpgrade.java new file mode 100644 index 00000000..eaca3ade --- /dev/null +++ b/src/main/java/com/pahimar/ee3/item/ItemAlchemicalInventoryUpgrade.java @@ -0,0 +1,5 @@ +package com.pahimar.ee3.item; + +public class ItemAlchemicalInventoryUpgrade extends ItemEE +{ +} diff --git a/src/main/java/com/pahimar/ee3/item/ItemAlchemicalUpgrade.java b/src/main/java/com/pahimar/ee3/item/ItemAlchemicalUpgrade.java deleted file mode 100644 index 24fe36ca..00000000 --- a/src/main/java/com/pahimar/ee3/item/ItemAlchemicalUpgrade.java +++ /dev/null @@ -1,204 +0,0 @@ -package com.pahimar.ee3.item; - -import com.pahimar.ee3.block.ModBlocks; -import com.pahimar.ee3.lib.Colours; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.tileentity.TileAlchemicalChest; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MathHelper; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; - -import java.util.List; - -public class ItemAlchemicalUpgrade extends ItemEE -{ - public ItemAlchemicalUpgrade(int id) - { - super(id); - this.setHasSubtypes(true); - this.setUnlocalizedName(Strings.ALCHEMICAL_UPGRADE_NAME); - this.setMaxStackSize(64); - } - - @Override - @SuppressWarnings({"rawtypes", "unchecked"}) - @SideOnly(Side.CLIENT) - public void getSubItems(int id, CreativeTabs creativeTab, List list) - { - for (int meta = 0; meta < Strings.ALCHEMICAL_UPGRADE_SUBTYPE_NAMES.length; ++meta) - { - list.add(new ItemStack(id, 1, meta)); - } - } - - @Override - public String getUnlocalizedName() - { - return String.format("item.%s%s", Strings.RESOURCE_PREFIX, Strings.ALCHEMICAL_UPGRADE_NAME); - } - - @Override - public String getUnlocalizedName(ItemStack itemStack) - { - return String.format("item.%s%s.%s", Strings.RESOURCE_PREFIX, Strings.ALCHEMICAL_UPGRADE_NAME, Strings.ALCHEMICAL_UPGRADE_SUBTYPE_NAMES[MathHelper.clamp_int(itemStack.getItemDamage(), 0, Strings.ALCHEMICAL_UPGRADE_SUBTYPE_NAMES.length - 1)]); - } - - @Override - public String getItemDisplayName(ItemStack itemStack) - { - switch (MathHelper.clamp_int(itemStack.getItemDamage(), 0, Strings.ALCHEMICAL_UPGRADE_SUBTYPE_NAMES.length - 1)) - { - case 0: - { - return EnumChatFormatting.GREEN + super.getItemDisplayName(itemStack); - } - case 1: - { - return EnumChatFormatting.BLUE + super.getItemDisplayName(itemStack); - } - case 2: - { - return EnumChatFormatting.RED + super.getItemDisplayName(itemStack); - } - default: - { - return EnumChatFormatting.WHITE + super.getItemDisplayName(itemStack); - } - } - } - - @Override - public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int sideHit, float hitVecX, float hitVecY, float hitVecZ) - { - if (world.isRemote) - { - return false; - } - - TileEntity tile = world.getBlockTileEntity(x, y, z); - if (canUpgrade(itemStack, tile)) - { - if (tile instanceof TileEntityChest) - { - TileEntityChest chest = (TileEntityChest) tile; - - //If players are using this chest, don't upgrade - if (chest.numUsingPlayers > 0) - { - return false; - } - - //Make the new Alchemical Chest TileEntity - TileAlchemicalChest newChest = (TileAlchemicalChest) ModBlocks.alchemicalChest.createTileEntity(world, itemStack.getItemDamage()); - - //Set the correct orientation - newChest.setOrientation(chest.blockMetadata); - - //Copy all the ItemStacks in our new chest and delete the ItemStacks in the old chest - for (int slot = 0; slot < chest.getSizeInventory(); slot++) - { - newChest.setInventorySlotContents(slot, chest.getStackInSlot(slot)); - chest.setInventorySlotContents(slot, null); - } - - //Set the block to air and make sure the neighbouring chests get notified - world.setBlock(x, y, z, 0, 0, 3); - chest.updateContainingBlockInfo(); - chest.checkForAdjacentChests(); - - //Set our new block and TileEntity instead - world.setBlock(x, y, z, ModBlocks.alchemicalChest.blockID, itemStack.getItemDamage(), 3); - world.setBlockTileEntity(x, y, z, newChest); - - itemStack.stackSize--; - return true; - } - else if (tile instanceof TileAlchemicalChest) - { - TileAlchemicalChest chest = (TileAlchemicalChest) tile; - - //If players are using this chest, don't upgrade - if (chest.numUsingPlayers > 0) - { - return false; - } - - //Make the new Alchemical Chest TileEntity - TileAlchemicalChest newChest = (TileAlchemicalChest) ModBlocks.alchemicalChest.createTileEntity(world, itemStack.getItemDamage()); - - //Set the correct orientation - newChest.setOrientation(chest.getOrientation()); - - //Copy all the ItemStacks in our new chest and delete the ItemStacks in the old chest - for (int slot = 0; slot < chest.getSizeInventory(); slot++) - { - newChest.setInventorySlotContents(slot, chest.getStackInSlot(slot)); - chest.setInventorySlotContents(slot, null); - } - - //Set the block to air - world.setBlock(x, y, z, 0, 0, 3); - chest.updateContainingBlockInfo(); - - //Set our new block and TileEntity instead - world.setBlock(x, y, z, ModBlocks.alchemicalChest.blockID, itemStack.getItemDamage(), 3); - world.setBlockTileEntity(x, y, z, newChest); - - itemStack.stackSize--; - return true; - } - } - return false; - } - - public boolean canUpgrade(ItemStack itemStack, TileEntity tile) - { - if (tile != null) - { - if (tile instanceof TileEntityChest) - { - return this.getDamage(itemStack) >= 0; - } - else if (tile instanceof TileAlchemicalChest) - { - return itemStack.getItemDamage() > tile.getBlockMetadata(); - } - } - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack itemStack, int renderPass) - { - if (itemStack.getItemDamage() == 0) - { - return Integer.parseInt(Colours.DUST_VERDANT, 16); - } - else if (itemStack.getItemDamage() == 1) - { - return Integer.parseInt(Colours.DUST_AZURE, 16); - } - else if (itemStack.getItemDamage() == 2) - { - return Integer.parseInt(Colours.DUST_MINIUM, 16); - } - - return Integer.parseInt(Colours.PURE_WHITE, 16); - } - - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean flag) - { - list.add(StatCollector.translateToLocal(Strings.UPGRADES_CHESTS)); - } -} diff --git a/src/main/java/com/pahimar/ee3/item/ItemBlockAlchemicalChest.java b/src/main/java/com/pahimar/ee3/item/ItemBlockAlchemicalChest.java deleted file mode 100644 index 2652788f..00000000 --- a/src/main/java/com/pahimar/ee3/item/ItemBlockAlchemicalChest.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.pahimar.ee3.item; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; - -import java.util.List; - -public class ItemBlockAlchemicalChest extends ItemBlock -{ - public ItemBlockAlchemicalChest(Block block) - { - super(block); - this.setHasSubtypes(true); - } - - @Override - public int getMetadata(int meta) - { - return meta; - } - - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean flag) - { - // TODO Localize and add more descriptive text - int metaData = itemStack.getItemDamage(); - - if (metaData == 0) - { - list.add("Small"); - } - else if (metaData == 1) - { - list.add("Medium"); - } - else if (metaData == 2) - { - list.add("Large"); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/item/ItemBlockAlchemicalFuel.java b/src/main/java/com/pahimar/ee3/item/ItemBlockAlchemicalFuel.java deleted file mode 100644 index 1e200397..00000000 --- a/src/main/java/com/pahimar/ee3/item/ItemBlockAlchemicalFuel.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.pahimar.ee3.item; - -import com.pahimar.ee3.block.ModBlocks; -import com.pahimar.ee3.lib.Strings; - -public class ItemBlockAlchemicalFuel extends ItemMultiTextureTile -{ - public ItemBlockAlchemicalFuel(int id) - { - super(id, ModBlocks.alchemicalFuel, Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES); - } -} diff --git a/src/main/java/com/pahimar/ee3/item/ItemBlockInfusedCloth.java b/src/main/java/com/pahimar/ee3/item/ItemBlockInfusedCloth.java deleted file mode 100644 index 9c5bd870..00000000 --- a/src/main/java/com/pahimar/ee3/item/ItemBlockInfusedCloth.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.pahimar.ee3.item; - -import com.pahimar.ee3.lib.ItemIds; -import com.pahimar.ee3.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; - -import java.util.List; - -public class ItemBlockInfusedCloth extends ItemBlock -{ - public ItemBlockInfusedCloth(int id) - { - super(id); - this.setHasSubtypes(true); - } - - @Override - public int getMetadata(int meta) - { - return meta; - } - - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean flag) - { - int dustMetaData = (itemStack.getItemDamage() % 3) + 1; - list.add(String.format("%s %s", StatCollector.translateToLocal(Strings.TOOLTIP_INFUSED_WITH), new ItemStack(ItemIds.ALCHEMICAL_DUST, 1, dustMetaData).getDisplayName())); - } -} diff --git a/src/main/java/com/pahimar/ee3/item/ItemBlockInfusedPlanks.java b/src/main/java/com/pahimar/ee3/item/ItemBlockInfusedPlanks.java deleted file mode 100644 index dc95ac7b..00000000 --- a/src/main/java/com/pahimar/ee3/item/ItemBlockInfusedPlanks.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.pahimar.ee3.item; - -import com.pahimar.ee3.lib.ItemIds; -import com.pahimar.ee3.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; - -import java.util.List; - -public class ItemBlockInfusedPlanks extends ItemBlock -{ - public ItemBlockInfusedPlanks(int id) - { - super(id); - this.setHasSubtypes(true); - } - - @Override - public int getMetadata(int meta) - { - return meta; - } - - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean flag) - { - int dustMetaData = (itemStack.getItemDamage() % 3) + 1; - list.add(String.format("%s %s", StatCollector.translateToLocal(Strings.TOOLTIP_INFUSED_WITH), new ItemStack(ItemIds.ALCHEMICAL_DUST, 1, dustMetaData).getDisplayName())); - } -} diff --git a/src/main/java/com/pahimar/ee3/item/ItemBlockInfusedWood.java b/src/main/java/com/pahimar/ee3/item/ItemBlockInfusedWood.java deleted file mode 100644 index c116ca75..00000000 --- a/src/main/java/com/pahimar/ee3/item/ItemBlockInfusedWood.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.pahimar.ee3.item; - -import com.pahimar.ee3.lib.ItemIds; -import com.pahimar.ee3.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; - -import java.util.List; - -public class ItemBlockInfusedWood extends ItemBlock -{ - public ItemBlockInfusedWood(int id) - { - super(id); - this.setHasSubtypes(true); - } - - @Override - public int getMetadata(int meta) - { - return meta; - } - - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean flag) - { - int dustMetaData = (itemStack.getItemDamage() % 3) + 1; - list.add(String.format("%s %s", StatCollector.translateToLocal(Strings.TOOLTIP_INFUSED_WITH), new ItemStack(ItemIds.ALCHEMICAL_DUST, 1, dustMetaData).getDisplayName())); - } -} diff --git a/src/main/java/com/pahimar/ee3/item/ItemChalk.java b/src/main/java/com/pahimar/ee3/item/ItemChalk.java index d2414cce..29fe211a 100644 --- a/src/main/java/com/pahimar/ee3/item/ItemChalk.java +++ b/src/main/java/com/pahimar/ee3/item/ItemChalk.java @@ -1,13 +1,13 @@ package com.pahimar.ee3.item; -import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.reference.Names; public class ItemChalk extends ItemEE { - public ItemChalk(int id) + public ItemChalk() { - super(id); - this.setUnlocalizedName(Strings.CHALK_NAME); + super(); this.maxStackSize = 64; + this.setUnlocalizedName(Names.Items.CHALK); } -} +} \ No newline at end of file diff --git a/src/main/java/com/pahimar/ee3/item/ItemDiviningRod.java b/src/main/java/com/pahimar/ee3/item/ItemDiviningRod.java index 1e628cc7..172fdde1 100644 --- a/src/main/java/com/pahimar/ee3/item/ItemDiviningRod.java +++ b/src/main/java/com/pahimar/ee3/item/ItemDiviningRod.java @@ -1,13 +1,5 @@ package com.pahimar.ee3.item; -import com.pahimar.ee3.lib.Strings; - public class ItemDiviningRod extends ItemEE { - public ItemDiviningRod(int id) - { - super(id); - this.setHasSubtypes(true); - this.setUnlocalizedName(Strings.DIVINING_ROD_NAME); - } } diff --git a/src/main/java/com/pahimar/ee3/item/ItemEE.java b/src/main/java/com/pahimar/ee3/item/ItemEE.java index 5d33cbe6..097dcf44 100644 --- a/src/main/java/com/pahimar/ee3/item/ItemEE.java +++ b/src/main/java/com/pahimar/ee3/item/ItemEE.java @@ -1,47 +1,33 @@ package com.pahimar.ee3.item; -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.creativetab.CreativeTab; +import com.pahimar.ee3.reference.Textures; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -/** - * Equivalent-Exchange-3 - *

- * ItemEE - * - * @author pahimar - */ public class ItemEE extends Item { - private static final int SHIFTED_ID_RANGE_CORRECTION = 256; - - public ItemEE(int id) + public ItemEE() { - super(id - SHIFTED_ID_RANGE_CORRECTION); - this.setCreativeTab(EquivalentExchange3.tabsEE3); - maxStackSize = 1; - setNoRepair(); + super(); + this.maxStackSize = 1; + this.setCreativeTab(CreativeTab.EE3_TAB); + this.setNoRepair(); } @Override public String getUnlocalizedName() { - return String.format("item.%s%s", Strings.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName())); + return String.format("item.%s%s", Textures.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override public String getUnlocalizedName(ItemStack itemStack) { - return String.format("item.%s%s", Strings.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName())); - } - - protected String getUnwrappedUnlocalizedName(String unlocalizedName) - { - return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); + return String.format("item.%s%s", Textures.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override @@ -50,4 +36,9 @@ public class ItemEE extends Item { itemIcon = iconRegister.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1)); } + + protected String getUnwrappedUnlocalizedName(String unlocalizedName) + { + return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); + } } diff --git a/src/main/java/com/pahimar/ee3/item/ItemInertStone.java b/src/main/java/com/pahimar/ee3/item/ItemInertStone.java index fc201e99..bd302190 100644 --- a/src/main/java/com/pahimar/ee3/item/ItemInertStone.java +++ b/src/main/java/com/pahimar/ee3/item/ItemInertStone.java @@ -1,19 +1,5 @@ package com.pahimar.ee3.item; -import com.pahimar.ee3.lib.Strings; - -/** - * Equivalent-Exchange-3 - *

- * ItemInertStone - * - * @author pahimar - */ public class ItemInertStone extends ItemEE { - public ItemInertStone(int id) - { - super(id); - this.setUnlocalizedName(Strings.INERT_STONE_NAME); - } } diff --git a/src/main/java/com/pahimar/ee3/item/ItemMiniumShard.java b/src/main/java/com/pahimar/ee3/item/ItemMiniumShard.java index 3665346e..6404f2fd 100644 --- a/src/main/java/com/pahimar/ee3/item/ItemMiniumShard.java +++ b/src/main/java/com/pahimar/ee3/item/ItemMiniumShard.java @@ -1,20 +1,5 @@ package com.pahimar.ee3.item; -import com.pahimar.ee3.lib.Strings; - -/** - * Equivalent-Exchange-3 - *

- * ItemMiniumShard - * - * @author pahimar - */ public class ItemMiniumShard extends ItemEE { - public ItemMiniumShard(int id) - { - super(id); - this.setUnlocalizedName(Strings.MINIUM_SHARD_NAME); - maxStackSize = 64; - } } diff --git a/src/main/java/com/pahimar/ee3/item/ItemMiniumStone.java b/src/main/java/com/pahimar/ee3/item/ItemMiniumStone.java index 52195806..b4296e0c 100644 --- a/src/main/java/com/pahimar/ee3/item/ItemMiniumStone.java +++ b/src/main/java/com/pahimar/ee3/item/ItemMiniumStone.java @@ -1,118 +1,5 @@ package com.pahimar.ee3.item; -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.helper.ItemStackNBTHelper; -import com.pahimar.ee3.helper.TransmutationHelper; -import com.pahimar.ee3.lib.GuiIds; -import com.pahimar.ee3.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -/** - * Equivalent-Exchange-3 - *

- * ItemMiniumStone - * - * @author pahimar - */ -public class ItemMiniumStone extends ItemEE implements ITransmutationStone, IKeyBound +public class ItemMiniumStone extends ItemEE { - public ItemMiniumStone(int id) - { - super(id); - this.setUnlocalizedName(Strings.MINIUM_STONE_NAME); - this.setMaxDamage(ConfigurationSettings.MINIUM_STONE_MAX_DURABILITY - 1); - } - - @Override - @SideOnly(Side.CLIENT) - public boolean hasEffect(ItemStack itemStack, int renderPass) - { - return ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN) || ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN); - } - - @Override - public String getItemDisplayName(ItemStack itemStack) - { - return EnumChatFormatting.BLUE + super.getItemDisplayName(itemStack); - } - - @Override - public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) - { - return false; - } - - @Override - public boolean getShareTag() - { - return true; - } - - @Override - public ItemStack getContainerItemStack(ItemStack itemStack) - { - ItemStack copiedStack = itemStack.copy(); - - copiedStack.setItemDamage(copiedStack.getItemDamage() + 1); - - // TODO Is this still necessary? - copiedStack.stackSize = 1; - - return copiedStack; - } - - @Override - public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int sideHit, float hitVecX, float hitVecY, float hitVecZ) - { - if (world.isRemote) - { - transmuteBlock(itemStack, entityPlayer, world, x, y, z, sideHit); - } - return true; - } - - @Override - public void openPortableCraftingGUI(EntityPlayer thePlayer, ItemStack itemStack) - { - ItemStackNBTHelper.setBoolean(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN, true); - thePlayer.openGui(EquivalentExchange3.instance, GuiIds.PORTABLE_CRAFTING, thePlayer.worldObj, (int) thePlayer.posX, (int) thePlayer.posY, (int) thePlayer.posZ); - } - - @Override - public void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit) - { - EquivalentExchange3.proxy.transmuteBlock(itemStack, player, world, x, y, z, sideHit); - } - - @Override - public void doKeyBindingAction(EntityPlayer thePlayer, ItemStack itemStack, String keyBinding) - { - if (keyBinding.equals(ConfigurationSettings.KEYBINDING_EXTRA)) - { - if (!thePlayer.isSneaking()) - { - openPortableCraftingGUI(thePlayer, itemStack); - } - } - else if (keyBinding.equals(ConfigurationSettings.KEYBINDING_TOGGLE)) - { - if (TransmutationHelper.targetBlockStack != null) - { - if (!thePlayer.isSneaking()) - { - TransmutationHelper.targetBlockStack = TransmutationHelper.getNextBlock(TransmutationHelper.targetBlockStack.itemID, TransmutationHelper.targetBlockStack.getItemDamage()); - } - else - { - TransmutationHelper.targetBlockStack = TransmutationHelper.getPreviousBlock(TransmutationHelper.targetBlockStack.itemID, TransmutationHelper.targetBlockStack.getItemDamage()); - } - } - } - } } diff --git a/src/main/java/com/pahimar/ee3/item/ItemPhilosophersStone.java b/src/main/java/com/pahimar/ee3/item/ItemPhilosophersStone.java index cd4cb96d..f5f7fd1d 100644 --- a/src/main/java/com/pahimar/ee3/item/ItemPhilosophersStone.java +++ b/src/main/java/com/pahimar/ee3/item/ItemPhilosophersStone.java @@ -1,177 +1,5 @@ package com.pahimar.ee3.item; -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.helper.ItemStackNBTHelper; -import com.pahimar.ee3.helper.TransmutationHelper; -import com.pahimar.ee3.lib.GuiIds; -import com.pahimar.ee3.lib.Sounds; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.network.PacketTypeHandler; -import com.pahimar.ee3.network.packet.PacketSoundEvent; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Equivalent-Exchange-3 - *

- * ItemPhilosophersStone - * - * @author pahimar - */ -public class ItemPhilosophersStone extends ItemEE implements ITransmutationStone, IChargeable, IKeyBound +public class ItemPhilosophersStone extends ItemEE { - private int maxChargeLevel; - - public ItemPhilosophersStone(int id) - { - super(id); - this.setUnlocalizedName(Strings.PHILOSOPHERS_STONE_NAME); - this.setMaxDamage(ConfigurationSettings.PHILOSOPHERS_STONE_MAX_DURABILITY - 1); - maxChargeLevel = 3; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean hasEffect(ItemStack itemStack, int renderPass) - { - return ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN) || ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN); - } - - @Override - public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) - { - return false; - } - - @Override - public boolean getShareTag() - { - return true; - } - - @Override - public ItemStack getContainerItemStack(ItemStack itemStack) - { - ItemStack copiedStack = itemStack.copy(); - - copiedStack.setItemDamage(copiedStack.getItemDamage() + 1); - - // TODO Is this still necessary? - copiedStack.stackSize = 1; - - return copiedStack; - } - - @Override - public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int sideHit, float hitVecX, float hitVecY, float hitVecZ) - { - if (world.isRemote) - { - transmuteBlock(itemStack, entityPlayer, world, x, y, z, sideHit); - } - return true; - } - - @Override - public void openPortableCraftingGUI(EntityPlayer thePlayer, ItemStack itemStack) - { - ItemStackNBTHelper.setBoolean(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN, true); - thePlayer.openGui(EquivalentExchange3.instance, GuiIds.PORTABLE_CRAFTING, thePlayer.worldObj, (int) thePlayer.posX, (int) thePlayer.posY, (int) thePlayer.posZ); - } - - @Override - public void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit) - { - EquivalentExchange3.proxy.transmuteBlock(itemStack, player, world, x, y, z, sideHit); - } - - @Override - public short getCharge(ItemStack stack) - { - return ItemStackNBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY); - } - - @Override - public void setCharge(ItemStack stack, short charge) - { - if (charge <= maxChargeLevel) - { - ItemStackNBTHelper.setShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY, charge); - } - } - - @Override - public void increaseCharge(ItemStack stack) - { - if (ItemStackNBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) < maxChargeLevel) - { - ItemStackNBTHelper.setShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY, (short) (ItemStackNBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) + 1)); - } - } - - @Override - public void decreaseCharge(ItemStack stack) - { - if (ItemStackNBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) > 0) - { - ItemStackNBTHelper.setShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY, (short) (ItemStackNBTHelper.getShort(stack, Strings.NBT_ITEM_CHARGE_LEVEL_KEY) - 1)); - } - } - - @Override - public void doKeyBindingAction(EntityPlayer thePlayer, ItemStack itemStack, String keyBinding) - { - if (keyBinding.equals(ConfigurationSettings.KEYBINDING_EXTRA)) - { - if (!thePlayer.isSneaking()) - { - openPortableCraftingGUI(thePlayer, itemStack); - } - } - else if (keyBinding.equals(ConfigurationSettings.KEYBINDING_TOGGLE)) - { - if (TransmutationHelper.targetBlockStack != null) - { - if (!thePlayer.isSneaking()) - { - TransmutationHelper.targetBlockStack = TransmutationHelper.getNextBlock(TransmutationHelper.targetBlockStack.itemID, TransmutationHelper.targetBlockStack.getItemDamage()); - } - else - { - TransmutationHelper.targetBlockStack = TransmutationHelper.getPreviousBlock(TransmutationHelper.targetBlockStack.itemID, TransmutationHelper.targetBlockStack.getItemDamage()); - } - } - } - else if (keyBinding.equals(ConfigurationSettings.KEYBINDING_CHARGE)) - { - if (!thePlayer.isSneaking()) - { - if (getCharge(itemStack) == maxChargeLevel) - { - PacketDispatcher.sendPacketToAllAround(thePlayer.posX, thePlayer.posY, thePlayer.posZ, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSoundEvent(thePlayer.username, Sounds.FAIL, thePlayer.posX, thePlayer.posY, thePlayer.posZ, 1.5F, 1.5F))); - } - else - { - increaseCharge(itemStack); - PacketDispatcher.sendPacketToAllAround(thePlayer.posX, thePlayer.posY, thePlayer.posZ, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSoundEvent(thePlayer.username, Sounds.CHARGE_UP, thePlayer.posX, thePlayer.posY, thePlayer.posZ, 0.5F, 0.5F + 0.5F * (getCharge(itemStack) * 1.0F / maxChargeLevel)))); - } - } - else - { - if (getCharge(itemStack) == 0) - { - PacketDispatcher.sendPacketToAllAround(thePlayer.posX, thePlayer.posY, thePlayer.posZ, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSoundEvent(thePlayer.username, Sounds.FAIL, thePlayer.posX, thePlayer.posY, thePlayer.posZ, 1.5F, 1.5F))); - } - else - { - decreaseCharge(itemStack); - PacketDispatcher.sendPacketToAllAround(thePlayer.posX, thePlayer.posY, thePlayer.posZ, 64D, thePlayer.worldObj.provider.dimensionId, PacketTypeHandler.populatePacket(new PacketSoundEvent(thePlayer.username, Sounds.CHARGE_DOWN, thePlayer.posX, thePlayer.posY, thePlayer.posZ, 0.5F, 1.0F - (0.5F - 0.5F * (getCharge(itemStack) * 1.0F / maxChargeLevel))))); - } - } - } - } } diff --git a/src/main/java/com/pahimar/ee3/item/ModItems.java b/src/main/java/com/pahimar/ee3/item/ModItems.java index 59ec0d08..1a6c156f 100644 --- a/src/main/java/com/pahimar/ee3/item/ModItems.java +++ b/src/main/java/com/pahimar/ee3/item/ModItems.java @@ -1,60 +1,19 @@ package com.pahimar.ee3.item; -import com.pahimar.ee3.lib.ItemIds; -import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.reference.Names; import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.item.Item; -/** - * Equivalent-Exchange-3 - *

- * ModItems - * - * @author pahimar - */ public class ModItems { - // Mod item instances - public static ItemEE miniumShard; - public static ItemEE inertStone; - public static ItemEE miniumStone; - public static ItemEE philStone; - public static ItemEE alchemicalDust; - public static ItemEE alchemicalBag; - public static ItemEE chalk; - public static ItemEE diviningRod; - public static ItemEE alchemicalFuel; - public static ItemEE alchemicalUpgrade; - - public static ItemMultiTextureTile alchemicalFuelBlock; + public static final Item itemAlchemicalBag = new ItemAlchemicalBag(); + public static final Item itemAlchemicalDust = new ItemAlchemicalDust(); + public static final Item itemChalk = new ItemChalk(); public static void init() { - // Initialize each mod item individually - miniumShard = new ItemMiniumShard(ItemIds.MINIUM_SHARD); - inertStone = new ItemInertStone(ItemIds.INERT_STONE); - miniumStone = new ItemMiniumStone(ItemIds.MINIUM_STONE); - philStone = new ItemPhilosophersStone(ItemIds.PHILOSOPHERS_STONE); - alchemicalDust = new ItemAlchemicalDust(ItemIds.ALCHEMICAL_DUST); - alchemicalBag = new ItemAlchemicalBag(ItemIds.ALCHEMICAL_BAG); - chalk = new ItemChalk(ItemIds.CHALK); - diviningRod = new ItemDiviningRod(ItemIds.DIVINING_ROD); - alchemicalFuel = new ItemAlchemicalFuel(ItemIds.ALCHEMICAL_FUEL); - alchemicalUpgrade = new ItemAlchemicalUpgrade(ItemIds.ALCHEMICAL_UPGRADE); - - // Set container items - miniumStone.setContainerItem(miniumStone); - philStone.setContainerItem(philStone); - - // Register items with the GameRegistry - GameRegistry.registerItem(miniumShard, "item." + Strings.MINIUM_SHARD_NAME); - GameRegistry.registerItem(inertStone, "item." + Strings.INERT_STONE_NAME); - GameRegistry.registerItem(miniumStone, "item." + Strings.MINIUM_STONE_NAME); - GameRegistry.registerItem(philStone, "item." + Strings.PHILOSOPHERS_STONE_NAME); - GameRegistry.registerItem(alchemicalDust, "item." + Strings.ALCHEMICAL_DUST_NAME); - GameRegistry.registerItem(alchemicalBag, "item." + Strings.ALCHEMICAL_BAG_NAME); - GameRegistry.registerItem(chalk, "item." + Strings.CHALK_NAME); - GameRegistry.registerItem(diviningRod, "item." + Strings.DIVINING_ROD_NAME); - GameRegistry.registerItem(alchemicalFuel, "item." + Strings.ALCHEMICAL_FUEL_NAME); - GameRegistry.registerItem(alchemicalUpgrade, "item." + Strings.ALCHEMICAL_UPGRADE_NAME); + GameRegistry.registerItem(itemAlchemicalBag, "item." + Names.Items.ALCHEMICAL_BAG); + GameRegistry.registerItem(itemAlchemicalDust, "item." + Names.Items.ALCHEMICAL_DUST); + GameRegistry.registerItem(itemChalk, "item." + Names.Items.CHALK); } } diff --git a/src/main/java/com/pahimar/ee3/item/crafting/RecipeAludel.java b/src/main/java/com/pahimar/ee3/item/crafting/RecipeAludel.java deleted file mode 100644 index a1f22f18..00000000 --- a/src/main/java/com/pahimar/ee3/item/crafting/RecipeAludel.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.pahimar.ee3.item.crafting; - -import com.pahimar.ee3.api.OreStack; -import com.pahimar.ee3.api.WrappedStack; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.ArrayList; -import java.util.List; - -public class RecipeAludel -{ - private ItemStack recipeOutput; - private WrappedStack inputStack; - private ItemStack dustStack; - - public RecipeAludel(ItemStack recipeOutput, ItemStack inputStack, ItemStack dustStack) - { - this.recipeOutput = recipeOutput.copy(); - this.inputStack = new WrappedStack(inputStack); - this.dustStack = dustStack.copy(); - } - - public RecipeAludel(ItemStack recipeOutput, OreStack inputStack, ItemStack dustStack) - { - this.recipeOutput = recipeOutput.copy(); - this.inputStack = new WrappedStack(inputStack); - this.dustStack = dustStack.copy(); - } - - public boolean matches(RecipeAludel recipeAludel) - { - return compareItemStacks(this.recipeOutput, recipeAludel.recipeOutput) && matches(recipeAludel.inputStack, recipeAludel.dustStack); - } - - public boolean matches(ItemStack inputStack, ItemStack dustStack) - { - if (OreDictionary.getOreID(inputStack) != -1) - { - if (matches(new WrappedStack(new OreStack(inputStack)), dustStack)) - { - return matches(new WrappedStack(new OreStack(inputStack)), dustStack); - } - } - - return matches(new WrappedStack(inputStack), dustStack); - } - - public boolean matches(WrappedStack inputStack, ItemStack dustStack) - { - return compareStacks(this.inputStack, inputStack) && compareItemStacks(this.dustStack, dustStack); - } - - public ItemStack getRecipeOutput() - { - return this.recipeOutput; - } - - public WrappedStack[] getRecipeInputs() - { - return new WrappedStack[]{inputStack, new WrappedStack(dustStack)}; - } - - public List getRecipeInputsAsWrappedStacks() - { - List recipeInputs = new ArrayList(); - recipeInputs.add(new WrappedStack(inputStack)); - recipeInputs.add(new WrappedStack(dustStack)); - return recipeInputs; - } - - @Override - public boolean equals(Object object) - { - if (object instanceof RecipeAludel) - { - return matches((RecipeAludel) object); - } - - return false; - } - - @Override - public String toString() - { - return String.format("Output: %s, Input: %s, Dust: %s", recipeOutput, inputStack, dustStack); - } - - private static boolean compareStacks(WrappedStack wrappedStack1, WrappedStack wrappedStack2) - { - if (wrappedStack1 != null && wrappedStack1.getWrappedStack() != null && wrappedStack2 != null && wrappedStack2.getWrappedStack() != null) - { - if (wrappedStack1.getWrappedStack() instanceof ItemStack && wrappedStack2.getWrappedStack() instanceof ItemStack) - { - ItemStack itemStack1 = (ItemStack) wrappedStack1.getWrappedStack(); - itemStack1.stackSize = wrappedStack1.getStackSize(); - ItemStack itemStack2 = (ItemStack) wrappedStack2.getWrappedStack(); - itemStack2.stackSize = wrappedStack2.getStackSize(); - - return compareItemStacks(itemStack1, itemStack2); - } - else if (wrappedStack1.getWrappedStack() instanceof OreStack && wrappedStack2.getWrappedStack() instanceof OreStack) - { - if (((OreStack) wrappedStack1.getWrappedStack()).oreName.equalsIgnoreCase(((OreStack) wrappedStack2.getWrappedStack()).oreName)) - { - return wrappedStack2.getStackSize() >= wrappedStack1.getStackSize(); - } - } - } - - return false; - } - - private static boolean compareItemStacks(ItemStack itemStack1, ItemStack itemStack2) - { - if (itemStack1 != null && itemStack2 != null) - { - if (itemStack1.itemID == itemStack2.itemID) - { - if (itemStack1.getItemDamage() == itemStack2.getItemDamage() || itemStack1.getItemDamage() == OreDictionary.WILDCARD_VALUE || itemStack2.getItemDamage() == OreDictionary.WILDCARD_VALUE) - { - if (itemStack1.hasTagCompound() && itemStack2.hasTagCompound()) - { - if (itemStack1.getTagCompound().hashCode() == itemStack2.getTagCompound().hashCode()) - { - return itemStack2.stackSize >= itemStack1.stackSize; - } - } - else if (!itemStack1.hasTagCompound() && !itemStack2.hasTagCompound()) - { - return itemStack2.stackSize >= itemStack1.stackSize; - } - } - } - } - - return false; - } -} \ No newline at end of file diff --git a/src/main/java/com/pahimar/ee3/item/crafting/RecipesAlchemicalBagDyes.java b/src/main/java/com/pahimar/ee3/item/crafting/RecipesAlchemicalBagDyes.java index 958bd722..65f5acb0 100644 --- a/src/main/java/com/pahimar/ee3/item/crafting/RecipesAlchemicalBagDyes.java +++ b/src/main/java/com/pahimar/ee3/item/crafting/RecipesAlchemicalBagDyes.java @@ -3,42 +3,30 @@ package com.pahimar.ee3.item.crafting; import com.pahimar.ee3.item.ItemAlchemicalBag; import net.minecraft.block.BlockColored; import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.init.Items; import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.World; import java.util.ArrayList; -/** - * Equivalent-Exchange-3 - *

- * RecipesAlchemicalBagDyes - * - * @author pahimar - */ public class RecipesAlchemicalBagDyes implements IRecipe { - @Override public boolean matches(InventoryCrafting inventoryCrafting, World world) { - ItemStack itemStack = null; ArrayList arrayList = new ArrayList(); for (int i = 0; i < inventoryCrafting.getSizeInventory(); ++i) { - ItemStack currentStack = inventoryCrafting.getStackInSlot(i); if (currentStack != null) { - if (currentStack.getItem() instanceof ItemAlchemicalBag) { - if (itemStack != null) { return false; @@ -48,8 +36,7 @@ public class RecipesAlchemicalBagDyes implements IRecipe } else { - - if (currentStack.itemID != Item.dyePowder.itemID) + if (currentStack.getItem() != Items.dye) { return false; } @@ -65,7 +52,6 @@ public class RecipesAlchemicalBagDyes implements IRecipe @Override public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) { - ItemStack itemStack = null; ItemAlchemicalBag itemAlchemicalBag = null; int[] colorChannels = new int[3]; @@ -77,15 +63,12 @@ public class RecipesAlchemicalBagDyes implements IRecipe for (k = 0; k < inventoryCrafting.getSizeInventory(); ++k) { - ItemStack currentStack = inventoryCrafting.getStackInSlot(k); if (currentStack != null) { - if (currentStack.getItem() instanceof ItemAlchemicalBag) { - itemAlchemicalBag = (ItemAlchemicalBag) currentStack.getItem(); if (itemStack != null) @@ -98,7 +81,6 @@ public class RecipesAlchemicalBagDyes implements IRecipe if (itemAlchemicalBag.hasColor(currentStack)) { - currentColor = itemAlchemicalBag.getColor(itemStack); red = (currentColor >> 16 & 255) / 255.0F; green = (currentColor >> 8 & 255) / 255.0F; @@ -112,13 +94,12 @@ public class RecipesAlchemicalBagDyes implements IRecipe } else { - - if (currentStack.itemID != Item.dyePowder.itemID) + if (currentStack.getItem() != Items.dye) { return null; } - float[] dyeColorChannels = EntitySheep.fleeceColorTable[BlockColored.getBlockFromDye(currentStack.getItemDamage())]; + float[] dyeColorChannels = EntitySheep.fleeceColorTable[BlockColored.func_150032_b(currentStack.getItemDamage())]; j1 = (int) (dyeColorChannels[0] * 255.0F); k1 = (int) (dyeColorChannels[1] * 255.0F); newColor = (int) (dyeColorChannels[2] * 255.0F); @@ -137,7 +118,6 @@ public class RecipesAlchemicalBagDyes implements IRecipe } else { - k = colorChannels[0] / j; l1 = colorChannels[1] / j; currentColor = colorChannels[2] / j; @@ -156,14 +136,12 @@ public class RecipesAlchemicalBagDyes implements IRecipe @Override public int getRecipeSize() { - return 10; } @Override public ItemStack getRecipeOutput() { - return null; } } diff --git a/src/main/java/com/pahimar/ee3/item/crafting/RecipesTransmutationStones.java b/src/main/java/com/pahimar/ee3/item/crafting/RecipesTransmutationStones.java deleted file mode 100644 index ac68dd79..00000000 --- a/src/main/java/com/pahimar/ee3/item/crafting/RecipesTransmutationStones.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.pahimar.ee3.item.crafting; - -import com.pahimar.ee3.helper.CraftingHelper; -import com.pahimar.ee3.item.ModItems; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -public class RecipesTransmutationStones -{ - private static final ItemStack MINIUM_STONE = new ItemStack(ModItems.miniumStone.itemID, 1, OreDictionary.WILDCARD_VALUE); - private static final ItemStack PHILOSOPHERS_STONE = new ItemStack(ModItems.philStone.itemID, 1, OreDictionary.WILDCARD_VALUE); - - public static void init() - { - registerTransmutationRecipes(MINIUM_STONE); - registerTransmutationRecipes(PHILOSOPHERS_STONE); - } - - private static void registerTransmutationRecipes(ItemStack transmutationStone) - { - /* 4 Cobble <-> 1 Flint */ - CraftingHelper.addShapelessOreRecipe(new ItemStack(Item.flint), transmutationStone, Block.cobblestone, Block.cobblestone, Block.cobblestone, Block.cobblestone); - CraftingHelper.addShapelessOreRecipe(new ItemStack(Block.cobblestone, 4), transmutationStone, Item.flint); - - /* 4 Dirt <-> 1 Gravel */ - CraftingHelper.addShapelessOreRecipe(new ItemStack(Block.gravel), transmutationStone, Block.dirt, Block.dirt, Block.dirt, Block.dirt); - CraftingHelper.addShapelessOreRecipe(new ItemStack(Block.dirt, 4), transmutationStone, Block.gravel); - - /* 4 Sand <-> 1 Sandstone */ - // Vanilla Recipes exist to make SandStone from 4 Sand - CraftingHelper.addShapelessOreRecipe(new ItemStack(Block.sand, 4), transmutationStone, new ItemStack(Block.sandStone, 1, OreDictionary.WILDCARD_VALUE)); - - /* 2 Sticks -> Wood Plank */ - CraftingHelper.addShapelessOreRecipe(new ItemStack(Block.planks), transmutationStone, "stickWood", "stickWood"); - // Vanilla recipe exists to make sticks from planks - - /* 4 Wood Planks -> Wood Block */ - CraftingHelper.addShapelessOreRecipe(new ItemStack(Block.wood), transmutationStone, "plankWood", "plankWood", "plankWood", "plankWood"); - // Vanilla recipes exist to make planks from any wood log - - /* 4 Gravel/Sandstone/Flint -> 1 Clay Ball, 1 Clay Ball -> 4 Gravel */ - CraftingHelper.addShapelessOreRecipe(new ItemStack(Item.clay), transmutationStone, Block.gravel, Block.gravel, Block.gravel, Block.gravel); - CraftingHelper.addShapelessOreRecipe(new ItemStack(Item.clay), transmutationStone, new ItemStack(Block.sandStone, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Block.sandStone, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Block.sandStone, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Block.sandStone, 1, OreDictionary.WILDCARD_VALUE)); - CraftingHelper.addShapelessOreRecipe(new ItemStack(Item.clay), transmutationStone, Item.flint, Item.flint, Item.flint, Item.flint); - CraftingHelper.addShapelessOreRecipe(new ItemStack(Block.gravel, 4), transmutationStone, Item.clay); - - /* 2 Wood Log <-> 1 Obsidian */ - CraftingHelper.addShapelessOreRecipe(new ItemStack(Block.obsidian), transmutationStone, "logWood", "logWood"); - CraftingHelper.addShapelessOreRecipe(new ItemStack(Block.wood, 2), transmutationStone, Block.obsidian); - - /* 4 Clay Ball <-> 1 Clay Block */ - // Vanilla recipe exists to make clay blocks from clay balls - CraftingHelper.addShapelessOreRecipe(new ItemStack(Item.clay, 4), transmutationStone, Block.blockClay); - - /* 4 Obsidian/Clay Block -> 1 Iron Ingot, Iron Ingot -> Clay Block */ - CraftingHelper.addShapelessOreRecipe(new ItemStack(Item.ingotIron), transmutationStone, Block.obsidian, Block.obsidian, Block.obsidian, Block.obsidian); - CraftingHelper.addShapelessOreRecipe(new ItemStack(Item.ingotIron), transmutationStone, Block.blockClay, Block.blockClay, Block.blockClay, Block.blockClay); - CraftingHelper.addShapelessOreRecipe(new ItemStack(Block.blockClay, 4), transmutationStone, Item.ingotIron); - - /* 8 Iron Ingot <-> 1 Gold Ingot */ - CraftingHelper.addShapelessOreRecipe(new ItemStack(Item.ingotGold), transmutationStone, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron); - CraftingHelper.addShapelessOreRecipe(new ItemStack(Item.ingotIron, 8), transmutationStone, Item.ingotGold); - - /* 4 Gold Ingot <-> 1 Diamond */ - CraftingHelper.addShapelessOreRecipe(new ItemStack(Item.diamond), transmutationStone, Item.ingotGold, Item.ingotGold, Item.ingotGold, Item.ingotGold); - CraftingHelper.addShapelessOreRecipe(new ItemStack(Item.ingotGold, 4), transmutationStone, Item.diamond); - - /* 8 Iron Block <-> 1 Gold Block */ - CraftingHelper.addShapelessOreRecipe(new ItemStack(Block.blockGold), transmutationStone, Block.blockIron, Block.blockIron, Block.blockIron, Block.blockIron, Block.blockIron, Block.blockIron, Block.blockIron, Block.blockIron); - CraftingHelper.addShapelessOreRecipe(new ItemStack(Block.blockIron, 8), transmutationStone, Block.blockGold); - - /* 4 Gold Block <-> 1 Diamond Block */ - CraftingHelper.addShapelessOreRecipe(new ItemStack(Block.blockDiamond), transmutationStone, Block.blockGold, Block.blockGold, Block.blockGold, Block.blockGold); - CraftingHelper.addShapelessOreRecipe(new ItemStack(Block.blockGold, 4), transmutationStone, Block.blockDiamond); - - /* 1 Ender Pearl <-> 4 Iron Ingot */ - CraftingHelper.addShapelessOreRecipe(new ItemStack(Item.enderPearl), transmutationStone, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron); - CraftingHelper.addShapelessOreRecipe(new ItemStack(Item.ingotIron, 4), transmutationStone, Item.enderPearl); - } -} diff --git a/src/main/java/com/pahimar/ee3/item/crafting/RecipesVanilla.java b/src/main/java/com/pahimar/ee3/item/crafting/RecipesVanilla.java deleted file mode 100644 index 79edf6a9..00000000 --- a/src/main/java/com/pahimar/ee3/item/crafting/RecipesVanilla.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.pahimar.ee3.item.crafting; - -import com.pahimar.ee3.block.ModBlocks; -import com.pahimar.ee3.helper.CraftingHelper; -import com.pahimar.ee3.item.ModItems; -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public class RecipesVanilla -{ - public static void init() - { - initBlockRecipes(); - initItemRecipes(); - } - - private static void initBlockRecipes() - { - GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalFuel, 1, 0), new Object[]{"iii", "iii", "iii", 'i', new ItemStack(ModItems.alchemicalFuel, 1, 0)}); - GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalFuel, 1, 1), new Object[]{"iii", "iii", "iii", 'i', new ItemStack(ModItems.alchemicalFuel, 1, 1)}); - GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalFuel, 1, 2), new Object[]{"iii", "iii", "iii", 'i', new ItemStack(ModItems.alchemicalFuel, 1, 2)}); - - GameRegistry.addRecipe(new ItemStack(ModBlocks.chalk), new Object[]{"bcb", "cbc", "bcb", 'b', new ItemStack(Item.dyePowder.itemID, 1, 15), 'c', new ItemStack(Item.clay)}); - GameRegistry.addRecipe(new ItemStack(ModBlocks.chalk), new Object[]{"cc", "cc", 'c', new ItemStack(ModItems.chalk)}); - - GameRegistry.addRecipe(new ItemStack(ModBlocks.glassBell), new Object[]{"iii", "i i", "i i", 'i', Block.glass}); - - GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.infusedPlanks, 4, 0), new ItemStack(ModBlocks.infusedWood, 1, 0)); - GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.infusedPlanks, 4, 1), new ItemStack(ModBlocks.infusedWood, 1, 1)); - GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.infusedPlanks, 4, 2), new ItemStack(ModBlocks.infusedWood, 1, 2)); - - GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 0), new Object[]{"ppp", "p p", "ppp", 'p', new ItemStack(ModBlocks.infusedPlanks, 1, 0)}); - GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 1), new Object[]{"ppp", "p p", "ppp", 'p', new ItemStack(ModBlocks.infusedPlanks, 1, 1)}); - GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 2), new Object[]{"ppp", "p p", "ppp", 'p', new ItemStack(ModBlocks.infusedPlanks, 1, 2)}); - - CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.calcinator), new Object[]{"i i", "sis", "s s", 'i', Item.ingotIron, 's', "stone"}); - CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.aludelBase), new Object[]{"iii", "sis", "iii", 'i', Item.ingotIron, 's', "stone"}); - CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.researchStation), new Object[]{"ipi", " s ", "sss", 'p', "plankWood", 'i', Item.ingotIron, 's', "stone"}); - } - - private static void initItemRecipes() - { - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 0), new ItemStack(ModBlocks.alchemicalFuel, 1, 0)); - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 1), new ItemStack(ModBlocks.alchemicalFuel, 1, 1)); - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 2), new ItemStack(ModBlocks.alchemicalFuel, 1, 2)); - - GameRegistry.addRecipe(new ItemStack(ModItems.inertStone), new Object[]{"sis", "igi", "sis", 's', Block.stone, 'i', Item.ingotIron, 'g', Item.ingotGold}); - - GameRegistry.addRecipe(new ItemStack(ModItems.alchemicalBag, 1, 0), new Object[]{"ccc", "cdc", "ccc", 'c', new ItemStack(ModBlocks.infusedCloth, 1, 0), 'd', new ItemStack(ModItems.alchemicalDust, 1, 1)}); - GameRegistry.addRecipe(new ItemStack(ModItems.alchemicalBag, 1, 1), new Object[]{"ccc", "cdc", "ccc", 'c', new ItemStack(ModBlocks.infusedCloth, 1, 1), 'd', new ItemStack(ModItems.alchemicalDust, 1, 2)}); - GameRegistry.addRecipe(new ItemStack(ModItems.alchemicalBag, 1, 2), new Object[]{"ccc", "cdc", "ccc", 'c', new ItemStack(ModBlocks.infusedCloth, 1, 2), 'd', new ItemStack(ModItems.alchemicalDust, 1, 3)}); - - CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.diviningRod), new Object[]{" s ", " s ", "s s", 's', "stickWood"}); - - GameRegistry.addRecipe(new ItemStack(ModItems.alchemicalUpgrade.itemID, 1, 0), new Object[]{"ppp", "pdp", "ppp", 'p', new ItemStack(ModBlocks.infusedPlanks, 1, 0), 'd', new ItemStack(ModItems.alchemicalDust, 1, 0)}); - GameRegistry.addRecipe(new ItemStack(ModItems.alchemicalUpgrade.itemID, 1, 1), new Object[]{"ppp", "pdp", "ppp", 'p', new ItemStack(ModBlocks.infusedPlanks, 1, 1), 'd', new ItemStack(ModItems.alchemicalDust, 1, 1)}); - GameRegistry.addRecipe(new ItemStack(ModItems.alchemicalUpgrade.itemID, 1, 2), new Object[]{"ppp", "pdp", "ppp", 'p', new ItemStack(ModBlocks.infusedPlanks, 1, 2), 'd', new ItemStack(ModItems.alchemicalDust, 1, 2)}); - } -} diff --git a/src/main/java/com/pahimar/ee3/lib/ActionTypes.java b/src/main/java/com/pahimar/ee3/lib/ActionTypes.java deleted file mode 100644 index fbb42053..00000000 --- a/src/main/java/com/pahimar/ee3/lib/ActionTypes.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.pahimar.ee3.lib; - -/** - * Equivalent-Exchange-3 - *

- * ActionTypes - * - * @author pahimar - */ -public class ActionTypes -{ - - public static final byte TRANSMUTATION = 0; -} diff --git a/src/main/java/com/pahimar/ee3/lib/BlockIds.java b/src/main/java/com/pahimar/ee3/lib/BlockIds.java deleted file mode 100644 index 919cb81e..00000000 --- a/src/main/java/com/pahimar/ee3/lib/BlockIds.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.pahimar.ee3.lib; - -/** - * Equivalent-Exchange-3 - *

- * BlockIds - * - * @author pahimar - */ -public class BlockIds -{ - /* Default block ids */ - public static int CALCINATOR_DEFAULT = 2451; - public static int ALUDEL_BASE_DEFAULT = 2452; - public static int GLASS_BELL_DEFAULT = 2453; - public static int ALCHEMICAL_CHEST_DEFAULT = 2454; - public static int ALCHEMICAL_FUEL_DEFAULT = 2455; - public static int CHALK_DEFAULT = 2456; - public static int ALCHEMY_SQUARE_DEFAULT = 2457; - public static int RESEARCH_STATION_DEFAULT = 2458; - public static int INFUSED_CLOTH_DEFAULT = 2460; - public static int INFUSED_WOOD_DEFAULT = 2461; - public static int INFUSED_PLANKS_DEFAULT = 2462; - - /* Current block ids */ - public static int CALCINATOR; - public static int ALUDEL_BASE; - public static int GLASS_BELL; - public static int ALCHEMICAL_CHEST; - public static int ALCHEMICAL_FUEL; - public static int CHALK; - public static int ALCHEMY_SQUARE; - public static int RESEARCH_STATION; - public static int INFUSED_CLOTH; - public static int INFUSED_WOOD; - public static int INFUSED_PLANKS; -} diff --git a/src/main/java/com/pahimar/ee3/lib/Commands.java b/src/main/java/com/pahimar/ee3/lib/Commands.java deleted file mode 100644 index 5aabddc2..00000000 --- a/src/main/java/com/pahimar/ee3/lib/Commands.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.pahimar.ee3.lib; - -/** - * Equivalent-Exchange-3 - *

- * Commands - * - * @author pahimar - */ -public class Commands -{ - /* Command related contants */ - public static final String ALL = "all"; - public static final String SELF = "self"; - public static final String ON = "on"; - public static final String OFF = "off"; - - public static final String COMMAND_EE3 = "ee3"; - public static final String COMMAND_ON = "on"; - public static final String COMMAND_OFF = "off"; - public static final String COMMAND_ALL = "all"; - public static final String COMMAND_SELF = "self"; - public static final String COMMAND_OVERLAY = "overlay"; - public static final String COMMAND_POSITION = "position"; - public static final String COMMAND_OPACITY = "opacity"; - public static final String COMMAND_SCALE = "scale"; - public static final String COMMAND_TOP = "top"; - public static final String COMMAND_BOTTOM = "bottom"; - public static final String COMMAND_LEFT = "left"; - public static final String COMMAND_RIGHT = "right"; - public static final String COMMAND_PARTICLES = "particles"; - public static final String COMMAND_SOUNDS = "sounds"; - public static final String COMMAND_VERSION = "version"; - public static final String COMMAND_CHANGELOG = "changelog"; - public static final String COMMAND_EE3_USAGE = "ee3 [ overlay | particles | sounds | version ]"; - public static final String COMMAND_OVERLAY_USAGE = "ee3 overlay [ on | off | position | scale | opacity ]"; - public static final String COMMAND_OVERLAY_POSITION_USAGE = "ee3 overlay position [ top | bottom ] [ left | right ]"; - public static final String COMMAND_OVERLAY_OPACITY_USAGE = "ee3 overlay opacity ### "; - public static final String COMMAND_OVERLAY_SCALE_USAGE = "ee3 overlay scale ### "; - public static final String COMMAND_PARTICLES_USAGE = "ee3 particles [ on | off ]"; - public static final String COMMAND_SOUNDS_USAGE = "ee3 sounds [ all | self | off ]"; - public static final String COMMAND_VERSION_USAGE = "command.ee3.version.usage"; - - public static final String COMMAND_OVERLAY_TURNED_ON = "command.ee3:overlay.turned_on"; - public static final String COMMAND_OVERLAY_TURNED_OFF = "command.ee3:overlay.turned_off"; - public static final String COMMAND_OVERLAY_POSITION_TOP_LEFT = "command.ee3:overlay.position.top_left"; - public static final String COMMAND_OVERLAY_POSITION_TOP_RIGHT = "command.ee3:overlay.position.top_right"; - public static final String COMMAND_OVERLAY_POSITION_BOTTOM_LEFT = "command.ee3:overlay.position.bottom_left"; - public static final String COMMAND_OVERLAY_POSITION_BOTTOM_RIGHT = "command.ee3:overlay.position.bottom_right"; - public static final String COMMAND_OVERLAY_OPACITY_USAGE_ADDITIONAL_TEXT = "command.ee3:overlay.opacity.usage.additional_text"; - public static final String COMMAND_OVERLAY_OPACITY_UPDATED = "command.ee3:overlay.opacity.updated"; - public static final String COMMAND_OVERLAY_SCALE_USAGE_ADDITIONAL_TEXT = "command.ee3:overlay.scale.usage.additional_text"; - public static final String COMMAND_OVERLAY_SCALE_UPDATED = "command.ee3:overlay.scale.updated"; - public static final String COMMAND_PARTICLES_TURNED_ON = "command.ee3:particles.turned_on"; - public static final String COMMAND_PARTICLES_TURNED_OFF = "command.ee3:particles.turned_off"; - public static final String COMMAND_SOUNDS_SET_TO_ALL = "command.ee3:sounds.set_to_all"; - public static final String COMMAND_SOUNDS_SET_TO_SELF = "command.ee3:sounds.set_to_self"; - public static final String COMMAND_SOUNDS_TURNED_OFF = "command.ee3:sounds.turned_off"; -} diff --git a/src/main/java/com/pahimar/ee3/lib/Compare.java b/src/main/java/com/pahimar/ee3/lib/Compare.java deleted file mode 100644 index 64a19eb2..00000000 --- a/src/main/java/com/pahimar/ee3/lib/Compare.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.pahimar.ee3.lib; - -public class Compare -{ - - // Comparator stuff - public static final int LESSER_THAN = -1; - public static final int EQUALS = 0; - public static final int GREATER_THAN = 1; -} diff --git a/src/main/java/com/pahimar/ee3/lib/ItemIds.java b/src/main/java/com/pahimar/ee3/lib/ItemIds.java deleted file mode 100644 index 1d3eb86d..00000000 --- a/src/main/java/com/pahimar/ee3/lib/ItemIds.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.pahimar.ee3.lib; - -/** - * Equivalent-Exchange-3 - *

- * ItemIds - * - * @author pahimar - */ -public class ItemIds -{ - /* Default item ids */ - public static int MINIUM_SHARD_DEFAULT = 27000; - public static int INERT_STONE_DEFAULT = 27001; - public static int MINIUM_STONE_DEFAULT = 27002; - public static int PHILOSOPHERS_STONE_DEFAULT = 27003; - public static int ALCHEMICAL_DUST_DEFAULT = 27004; - public static int ALCHEMICAL_BAG_DEFAULT = 27005; - public static int CHALK_DEFAULT = 27006; - public static int DIVINING_ROD_DEFAULT = 27007; - public static int ALCHEMICAL_FUEL_DEFAULT = 27008; - public static int ALCHEMICAL_UPGRADE_DEFAULT = 27009; - - /* Current item ids */ - public static int MINIUM_SHARD; - public static int INERT_STONE; - public static int MINIUM_STONE; - public static int PHILOSOPHERS_STONE; - public static int ALCHEMICAL_DUST; - public static int ALCHEMICAL_BAG; - public static int CHALK; - public static int DIVINING_ROD; - public static int ALCHEMICAL_FUEL; - public static int ALCHEMICAL_UPGRADE; -} diff --git a/src/main/java/com/pahimar/ee3/lib/ItemUpdateTypes.java b/src/main/java/com/pahimar/ee3/lib/ItemUpdateTypes.java deleted file mode 100644 index 79ff7244..00000000 --- a/src/main/java/com/pahimar/ee3/lib/ItemUpdateTypes.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.pahimar.ee3.lib; - -/** - * Equivalent-Exchange-3 - *

- * ItemUpdateTypes - * - * @author pahimar - */ -public class ItemUpdateTypes -{ - - public static final byte DESTROYED = 0; -} diff --git a/src/main/java/com/pahimar/ee3/lib/Models.java b/src/main/java/com/pahimar/ee3/lib/Models.java deleted file mode 100644 index c612d704..00000000 --- a/src/main/java/com/pahimar/ee3/lib/Models.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.pahimar.ee3.lib; - -public class Models -{ - - // Base file paths - public static final String MODEL_LOCATION = "/assets/ee3/models/"; - - public static final String ALUDEL = MODEL_LOCATION + "aludel.obj"; - public static final String CALCINATOR = MODEL_LOCATION + "calcinator.obj"; - public static final String GLASS_BELL = MODEL_LOCATION + "aludel.obj"; - public static final String RESEARCH_STATION = MODEL_LOCATION + "researchStation.obj"; -} diff --git a/src/main/java/com/pahimar/ee3/lib/Particles.java b/src/main/java/com/pahimar/ee3/lib/Particles.java deleted file mode 100644 index 4b98acad..00000000 --- a/src/main/java/com/pahimar/ee3/lib/Particles.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.pahimar.ee3.lib; - -/** - * Equivalent-Exchange-3 - *

- * Particles - * - * @author pahimar - */ -public class Particles -{ - /* Vanilla particle names (not necessarily all of them) */ - public static final String NORMAL_SMOKE = "smoke"; - public static final String LARGE_SMOKE = "largesmoke"; - public static final String NORMAL_EXPLODE = "explode"; - public static final String LARGE_EXPLODE = "largeexplode"; - public static final String HUGE_EXPLODE = "hugeexplode"; - public static final String HEART = "heart"; - public static final String DEATH_SUSPEND = "deathsuspend"; - public static final String SUSPEND = "suspend"; - public static final String WITCH_MAGIC = "witchMagic"; - public static final String BUBBLE = "bubble"; - public static final String SPLASH = "splash"; - public static final String SNOWBALL_POOF = "snowballpoof"; - public static final String SNOW_SHOVEL = "snowshovel"; - public static final String NOTE = "note"; - public static final String PORTAL = "portal"; - public static final String MOB_SPELL = "mobSpell"; - public static final String MOB_SPELL_AMBIENT = "mobSpellAmbient"; - public static final String FIREWORKS_SPARKLE = "fireworksSpark"; - public static final String SLIME = "slime"; - public static final String CRIT = "crit"; - public static final String FLAME = "flame"; - public static final String ENCHANTMENT_TABLE = "enchantmenttable"; - public static final String DRIP_WATER = "dripWater"; - public static final String DRIP_LAVA = "dripLava"; - public static final String TOWN_AURA = "townaura"; - public static final String RED_DUST = "reddust"; -} diff --git a/src/main/java/com/pahimar/ee3/lib/Reference.java b/src/main/java/com/pahimar/ee3/lib/Reference.java deleted file mode 100644 index 2aac0326..00000000 --- a/src/main/java/com/pahimar/ee3/lib/Reference.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.pahimar.ee3.lib; - -import com.google.common.base.Throwables; - -import java.io.InputStream; -import java.util.Properties; - -/** - * Equivalent-Exchange-3 - *

- * Reference - * - * @author pahimar - */ -public class Reference -{ - static - { - Properties prop = new Properties(); - - try - { - InputStream stream = Reference.class.getClassLoader().getResourceAsStream("version.properties"); - prop.load(stream); - stream.close(); - } - catch (Exception e) - { - Throwables.propagate(e); // just throw it... - } - - VERSION_NUMBER = prop.getProperty("version") + " (build " + prop.getProperty("build_number") + ")"; - } - - // General Mod related constants - public static final String MOD_ID = "EE3"; - public static final String CHANNEL_NAME = MOD_ID; - public static final String MOD_NAME = "Equivalent Exchange 3"; - public static final String VERSION_NUMBER; - public static final String FINGERPRINT = "@FINGERPRINT@"; - public static final int ONE_SECOND_IN_TICKS = 20; - public static final String SERVER_PROXY_CLASS = "com.pahimar.ee3.proxy.ServerProxy"; - public static final String CLIENT_PROXY_CLASS = "com.pahimar.ee3.proxy.ClientProxy"; - public static final int VERSION_CHECK_ATTEMPTS = 3; -} diff --git a/src/main/java/com/pahimar/ee3/lib/RenderIds.java b/src/main/java/com/pahimar/ee3/lib/RenderIds.java deleted file mode 100644 index ddeadd54..00000000 --- a/src/main/java/com/pahimar/ee3/lib/RenderIds.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.pahimar.ee3.lib; - -/** - * Equivalent-Exchange-3 - *

- * RenderIds - * - * @author pahimar - */ -public class RenderIds -{ - public static int calcinatorRender; - public static int aludelRender; - public static int alchemicalChestRender; - public static int glassBell; - public static int researchStation; -} diff --git a/src/main/java/com/pahimar/ee3/lib/Strings.java b/src/main/java/com/pahimar/ee3/lib/Strings.java deleted file mode 100644 index 90249c38..00000000 --- a/src/main/java/com/pahimar/ee3/lib/Strings.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.pahimar.ee3.lib; - -/** - * Equivalent-Exchange-3 - *

- * Strings - * - * @author pahimar - */ -public class Strings -{ - /* Localization Prefixes */ - public static final String RESOURCE_PREFIX = Reference.MOD_ID.toLowerCase() + ":"; - - /* Fingerprint check related constants */ - public static final String NO_FINGERPRINT_MESSAGE = "The copy of Equivalent Exchange 3 that you are running is a development version of the mod, and as such may be unstable and/or incomplete."; - public static final String INVALID_FINGERPRINT_MESSAGE = "The copy of Equivalent Exchange 3 that you are running has been modified from the original, and unpredictable things may happen. Please consider re-downloading the original version of the mod."; - - /* Version check related constants */ - public static final String VERSION_CHECK_INIT_LOG_MESSAGE = "version.ee3:init_log_message"; - public static final String UNINITIALIZED_MESSAGE = "version.ee3:uninitialized"; - public static final String CURRENT_MESSAGE = "version.ee3:current"; - public static final String OUTDATED_MESSAGE = "version.ee3:outdated"; - public static final String GENERAL_ERROR_MESSAGE = "version.ee3:general_error"; - public static final String FINAL_ERROR_MESSAGE = "version.ee3:final_error"; - public static final String MC_VERSION_NOT_FOUND = "version.ee3:mc_version_not_found"; - - // Tooltip related localiation keys - public static final String TOOLTIP_INFUSED_WITH = "tooltip.ee3:infusedPrefix"; - public static final String UPGRADES_CHESTS = "tooltip.ee3:upgradesPrefix"; - - /* NBT related constants */ - public static final String NBT_ITEM_CHARGE_LEVEL_KEY = "itemChargeLevel"; - public static final String NBT_ITEM_MODE_KEY = "itemMode"; - public static final String NBT_ITEM_CRAFTING_GUI_OPEN = "itemCraftingGuiOpen"; - public static final String NBT_ITEM_TRANSMUTATION_GUI_OPEN = "itemTransmutationGuiOpen"; - public static final String NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN = "itemAlchemicalBagGuiOpen"; - public static final String NBT_ITEM_UUID_MOST_SIG = "itemUUIDMostSig"; - public static final String NBT_ITEM_UUID_LEAST_SIG = "itemUUIDLeastSig"; - public static final String NBT_ITEM_DISPLAY = "display"; - public static final String NBT_ITEM_COLOR = "color"; - public static final String NBT_TE_STATE_KEY = "teState"; - public static final String NBT_CUSTOM_NAME = "CustomName"; - public static final String NBT_TE_DIRECTION_KEY = "teDirection"; - - /* Block name constants */ - public static final String CALCINATOR_NAME = "calcinator"; - public static final String ALUDEL_NAME = "aludel"; - public static final String ALCHEMICAL_CHEST_NAME = "alchemicalChest"; - public static final String GLASS_BELL_NAME = "glassBell"; - public static final String ALCHEMY_SQUARE_NAME = "alchemySquare"; - public static final String RESEARCH_STATION_NAME = "researchStation"; - public static final String INFUSED_CLOTH_NAME = "infusedCloth"; - public static final String INFUSED_WOOD_NAME = "infusedWood"; - public static final String INFUSED_PLANKS_NAME = "infusedPlanks"; - - /* Item name constants */ - public static final String MINIUM_SHARD_NAME = "shardMinium"; - public static final String INERT_STONE_NAME = "stoneInert"; - public static final String MINIUM_STONE_NAME = "stoneMinium"; - public static final String PHILOSOPHERS_STONE_NAME = "stonePhilosophers"; - public static final String ALCHEMICAL_DUST_NAME = "alchemicalDust"; - public static final String[] ALCHEMICAL_DUST_SUBTYPE_NAMES = {"ash", "verdant", "azure", "minium"}; - public static final String ALCHEMICAL_BAG_NAME = "alchemicalBag"; - public static final String CHALK_NAME = "chalk"; - public static final String DIVINING_ROD_NAME = "diviningRod"; - public static final String ALCHEMICAL_COAL_NAME = "alchemicalCoal"; - public static final String MOBIUS_FUEL_NAME = "mobiusFuel"; - public static final String AETERNALIS_FUEL_NAME = "aeternalisFuel"; - public static final String[] ALCHEMICAL_FUEL_SUBTYPE_NAMES = {ALCHEMICAL_COAL_NAME, MOBIUS_FUEL_NAME, AETERNALIS_FUEL_NAME}; - public static final String ALCHEMICAL_FUEL_NAME = "alchemicalFuel"; - public static final String ALCHEMICAL_FUEL_BLOCK_NAME = "alchemicalFuelBlock"; - public static final String ALCHEMICAL_UPGRADE_NAME = "alchemicalUpgrade"; - public static final String[] ALCHEMICAL_UPGRADE_SUBTYPE_NAMES = {"verdant", "azure", "minium"}; - - /* Transmutation cost related constants */ - public static final String TRANSMUTATION_COST = "_cost"; - public static final String TRANSMUTATION_COST_ITEM = "item" + TRANSMUTATION_COST; - public static final String TRANSMUTATION_COST_BLOCK = "block" + TRANSMUTATION_COST; - public static final String TRANSMUTATION_COST_MOB = "mob" + TRANSMUTATION_COST; - - /* Container related constants */ - public static final String CONTAINER_CALCINATOR_NAME = "container.ee3:" + CALCINATOR_NAME; - public static final String CONTAINER_ALUDEL_NAME = "container.ee3:" + ALUDEL_NAME; - public static final String CONTAINER_ALCHEMICAL_CHEST_NAME = "container.ee3:" + ALCHEMICAL_CHEST_NAME; - public static final String CONTAINER_ALCHEMICAL_BAG_NAME = "container.ee3:" + ALCHEMICAL_BAG_NAME; - public static final String CONTAINER_GLASS_BELL_NAME = "container.ee3:" + GLASS_BELL_NAME; - public static final String CONTAINER_INVENTORY = "container.inventory"; - public static final String CONTAINER_PORTABLE_CRAFTING = "container.crafting"; -} diff --git a/src/main/java/com/pahimar/ee3/lib/Textures.java b/src/main/java/com/pahimar/ee3/lib/Textures.java deleted file mode 100644 index 17f233ea..00000000 --- a/src/main/java/com/pahimar/ee3/lib/Textures.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.pahimar.ee3.lib; - -import com.pahimar.ee3.helper.ResourceLocationHelper; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.ResourceLocation; - -/** - * Equivalent-Exchange-3 - *

- * Sprites - * - * @author pahimar - */ -public class Textures -{ - - // Base file paths - public static final String MODEL_TEXTURE_LOCATION = "textures/models/"; - public static final String ARMOR_SHEET_LOCATION = "textures/armor/"; - public static final String GUI_SHEET_LOCATION = "textures/gui/"; - public static final String EFFECTS_LOCATION = "textures/effects/"; - - // Item/Block sprite sheets - public static final ResourceLocation VANILLA_BLOCK_TEXTURE_SHEET = TextureMap.locationBlocksTexture; - public static final ResourceLocation VANILLA_ITEM_TEXTURE_SHEET = TextureMap.locationItemsTexture; - - // Armor sprite sheets - - // GUI textures - public static final ResourceLocation GUI_CALCINATOR = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "calcinator.png"); - public static final ResourceLocation GUI_ALUDEL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "aludel.png"); - public static final ResourceLocation GUI_ALCHEMICAL_BAG_SMALL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalBag_small.png"); - public static final ResourceLocation GUI_ALCHEMICAL_BAG_MEDIUM = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalBag_medium.png"); - public static final ResourceLocation GUI_ALCHEMICAL_BAG_LARGE = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalBag_large.png"); - public static final ResourceLocation GUI_ALCHEMICAL_CHEST_SMALL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalChest_small.png"); - public static final ResourceLocation GUI_ALCHEMICAL_CHEST_MEDIUM = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalChest_medium.png"); - public static final ResourceLocation GUI_ALCHEMICAL_CHEST_LARGE = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalChest_large.png"); - public static final ResourceLocation GUI_PORTABLE_CRAFTING = new ResourceLocation("textures/gui/container/crafting_table.png"); - public static final ResourceLocation GUI_GLASS_BELL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "glassBell.png"); - - // Model textures - public static final ResourceLocation MODEL_CALCINATOR_IDLE = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "calcinator_idle.png"); - public static final ResourceLocation MODEL_CALCINATOR_ACTIVE = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "calcinator_active.png"); - public static final ResourceLocation MODEL_ALUDEL = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "aludel.png"); - public static final ResourceLocation MODEL_ALCHEMICAL_CHEST_SMALL = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "alchemicalChest_small.png"); - public static final ResourceLocation MODEL_ALCHEMICAL_CHEST_MEDIUM = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "alchemicalChest_medium.png"); - public static final ResourceLocation MODEL_ALCHEMICAL_CHEST_LARGE = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "alchemicalChest_large.png"); - public static final ResourceLocation MODEL_GLASS_BELL = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "aludel.png"); - public static final ResourceLocation MODEL_RESEARCH_STATION = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "researchStation.png"); - - // Effect textures - public static final ResourceLocation EFFECT_WORLD_TRANSMUTATION = ResourceLocationHelper.getResourceLocation(EFFECTS_LOCATION + "noise.png"); -} diff --git a/src/main/java/com/pahimar/ee3/network/PacketHandler.java b/src/main/java/com/pahimar/ee3/network/PacketHandler.java deleted file mode 100644 index b94b1852..00000000 --- a/src/main/java/com/pahimar/ee3/network/PacketHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.pahimar.ee3.network; - -import com.pahimar.ee3.network.packet.PacketEE; - -/** - * Equivalent-Exchange-3 - *

- * PacketHandler - * - * @author pahimar - */ -public class PacketHandler implements IPacketHandler -{ - /** - * Handles Packet250CustomPayload packets that are registered to an Equivalent Exchange 3 network channel - * - * @param manager - * The NetworkManager associated with the current platform (client/server) - * @param packet - * The Packet250CustomPayload that was received - * @param player - * The Player associated with the packet - */ - @Override - public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) - { - // Build a PacketEE object from the data contained within the Packet250CustomPayload packet - PacketEE packetEE = PacketTypeHandler.buildPacket(packet.data); - - // Execute the appropriate actions based on the PacketEE type - packetEE.execute(manager, player); - } -} diff --git a/src/main/java/com/pahimar/ee3/network/PacketTypeHandler.java b/src/main/java/com/pahimar/ee3/network/PacketTypeHandler.java deleted file mode 100644 index 374cbcd9..00000000 --- a/src/main/java/com/pahimar/ee3/network/PacketTypeHandler.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.pahimar.ee3.network; - -import com.pahimar.ee3.lib.Reference; -import com.pahimar.ee3.network.packet.*; - -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; - -/** - * Equivalent-Exchange-3 - *

- * PacketTypeHandler - * - * @author pahimar - */ -public enum PacketTypeHandler -{ - KEY(PacketKeyPressed.class), - TILE(PacketTileUpdate.class), - REQUEST_EVENT(PacketRequestEvent.class), - SPAWN_PARTICLE(PacketSpawnParticle.class), - SOUND_EVENT(PacketSoundEvent.class), - ITEM_UPDATE(PacketItemUpdate.class), - TILE_WITH_ITEM(PacketTileWithItemUpdate.class), - TILE_CALCINATOR(PacketTileCalcinator.class); - - private Class clazz; - - PacketTypeHandler(Class clazz) - { - this.clazz = clazz; - } - - public static PacketEE buildPacket(byte[] data) - { - ByteArrayInputStream bis = new ByteArrayInputStream(data); - int selector = bis.read(); - DataInputStream dis = new DataInputStream(bis); - - PacketEE packet = null; - - try - { - packet = values()[selector].clazz.newInstance(); - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - - packet.readPopulate(dis); - - return packet; - } - - public static PacketEE buildPacket(PacketTypeHandler type) - { - PacketEE packet = null; - - try - { - packet = values()[type.ordinal()].clazz.newInstance(); - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - - return packet; - } - - public static Packet populatePacket(PacketEE packetEE) - { - byte[] data = packetEE.populate(); - - Packet250CustomPayload packet250 = new Packet250CustomPayload(); - packet250.channel = Reference.CHANNEL_NAME; - packet250.data = data; - packet250.length = data.length; - packet250.isChunkDataPacket = packetEE.isChunkDataPacket; - - return packet250; - } -} diff --git a/src/main/java/com/pahimar/ee3/network/packet/PacketEE.java b/src/main/java/com/pahimar/ee3/network/packet/PacketEE.java deleted file mode 100644 index ada9b09f..00000000 --- a/src/main/java/com/pahimar/ee3/network/packet/PacketEE.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.pahimar.ee3.network.packet; - -import com.pahimar.ee3.network.PacketTypeHandler; - -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -/** - * Equivalent-Exchange-3 - *

- * PacketEE - * - * @author pahimar - */ -public class PacketEE -{ - - public PacketTypeHandler packetType; - public boolean isChunkDataPacket; - - public PacketEE(PacketTypeHandler packetType, boolean isChunkDataPacket) - { - - this.packetType = packetType; - this.isChunkDataPacket = isChunkDataPacket; - } - - public byte[] populate() - { - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - DataOutputStream dos = new DataOutputStream(bos); - - try - { - dos.writeByte(packetType.ordinal()); - this.writeData(dos); - } - catch (IOException e) - { - e.printStackTrace(System.err); - } - - return bos.toByteArray(); - } - - public void readPopulate(DataInputStream data) - { - - try - { - this.readData(data); - } - catch (IOException e) - { - e.printStackTrace(System.err); - } - } - - public void readData(DataInputStream data) throws IOException - { - - } - - public void writeData(DataOutputStream dos) throws IOException - { - - } - - public void execute(INetworkManager network, Player player) - { - - } - - public void setKey(int key) - { - - } -} diff --git a/src/main/java/com/pahimar/ee3/network/packet/PacketItemUpdate.java b/src/main/java/com/pahimar/ee3/network/packet/PacketItemUpdate.java deleted file mode 100644 index f7874a19..00000000 --- a/src/main/java/com/pahimar/ee3/network/packet/PacketItemUpdate.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.pahimar.ee3.network.packet; - -import com.pahimar.ee3.lib.ItemUpdateTypes; -import com.pahimar.ee3.network.PacketTypeHandler; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -/** - * Equivalent-Exchange-3 - *

- * PacketItemUpdate - * - * @author pahimar - */ -public class PacketItemUpdate extends PacketEE -{ - - public byte slot; - public byte updateType; - - public PacketItemUpdate() - { - - super(PacketTypeHandler.ITEM_UPDATE, false); - } - - public PacketItemUpdate(byte slot, byte updateType) - { - - super(PacketTypeHandler.ITEM_UPDATE, false); - this.slot = slot; - this.updateType = updateType; - } - - @Override - public void writeData(DataOutputStream data) throws IOException - { - - data.writeByte(slot); - data.writeByte(updateType); - } - - @Override - public void readData(DataInputStream data) throws IOException - { - - slot = data.readByte(); - updateType = data.readByte(); - } - - @Override - public void execute(INetworkManager manager, Player player) - { - - EntityPlayer thePlayer = (EntityPlayer) player; - ItemStack destroyedStack = thePlayer.inventory.getStackInSlot(slot); - - if (updateType == ItemUpdateTypes.DESTROYED) - { - thePlayer.renderBrokenItemStack(destroyedStack); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/network/packet/PacketKeyPressed.java b/src/main/java/com/pahimar/ee3/network/packet/PacketKeyPressed.java deleted file mode 100644 index bd788f7a..00000000 --- a/src/main/java/com/pahimar/ee3/network/packet/PacketKeyPressed.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.pahimar.ee3.network.packet; - -import com.pahimar.ee3.item.IKeyBound; -import com.pahimar.ee3.network.PacketTypeHandler; -import net.minecraft.entity.player.EntityPlayer; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -/** - * Equivalent-Exchange-3 - *

- * PacketKeyPressed - * - * @author pahimar - */ -public class PacketKeyPressed extends PacketEE -{ - - public String key; - - public PacketKeyPressed() - { - - super(PacketTypeHandler.KEY, false); - } - - public PacketKeyPressed(String key) - { - - super(PacketTypeHandler.KEY, false); - this.key = key; - } - - @Override - public void writeData(DataOutputStream data) throws IOException - { - - data.writeUTF(key); - } - - @Override - public void readData(DataInputStream data) throws IOException - { - - key = data.readUTF(); - } - - @Override - public void execute(INetworkManager manager, Player player) - { - - EntityPlayer thePlayer = (EntityPlayer) player; - - if (thePlayer.getCurrentEquippedItem() != null && thePlayer.getCurrentEquippedItem().getItem() instanceof IKeyBound) - { - ((IKeyBound) thePlayer.getCurrentEquippedItem().getItem()).doKeyBindingAction(thePlayer, thePlayer.getCurrentEquippedItem(), key); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/network/packet/PacketRequestEvent.java b/src/main/java/com/pahimar/ee3/network/packet/PacketRequestEvent.java deleted file mode 100644 index 0d3b27d7..00000000 --- a/src/main/java/com/pahimar/ee3/network/packet/PacketRequestEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.pahimar.ee3.network.packet; - -import com.pahimar.ee3.handler.WorldTransmutationHandler; -import com.pahimar.ee3.network.PacketTypeHandler; -import net.minecraft.entity.player.EntityPlayer; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -/** - * Equivalent-Exchange-3 - *

- * PacketRequestEvent - * - * @author pahimar - */ -public class PacketRequestEvent extends PacketEE -{ - - public byte eventType; - public int originX, originY, originZ; - public byte sideHit; - public byte rangeX, rangeY, rangeZ; - public String data; - - public PacketRequestEvent() - { - - super(PacketTypeHandler.REQUEST_EVENT, false); - } - - public PacketRequestEvent(byte eventType, int originX, int originY, int originZ, byte sideHit, byte rangeX, byte rangeY, byte rangeZ, String data) - { - - super(PacketTypeHandler.REQUEST_EVENT, false); - this.eventType = eventType; - this.originX = originX; - this.originY = originY; - this.originZ = originZ; - this.sideHit = sideHit; - this.rangeX = rangeX; - this.rangeY = rangeY; - this.rangeZ = rangeZ; - this.data = data; - } - - @Override - public void writeData(DataOutputStream data) throws IOException - { - - data.writeByte(eventType); - data.writeInt(originX); - data.writeInt(originY); - data.writeInt(originZ); - data.writeByte(sideHit); - data.writeByte(rangeX); - data.writeByte(rangeY); - data.writeByte(rangeZ); - data.writeUTF(this.data); - } - - @Override - public void readData(DataInputStream data) throws IOException - { - - eventType = data.readByte(); - originX = data.readInt(); - originY = data.readInt(); - originZ = data.readInt(); - sideHit = data.readByte(); - rangeX = data.readByte(); - rangeY = data.readByte(); - rangeZ = data.readByte(); - this.data = data.readUTF(); - } - - @Override - public void execute(INetworkManager manager, Player player) - { - - EntityPlayer thePlayer = (EntityPlayer) player; - WorldTransmutationHandler.handleWorldTransmutation(thePlayer, originX, originY, originZ, rangeX, rangeY, rangeZ, sideHit, data); - } -} diff --git a/src/main/java/com/pahimar/ee3/network/packet/PacketSoundEvent.java b/src/main/java/com/pahimar/ee3/network/packet/PacketSoundEvent.java deleted file mode 100644 index bc89586f..00000000 --- a/src/main/java/com/pahimar/ee3/network/packet/PacketSoundEvent.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.pahimar.ee3.network.packet; - -import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.lib.Commands; -import com.pahimar.ee3.network.PacketTypeHandler; -import cpw.mods.fml.client.FMLClientHandler; -import net.minecraft.entity.player.EntityPlayer; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -/** - * Equivalent-Exchange-3 - *

- * PacketSoundEvent - * - * @author pahimar - */ -public class PacketSoundEvent extends PacketEE -{ - - public String playerName; - public String soundName; - public double x, y, z; - public float volume, pitch; - - public PacketSoundEvent() - { - - super(PacketTypeHandler.SOUND_EVENT, false); - } - - public PacketSoundEvent(String playerName, String soundName, double x, double y, double z, float volume, float pitch) - { - - super(PacketTypeHandler.SOUND_EVENT, false); - this.playerName = playerName; - this.soundName = soundName; - this.x = x; - this.y = y; - this.z = z; - this.volume = volume; - this.pitch = pitch; - } - - @Override - public void writeData(DataOutputStream data) throws IOException - { - - data.writeUTF(playerName); - data.writeUTF(soundName); - data.writeDouble(x); - data.writeDouble(y); - data.writeDouble(z); - data.writeFloat(volume); - data.writeFloat(pitch); - } - - @Override - public void readData(DataInputStream data) throws IOException - { - - playerName = data.readUTF(); - soundName = data.readUTF(); - x = data.readDouble(); - y = data.readDouble(); - z = data.readDouble(); - volume = data.readFloat(); - pitch = data.readFloat(); - } - - @Override - public void execute(INetworkManager manager, Player player) - { - - EntityPlayer thePlayer = (EntityPlayer) player; - - if (ConfigurationSettings.ENABLE_SOUNDS.equalsIgnoreCase(Commands.ALL)) - { - FMLClientHandler.instance().getClient().sndManager.playSound(soundName, (float) x, (float) y, (float) z, volume, pitch); - } - else if (ConfigurationSettings.ENABLE_SOUNDS.equalsIgnoreCase(Commands.SELF)) - { - if (thePlayer.username.equalsIgnoreCase(playerName)) - { - FMLClientHandler.instance().getClient().sndManager.playSound(soundName, (float) x, (float) y, (float) z, volume, pitch); - } - } - } -} diff --git a/src/main/java/com/pahimar/ee3/network/packet/PacketSpawnParticle.java b/src/main/java/com/pahimar/ee3/network/packet/PacketSpawnParticle.java deleted file mode 100644 index f56dc963..00000000 --- a/src/main/java/com/pahimar/ee3/network/packet/PacketSpawnParticle.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.pahimar.ee3.network.packet; - -import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.network.PacketTypeHandler; -import net.minecraft.entity.player.EntityPlayer; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -/** - * Equivalent-Exchange-3 - *

- * PacketSpawnParticle - * - * @author pahimar - */ -public class PacketSpawnParticle extends PacketEE -{ - - public String particleName; - public double x, y, z; - public double velocityX, velocityY, velocityZ; - - public PacketSpawnParticle() - { - - super(PacketTypeHandler.SPAWN_PARTICLE, false); - } - - public PacketSpawnParticle(String particleName, double x, double y, double z, double velocityX, double velocityY, double velocityZ) - { - - super(PacketTypeHandler.SPAWN_PARTICLE, false); - this.particleName = particleName; - this.x = x; - this.y = y; - this.z = z; - this.velocityX = velocityX; - this.velocityY = velocityY; - this.velocityZ = velocityZ; - } - - @Override - public void writeData(DataOutputStream data) throws IOException - { - - data.writeUTF(particleName); - data.writeDouble(x); - data.writeDouble(y); - data.writeDouble(z); - data.writeDouble(velocityX); - data.writeDouble(velocityY); - data.writeDouble(velocityZ); - } - - @Override - public void readData(DataInputStream data) throws IOException - { - - particleName = data.readUTF(); - x = data.readDouble(); - y = data.readDouble(); - z = data.readDouble(); - velocityX = data.readDouble(); - velocityY = data.readDouble(); - velocityZ = data.readDouble(); - } - - @Override - public void execute(INetworkManager manager, Player player) - { - - EntityPlayer thePlayer = (EntityPlayer) player; - - if (ConfigurationSettings.ENABLE_PARTICLE_FX) - { - thePlayer.worldObj.spawnParticle(particleName, x, y, z, velocityX, velocityY, velocityZ); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/network/packet/PacketTileCalcinator.java b/src/main/java/com/pahimar/ee3/network/packet/PacketTileCalcinator.java deleted file mode 100644 index cd87167f..00000000 --- a/src/main/java/com/pahimar/ee3/network/packet/PacketTileCalcinator.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.pahimar.ee3.network.packet; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.network.PacketTypeHandler; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -public class PacketTileCalcinator extends PacketEE -{ - public int x, y, z; - public byte orientation; - public byte state; - public String customName; - public byte leftStackSize, leftStackMeta, rightStackSize, rightStackMeta; - - public PacketTileCalcinator() - { - super(PacketTypeHandler.TILE_CALCINATOR, true); - } - - public PacketTileCalcinator(int x, int y, int z, ForgeDirection orientation, byte state, String customName, byte leftStackSize, byte leftStackMeta, byte rightStackSize, byte rightStackMeta) - { - super(PacketTypeHandler.TILE_CALCINATOR, true); - this.x = x; - this.y = y; - this.z = z; - this.orientation = (byte) orientation.ordinal(); - this.state = state; - this.customName = customName; - this.leftStackSize = leftStackSize; - this.leftStackMeta = leftStackMeta; - this.rightStackSize = rightStackSize; - this.rightStackMeta = rightStackMeta; - } - - @Override - public void writeData(DataOutputStream data) throws IOException - { - data.writeInt(x); - data.writeInt(y); - data.writeInt(z); - data.writeByte(orientation); - data.writeByte(state); - data.writeUTF(customName); - data.writeByte(leftStackSize); - data.writeByte(leftStackMeta); - data.writeByte(rightStackSize); - data.writeByte(rightStackMeta); - } - - @Override - public void readData(DataInputStream data) throws IOException - { - x = data.readInt(); - y = data.readInt(); - z = data.readInt(); - orientation = data.readByte(); - state = data.readByte(); - customName = data.readUTF(); - leftStackSize = data.readByte(); - leftStackMeta = data.readByte(); - rightStackSize = data.readByte(); - rightStackMeta = data.readByte(); - } - - @Override - public void execute(INetworkManager manager, Player player) - { - EquivalentExchange3.proxy.handleTileCalcinatorPacket(x, y, z, ForgeDirection.getOrientation(orientation), state, customName, leftStackSize, leftStackMeta, rightStackSize, rightStackMeta); - } -} diff --git a/src/main/java/com/pahimar/ee3/network/packet/PacketTileUpdate.java b/src/main/java/com/pahimar/ee3/network/packet/PacketTileUpdate.java deleted file mode 100644 index f62cee8e..00000000 --- a/src/main/java/com/pahimar/ee3/network/packet/PacketTileUpdate.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.pahimar.ee3.network.packet; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.network.PacketTypeHandler; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -/** - * Equivalent-Exchange-3 - *

- * PacketTileUpdate - * - * @author pahimar - */ -public class PacketTileUpdate extends PacketEE -{ - public int x, y, z; - public byte orientation; - public byte state; - public String customName; - - public PacketTileUpdate() - { - super(PacketTypeHandler.TILE, true); - } - - public PacketTileUpdate(int x, int y, int z, ForgeDirection orientation, byte state, String customName) - { - super(PacketTypeHandler.TILE, true); - this.x = x; - this.y = y; - this.z = z; - this.orientation = (byte) orientation.ordinal(); - this.state = state; - this.customName = customName; - } - - @Override - public void writeData(DataOutputStream data) throws IOException - { - data.writeInt(x); - data.writeInt(y); - data.writeInt(z); - data.writeByte(orientation); - data.writeByte(state); - data.writeUTF(customName); - } - - @Override - public void readData(DataInputStream data) throws IOException - { - x = data.readInt(); - y = data.readInt(); - z = data.readInt(); - orientation = data.readByte(); - state = data.readByte(); - customName = data.readUTF(); - } - - @Override - public void execute(INetworkManager manager, Player player) - { - EquivalentExchange3.proxy.handleTileEntityPacket(x, y, z, ForgeDirection.getOrientation(orientation), state, customName); - } -} diff --git a/src/main/java/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java b/src/main/java/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java deleted file mode 100644 index a8f95b3e..00000000 --- a/src/main/java/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.pahimar.ee3.network.packet; - -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.network.PacketTypeHandler; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -public class PacketTileWithItemUpdate extends PacketEE -{ - public int x, y, z; - public byte orientation; - public byte state; - public String customName; - public int itemID, metaData, stackSize, color; - - public PacketTileWithItemUpdate() - { - super(PacketTypeHandler.TILE_WITH_ITEM, true); - } - - public PacketTileWithItemUpdate(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) - { - super(PacketTypeHandler.TILE_WITH_ITEM, true); - this.x = x; - this.y = y; - this.z = z; - this.orientation = (byte) orientation.ordinal(); - this.state = state; - this.customName = customName; - this.itemID = itemID; - this.metaData = metaData; - this.stackSize = stackSize; - this.color = color; - } - - @Override - public void writeData(DataOutputStream data) throws IOException - { - data.writeInt(x); - data.writeInt(y); - data.writeInt(z); - data.writeByte(orientation); - data.writeByte(state); - data.writeUTF(customName); - data.writeInt(itemID); - data.writeInt(metaData); - data.writeInt(stackSize); - data.writeInt(color); - } - - @Override - public void readData(DataInputStream data) throws IOException - { - x = data.readInt(); - y = data.readInt(); - z = data.readInt(); - orientation = data.readByte(); - state = data.readByte(); - customName = data.readUTF(); - itemID = data.readInt(); - metaData = data.readInt(); - stackSize = data.readInt(); - color = data.readInt(); - } - - @Override - public void execute(INetworkManager manager, Player player) - { - EquivalentExchange3.proxy.handleTileWithItemPacket(x, y, z, ForgeDirection.getOrientation(orientation), state, customName, itemID, metaData, stackSize, color); - } -} diff --git a/src/main/java/com/pahimar/ee3/proxy/ClientProxy.java b/src/main/java/com/pahimar/ee3/proxy/ClientProxy.java index cbf8b8a5..d189bf83 100644 --- a/src/main/java/com/pahimar/ee3/proxy/ClientProxy.java +++ b/src/main/java/com/pahimar/ee3/proxy/ClientProxy.java @@ -1,251 +1,5 @@ package com.pahimar.ee3.proxy; -import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.client.audio.SoundHandler; -import com.pahimar.ee3.client.handler.DrawBlockHighlightHandler; -import com.pahimar.ee3.client.handler.ItemTooltipEventHandler; -import com.pahimar.ee3.client.handler.KeyBindingHandler; -import com.pahimar.ee3.client.handler.TransmutationTargetOverlayHandler; -import com.pahimar.ee3.client.helper.KeyBindingHelper; -import com.pahimar.ee3.client.renderer.item.*; -import com.pahimar.ee3.client.renderer.tileentity.*; -import com.pahimar.ee3.helper.ItemHelper; -import com.pahimar.ee3.helper.TransmutationHelper; -import com.pahimar.ee3.item.IChargeable; -import com.pahimar.ee3.lib.ActionTypes; -import com.pahimar.ee3.lib.BlockIds; -import com.pahimar.ee3.lib.Colours; -import com.pahimar.ee3.lib.RenderIds; -import com.pahimar.ee3.network.PacketTypeHandler; -import com.pahimar.ee3.network.packet.PacketRequestEvent; -import com.pahimar.ee3.tileentity.*; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.client.registry.ClientRegistry; -import cpw.mods.fml.client.registry.RenderingRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.client.MinecraftForgeClient; -import net.minecraftforge.common.MinecraftForge; - -/** - * Equivalent-Exchange-3 - *

- * ClientProxy - * - * @author pahimar - */ -@SideOnly(Side.CLIENT) public class ClientProxy extends CommonProxy { - @Override - public void registerKeyBindingHandler() - { - KeyBindingRegistry.registerKeyBinding(new KeyBindingHandler()); - } - - @Override - public void registerRenderTickHandler() - { - TickRegistry.registerTickHandler(new TransmutationTargetOverlayHandler(), Side.CLIENT); - } - - @Override - public void registerDrawBlockHighlightHandler() - { - MinecraftForge.EVENT_BUS.register(new DrawBlockHighlightHandler()); - } - - @Override - public void setKeyBinding(String name, int value) - { - KeyBindingHelper.addKeyBinding(name, value); - KeyBindingHelper.addIsRepeating(false); - } - - @Override - public void registerSoundHandler() - { - MinecraftForge.EVENT_BUS.register(new SoundHandler()); - } - - @Override - public void initRenderingAndTextures() - { - RenderIds.calcinatorRender = RenderingRegistry.getNextAvailableRenderId(); - RenderIds.aludelRender = RenderingRegistry.getNextAvailableRenderId(); - RenderIds.alchemicalChestRender = RenderingRegistry.getNextAvailableRenderId(); - RenderIds.glassBell = RenderingRegistry.getNextAvailableRenderId(); - RenderIds.researchStation = RenderingRegistry.getNextAvailableRenderId(); - - MinecraftForgeClient.registerItemRenderer(BlockIds.CALCINATOR, new ItemCalcinatorRenderer()); - MinecraftForgeClient.registerItemRenderer(BlockIds.ALUDEL_BASE, new ItemAludelRenderer()); - MinecraftForgeClient.registerItemRenderer(BlockIds.ALCHEMICAL_CHEST, new ItemAlchemicalChestRenderer()); - MinecraftForgeClient.registerItemRenderer(BlockIds.GLASS_BELL, new ItemGlassBellRenderer()); - MinecraftForgeClient.registerItemRenderer(BlockIds.RESEARCH_STATION, new ItemResearchStationRenderer()); - - ClientRegistry.bindTileEntitySpecialRenderer(TileCalcinator.class, new TileEntityCalcinatorRenderer()); - ClientRegistry.bindTileEntitySpecialRenderer(TileAludel.class, new TileEntityAludelRenderer()); - ClientRegistry.bindTileEntitySpecialRenderer(TileAlchemicalChest.class, new TileEntityAlchemicalChestRenderer()); - ClientRegistry.bindTileEntitySpecialRenderer(TileGlassBell.class, new TileEntityGlassBellRenderer()); - ClientRegistry.bindTileEntitySpecialRenderer(TileResearchStation.class, new TileEntityResearchStationRenderer()); - } - - @Override - public void registerItemTooltipHandler() - { - MinecraftForge.EVENT_BUS.register(new ItemTooltipEventHandler()); - } - - @Override - public void sendRequestEventPacket(byte eventType, int originX, int originY, int originZ, byte sideHit, byte rangeX, byte rangeY, byte rangeZ, String data) - { - PacketDispatcher.sendPacketToServer(PacketTypeHandler.populatePacket(new PacketRequestEvent(eventType, originX, originY, originZ, sideHit, rangeX, rangeY, rangeZ, data))); - } - - @Override - public void handleTileEntityPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName) - { - TileEntity tileEntity = FMLClientHandler.instance().getClient().theWorld.getBlockTileEntity(x, y, z); - - if (tileEntity != null) - { - if (tileEntity instanceof TileEE) - { - ((TileEE) tileEntity).setOrientation(orientation); - ((TileEE) tileEntity).setState(state); - ((TileEE) tileEntity).setCustomName(customName); - } - } - } - - @Override - public void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) - { - World world = FMLClientHandler.instance().getClient().theWorld; - TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - - this.handleTileEntityPacket(x, y, z, orientation, state, customName); - - if (tileEntity instanceof TileGlassBell) - { - ItemStack itemStack = null; - if (itemID != -1) - { - itemStack = new ItemStack(itemID, stackSize, metaData); - if (color != Integer.parseInt(Colours.PURE_WHITE, 16)) - { - ItemHelper.setColor(itemStack, color); - } - } - - ((TileGlassBell) tileEntity).outputItemStack = itemStack; - world.updateAllLightTypes(x, y, z); - } - else if (tileEntity instanceof TileAludel) - { - ItemStack itemStack = null; - - if (itemID != -1) - { - itemStack = new ItemStack(itemID, stackSize, metaData); - if (color != Integer.parseInt(Colours.PURE_WHITE, 16)) - { - ItemHelper.setColor(itemStack, color); - } - } - - ((TileAludel) tileEntity).outputItemStack = itemStack; - world.updateAllLightTypes(x, y, z); - } - } - - @Override - public void handleTileCalcinatorPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, byte leftStackSize, byte leftStackMeta, byte rightStackSize, byte rightStackMeta) - { - World world = FMLClientHandler.instance().getClient().theWorld; - TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - - this.handleTileEntityPacket(x, y, z, orientation, state, customName); - - if (tileEntity instanceof TileCalcinator) - { - ((TileCalcinator) tileEntity).leftStackSize = leftStackSize; - ((TileCalcinator) tileEntity).leftStackMeta = leftStackMeta; - ((TileCalcinator) tileEntity).rightStackSize = rightStackSize; - ((TileCalcinator) tileEntity).rightStackMeta = rightStackMeta; - world.updateAllLightTypes(x, y, z); - } - } - - @Override - public void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit) - { - if (TransmutationHelper.targetBlockStack != null) - { - if (itemStack != null) - { - int pnX = 1; - int pnY = 1; - int pnZ = 1; - if (itemStack.getItem() instanceof IChargeable) - { - int charge = ((IChargeable) itemStack.getItem()).getCharge(itemStack) * 2; - switch (ForgeDirection.getOrientation(sideHit)) - { - case UP: - { - pnX = 1 + charge; - pnZ = 1 + charge; - break; - } - case DOWN: - { - pnX = 1 + charge; - pnZ = 1 + charge; - break; - } - case NORTH: - { - pnX = 1 + charge; - pnY = 1 + charge; - break; - } - case SOUTH: - { - pnX = 1 + charge; - pnY = 1 + charge; - break; - } - case EAST: - { - pnY = 1 + charge; - pnZ = 1 + charge; - break; - } - case WEST: - { - pnY = 1 + charge; - pnZ = 1 + charge; - break; - } - case UNKNOWN: - { - pnX = 0; - pnY = 0; - pnZ = 0; - break; - } - default: - break; - } - } - - EquivalentExchange3.proxy.sendRequestEventPacket(ActionTypes.TRANSMUTATION, x, y, z, (byte) sideHit, (byte) pnX, (byte) pnY, (byte) pnZ, TransmutationHelper.formatTargetBlockInfo(TransmutationHelper.targetBlockStack)); - } - } - } } diff --git a/src/main/java/com/pahimar/ee3/proxy/CommonProxy.java b/src/main/java/com/pahimar/ee3/proxy/CommonProxy.java index 17350320..7118aee4 100644 --- a/src/main/java/com/pahimar/ee3/proxy/CommonProxy.java +++ b/src/main/java/com/pahimar/ee3/proxy/CommonProxy.java @@ -1,20 +1,5 @@ package com.pahimar.ee3.proxy; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.tileentity.*; -import cpw.mods.fml.common.registry.GameRegistry; - -public abstract class CommonProxy implements IProxy +public class CommonProxy implements IProxy { - public void registerTileEntities() - { - GameRegistry.registerTileEntity(TileCalcinator.class, "tile." + Strings.CALCINATOR_NAME); - GameRegistry.registerTileEntity(TileAludel.class, "tile." + Strings.ALUDEL_NAME); - GameRegistry.registerTileEntity(TileAlchemicalChest.class, "tile." + Strings.ALCHEMICAL_CHEST_NAME); - GameRegistry.registerTileEntity(TileAlchemicalChestSmall.class, "tile." + Strings.ALCHEMICAL_CHEST_NAME + "Small"); - GameRegistry.registerTileEntity(TileAlchemicalChestMedium.class, "tile." + Strings.ALCHEMICAL_CHEST_NAME + "Medium"); - GameRegistry.registerTileEntity(TileAlchemicalChestLarge.class, "tile." + Strings.ALCHEMICAL_CHEST_NAME + "Large"); - GameRegistry.registerTileEntity(TileGlassBell.class, "tile." + Strings.GLASS_BELL_NAME); - GameRegistry.registerTileEntity(TileResearchStation.class, "tile." + Strings.RESEARCH_STATION_NAME); - } } diff --git a/src/main/java/com/pahimar/ee3/proxy/IProxy.java b/src/main/java/com/pahimar/ee3/proxy/IProxy.java index 3f08437c..146fe7d2 100644 --- a/src/main/java/com/pahimar/ee3/proxy/IProxy.java +++ b/src/main/java/com/pahimar/ee3/proxy/IProxy.java @@ -1,34 +1,5 @@ package com.pahimar.ee3.proxy; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - public interface IProxy { - public abstract void registerKeyBindingHandler(); - - public abstract void registerRenderTickHandler(); - - public abstract void registerDrawBlockHighlightHandler(); - - public abstract void setKeyBinding(String name, int value); - - public abstract void registerSoundHandler(); - - public abstract void initRenderingAndTextures(); - - public abstract void registerTileEntities(); - - public abstract void registerItemTooltipHandler(); - - public abstract void sendRequestEventPacket(byte eventType, int originX, int originY, int originZ, byte sideHit, byte rangeX, byte rangeY, byte rangeZ, String data); - - public abstract void handleTileEntityPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName); - - public abstract void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color); - - public abstract void handleTileCalcinatorPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, byte leftStackSize, byte leftStackMeta, byte rightStackSize, byte rightStackMeta); - - public abstract void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit); } diff --git a/src/main/java/com/pahimar/ee3/proxy/ServerProxy.java b/src/main/java/com/pahimar/ee3/proxy/ServerProxy.java index d3bb76c3..79f9d0fc 100644 --- a/src/main/java/com/pahimar/ee3/proxy/ServerProxy.java +++ b/src/main/java/com/pahimar/ee3/proxy/ServerProxy.java @@ -1,76 +1,5 @@ package com.pahimar.ee3.proxy; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Equivalent-Exchange-3 - *

- * ServerProxy - * - * @author pahimar - */ public class ServerProxy extends CommonProxy { - public void registerKeyBindingHandler() - { - // NOOP - } - - public void registerRenderTickHandler() - { - // NOOP - } - - public void registerDrawBlockHighlightHandler() - { - // NOOP - } - - public void setKeyBinding(String name, int value) - { - // NOOP - } - - public void registerSoundHandler() - { - // NOOP - } - - public void initRenderingAndTextures() - { - // NOOP - } - - @Override - public void registerItemTooltipHandler() - { - // NOOP - } - - public void transmuteBlock(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int sideHit) - { - // NOOP - } - - public void sendRequestEventPacket(byte eventType, int originX, int originY, int originZ, byte sideHit, byte rangeX, byte rangeY, byte rangeZ, String data) - { - // NOOP - } - - public void handleTileEntityPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName) - { - // NOOP - } - - public void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) - { - // NOOP - } - - public void handleTileCalcinatorPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, byte leftStackSize, byte leftStackMeta, byte rightStackSize, byte rightStackMeta) - { - // NOOP - } } diff --git a/src/main/java/com/pahimar/ee3/recipe/CalcinationManager.java b/src/main/java/com/pahimar/ee3/recipe/CalcinationManager.java deleted file mode 100644 index bd23fdb7..00000000 --- a/src/main/java/com/pahimar/ee3/recipe/CalcinationManager.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.pahimar.ee3.recipe; - -import com.pahimar.ee3.emc.EmcRegistry; -import com.pahimar.ee3.emc.EmcValue; -import com.pahimar.ee3.helper.ItemHelper; -import com.pahimar.ee3.item.ItemAlchemicalDust; -import com.pahimar.ee3.item.ModItems; -import net.minecraft.item.ItemStack; - -import java.util.TreeMap; - -/** - * Equivalent-Exchange-3 - *

- * CalcinationManager - * - * @author pahimar - */ -public class CalcinationManager -{ - public static ItemStack getCalcinationResult(ItemStack calcinedStack) - { - ItemStack itemStack = calcinedStack.copy(); - itemStack.stackSize = 1; - - TreeMap sortedItems = new TreeMap(); - - for (ItemStack dustStack : ItemAlchemicalDust.getAlchemicalDusts()) - { - // If the item to be calcined is an alchemical dust, return null (you cannot calcine what's already been calcined) - if (ItemHelper.equals(itemStack, dustStack)) - { - return null; - } - - if (EmcRegistry.getInstance().hasEmcValue(dustStack)) - { - sortedItems.put(EmcRegistry.getInstance().getEmcValue(dustStack), dustStack); - } - } - - if (EmcRegistry.getInstance().hasEmcValue(itemStack)) - { - if (sortedItems.containsKey(EmcRegistry.getInstance().getEmcValue(itemStack))) - { - return sortedItems.get(EmcRegistry.getInstance().getEmcValue(itemStack)); - } - else - { - sortedItems.put(EmcRegistry.getInstance().getEmcValue(itemStack), itemStack); - - if (sortedItems.lowerEntry(EmcRegistry.getInstance().getEmcValue(itemStack)) == null) - { - return new ItemStack(ModItems.alchemicalDust, 1, 0); - } - else - { - return sortedItems.lowerEntry(EmcRegistry.getInstance().getEmcValue(itemStack)).getValue(); - } - } - } - else - { - return new ItemStack(ModItems.alchemicalDust, 1, 0); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/recipe/RecipeRegistry.java b/src/main/java/com/pahimar/ee3/recipe/RecipeRegistry.java deleted file mode 100644 index 502f011b..00000000 --- a/src/main/java/com/pahimar/ee3/recipe/RecipeRegistry.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.pahimar.ee3.recipe; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.pahimar.ee3.api.WrappedStack; -import com.pahimar.ee3.item.crafting.RecipeAludel; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import java.util.*; - -public class RecipeRegistry -{ - - private static RecipeRegistry recipeRegistry = null; - - private Multimap> recipeMap; - private List discoveredStacks; - - private RecipeRegistry() - { - recipeMap = HashMultimap.create(); - discoveredStacks = new ArrayList(); - - init(); - } - - public static RecipeRegistry getInstance() - { - if (recipeRegistry == null) - { - recipeRegistry = new RecipeRegistry(); - } - - return recipeRegistry; - } - - private void init() - { - // Add recipes in the vanilla crafting manager - for (WrappedStack outputStack : RecipesVanilla.getVanillaRecipes().keySet()) - { - for (List inputStacks : RecipesVanilla.getVanillaRecipes().get(outputStack)) - { - if (!recipeMap.get(outputStack).contains(inputStacks)) - { - recipeMap.put(outputStack, inputStacks); - } - } - } - - // Add fluid container recipes - for (WrappedStack outputStack : RecipesFluidContainers.getFluidContainerRecipes().keySet()) - { - for (List inputStacks : RecipesFluidContainers.getFluidContainerRecipes().get(outputStack)) - { - if (!recipeMap.get(outputStack).contains(inputStacks)) - { - recipeMap.put(outputStack, inputStacks); - } - } - } - - // Add potion recipes - for (WrappedStack outputStack : RecipesPotions.getPotionRecipes().keySet()) - { - for (List inputStacks : RecipesPotions.getPotionRecipes().get(outputStack)) - { - if (!recipeMap.get(outputStack).contains(inputStacks)) - { - recipeMap.put(outputStack, inputStacks); - } - } - } - - // Add Aludel recipes - for (RecipeAludel recipeAludel : RecipesAludel.getInstance().getRecipes()) - { - WrappedStack recipeOutput = new WrappedStack(recipeAludel.getRecipeOutput()); - List recipeInputs = recipeAludel.getRecipeInputsAsWrappedStacks(); - - if (!recipeMap.get(recipeOutput).contains(recipeInputs)) - { - recipeMap.put(recipeOutput, recipeInputs); - } - } - - // Add recipes gathered via IMC - for (WrappedStack outputStack : RecipesIMC.getIMCRecipes().keySet()) - { - for (List inputStacks : RecipesIMC.getIMCRecipes().get(outputStack)) - { - if (!recipeMap.get(outputStack).contains(inputStacks)) - { - recipeMap.put(outputStack, inputStacks); - } - } - } - - // Discover all stacks that we can - discoverStacks(); - } - - public Multimap> getRecipeMappings() - { - - return recipeRegistry.recipeMap; - } - - public List getDiscoveredStacks() - { - - return Collections.unmodifiableList(recipeRegistry.discoveredStacks); - } - - private void discoverStacks() - { - discoveredStacks = new ArrayList(); - - // Scan stacks from known recipes - for (WrappedStack recipeOutput : recipeMap.keySet()) - { - if (!discoveredStacks.contains(new WrappedStack(recipeOutput.getWrappedStack()))) - { - discoveredStacks.add(new WrappedStack(recipeOutput.getWrappedStack())); - } - - for (List recipeInputList : recipeMap.get(recipeOutput)) - { - for (WrappedStack recipeInput : recipeInputList) - { - if (!discoveredStacks.contains(new WrappedStack(recipeInput.getWrappedStack()))) - { - discoveredStacks.add(new WrappedStack(recipeInput.getWrappedStack())); - } - } - } - } - - // Scan stacks from vanilla item array - for (int i = 0; i < Item.itemsList.length; i++) - { - if (Item.itemsList[i] != null) - { - if (Item.itemsList[i].getHasSubtypes()) - { - for (int meta = 0; meta < 16; meta++) - { - WrappedStack wrappedItemStack = new WrappedStack(new ItemStack(Item.itemsList[i].itemID, 1, meta)); - - if (!discoveredStacks.contains(wrappedItemStack)) - { - discoveredStacks.add(wrappedItemStack); - } - } - } - else - { - WrappedStack wrappedItemStack = new WrappedStack(Item.itemsList[i]); - - if (!discoveredStacks.contains(wrappedItemStack)) - { - discoveredStacks.add(wrappedItemStack); - } - } - } - } - } - - @Override - public String toString() - { - - StringBuilder stringBuilder = new StringBuilder(); - - // Sort the keys for output to console - SortedSet set = new TreeSet(); - set.addAll(recipeMap.keySet()); - - for (WrappedStack key : set) - { - - Collection> recipeMappings = recipeMap.get(key); - - for (List recipeList : recipeMappings) - { - stringBuilder.append(String.format("Recipe Output: %s, Recipe Input: %s\n", key.toString(), recipeList.toString())); - } - } - - return stringBuilder.toString(); - } -} diff --git a/src/main/java/com/pahimar/ee3/recipe/RecipesAludel.java b/src/main/java/com/pahimar/ee3/recipe/RecipesAludel.java deleted file mode 100644 index 1c7a418a..00000000 --- a/src/main/java/com/pahimar/ee3/recipe/RecipesAludel.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.pahimar.ee3.recipe; - -import com.pahimar.ee3.api.OreStack; -import com.pahimar.ee3.block.ModBlocks; -import com.pahimar.ee3.helper.LogHelper; -import com.pahimar.ee3.item.ModItems; -import com.pahimar.ee3.item.crafting.RecipeAludel; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.ArrayList; -import java.util.List; - -public class RecipesAludel -{ - private static RecipesAludel aludelRegistry = null; - - private List aludelRecipes; - - private RecipesAludel() - { - aludelRecipes = new ArrayList(); - } - - public static RecipesAludel getInstance() - { - if (aludelRegistry == null) - { - aludelRegistry = new RecipesAludel(); - aludelRegistry.init(); - } - - return aludelRegistry; - } - - private void init() - { - // Ash + Verdant = Azure - aludelRegistry.addRecipe(new ItemStack(ModItems.alchemicalDust.itemID, 1, 2), new ItemStack(ModItems.alchemicalDust.itemID, 1, 0), new ItemStack(ModItems.alchemicalDust.itemID, 32, 1)); - - // Ash + Azure = Minium - aludelRegistry.addRecipe(new ItemStack(ModItems.alchemicalDust.itemID, 1, 3), new ItemStack(ModItems.alchemicalDust.itemID, 1, 0), new ItemStack(ModItems.alchemicalDust.itemID, 4, 2)); - - // Alchemical Coal - aludelRegistry.addRecipe(new ItemStack(ModItems.alchemicalFuel.itemID, 1, 0), new ItemStack(Item.coal, 1, 0), new ItemStack(ModItems.alchemicalDust.itemID, 32, 1)); - aludelRegistry.addRecipe(new ItemStack(ModItems.alchemicalFuel.itemID, 1, 0), new ItemStack(Item.coal, 1, 0), new ItemStack(ModItems.alchemicalDust.itemID, 1, 2)); - aludelRegistry.addRecipe(new ItemStack(ModItems.alchemicalFuel.itemID, 4, 0), new ItemStack(Item.coal, 4, 0), new ItemStack(ModItems.alchemicalDust.itemID, 1, 3)); - - // Mobius Fuel - aludelRegistry.addRecipe(new ItemStack(ModItems.alchemicalFuel.itemID, 1, 1), new ItemStack(ModItems.alchemicalFuel.itemID, 1, 0), new ItemStack(ModItems.alchemicalDust.itemID, 7, 2)); - aludelRegistry.addRecipe(new ItemStack(ModItems.alchemicalFuel.itemID, 1, 1), new ItemStack(ModItems.alchemicalFuel.itemID, 1, 0), new ItemStack(ModItems.alchemicalDust.itemID, 2, 3)); - - // Aeternalis Fuel - aludelRegistry.addRecipe(new ItemStack(ModItems.alchemicalFuel.itemID, 1, 2), new ItemStack(ModItems.alchemicalFuel.itemID, 1, 1), new ItemStack(ModItems.alchemicalDust.itemID, 56, 2)); - aludelRegistry.addRecipe(new ItemStack(ModItems.alchemicalFuel.itemID, 1, 2), new ItemStack(ModItems.alchemicalFuel.itemID, 1, 1), new ItemStack(ModItems.alchemicalDust.itemID, 14, 3)); - - // Infused Cloth - aludelRegistry.addRecipe(new ItemStack(ModBlocks.infusedCloth.blockID, 1, 0), new ItemStack(Block.cloth.blockID, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust.itemID, 1, 1)); - aludelRegistry.addRecipe(new ItemStack(ModBlocks.infusedCloth.blockID, 1, 1), new ItemStack(Block.cloth.blockID, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust.itemID, 1, 2)); - aludelRegistry.addRecipe(new ItemStack(ModBlocks.infusedCloth.blockID, 1, 2), new ItemStack(Block.cloth.blockID, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust.itemID, 1, 3)); - - // Infused Wood - aludelRegistry.addRecipe(new ItemStack(ModBlocks.infusedWood.blockID, 1, 0), new OreStack("logWood"), new ItemStack(ModItems.alchemicalDust.itemID, 4, 1)); - aludelRegistry.addRecipe(new ItemStack(ModBlocks.infusedWood.blockID, 1, 1), new OreStack("logWood"), new ItemStack(ModItems.alchemicalDust.itemID, 4, 2)); - aludelRegistry.addRecipe(new ItemStack(ModBlocks.infusedWood.blockID, 1, 2), new OreStack("logWood"), new ItemStack(ModItems.alchemicalDust.itemID, 4, 3)); - - // Infused Planks - aludelRegistry.addRecipe(new ItemStack(ModBlocks.infusedPlanks.blockID, 1, 0), new OreStack("plankWood"), new ItemStack(ModItems.alchemicalDust.itemID, 1, 1)); - aludelRegistry.addRecipe(new ItemStack(ModBlocks.infusedPlanks.blockID, 1, 1), new OreStack("plankWood"), new ItemStack(ModItems.alchemicalDust.itemID, 1, 2)); - aludelRegistry.addRecipe(new ItemStack(ModBlocks.infusedPlanks.blockID, 1, 2), new OreStack("plankWood"), new ItemStack(ModItems.alchemicalDust.itemID, 1, 3)); - - // Alchemical Chest - aludelRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 0), new ItemStack(Block.chest.blockID, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust.itemID, 8, 1)); - aludelRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 0), new ItemStack(Block.chestTrapped.blockID, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust.itemID, 8, 1)); - aludelRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 1), new ItemStack(Block.chest.blockID, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust.itemID, 8, 2)); - aludelRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 1), new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 0), new ItemStack(ModItems.alchemicalDust.itemID, 8, 2)); - aludelRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 2), new ItemStack(Block.chest.blockID, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModItems.alchemicalDust.itemID, 8, 3)); - aludelRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 2), new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 0), new ItemStack(ModItems.alchemicalDust.itemID, 8, 3)); - aludelRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 2), new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 1), new ItemStack(ModItems.alchemicalDust.itemID, 8, 3)); - - // Minium Stone - aludelRegistry.addRecipe(new ItemStack(ModItems.miniumStone), new ItemStack(ModItems.inertStone), new ItemStack(ModItems.alchemicalDust.itemID, 8, 3)); - } - - public void addRecipe(ItemStack recipeOutput, ItemStack recipeInputStack, ItemStack recipeInputDust) - { - addRecipe(new RecipeAludel(recipeOutput, recipeInputStack, recipeInputDust)); - } - - public void addRecipe(ItemStack recipeOutput, OreStack recipeInputStack, ItemStack recipeInputDust) - { - addRecipe(new RecipeAludel(recipeOutput, recipeInputStack, recipeInputDust)); - } - - public void addRecipe(RecipeAludel recipeAludel) - { - if (!aludelRecipes.contains(recipeAludel)) - { - aludelRecipes.add(recipeAludel); - } - else - { - LogHelper.debug(String.format("Attempted to add RecipeAludel '%s' but already exists in the recipe list", recipeAludel)); - } - } - - public ItemStack getResult(ItemStack recipeInputStack, ItemStack recipeInputDust) - { - for (RecipeAludel recipeAludel : aludelRecipes) - { - if (recipeAludel.matches(recipeInputStack, recipeInputDust)) - { - return recipeAludel.getRecipeOutput(); - } - } - - return null; - } - - public RecipeAludel getRecipe(ItemStack recipeInputStack, ItemStack recipeInputDust) - { - for (RecipeAludel recipeAludel : aludelRecipes) - { - if (recipeAludel.matches(recipeInputStack, recipeInputDust)) - { - return recipeAludel; - } - } - - return null; - } - - public List getRecipes() - { - return aludelRecipes; - } - - public void debugDumpMap() - { - for (RecipeAludel recipeAludel : aludelRecipes) - { - LogHelper.debug(String.format("Output: %s, Input Stack: %s, Dust Stack: %s", recipeAludel.getRecipeOutput(), recipeAludel.getRecipeInputs()[0], recipeAludel.getRecipeInputs()[1])); - } - } -} diff --git a/src/main/java/com/pahimar/ee3/recipe/RecipesFluidContainers.java b/src/main/java/com/pahimar/ee3/recipe/RecipesFluidContainers.java deleted file mode 100644 index 94e472f3..00000000 --- a/src/main/java/com/pahimar/ee3/recipe/RecipesFluidContainers.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.pahimar.ee3.recipe; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.pahimar.ee3.api.WrappedStack; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData; - -import java.util.Arrays; -import java.util.List; - -public class RecipesFluidContainers -{ - private static Multimap> fluidContainerRecipes = null; - - public static Multimap> getFluidContainerRecipes() - { - if (fluidContainerRecipes == null) - { - init(); - } - return fluidContainerRecipes; - } - - private static void init() - { - fluidContainerRecipes = HashMultimap.create(); - - for (FluidContainerData fluidContainerData : FluidContainerRegistry.getRegisteredFluidContainerData()) - { - if (fluidContainerData.fluid != null) - { - if (fluidContainerData.filledContainer != null && fluidContainerData.emptyContainer != null) - { - fluidContainerRecipes.put(new WrappedStack(fluidContainerData.filledContainer.copy()), Arrays.asList(new WrappedStack(fluidContainerData.fluid.copy()), new WrappedStack(fluidContainerData.emptyContainer.copy()))); - } - } - } - } -} diff --git a/src/main/java/com/pahimar/ee3/recipe/RecipesIMC.java b/src/main/java/com/pahimar/ee3/recipe/RecipesIMC.java deleted file mode 100644 index 6a4dd52a..00000000 --- a/src/main/java/com/pahimar/ee3/recipe/RecipesIMC.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.pahimar.ee3.recipe; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.pahimar.ee3.api.WrappedStack; -import com.pahimar.ee3.helper.RecipeHelper; - -import java.util.List; - -/** - * Equivalent-Exchange-3 - *

- * RecipesIMC - * - * @author pahimar - */ -public class RecipesIMC -{ - - private static Multimap> imcRecipes = HashMultimap.create(); - - public static Multimap> getIMCRecipes() - { - return imcRecipes; - } - - public static void addRecipe(WrappedStack recipeOutput, List recipeInputs) - { - imcRecipes.put(recipeOutput, RecipeHelper.collateInputStacks(recipeInputs)); - } -} diff --git a/src/main/java/com/pahimar/ee3/recipe/RecipesPotions.java b/src/main/java/com/pahimar/ee3/recipe/RecipesPotions.java deleted file mode 100644 index 5bef77a4..00000000 --- a/src/main/java/com/pahimar/ee3/recipe/RecipesPotions.java +++ /dev/null @@ -1,296 +0,0 @@ -package com.pahimar.ee3.recipe; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.pahimar.ee3.api.WrappedStack; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import java.util.Arrays; -import java.util.List; - -public class RecipesPotions -{ - - private static Multimap> potionRecipes = null; - - private static WrappedStack reagentWater = new WrappedStack(new ItemStack(Block.waterStill)); - private static WrappedStack reagentNetherWart = new WrappedStack(new ItemStack(372, 1, 0)); - private static WrappedStack reagentGlowstoneDust = new WrappedStack(new ItemStack(Item.glowstone)); - private static WrappedStack reagentRedstoneDust = new WrappedStack(new ItemStack(331, 1, 0)); - private static WrappedStack reagentGunpowder = new WrappedStack(new ItemStack(Item.gunpowder)); - private static WrappedStack reagentGoldenCarrot = new WrappedStack(new ItemStack(Item.goldenCarrot)); - private static WrappedStack reagentMagmaCream = new WrappedStack(new ItemStack(Item.magmaCream)); - private static WrappedStack reagentSugar = new WrappedStack(new ItemStack(Item.sugar)); - private static WrappedStack reagentGlisteringMelon = new WrappedStack(new ItemStack(Item.speckledMelon)); - private static WrappedStack reagentSpiderEye = new WrappedStack(new ItemStack(Item.spiderEye)); - private static WrappedStack reagentGhastTear = new WrappedStack(new ItemStack(Item.ghastTear)); - private static WrappedStack reagentFermentedSpiderEye = new WrappedStack(new ItemStack(Item.fermentedSpiderEye)); - private static WrappedStack reagentBlazePowder = new WrappedStack(new ItemStack(Item.blazePowder)); - - private static WrappedStack bottleEmpty = new WrappedStack(Item.glassBottle); - private static WrappedStack bottleWater = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 0)); - - private static WrappedStack potionAwkward = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16)); - private static WrappedStack potionThick = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 32)); - private static WrappedStack potionMundane = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 128)); - private static WrappedStack potionMundaneExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 64)); - private static WrappedStack potionMundaneSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16512)); - private static WrappedStack potionMundaneSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16448)); - - private static WrappedStack potionRegeneration = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8193)); - private static WrappedStack potionRegenerationEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8225)); - private static WrappedStack potionRegenerationExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8257)); - private static WrappedStack potionRegenerationSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16385)); - private static WrappedStack potionRegenerationSplashEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16417)); - private static WrappedStack potionRegenerationSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16449)); - - private static WrappedStack potionSwiftness = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8194)); - private static WrappedStack potionSwiftnessEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8226)); - private static WrappedStack potionSwiftnessExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8258)); - private static WrappedStack potionSwiftnessSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16386)); - private static WrappedStack potionSwiftnessSplashEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16418)); - private static WrappedStack potionSwiftnessSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16450)); - - private static WrappedStack potionFireResist = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8195)); - private static WrappedStack potionFireResistExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8259)); - private static WrappedStack potionFireResistSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16387)); - private static WrappedStack potionFireResistSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16451)); - - private static WrappedStack potionPoison = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8196)); - private static WrappedStack potionPoisonEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8228)); - private static WrappedStack potionPoisonExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8260)); - private static WrappedStack potionPoisonSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16388)); - private static WrappedStack potionPoisonSplashEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16420)); - private static WrappedStack potionPoisonSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16452)); - - private static WrappedStack potionHealing = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8197)); - private static WrappedStack potionHealingEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8229)); - private static WrappedStack potionHealingSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16389)); - private static WrappedStack potionHealingSplashEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16421)); - - private static WrappedStack potionNightVision = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8198)); - private static WrappedStack potionNightVisionExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8262)); - private static WrappedStack potionNightVisionSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16390)); - private static WrappedStack potionNightVisionSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16454)); - - private static WrappedStack potionWeakness = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8200)); - private static WrappedStack potionWeaknessExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8264)); - private static WrappedStack potionWeaknessSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16392)); - private static WrappedStack potionWeaknessSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16456)); - - private static WrappedStack potionStrength = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8201)); - private static WrappedStack potionStrengthEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8233)); - private static WrappedStack potionStrengthExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8265)); - private static WrappedStack potionStrengthSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16393)); - private static WrappedStack potionStrengthSplashEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16425)); - private static WrappedStack potionStrengthSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16457)); - - private static WrappedStack potionSlowness = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8202)); - private static WrappedStack potionSlownessExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8266)); - private static WrappedStack potionSlownessSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16394)); - private static WrappedStack potionSlownessSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16458)); - - private static WrappedStack potionHarming = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8204)); - private static WrappedStack potionHarmingEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8236)); - private static WrappedStack potionHarmingSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16396)); - private static WrappedStack potionHarmingSplashEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16428)); - - private static WrappedStack potionInvisibility = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8206)); - private static WrappedStack potionInvisibilityExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8270)); - private static WrappedStack potionInvisibilitySplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16398)); - private static WrappedStack potionInvisibilitySplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16462)); - - public static Multimap> getPotionRecipes() - { - - if (potionRecipes == null) - { - init(); - } - - return potionRecipes; - } - - private static void init() - { - - potionRecipes = HashMultimap.create(); - - potionRecipes.put(bottleWater, Arrays.asList(bottleEmpty, reagentWater)); - - potionRecipes.put(potionAwkward, Arrays.asList(bottleWater, reagentNetherWart)); - - potionRecipes.put(potionNightVision, Arrays.asList(potionAwkward, reagentGoldenCarrot)); - potionRecipes.put(potionNightVision, Arrays.asList(potionNightVisionExtended, reagentGlowstoneDust)); - potionRecipes.put(potionNightVisionSplash, Arrays.asList(potionNightVisionSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionNightVisionSplash, Arrays.asList(potionNightVision, reagentGunpowder)); - - potionRecipes.put(potionNightVisionExtended, Arrays.asList(potionNightVision, reagentRedstoneDust)); - potionRecipes.put(potionNightVisionSplashExtended, Arrays.asList(potionNightVisionSplash, reagentRedstoneDust)); - potionRecipes.put(potionNightVisionSplashExtended, Arrays.asList(potionNightVisionExtended, reagentGunpowder)); - - potionRecipes.put(potionInvisibility, Arrays.asList(potionNightVision, reagentFermentedSpiderEye)); - potionRecipes.put(potionInvisibility, Arrays.asList(potionInvisibilityExtended, reagentGlowstoneDust)); - potionRecipes.put(potionInvisibilitySplash, Arrays.asList(potionNightVisionSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionInvisibilitySplash, Arrays.asList(potionInvisibilitySplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionInvisibilitySplash, Arrays.asList(potionInvisibility, reagentGunpowder)); - - potionRecipes.put(potionInvisibilityExtended, Arrays.asList(potionInvisibility, reagentRedstoneDust)); - potionRecipes.put(potionInvisibilityExtended, Arrays.asList(potionNightVisionExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionInvisibilitySplashExtended, Arrays.asList(potionInvisibilitySplash, reagentRedstoneDust)); - potionRecipes.put(potionInvisibilitySplashExtended, Arrays.asList(potionNightVisionSplashExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionInvisibilitySplashExtended, Arrays.asList(potionInvisibilityExtended, reagentGunpowder)); - - potionRecipes.put(potionFireResist, Arrays.asList(potionAwkward, reagentMagmaCream)); - potionRecipes.put(potionFireResist, Arrays.asList(potionFireResistExtended, reagentGlowstoneDust)); - potionRecipes.put(potionFireResistSplash, Arrays.asList(potionFireResistSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionFireResistSplash, Arrays.asList(potionFireResist, reagentGunpowder)); - - potionRecipes.put(potionFireResistExtended, Arrays.asList(potionFireResist, reagentRedstoneDust)); - potionRecipes.put(potionFireResistSplashExtended, Arrays.asList(potionFireResistSplash, reagentRedstoneDust)); - potionRecipes.put(potionFireResistSplashExtended, Arrays.asList(potionFireResistExtended, reagentGunpowder)); - - potionRecipes.put(potionSlowness, Arrays.asList(potionFireResist, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlowness, Arrays.asList(potionSlownessExtended, reagentGlowstoneDust)); - potionRecipes.put(potionSlowness, Arrays.asList(potionSwiftness, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlowness, Arrays.asList(potionSwiftnessExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessSplash, Arrays.asList(potionFireResistSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessSplash, Arrays.asList(potionSlownessSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionSlownessSplash, Arrays.asList(potionSwiftnessSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessSplash, Arrays.asList(potionSwiftnessSplashExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessSplash, Arrays.asList(potionSlowness, reagentGunpowder)); - - potionRecipes.put(potionSlownessExtended, Arrays.asList(potionFireResistExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessExtended, Arrays.asList(potionSwiftnessEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessSplashExtended, Arrays.asList(potionFireResistSplashExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessSplashExtended, Arrays.asList(potionSwiftnessSplashEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionSlownessSplashExtended, Arrays.asList(potionSlownessExtended, reagentGunpowder)); - - potionRecipes.put(potionSwiftness, Arrays.asList(potionAwkward, reagentSugar)); - potionRecipes.put(potionSwiftnessSplash, Arrays.asList(potionSwiftness, reagentGunpowder)); - - potionRecipes.put(potionSwiftnessExtended, Arrays.asList(potionSwiftness, reagentRedstoneDust)); - potionRecipes.put(potionSwiftnessExtended, Arrays.asList(potionSwiftnessEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionSwiftnessSplashExtended, Arrays.asList(potionSwiftnessSplash, reagentRedstoneDust)); - potionRecipes.put(potionSwiftnessSplashExtended, Arrays.asList(potionSwiftnessSplashEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionSwiftnessSplashExtended, Arrays.asList(potionSwiftnessExtended, reagentGunpowder)); - - potionRecipes.put(potionSwiftnessEnhanced, Arrays.asList(potionSwiftness, reagentGlowstoneDust)); - potionRecipes.put(potionSwiftnessEnhanced, Arrays.asList(potionSwiftnessExtended, reagentGlowstoneDust)); - potionRecipes.put(potionSwiftnessSplashEnhanced, Arrays.asList(potionSwiftnessSplash, reagentGlowstoneDust)); - potionRecipes.put(potionSwiftnessSplashEnhanced, Arrays.asList(potionSwiftnessSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionSwiftnessSplashEnhanced, Arrays.asList(potionSwiftnessEnhanced, reagentGunpowder)); - - potionRecipes.put(potionHealing, Arrays.asList(potionAwkward, reagentGlisteringMelon)); - potionRecipes.put(potionHealing, Arrays.asList(potionHealingEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionHealingSplash, Arrays.asList(potionHealingSplashEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionHealingSplash, Arrays.asList(potionHealing, reagentGunpowder)); - - potionRecipes.put(potionHealingEnhanced, Arrays.asList(potionHealing, reagentGlowstoneDust)); - potionRecipes.put(potionHealingSplashEnhanced, Arrays.asList(potionHealingSplash, reagentGlowstoneDust)); - potionRecipes.put(potionHealingSplashEnhanced, Arrays.asList(potionHealingEnhanced, reagentGunpowder)); - - potionRecipes.put(potionHarming, Arrays.asList(potionHealing, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarming, Arrays.asList(potionPoison, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarming, Arrays.asList(potionPoisonExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarming, Arrays.asList(potionHarmingEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionHarmingSplash, Arrays.asList(potionHealingSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarmingSplash, Arrays.asList(potionPoisonSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarmingSplash, Arrays.asList(potionPoisonSplashExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarmingSplash, Arrays.asList(potionHarmingSplashEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionHarmingSplash, Arrays.asList(potionHarming, reagentGunpowder)); - - potionRecipes.put(potionHarmingEnhanced, Arrays.asList(potionHealingEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarmingEnhanced, Arrays.asList(potionHarming, reagentGlowstoneDust)); - potionRecipes.put(potionHarmingEnhanced, Arrays.asList(potionPoisonEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarmingSplashEnhanced, Arrays.asList(potionHealingSplashEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarmingSplashEnhanced, Arrays.asList(potionHarmingSplash, reagentGlowstoneDust)); - potionRecipes.put(potionHarmingSplashEnhanced, Arrays.asList(potionPoisonSplashEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionHarmingSplashEnhanced, Arrays.asList(potionHarmingEnhanced, reagentGunpowder)); - - potionRecipes.put(potionPoison, Arrays.asList(potionAwkward, reagentSpiderEye)); - potionRecipes.put(potionPoisonSplash, Arrays.asList(potionPoison, reagentGunpowder)); - - potionRecipes.put(potionPoisonExtended, Arrays.asList(potionPoisonExtended, reagentRedstoneDust)); - potionRecipes.put(potionPoisonExtended, Arrays.asList(potionPoisonEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionPoisonSplashExtended, Arrays.asList(potionPoisonSplashExtended, reagentRedstoneDust)); - potionRecipes.put(potionPoisonSplashExtended, Arrays.asList(potionPoisonSplashEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionPoisonSplashExtended, Arrays.asList(potionPoisonExtended, reagentGunpowder)); - - potionRecipes.put(potionPoisonEnhanced, Arrays.asList(potionPoison, reagentGlowstoneDust)); - potionRecipes.put(potionPoisonEnhanced, Arrays.asList(potionPoisonExtended, reagentGlowstoneDust)); - potionRecipes.put(potionPoisonSplashEnhanced, Arrays.asList(potionPoisonSplash, reagentGlowstoneDust)); - potionRecipes.put(potionPoisonSplashEnhanced, Arrays.asList(potionPoisonSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionPoisonSplashEnhanced, Arrays.asList(potionPoisonEnhanced, reagentGunpowder)); - - potionRecipes.put(potionRegeneration, Arrays.asList(potionAwkward, reagentGhastTear)); - potionRecipes.put(potionRegenerationSplash, Arrays.asList(potionRegeneration, reagentGunpowder)); - - potionRecipes.put(potionRegenerationExtended, Arrays.asList(potionRegeneration, reagentRedstoneDust)); - potionRecipes.put(potionRegenerationExtended, Arrays.asList(potionRegenerationEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionRegenerationSplashExtended, Arrays.asList(potionRegenerationSplash, reagentRedstoneDust)); - potionRecipes.put(potionRegenerationSplashExtended, Arrays.asList(potionRegenerationSplashEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionRegenerationSplashExtended, Arrays.asList(potionRegenerationExtended, reagentGunpowder)); - - potionRecipes.put(potionRegenerationEnhanced, Arrays.asList(potionRegeneration, reagentGlowstoneDust)); - potionRecipes.put(potionRegenerationEnhanced, Arrays.asList(potionRegenerationExtended, reagentGlowstoneDust)); - potionRecipes.put(potionRegenerationSplashEnhanced, Arrays.asList(potionRegenerationSplash, reagentGlowstoneDust)); - potionRecipes.put(potionRegenerationSplashEnhanced, Arrays.asList(potionRegenerationSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionRegenerationSplashEnhanced, Arrays.asList(potionRegenerationEnhanced, reagentGunpowder)); - - potionRecipes.put(potionWeakness, Arrays.asList(potionAwkward, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeakness, Arrays.asList(potionRegeneration, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeakness, Arrays.asList(potionRegenerationEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeakness, Arrays.asList(potionStrength, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeakness, Arrays.asList(potionStrengthEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeakness, Arrays.asList(potionMundane, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeakness, Arrays.asList(potionWeaknessExtended, reagentGlowstoneDust)); - potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionRegenerationSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionRegenerationSplashEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionStrengthSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionStrengthSplashEnhanced, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionMundaneSplash, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionWeaknessSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionWeaknessSplash, Arrays.asList(potionWeakness, reagentGunpowder)); - - potionRecipes.put(potionWeaknessExtended, Arrays.asList(potionWeakness, reagentRedstoneDust)); - potionRecipes.put(potionWeaknessExtended, Arrays.asList(potionRegenerationExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessExtended, Arrays.asList(potionStrengthExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessExtended, Arrays.asList(potionMundaneExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionWeaknessSplash, reagentRedstoneDust)); - potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionRegenerationSplashExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionStrengthSplashExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionMundaneSplashExtended, reagentFermentedSpiderEye)); - potionRecipes.put(potionWeaknessSplashExtended, Arrays.asList(potionWeaknessExtended, reagentGunpowder)); - - potionRecipes.put(potionStrength, Arrays.asList(potionAwkward, reagentBlazePowder)); - potionRecipes.put(potionStrengthSplash, Arrays.asList(potionStrength, reagentGunpowder)); - - potionRecipes.put(potionStrengthEnhanced, Arrays.asList(potionStrength, reagentGlowstoneDust)); - potionRecipes.put(potionStrengthEnhanced, Arrays.asList(potionStrengthExtended, reagentGlowstoneDust)); - potionRecipes.put(potionStrengthSplashEnhanced, Arrays.asList(potionStrengthSplash, reagentGlowstoneDust)); - potionRecipes.put(potionStrengthSplashEnhanced, Arrays.asList(potionStrengthSplashExtended, reagentGlowstoneDust)); - potionRecipes.put(potionStrengthSplashEnhanced, Arrays.asList(potionStrengthEnhanced, reagentGunpowder)); - - potionRecipes.put(potionStrengthExtended, Arrays.asList(potionStrength, reagentRedstoneDust)); - potionRecipes.put(potionStrengthExtended, Arrays.asList(potionStrengthEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionStrengthSplashExtended, Arrays.asList(potionStrengthSplash, reagentRedstoneDust)); - potionRecipes.put(potionStrengthSplashExtended, Arrays.asList(potionStrengthSplashEnhanced, reagentRedstoneDust)); - potionRecipes.put(potionStrengthSplashExtended, Arrays.asList(potionStrengthExtended, reagentGunpowder)); - - potionRecipes.put(potionThick, Arrays.asList(bottleWater, reagentGlowstoneDust)); - - potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentSugar)); - potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentGlisteringMelon)); - potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentSpiderEye)); - potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentBlazePowder)); - potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentMagmaCream)); - potionRecipes.put(potionMundane, Arrays.asList(bottleWater, reagentGhastTear)); - potionRecipes.put(potionMundaneSplash, Arrays.asList(potionMundane, reagentGunpowder)); - - potionRecipes.put(potionMundaneExtended, Arrays.asList(bottleWater, reagentRedstoneDust)); - potionRecipes.put(potionMundaneSplashExtended, Arrays.asList(potionMundaneExtended, reagentGunpowder)); - } -} diff --git a/src/main/java/com/pahimar/ee3/recipe/RecipesVanilla.java b/src/main/java/com/pahimar/ee3/recipe/RecipesVanilla.java deleted file mode 100644 index 10ebd1d4..00000000 --- a/src/main/java/com/pahimar/ee3/recipe/RecipesVanilla.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.pahimar.ee3.recipe; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.pahimar.ee3.api.WrappedStack; -import com.pahimar.ee3.helper.RecipeHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; - -import java.util.ArrayList; -import java.util.List; - -public class RecipesVanilla -{ - private static Multimap> vanillaRecipes = null; - - public static Multimap> getVanillaRecipes() - { - if (vanillaRecipes == null) - { - init(); - } - - return vanillaRecipes; - } - - private static void init() - { - vanillaRecipes = HashMultimap.create(); - - for (Object recipeObject : CraftingManager.getInstance().getRecipeList()) - { - /** - * Vanilla - */ - if (recipeObject instanceof ShapedRecipes || recipeObject instanceof ShapelessRecipes || recipeObject instanceof ShapedOreRecipe || recipeObject instanceof ShapelessOreRecipe) - { - IRecipe recipe = (IRecipe) recipeObject; - ItemStack recipeOutput = recipe.getRecipeOutput(); - - if (recipeOutput != null) - { - ArrayList recipeInputs = RecipeHelper.getRecipeInputs(recipe); - - if (!recipeInputs.isEmpty()) - { - vanillaRecipes.put(new WrappedStack(recipeOutput), recipeInputs); - } - } - } - } - } -} diff --git a/src/main/java/com/pahimar/ee3/lib/Colours.java b/src/main/java/com/pahimar/ee3/reference/Colors.java similarity index 90% rename from src/main/java/com/pahimar/ee3/lib/Colours.java rename to src/main/java/com/pahimar/ee3/reference/Colors.java index 7935083b..deb86822 100644 --- a/src/main/java/com/pahimar/ee3/lib/Colours.java +++ b/src/main/java/com/pahimar/ee3/reference/Colors.java @@ -1,13 +1,6 @@ -package com.pahimar.ee3.lib; +package com.pahimar.ee3.reference; -/** - * Equivalent-Exchange-3 - *

- * Colours - * - * @author pahimar - */ -public class Colours +public class Colors { public static final String PURE_WHITE = "ffffff"; diff --git a/src/main/java/com/pahimar/ee3/reference/EventHandlers.java b/src/main/java/com/pahimar/ee3/reference/EventHandlers.java new file mode 100644 index 00000000..37fd1527 --- /dev/null +++ b/src/main/java/com/pahimar/ee3/reference/EventHandlers.java @@ -0,0 +1,8 @@ +package com.pahimar.ee3.reference; + +import com.pahimar.ee3.handler.ItemEventHandler; + +public class EventHandlers +{ + public static final ItemEventHandler itemEventHandler = new ItemEventHandler(); +} diff --git a/src/main/java/com/pahimar/ee3/lib/GuiIds.java b/src/main/java/com/pahimar/ee3/reference/GuiIds.java similarity index 74% rename from src/main/java/com/pahimar/ee3/lib/GuiIds.java rename to src/main/java/com/pahimar/ee3/reference/GuiIds.java index 69c388e6..d488eac6 100644 --- a/src/main/java/com/pahimar/ee3/lib/GuiIds.java +++ b/src/main/java/com/pahimar/ee3/reference/GuiIds.java @@ -1,12 +1,5 @@ -package com.pahimar.ee3.lib; +package com.pahimar.ee3.reference; -/** - * Equivalent-Exchange-3 - *

- * GuiIds - * - * @author pahimar - */ public class GuiIds { public static final int PORTABLE_CRAFTING = 0; diff --git a/src/main/java/com/pahimar/ee3/reference/Names.java b/src/main/java/com/pahimar/ee3/reference/Names.java new file mode 100644 index 00000000..df7e9016 --- /dev/null +++ b/src/main/java/com/pahimar/ee3/reference/Names.java @@ -0,0 +1,32 @@ +package com.pahimar.ee3.reference; + +public class Names +{ + public static class Items + { + public static final String ALCHEMICAL_BAG = "alchemicalBag"; + public static final String ALCHEMICAL_DUST = "alchemicalDust"; + public static final String[] ALCHEMICAL_DUST_SUBTYPES = {"ash", "verdant", "azure", "minium"}; + public static final String ALCHEMICAL_COAL_NAME = "alchemicalCoal"; + public static final String MOBIUS_FUEL_NAME = "mobiusFuel"; + public static final String AETERNALIS_FUEL_NAME = "aeternalisFuel"; + public static final String[] ALCHEMICAL_FUEL_SUBTYPES = {ALCHEMICAL_COAL_NAME, MOBIUS_FUEL_NAME, AETERNALIS_FUEL_NAME}; + public static final String CHALK = "chalk"; + } + + public static class NBT + { + public static final String CHARGE_LEVEL = "chargeLevel"; + public static final String MODE = "mode"; + public static final String CRAFTING_GUI_OPEN = "craftingGuiOpen"; + public static final String TRANSMUTATION_GUI_OPEN = "transmutationGuiOpen"; + public static final String ALCHEMICAL_BAG_GUI_OPEN = "alchemicalBagGuiOpen"; + public static final String UUID_MOST_SIG = "UUIDMostSig"; + public static final String UUID_LEAST_SIG = "UUIDLeastSig"; + public static final String DISPLAY = "display"; + public static final String COLOR = "color"; + public static final String STATE = "teState"; + public static final String CUSTOM_NAME = "CustomName"; + public static final String DIRECTION = "teDirection"; + } +} diff --git a/src/main/java/com/pahimar/ee3/reference/Reference.java b/src/main/java/com/pahimar/ee3/reference/Reference.java new file mode 100644 index 00000000..fd94c39d --- /dev/null +++ b/src/main/java/com/pahimar/ee3/reference/Reference.java @@ -0,0 +1,10 @@ +package com.pahimar.ee3.reference; + +public class Reference +{ + public static final String MOD_ID = "EE3"; + public static final String MOD_NAME = "Equivalent Exchange 3"; + public static final String FINGERPRINT = "@FINGERPRINT@"; + public static final String SERVER_PROXY_CLASS = "com.pahimar.ee3.proxy.ServerProxy"; + public static final String CLIENT_PROXY_CLASS = "com.pahimar.ee3.proxy.ClientProxy"; +} diff --git a/src/main/java/com/pahimar/ee3/lib/Sounds.java b/src/main/java/com/pahimar/ee3/reference/Sounds.java similarity index 60% rename from src/main/java/com/pahimar/ee3/lib/Sounds.java rename to src/main/java/com/pahimar/ee3/reference/Sounds.java index 72d22312..6a0a08cf 100644 --- a/src/main/java/com/pahimar/ee3/lib/Sounds.java +++ b/src/main/java/com/pahimar/ee3/reference/Sounds.java @@ -1,24 +1,15 @@ -package com.pahimar.ee3.lib; +package com.pahimar.ee3.reference; -/** - * Equivalent-Exchange-3 - *

- * Sounds - * - * @author pahimar - */ public class Sounds { - - private static final String SOUND_RESOURCE_LOCATION = Reference.MOD_ID.toLowerCase() + ":"; + public static final String CHEST_OPEN = "random.chestopen"; + public static final String CHEST_CLOSE = "random.chestclosed"; private static final String SOUND_PREFIX = Reference.MOD_ID.toLowerCase() + ":"; - - public static String[] soundFiles = {SOUND_RESOURCE_LOCATION + "chargeDown.ogg", SOUND_RESOURCE_LOCATION + "chargeUp.ogg", SOUND_RESOURCE_LOCATION + "destruct.ogg", SOUND_RESOURCE_LOCATION + "fail.ogg", SOUND_RESOURCE_LOCATION + "gust.ogg", SOUND_RESOURCE_LOCATION + "heal.ogg", SOUND_RESOURCE_LOCATION + "kinesis.ogg", SOUND_RESOURCE_LOCATION + "launch.ogg", SOUND_RESOURCE_LOCATION + "nova.ogg", SOUND_RESOURCE_LOCATION + "philball.ogg", SOUND_RESOURCE_LOCATION + "tock.ogg", SOUND_RESOURCE_LOCATION + "transmute.ogg", SOUND_RESOURCE_LOCATION + "wall.ogg", SOUND_RESOURCE_LOCATION + "waterball.ogg", SOUND_RESOURCE_LOCATION + "wind.ogg"}; - public static final String CHARGE_DOWN = SOUND_PREFIX + "chargeDown"; public static final String CHARGE_UP = SOUND_PREFIX + "chargeUp"; public static final String DESTRUCTION = SOUND_PREFIX + "destruct"; public static final String FAIL = SOUND_PREFIX + "fail"; + public static final String CHARGE_FAIL = FAIL; public static final String GUST = SOUND_PREFIX + "gust"; public static final String HEAL = SOUND_PREFIX + "heal"; public static final String KINESIS = SOUND_PREFIX + "kinesis"; @@ -30,8 +21,4 @@ public class Sounds public static final String WALL = SOUND_PREFIX + "wall"; public static final String WATER_BALL = SOUND_PREFIX + "waterball"; public static final String WIND = SOUND_PREFIX + "wind"; - - public static final String CHEST_OPEN = "random.chestopen"; - public static final String CHEST_CLOSE = "random.chestclosed"; - public static final String CHARGE_FAIL = FAIL; } diff --git a/src/main/java/com/pahimar/ee3/reference/Textures.java b/src/main/java/com/pahimar/ee3/reference/Textures.java new file mode 100644 index 00000000..8625a0bd --- /dev/null +++ b/src/main/java/com/pahimar/ee3/reference/Textures.java @@ -0,0 +1,6 @@ +package com.pahimar.ee3.reference; + +public class Textures +{ + public static final String RESOURCE_PREFIX = Reference.MOD_ID.toLowerCase() + ":"; +} diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChest.java b/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChest.java deleted file mode 100644 index a9286dbe..00000000 --- a/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChest.java +++ /dev/null @@ -1,329 +0,0 @@ -package com.pahimar.ee3.tileentity; - -import com.pahimar.ee3.block.BlockAlchemicalChest; -import com.pahimar.ee3.inventory.ContainerAlchemicalChest; -import com.pahimar.ee3.lib.Sounds; -import com.pahimar.ee3.lib.Strings; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -/** - * Equivalent-Exchange-3 - *

- * TileAlchemicalChest - * - * @author pahimar - */ -public class TileAlchemicalChest extends TileEE implements IInventory -{ - /** - * The current angle of the chest lid (between 0 and 1) - */ - public float lidAngle; - - /** - * The angle of the chest lid last tick - */ - public float prevLidAngle; - - /** - * The number of players currently using this chest - */ - public int numUsingPlayers; - - /** - * Server sync counter (once per 20 ticks) - */ - private int ticksSinceSync; - - /** - * The ItemStacks that hold the items currently being used in the Alchemical Chest - */ - private ItemStack[] inventory; - - public TileAlchemicalChest(int metaData) - { - super(); - this.state = (byte) metaData; - - if (metaData == 0) - { - inventory = new ItemStack[ContainerAlchemicalChest.SMALL_INVENTORY_SIZE]; - } - else if (metaData == 1) - { - inventory = new ItemStack[ContainerAlchemicalChest.MEDIUM_INVENTORY_SIZE]; - } - else if (metaData == 2) - { - inventory = new ItemStack[ContainerAlchemicalChest.LARGE_INVENTORY_SIZE]; - } - } - - @Override - public int getSizeInventory() - { - return inventory.length; - } - - @Override - public ItemStack getStackInSlot(int slotIndex) - { - return inventory[slotIndex]; - } - - @Override - public ItemStack decrStackSize(int slotIndex, int decrementAmount) - { - ItemStack itemStack = getStackInSlot(slotIndex); - if (itemStack != null) - { - if (itemStack.stackSize <= decrementAmount) - { - setInventorySlotContents(slotIndex, null); - } - else - { - itemStack = itemStack.splitStack(decrementAmount); - if (itemStack.stackSize == 0) - { - setInventorySlotContents(slotIndex, null); - } - } - } - - return itemStack; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slotIndex) - { - if (inventory[slotIndex] != null) - { - ItemStack itemStack = inventory[slotIndex]; - inventory[slotIndex] = null; - return itemStack; - } - else - { - return null; - } - } - - @Override - public void setInventorySlotContents(int slotIndex, ItemStack itemStack) - { - inventory[slotIndex] = itemStack; - - if (itemStack != null && itemStack.stackSize > this.getInventoryStackLimit()) - { - itemStack.stackSize = this.getInventoryStackLimit(); - } - - this.markDirty(); - } - - @Override - public String getInventoryName() - { - return this.hasCustomName() ? this.getCustomName() : Strings.CONTAINER_ALCHEMICAL_CHEST_NAME; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * Do not make give this method the name canInteractWith because it clashes with Container - * - * @param entityplayer - */ - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) - { - return true; - } - - /** - * Called when a client event is received with the event number and argument, see World.sendClientEvent - */ - @Override - public boolean receiveClientEvent(int eventID, int numUsingPlayers) - { - if (eventID == 1) - { - this.numUsingPlayers = numUsingPlayers; - return true; - } - else - { - return super.receiveClientEvent(eventID, numUsingPlayers); - } - } - - @Override - public void openInventory() - { - if (this.numUsingPlayers < 0) - { - this.numUsingPlayers = 0; - } - - ++this.numUsingPlayers; - this.worldObj.addBlockEvent(xCoord, yCoord, zCoord, this.getBlockType(), 1, numUsingPlayers); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - } - - @Override - public void closeInventory() - { - if (this.getBlockType() instanceof BlockAlchemicalChest) - { - --this.numUsingPlayers; - this.worldObj.addBlockEvent(xCoord, yCoord, zCoord, this.getBlockType(), 1, numUsingPlayers); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - } - } - - /** - * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count - * ticks and creates a new spawn inside its implementation. - */ - @Override - public void updateEntity() - { - super.updateEntity(); - - if (++ticksSinceSync % 20 * 4 == 0) - { - worldObj.addBlockEvent(xCoord, yCoord, zCoord, this.getBlockType(), 1, numUsingPlayers); - } - - prevLidAngle = lidAngle; - float angleIncrement = 0.1F; - double adjustedXCoord, adjustedZCoord; - - if (numUsingPlayers > 0 && lidAngle == 0.0F) - { - adjustedXCoord = xCoord + 0.5D; - adjustedZCoord = zCoord + 0.5D; - worldObj.playSoundEffect(adjustedXCoord, yCoord + 0.5D, adjustedZCoord, Sounds.CHEST_OPEN, 0.5F, worldObj.rand.nextFloat() * 0.1F + 0.9F); - } - - if (numUsingPlayers == 0 && lidAngle > 0.0F || numUsingPlayers > 0 && lidAngle < 1.0F) - { - float var8 = lidAngle; - - if (numUsingPlayers > 0) - { - lidAngle += angleIncrement; - } - else - { - lidAngle -= angleIncrement; - } - - if (lidAngle > 1.0F) - { - lidAngle = 1.0F; - } - - if (lidAngle < 0.5F && var8 >= 0.5F) - { - adjustedXCoord = xCoord + 0.5D; - adjustedZCoord = zCoord + 0.5D; - worldObj.playSoundEffect(adjustedXCoord, yCoord + 0.5D, adjustedZCoord, Sounds.CHEST_CLOSE, 0.5F, worldObj.rand.nextFloat() * 0.1F + 0.9F); - } - - if (lidAngle < 0.0F) - { - lidAngle = 0.0F; - } - } - } - - @Override - public void readFromNBT(NBTTagCompound nbtTagCompound) - { - super.readFromNBT(nbtTagCompound); - - // Read in the ItemStacks in the inventory from NBT - NBTTagList tagList = nbtTagCompound.getTagList("Items", 10); - inventory = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < tagList.tagCount(); ++i) - { - NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); - byte slotIndex = tagCompound.getByte("Slot"); - if (slotIndex >= 0 && slotIndex < inventory.length) - { - inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); - } - } - } - - @Override - public void writeToNBT(NBTTagCompound nbtTagCompound) - { - super.writeToNBT(nbtTagCompound); - - // Write the ItemStacks in the inventory to NBT - NBTTagList tagList = new NBTTagList(); - for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) - { - if (inventory[currentIndex] != null) - { - NBTTagCompound tagCompound = new NBTTagCompound(); - tagCompound.setByte("Slot", (byte) currentIndex); - inventory[currentIndex].writeToNBT(tagCompound); - tagList.appendTag(tagCompound); - } - } - nbtTagCompound.setTag("Items", tagList); - } - - @Override - public boolean hasCustomInventoryName() - { - return this.hasCustomName(); - } - - @Override - public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) - { - return true; - } - - @Override - public String toString() - { - StringBuilder stringBuilder = new StringBuilder(); - - stringBuilder.append(super.toString()); - - stringBuilder.append("TileAlchemicalChest Data - "); - for (int i = 0; i < inventory.length; i++) - { - if (i != 0) - { - stringBuilder.append(", "); - } - - if (inventory[i] != null) - { - stringBuilder.append(String.format("inventory[%d]: %s", i, inventory[i].toString())); - } - else - { - stringBuilder.append(String.format("inventory[%d]: empty", i)); - } - } - stringBuilder.append("\n"); - - return stringBuilder.toString(); - } -} diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestLarge.java b/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestLarge.java deleted file mode 100644 index e31de027..00000000 --- a/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestLarge.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.pahimar.ee3.tileentity; - -public class TileAlchemicalChestLarge extends TileAlchemicalChest -{ - public TileAlchemicalChestLarge() - { - super(2); - } -} diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestMedium.java b/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestMedium.java deleted file mode 100644 index 7851756f..00000000 --- a/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestMedium.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.pahimar.ee3.tileentity; - -public class TileAlchemicalChestMedium extends TileAlchemicalChest -{ - public TileAlchemicalChestMedium() - { - super(1); - } -} diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestSmall.java b/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestSmall.java deleted file mode 100644 index 28f5ffc6..00000000 --- a/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestSmall.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.pahimar.ee3.tileentity; - -public class TileAlchemicalChestSmall extends TileAlchemicalChest -{ - public TileAlchemicalChestSmall() - { - super(0); - } -} diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileAlchemySquare.java b/src/main/java/com/pahimar/ee3/tileentity/TileAlchemySquare.java deleted file mode 100644 index eebd2ec4..00000000 --- a/src/main/java/com/pahimar/ee3/tileentity/TileAlchemySquare.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.pahimar.ee3.tileentity; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -public class TileAlchemySquare extends TileEE implements IInventory -{ - public static final int INVENTORY_SIZE = 8; - private ItemStack[] inventory; - - public TileAlchemySquare() - { - inventory = new ItemStack[INVENTORY_SIZE]; - } - - /** - * Returns the number of slots in the inventory. - */ - @Override - public int getSizeInventory() - { - return INVENTORY_SIZE; - } - - /** - * Returns the stack in slot i - * - * @param slotIndex - */ - @Override - public ItemStack getStackInSlot(int slotIndex) - { - return inventory[slotIndex]; - } - - /** - * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a - * new stack. - * - * @param slotIndex - * @param amount - */ - @Override - public ItemStack decrStackSize(int slotIndex, int amount) - { - return null; - } - - /** - * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - - * like when you close a workbench GUI. - * - * @param slotIndex - */ - @Override - public ItemStack getStackInSlotOnClosing(int slotIndex) - { - return null; - } - - /** - * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). - * - * @param slotIndex - * @param itemStack - */ - @Override - public void setInventorySlotContents(int slotIndex, ItemStack itemStack) - { - - } - - /** - * Returns the name of the inventory. - */ - @Override - public String getInventoryName() - { - return null; - } - - /** - * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's - * language. Otherwise it will be used directly. - */ - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - /** - * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't - * this more of a set than a get?* - */ - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * Do not make give this method the name canInteractWith because it clashes with Container - * - * @param entityplayer - */ - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) - { - return true; - } - - @Override - public void openInventory() - { - // NOOP - } - - @Override - public void closeInventory() - { - // NOOP - } - - /** - * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. - * - * @param slotIndex - * @param itemStack - */ - @Override - public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) - { - return false; - } -} diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileAludel.java b/src/main/java/com/pahimar/ee3/tileentity/TileAludel.java deleted file mode 100644 index 6c36e196..00000000 --- a/src/main/java/com/pahimar/ee3/tileentity/TileAludel.java +++ /dev/null @@ -1,476 +0,0 @@ -package com.pahimar.ee3.tileentity; - -import com.pahimar.ee3.helper.ItemHelper; -import com.pahimar.ee3.item.ItemAlchemicalDust; -import com.pahimar.ee3.item.crafting.RecipeAludel; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.network.PacketTypeHandler; -import com.pahimar.ee3.network.packet.PacketTileWithItemUpdate; -import com.pahimar.ee3.recipe.RecipesAludel; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.Packet; -import net.minecraft.tileentity.TileEntityFurnace; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Equivalent-Exchange-3 - *

- * TileAludel - * - * @author pahimar - */ -public class TileAludel extends TileEE implements ISidedInventory -{ - public static final int INVENTORY_SIZE = 4; - public static final int FUEL_INVENTORY_INDEX = 0; - public static final int INPUT_INVENTORY_INDEX = 1; - public static final int DUST_INVENTORY_INDEX = 2; - public static final int OUTPUT_INVENTORY_INDEX = 3; - public int deviceCookTime; // How much longer the Aludel will cook - public int fuelBurnTime; // The fuel value for the currently burning fuel - public int itemCookTime; // How long the current item has been "cooking" - public ItemStack outputItemStack; - public boolean hasGlassBell = false; - /** - * The ItemStacks that hold the items currently being used in the Aludel - */ - private ItemStack[] inventory; - - public TileAludel() - { - inventory = new ItemStack[INVENTORY_SIZE]; - } - - @Override - public int getSizeInventory() - { - return inventory.length; - } - - @Override - public ItemStack getStackInSlot(int slotIndex) - { - return inventory[slotIndex]; - } - - @Override - public ItemStack decrStackSize(int slotIndex, int decrementAmount) - { - ItemStack itemStack = getStackInSlot(slotIndex); - if (itemStack != null) - { - if (itemStack.stackSize <= decrementAmount) - { - setInventorySlotContents(slotIndex, null); - } - else - { - itemStack = itemStack.splitStack(decrementAmount); - if (itemStack.stackSize == 0) - { - setInventorySlotContents(slotIndex, null); - } - } - } - - return itemStack; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slotIndex) - { - ItemStack itemStack = getStackInSlot(slotIndex); - if (itemStack != null) - { - setInventorySlotContents(slotIndex, null); - } - return itemStack; - } - - @Override - public void setInventorySlotContents(int slotIndex, ItemStack itemStack) - { - inventory[slotIndex] = itemStack; - if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) - { - itemStack.stackSize = getInventoryStackLimit(); - } - } - - @Override - public String getInventoryName() - { - return this.hasCustomName() ? this.getCustomName() : Strings.CONTAINER_ALUDEL_NAME; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public boolean receiveClientEvent(int eventId, int eventData) - { - if (eventId == 1) - { - this.state = (byte) eventData; - this.worldObj.updateAllLightTypes(this.xCoord, this.yCoord, this.zCoord); - return true; - } - else - { - return super.receiveClientEvent(eventId, eventData); - } - } - - @Override - public void openInventory() - { - // NOOP - } - - @Override - public void closeInventory() - { - // NOOP - } - - @Override - public void readFromNBT(NBTTagCompound nbtTagCompound) - { - super.readFromNBT(nbtTagCompound); - - // Read in the ItemStacks in the inventory from NBT - NBTTagList tagList = nbtTagCompound.getTagList("Items", 10); - inventory = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < tagList.tagCount(); ++i) - { - NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); - byte slotIndex = tagCompound.getByte("Slot"); - if (slotIndex >= 0 && slotIndex < inventory.length) - { - inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); - } - } - - deviceCookTime = nbtTagCompound.getInteger("deviceCookTime"); - fuelBurnTime = nbtTagCompound.getInteger("fuelBurnTime"); - itemCookTime = nbtTagCompound.getInteger("itemCookTime"); - hasGlassBell = nbtTagCompound.getBoolean("hasGlassBell"); - } - - @Override - public void writeToNBT(NBTTagCompound nbtTagCompound) - { - super.writeToNBT(nbtTagCompound); - - // Write the ItemStacks in the inventory to NBT - NBTTagList tagList = new NBTTagList(); - for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) - { - if (inventory[currentIndex] != null) - { - NBTTagCompound tagCompound = new NBTTagCompound(); - tagCompound.setByte("Slot", (byte) currentIndex); - inventory[currentIndex].writeToNBT(tagCompound); - tagList.appendTag(tagCompound); - } - } - nbtTagCompound.setTag("Items", tagList); - nbtTagCompound.setInteger("deviceCookTime", deviceCookTime); - nbtTagCompound.setInteger("fuelBurnTime", fuelBurnTime); - nbtTagCompound.setInteger("itemCookTime", itemCookTime); - nbtTagCompound.setBoolean("hasGlassBell", hasGlassBell); - } - - @Override - public boolean hasCustomInventoryName() - { - return this.hasCustomName(); - } - - @Override - public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) - { - switch (slotIndex) - { - case FUEL_INVENTORY_INDEX: - { - return TileEntityFurnace.isItemFuel(itemStack); - } - case INPUT_INVENTORY_INDEX: - { - return true; - } - case DUST_INVENTORY_INDEX: - { - return itemStack.getItem() instanceof ItemAlchemicalDust; - } - default: - { - return false; - } - } - } - - @Override - public void updateEntity() - { - boolean isBurning = this.deviceCookTime > 0; - boolean sendUpdate = false; - - // If the Aludel still has burn time, decrement it - if (this.deviceCookTime > 0) - { - this.deviceCookTime--; - } - - if (!this.worldObj.isRemote) - { - // Start "cooking" a new item, if we can - if (this.deviceCookTime == 0 && this.canInfuse()) - { - this.fuelBurnTime = this.deviceCookTime = TileEntityFurnace.getItemBurnTime(this.inventory[FUEL_INVENTORY_INDEX]); - - if (this.deviceCookTime > 0) - { - sendUpdate = true; - - if (this.inventory[FUEL_INVENTORY_INDEX] != null) - { - --this.inventory[FUEL_INVENTORY_INDEX].stackSize; - - if (this.inventory[FUEL_INVENTORY_INDEX].stackSize == 0) - { - this.inventory[FUEL_INVENTORY_INDEX] = this.inventory[FUEL_INVENTORY_INDEX].getItem().getContainerItemStack(inventory[FUEL_INVENTORY_INDEX]); - } - } - } - } - - // Continue "cooking" the same item, if we can - if (this.deviceCookTime > 0 && this.canInfuse()) - { - this.itemCookTime++; - - if (this.itemCookTime == 200) - { - this.itemCookTime = 0; - this.infuseItem(); - sendUpdate = true; - } - } - else - { - this.itemCookTime = 0; - } - - // If the state has changed, catch that something changed - if (isBurning != this.deviceCookTime > 0) - { - sendUpdate = true; - } - } - - if (sendUpdate) - { - this.onInventoryChanged(); - this.state = this.deviceCookTime > 0 ? (byte) 1 : (byte) 0; - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID, 1, this.state); - PacketDispatcher.sendPacketToAllAround(this.xCoord, this.yCoord, this.zCoord, 128d, this.worldObj.provider.dimensionId, getDescriptionPacket()); - this.worldObj.notifyBlockChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID); - } - } - - @SideOnly(Side.CLIENT) - public int getCookProgressScaled(int scale) - { - return this.itemCookTime * scale / 200; - } - - @SideOnly(Side.CLIENT) - public int getBurnTimeRemainingScaled(int scale) - { - if (this.fuelBurnTime > 0) - { - return this.deviceCookTime * scale / this.fuelBurnTime; - } - return 0; - } - - private boolean canInfuse() - { - if (!hasGlassBell || inventory[INPUT_INVENTORY_INDEX] == null || inventory[DUST_INVENTORY_INDEX] == null) - { - return false; - } - else - { - ItemStack infusedItemStack = RecipesAludel.getInstance().getResult(inventory[INPUT_INVENTORY_INDEX], inventory[DUST_INVENTORY_INDEX]); - - if (infusedItemStack == null) - { - return false; - } - - if (inventory[OUTPUT_INVENTORY_INDEX] == null) - { - return true; - } - else - { - boolean outputEquals = this.inventory[OUTPUT_INVENTORY_INDEX].isItemEqual(infusedItemStack); - int mergedOutputStackSize = this.inventory[OUTPUT_INVENTORY_INDEX].stackSize + infusedItemStack.stackSize; - - if (outputEquals) - { - return mergedOutputStackSize <= getInventoryStackLimit() && mergedOutputStackSize <= infusedItemStack.getMaxStackSize(); - } - } - } - - return false; - } - - public void infuseItem() - { - if (this.canInfuse()) - { - RecipeAludel recipe = RecipesAludel.getInstance().getRecipe(inventory[INPUT_INVENTORY_INDEX], inventory[DUST_INVENTORY_INDEX]); - - if (this.inventory[OUTPUT_INVENTORY_INDEX] == null) - { - this.inventory[OUTPUT_INVENTORY_INDEX] = recipe.getRecipeOutput().copy(); - } - else if (this.inventory[OUTPUT_INVENTORY_INDEX].isItemEqual(recipe.getRecipeOutput())) - { - inventory[OUTPUT_INVENTORY_INDEX].stackSize += recipe.getRecipeOutput().stackSize; - } - - decrStackSize(INPUT_INVENTORY_INDEX, recipe.getRecipeInputs()[0].getStackSize()); - decrStackSize(DUST_INVENTORY_INDEX, recipe.getRecipeInputs()[1].getStackSize()); - } - } - - @Override - public Packet getDescriptionPacket() - { - ItemStack itemStack = this.inventory[OUTPUT_INVENTORY_INDEX]; - - if (itemStack != null && itemStack.stackSize > 0) - { - return PacketTypeHandler.populatePacket(new PacketTileWithItemUpdate(xCoord, yCoord, zCoord, orientation, state, customName, itemStack.itemID, itemStack.getItemDamage(), itemStack.stackSize, ItemHelper.getColor(itemStack))); - } - else - { - return PacketTypeHandler.populatePacket(new PacketTileWithItemUpdate(xCoord, yCoord, zCoord, orientation, state, customName, -1, 0, 0, 0)); - } - } - - @Override - public void markDirty() - { - PacketDispatcher.sendPacketToAllAround(this.xCoord, this.yCoord, this.zCoord, 128D, this.worldObj.provider.dimensionId, getDescriptionPacket()); - - worldObj.updateAllLightTypes(xCoord, yCoord, zCoord); - - if (hasGlassBell) - { - worldObj.updateAllLightTypes(xCoord, yCoord + 1, zCoord); - } - } - - /** - * Do not make give this method the name canInteractWith because it clashes with Container - * - * @param entityplayer - */ - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) - { - return true; - } - - @Override - public String toString() - { - StringBuilder stringBuilder = new StringBuilder(); - - stringBuilder.append(super.toString()); - - stringBuilder.append("TileAludel Data - "); - for (int i = 0; i < inventory.length; i++) - { - if (i != 0) - { - stringBuilder.append(", "); - } - - if (inventory[i] != null) - { - stringBuilder.append(String.format("inventory[%d]: %s", i, inventory[i].toString())); - } - else - { - stringBuilder.append(String.format("inventory[%d]: empty", i)); - } - } - stringBuilder.append("\n"); - - return stringBuilder.toString(); - } - - /** - * Returns an array containing the indices of the slots that can be accessed by automation on the given side of this - * block. - * - * @param side - */ - @Override - public int[] getAccessibleSlotsFromSide(int side) - { - return side == ForgeDirection.DOWN.ordinal() ? new int[]{FUEL_INVENTORY_INDEX, OUTPUT_INVENTORY_INDEX} : new int[]{INPUT_INVENTORY_INDEX, DUST_INVENTORY_INDEX, OUTPUT_INVENTORY_INDEX}; - } - - /** - * Returns true if automation can insert the given item in the given slot from the given side. Args: Slot, item, - * side - * - * @param slotIndex - * @param itemStack - * @param side - */ - @Override - public boolean canInsertItem(int slotIndex, ItemStack itemStack, int side) - { - if (worldObj.getTileEntity(xCoord, yCoord + 1, zCoord) instanceof TileGlassBell) - { - return isItemValidForSlot(slotIndex, itemStack); - } - else - { - return false; - } - } - - /** - * Returns true if automation can extract the given item in the given slot from the given side. Args: Slot, item, - * side - * - * @param slotIndex - * @param itemStack - * @param side - */ - @Override - public boolean canExtractItem(int slotIndex, ItemStack itemStack, int side) - { - return slotIndex == OUTPUT_INVENTORY_INDEX; - } -} diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileCalcinator.java b/src/main/java/com/pahimar/ee3/tileentity/TileCalcinator.java deleted file mode 100644 index 19c87e0c..00000000 --- a/src/main/java/com/pahimar/ee3/tileentity/TileCalcinator.java +++ /dev/null @@ -1,555 +0,0 @@ -package com.pahimar.ee3.tileentity; - -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.recipe.CalcinationManager; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.Packet; -import net.minecraft.tileentity.TileEntityFurnace; -import net.minecraft.tileentity.TileEntityHopper; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Equivalent-Exchange-3 - *

- * TileCalcinator - * - * @author pahimar - */ -public class TileCalcinator extends TileEE implements ISidedInventory -{ - public static final int INVENTORY_SIZE = 4; - public static final int FUEL_INVENTORY_INDEX = 0; - public static final int INPUT_INVENTORY_INDEX = 1; - public static final int OUTPUT_LEFT_INVENTORY_INDEX = 2; - public static final int OUTPUT_RIGHT_INVENTORY_INDEX = 3; - private static final int DEFAULT_ITEM_SUCK_COOL_DOWN = 20; - public int deviceCookTime; // How much longer the Calcinator will cook - public int fuelBurnTime; // The fuel value for the currently burning fuel - public int itemCookTime; // How long the current item has been "cooking" - - public byte leftStackSize, leftStackMeta, rightStackSize, rightStackMeta; - - public int itemSuckCoolDown = 0; - /** - * The ItemStacks that hold the items currently being used in the Calcinator - */ - private ItemStack[] inventory; - - public TileCalcinator() - { - inventory = new ItemStack[INVENTORY_SIZE]; - } - - /** - * Sucks one item into the given hopper from an inventory or EntityItem above it. - */ - public static boolean suckItemsIntoCalcinator(TileCalcinator calcinator) - { -// EntityItem entityitem = TileEntityHopper.getEntityAbove(calcinator.getWorldObj(), calcinator.xCoord, calcinator.yCoord + 1.0D, calcinator.zCoord); - EntityItem entityitem = TileEntityHopper.func_145897_a(calcinator.getWorldObj(), calcinator.xCoord, calcinator.yCoord + 1.0D, calcinator.zCoord); - -// return entityitem != null && TileEntityHopper.insertStackFromEntity(calcinator, entityitem); - return entityitem != null && TileEntityHopper.func_145898_a(calcinator, entityitem); - } - - /** - * Returns the number of slots in the inventory. - */ - @Override - public int getSizeInventory() - { - return inventory.length; - } - - /** - * Returns the stack in slot i - */ - @Override - public ItemStack getStackInSlot(int slotIndex) - { - sendDustPileData(); - return inventory[slotIndex]; - } - - @Override - public ItemStack decrStackSize(int slotIndex, int decrementAmount) - { - ItemStack itemStack = getStackInSlot(slotIndex); - if (itemStack != null) - { - if (itemStack.stackSize <= decrementAmount) - { - setInventorySlotContents(slotIndex, null); - } - else - { - itemStack = itemStack.splitStack(decrementAmount); - if (itemStack.stackSize == 0) - { - setInventorySlotContents(slotIndex, null); - } - } - } - - return itemStack; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slotIndex) - { - ItemStack itemStack = getStackInSlot(slotIndex); - if (itemStack != null) - { - setInventorySlotContents(slotIndex, null); - } - return itemStack; - } - - @Override - public void setInventorySlotContents(int slotIndex, ItemStack itemStack) - { - inventory[slotIndex] = itemStack; - if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) - { - itemStack.stackSize = getInventoryStackLimit(); - } - } - - @Override - public String getInventoryName() - { - return this.hasCustomName() ? this.getCustomName() : Strings.CONTAINER_CALCINATOR_NAME; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - /** - * Do not make give this method the name canInteractWith because it clashes with Container - * - * @param entityplayer - */ - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) - { - return true; - } - - @Override - public boolean receiveClientEvent(int eventId, int eventData) - { - if (eventId == 1) - { - this.state = (byte) eventData; - this.worldObj.updateAllLightTypes(this.xCoord, this.yCoord, this.zCoord); - return true; - } - else if (eventId == 2) - { - this.leftStackSize = (byte) eventData; - return true; - } - else if (eventId == 3) - { - this.leftStackMeta = (byte) eventData; - return true; - } - else if (eventId == 4) - { - this.rightStackSize = (byte) eventData; - return true; - } - else if (eventId == 5) - { - this.rightStackMeta = (byte) eventData; - return true; - } - else - { - return super.receiveClientEvent(eventId, eventData); - } - } - - @Override - public void openInventory() - { - - } - - @Override - public void closeInventory() - { - - } - - @Override - public void readFromNBT(NBTTagCompound nbtTagCompound) - { - super.readFromNBT(nbtTagCompound); - - // Read in the ItemStacks in the inventory from NBT - NBTTagList tagList = nbtTagCompound.getTagList("Items", 10); - inventory = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < tagList.tagCount(); ++i) - { - NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); - byte slotIndex = tagCompound.getByte("Slot"); - if (slotIndex >= 0 && slotIndex < inventory.length) - { - inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); - } - } - - deviceCookTime = nbtTagCompound.getInteger("deviceCookTime"); - fuelBurnTime = nbtTagCompound.getInteger("fuelBurnTime"); - itemCookTime = nbtTagCompound.getInteger("itemCookTime"); - itemSuckCoolDown = nbtTagCompound.getInteger("itemSuckCoolDown"); - } - - @Override - public void writeToNBT(NBTTagCompound nbtTagCompound) - { - super.writeToNBT(nbtTagCompound); - - // Write the ItemStacks in the inventory to NBT - NBTTagList tagList = new NBTTagList(); - for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) - { - if (inventory[currentIndex] != null) - { - NBTTagCompound tagCompound = new NBTTagCompound(); - tagCompound.setByte("Slot", (byte) currentIndex); - inventory[currentIndex].writeToNBT(tagCompound); - tagList.appendTag(tagCompound); - } - } - nbtTagCompound.setTag("Items", tagList); - nbtTagCompound.setInteger("deviceCookTime", deviceCookTime); - nbtTagCompound.setInteger("fuelBurnTime", fuelBurnTime); - nbtTagCompound.setInteger("itemCookTime", itemCookTime); - nbtTagCompound.setInteger("itemSuckCoolDown", itemSuckCoolDown); - } - - @Override - public boolean hasCustomInventoryName() - { - return this.hasCustomName(); - } - - @Override - public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) - { - switch (slotIndex) - { - case FUEL_INVENTORY_INDEX: - { - return TileEntityFurnace.isItemFuel(itemStack); - } - case INPUT_INVENTORY_INDEX: - { - return true; - } - default: - { - return false; - } - } - } - - @Override - public void updateEntity() - { - boolean isBurning = this.deviceCookTime > 0; - boolean sendUpdate = false; - - // If the Calcinator still has burn time, decrement it - if (this.deviceCookTime > 0) - { - this.deviceCookTime--; - } - - if (!this.worldObj.isRemote) - { - // Start "cooking" a new item, if we can - if (this.deviceCookTime == 0 && this.canCalcinate()) - { - this.fuelBurnTime = this.deviceCookTime = TileEntityFurnace.getItemBurnTime(this.inventory[FUEL_INVENTORY_INDEX]); - - if (this.deviceCookTime > 0) - { - sendUpdate = true; - - if (this.inventory[FUEL_INVENTORY_INDEX] != null) - { - --this.inventory[FUEL_INVENTORY_INDEX].stackSize; - - if (this.inventory[FUEL_INVENTORY_INDEX].stackSize == 0) - { - this.inventory[FUEL_INVENTORY_INDEX] = this.inventory[FUEL_INVENTORY_INDEX].getItem().getContainerItemStack(inventory[FUEL_INVENTORY_INDEX]); - } - } - } - } - - // Continue "cooking" the same item, if we can - if (this.deviceCookTime > 0 && this.canCalcinate()) - { - this.itemCookTime++; - - if (this.itemCookTime == 200) - { - this.itemCookTime = 0; - this.calcinateItem(); - sendUpdate = true; - } - } - else - { - this.itemCookTime = 0; - } - - // If the state has changed, catch that something changed - if (isBurning != this.deviceCookTime > 0) - { - sendUpdate = true; - } - - //Item sucking - if (this.itemSuckCoolDown > 0) - { - itemSuckCoolDown--; - } - else - { - if (suckItemsIntoCalcinator(this)) - { - markDirty(); - } - itemSuckCoolDown = DEFAULT_ITEM_SUCK_COOL_DOWN; - } - } - - if (sendUpdate) - { - this.markDirty(); - this.state = this.deviceCookTime > 0 ? (byte) 1 : (byte) 0; - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.state); - sendDustPileData(); - this.worldObj.notifyBlockChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - } - } - - @SideOnly(Side.CLIENT) - public int getCookProgressScaled(int scale) - { - return this.itemCookTime * scale / 200; - } - - @SideOnly(Side.CLIENT) - public int getBurnTimeRemainingScaled(int scale) - { - if (this.fuelBurnTime > 0) - { - return this.deviceCookTime * scale / this.fuelBurnTime; - } - - return 0; - } - - /** - * Determines if with the current inventory we can calcinate an item into dusts - */ - private boolean canCalcinate() - { - if (inventory[INPUT_INVENTORY_INDEX] == null) - { - return false; - } - else - { - ItemStack alchemicalDustStack = CalcinationManager.getCalcinationResult(this.inventory[INPUT_INVENTORY_INDEX]); - - /** - * If we don't get a calcination result, then return false - */ - if (alchemicalDustStack == null) - { - return false; - } - - /** - * If either slot is empty, return true (we have a valid calcination result - */ - if (this.inventory[OUTPUT_LEFT_INVENTORY_INDEX] == null || this.inventory[OUTPUT_RIGHT_INVENTORY_INDEX] == null) - { - return true; - } - - boolean leftEquals = this.inventory[OUTPUT_LEFT_INVENTORY_INDEX].isItemEqual(alchemicalDustStack); - int leftResult = this.inventory[OUTPUT_LEFT_INVENTORY_INDEX].stackSize + alchemicalDustStack.stackSize; - - boolean rightEquals = this.inventory[OUTPUT_RIGHT_INVENTORY_INDEX].isItemEqual(alchemicalDustStack); - int rightResult = this.inventory[OUTPUT_RIGHT_INVENTORY_INDEX].stackSize + alchemicalDustStack.stackSize; - - if (!leftEquals && !rightEquals) - { - return false; - } - else if (leftEquals && !rightEquals) - { - return leftResult <= getInventoryStackLimit() && leftResult <= alchemicalDustStack.getMaxStackSize(); - } - else if (!leftEquals) - { - return rightResult <= getInventoryStackLimit() && rightResult <= alchemicalDustStack.getMaxStackSize(); - } - else - { - return leftResult <= getInventoryStackLimit() && leftResult <= alchemicalDustStack.getMaxStackSize() || rightResult <= getInventoryStackLimit() && rightResult <= alchemicalDustStack.getMaxStackSize(); - } - } - } - - public void calcinateItem() - { - if (this.canCalcinate()) - { - ItemStack alchemicalDustStack = CalcinationManager.getCalcinationResult(this.inventory[INPUT_INVENTORY_INDEX]); - addItemStackToOutput(alchemicalDustStack.copy()); - - this.inventory[INPUT_INVENTORY_INDEX].stackSize--; - - if (this.inventory[INPUT_INVENTORY_INDEX].stackSize <= 0) - { - this.inventory[INPUT_INVENTORY_INDEX] = null; - } - } - } - - private void addItemStackToOutput(ItemStack alchemicalDustStack) - { - int maxStackSize = Math.min(getInventoryStackLimit(), alchemicalDustStack.getMaxStackSize()); - - if (this.inventory[OUTPUT_LEFT_INVENTORY_INDEX] == null) - { - this.inventory[OUTPUT_LEFT_INVENTORY_INDEX] = alchemicalDustStack; - return; - } - if (this.inventory[OUTPUT_LEFT_INVENTORY_INDEX].isItemEqual(alchemicalDustStack) - && this.inventory[OUTPUT_LEFT_INVENTORY_INDEX].stackSize < maxStackSize) - { - int addedSize = Math.min(alchemicalDustStack.stackSize, maxStackSize - this.inventory[OUTPUT_LEFT_INVENTORY_INDEX].stackSize); - alchemicalDustStack.stackSize -= addedSize; - this.inventory[OUTPUT_LEFT_INVENTORY_INDEX].stackSize += addedSize; - if (alchemicalDustStack == null || alchemicalDustStack.stackSize == 0) - { - return; - } - } - if (this.inventory[OUTPUT_RIGHT_INVENTORY_INDEX] == null) - { - this.inventory[OUTPUT_RIGHT_INVENTORY_INDEX] = alchemicalDustStack; - return; - } - if (this.inventory[OUTPUT_RIGHT_INVENTORY_INDEX].isItemEqual(alchemicalDustStack) - && this.inventory[OUTPUT_RIGHT_INVENTORY_INDEX].stackSize < maxStackSize) - { - int addedSize = Math.min(alchemicalDustStack.stackSize, maxStackSize - this.inventory[OUTPUT_RIGHT_INVENTORY_INDEX].stackSize); - alchemicalDustStack.stackSize -= addedSize; - this.inventory[OUTPUT_RIGHT_INVENTORY_INDEX].stackSize += addedSize; - } - } - - @Override - public Packet getDescriptionPacket() - { -// return PacketTypeHandler.populatePacket(new PacketTileCalcinator(xCoord, yCoord, zCoord, orientation, state, customName, (byte) getLeftStackSize(), (byte) getLeftStackMeta(), (byte) getRightStackSize(), (byte) getRightStackMeta())); - // FIXME - return null; - } - - private int getLeftStackSize() - { - if (this.inventory[OUTPUT_LEFT_INVENTORY_INDEX] != null) - { - return this.inventory[OUTPUT_LEFT_INVENTORY_INDEX].stackSize; - } - - return 0; - } - - private int getLeftStackMeta() - { - if (this.inventory[OUTPUT_LEFT_INVENTORY_INDEX] != null) - { - return this.inventory[OUTPUT_LEFT_INVENTORY_INDEX].getItemDamage(); - } - - return 0; - } - - private int getRightStackSize() - { - if (this.inventory[OUTPUT_RIGHT_INVENTORY_INDEX] != null) - { - return this.inventory[OUTPUT_RIGHT_INVENTORY_INDEX].stackSize; - } - - return 0; - } - - private int getRightStackMeta() - { - if (this.inventory[OUTPUT_RIGHT_INVENTORY_INDEX] != null) - { - return this.inventory[OUTPUT_RIGHT_INVENTORY_INDEX].getItemDamage(); - } - - return 0; - } - - private void sendDustPileData() - { - if (this.getBlockType() != null) - { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 2, getLeftStackSize()); - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 3, getLeftStackMeta()); - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 4, getRightStackSize()); - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 5, getRightStackMeta()); - } - } - - /** - * Returns an array containing the indices of the slots that can be accessed by automation on the given side of this - * block. - * - * @param side - */ - @Override - public int[] getAccessibleSlotsFromSide(int side) - { - return side == ForgeDirection.DOWN.ordinal() ? new int[]{FUEL_INVENTORY_INDEX, OUTPUT_LEFT_INVENTORY_INDEX, OUTPUT_RIGHT_INVENTORY_INDEX} : new int[]{INPUT_INVENTORY_INDEX, OUTPUT_LEFT_INVENTORY_INDEX, OUTPUT_RIGHT_INVENTORY_INDEX}; - } - - @Override - public boolean canInsertItem(int slotIndex, ItemStack itemStack, int side) - { - return isItemValidForSlot(slotIndex, itemStack); - } - - @Override - public boolean canExtractItem(int slotIndex, ItemStack itemStack, int side) - { - return slotIndex == OUTPUT_LEFT_INVENTORY_INDEX || slotIndex == OUTPUT_RIGHT_INVENTORY_INDEX; - } -} \ No newline at end of file diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileEE.java b/src/main/java/com/pahimar/ee3/tileentity/TileEE.java deleted file mode 100644 index 271dc108..00000000 --- a/src/main/java/com/pahimar/ee3/tileentity/TileEE.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.pahimar.ee3.tileentity; - -import com.pahimar.ee3.lib.Strings; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.Packet; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Equivalent-Exchange-3 - *

- * TileEE - * - * @author pahimar - */ -public class TileEE extends TileEntity -{ - protected ForgeDirection orientation; - protected byte state; - protected String customName; - - public TileEE() - { - orientation = ForgeDirection.SOUTH; - state = 0; - customName = ""; - } - - public ForgeDirection getOrientation() - { - return orientation; - } - - public void setOrientation(int orientation) - { - this.orientation = ForgeDirection.getOrientation(orientation); - } - - public void setOrientation(ForgeDirection orientation) - { - this.orientation = orientation; - } - - public short getState() - { - return state; - } - - public void setState(byte state) - { - this.state = state; - } - - public boolean hasCustomName() - { - return customName != null && customName.length() > 0; - } - - public String getCustomName() - { - return customName; - } - - public void setCustomName(String customName) - { - this.customName = customName; - } - - @Override - public void readFromNBT(NBTTagCompound nbtTagCompound) - { - super.readFromNBT(nbtTagCompound); - - if (nbtTagCompound.hasKey(Strings.NBT_TE_DIRECTION_KEY)) - { - orientation = ForgeDirection.getOrientation(nbtTagCompound.getByte(Strings.NBT_TE_DIRECTION_KEY)); - } - - if (nbtTagCompound.hasKey(Strings.NBT_TE_STATE_KEY)) - { - state = nbtTagCompound.getByte(Strings.NBT_TE_STATE_KEY); - } - - if (nbtTagCompound.hasKey(Strings.NBT_CUSTOM_NAME)) - { - customName = nbtTagCompound.getString(Strings.NBT_CUSTOM_NAME); - } - } - - @Override - public void writeToNBT(NBTTagCompound nbtTagCompound) - { - super.writeToNBT(nbtTagCompound); - - nbtTagCompound.setByte(Strings.NBT_TE_DIRECTION_KEY, (byte) orientation.ordinal()); - nbtTagCompound.setByte(Strings.NBT_TE_STATE_KEY, state); - - if (this.hasCustomName()) - { - nbtTagCompound.setString(Strings.NBT_CUSTOM_NAME, customName); - } - } - - @Override - public Packet getDescriptionPacket() - { -// return PacketTypeHandler.populatePacket(new PacketTileUpdate(xCoord, yCoord, zCoord, orientation, state, customName)); - - // FIXME Send proper packets - return null; - } -} diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileGlassBell.java b/src/main/java/com/pahimar/ee3/tileentity/TileGlassBell.java deleted file mode 100644 index 1967b584..00000000 --- a/src/main/java/com/pahimar/ee3/tileentity/TileGlassBell.java +++ /dev/null @@ -1,239 +0,0 @@ -package com.pahimar.ee3.tileentity; - -import com.pahimar.ee3.helper.ItemHelper; -import com.pahimar.ee3.lib.Strings; -import com.pahimar.ee3.network.PacketTypeHandler; -import com.pahimar.ee3.network.packet.PacketTileWithItemUpdate; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.Packet; - -public class TileGlassBell extends TileEE implements IInventory -{ - public static final int INVENTORY_SIZE = 1; - public static final int DISPLAY_SLOT_INVENTORY_INDEX = 0; - public ItemStack outputItemStack; - /** - * Server sync counter (once per 20 ticks) - */ - private int ticksSinceSync; - /** - * The ItemStacks that hold the items currently being used in the Glass Bell - */ - private ItemStack[] inventory; - - public TileGlassBell() - { - inventory = new ItemStack[INVENTORY_SIZE]; - } - - @Override - public int getSizeInventory() - { - return inventory.length; - } - - @Override - public ItemStack getStackInSlot(int slotIndex) - { - return inventory[slotIndex]; - } - - @Override - public ItemStack decrStackSize(int slotIndex, int decrementAmount) - { - ItemStack itemStack = getStackInSlot(slotIndex); - if (itemStack != null) - { - if (itemStack.stackSize <= decrementAmount) - { - setInventorySlotContents(slotIndex, null); - } - else - { - itemStack = itemStack.splitStack(decrementAmount); - if (itemStack.stackSize == 0) - { - setInventorySlotContents(slotIndex, null); - } - } - } - - return itemStack; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slotIndex) - { - ItemStack itemStack = getStackInSlot(slotIndex); - if (itemStack != null) - { - setInventorySlotContents(slotIndex, null); - } - return itemStack; - } - - @Override - public void setInventorySlotContents(int slotIndex, ItemStack itemStack) - { - inventory[slotIndex] = itemStack; - if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) - { - itemStack.stackSize = getInventoryStackLimit(); - } - } - - @Override - public String getInventoryName() - { - return this.hasCustomName() ? this.getCustomName() : Strings.CONTAINER_GLASS_BELL_NAME; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public void openInventory() - { - - } - - @Override - public void closeInventory() - { - - } - - @Override - public void readFromNBT(NBTTagCompound nbtTagCompound) - { - super.readFromNBT(nbtTagCompound); - - // Read in the ItemStacks in the inventory from NBT - NBTTagList tagList = nbtTagCompound.getTagList("Items", 10); - inventory = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < tagList.tagCount(); ++i) - { - NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); - byte slotIndex = tagCompound.getByte("Slot"); - if (slotIndex >= 0 && slotIndex < inventory.length) - { - inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); - } - } - } - - @Override - public void writeToNBT(NBTTagCompound nbtTagCompound) - { - super.writeToNBT(nbtTagCompound); - - // Write the ItemStacks in the inventory to NBT - NBTTagList tagList = new NBTTagList(); - for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) - { - if (inventory[currentIndex] != null) - { - NBTTagCompound tagCompound = new NBTTagCompound(); - tagCompound.setByte("Slot", (byte) currentIndex); - inventory[currentIndex].writeToNBT(tagCompound); - tagList.appendTag(tagCompound); - } - } - nbtTagCompound.setTag("Items", tagList); - } - - @Override - public boolean hasCustomInventoryName() - { - return this.hasCustomName(); - } - - @Override - public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) - { - return true; - } - - @Override - public void updateEntity() - { - super.updateEntity(); - ItemStack displayStack = this.inventory[DISPLAY_SLOT_INVENTORY_INDEX]; - - if (!this.worldObj.isRemote) - { - if (++ticksSinceSync % 20 == 0) - { - PacketDispatcher.sendPacketToAllAround(this.xCoord, this.yCoord, this.zCoord, 128d, this.worldObj.provider.dimensionId, getDescriptionPacket()); - } - } - } - - @Override - public Packet getDescriptionPacket() - { - ItemStack itemStack = this.inventory[DISPLAY_SLOT_INVENTORY_INDEX]; - - if (itemStack != null && itemStack.stackSize > 0) - { - return PacketTypeHandler.populatePacket(new PacketTileWithItemUpdate(xCoord, yCoord, zCoord, orientation, state, customName, itemStack.itemID, itemStack.getItemDamage(), itemStack.stackSize, ItemHelper.getColor(itemStack))); - } - else - { - return PacketTypeHandler.populatePacket(new PacketTileWithItemUpdate(xCoord, yCoord, zCoord, orientation, state, customName, -1, 0, 0, 0)); - } - } - - @Override - public void markDirty() - { - worldObj.updateAllLightTypes(xCoord, yCoord, zCoord); - } - - /** - * Do not make give this method the name canInteractWith because it clashes with Container - * - * @param entityplayer - */ - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) - { - return true; - } - - @Override - public String toString() - { - StringBuilder stringBuilder = new StringBuilder(); - - stringBuilder.append(super.toString()); - - stringBuilder.append("TileGlassBell Data - "); - for (int i = 0; i < inventory.length; i++) - { - if (i != 0) - { - stringBuilder.append(", "); - } - - if (inventory[i] != null) - { - stringBuilder.append(String.format("inventory[%d]: %s", i, inventory[i].toString())); - } - else - { - stringBuilder.append(String.format("inventory[%d]: empty", i)); - } - } - stringBuilder.append("\n"); - - return stringBuilder.toString(); - } -} diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileResearchStation.java b/src/main/java/com/pahimar/ee3/tileentity/TileResearchStation.java deleted file mode 100644 index c88afbb1..00000000 --- a/src/main/java/com/pahimar/ee3/tileentity/TileResearchStation.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.pahimar.ee3.tileentity; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -public class TileResearchStation extends TileEE implements IInventory -{ - - /** - * Returns the number of slots in the inventory. - */ - @Override - public int getSizeInventory() - { - return 0; - } - - /** - * Returns the stack in slot i - * - * @param i - */ - @Override - public ItemStack getStackInSlot(int i) - { - return null; - } - - /** - * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a - * new stack. - * - * @param i - * @param j - */ - @Override - public ItemStack decrStackSize(int i, int j) - { - return null; - } - - /** - * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - - * like when you close a workbench GUI. - * - * @param i - */ - @Override - public ItemStack getStackInSlotOnClosing(int i) - { - return null; - } - - /** - * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). - * - * @param i - * @param itemstack - */ - @Override - public void setInventorySlotContents(int i, ItemStack itemstack) - { - - } - - /** - * Returns the name of the inventory. - */ - @Override - public String getInventoryName() - { - return null; - } - - /** - * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's - * language. Otherwise it will be used directly. - */ - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - /** - * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't - * this more of a set than a get?* - */ - @Override - public int getInventoryStackLimit() - { - return 0; - } - - /** - * Do not make give this method the name canInteractWith because it clashes with Container - * - * @param entityplayer - */ - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) - { - return true; - } - - @Override - public void openInventory() - { - - } - - @Override - public void closeInventory() - { - - } - - /** - * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. - * - * @param i - * @param itemstack - */ - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) - { - return false; - } -} diff --git a/src/main/java/com/pahimar/ee3/transmutation/ExchangeRegistry.java b/src/main/java/com/pahimar/ee3/transmutation/ExchangeRegistry.java deleted file mode 100644 index 2eb69248..00000000 --- a/src/main/java/com/pahimar/ee3/transmutation/ExchangeRegistry.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.pahimar.ee3.transmutation; - -public class ExchangeRegistry { -} diff --git a/src/main/java/com/pahimar/ee3/util/ColorHelper.java b/src/main/java/com/pahimar/ee3/util/ColorHelper.java new file mode 100644 index 00000000..d8ab0e76 --- /dev/null +++ b/src/main/java/com/pahimar/ee3/util/ColorHelper.java @@ -0,0 +1,52 @@ +package com.pahimar.ee3.util; + +import com.pahimar.ee3.reference.Colors; +import com.pahimar.ee3.reference.Names; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class ColorHelper +{ + public static boolean hasColor(ItemStack itemStack) + { + return itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey(Names.NBT.DISPLAY) && itemStack.getTagCompound().getCompoundTag(Names.NBT.DISPLAY).hasKey(Names.NBT.COLOR); + } + + public static int getColor(ItemStack itemStack) + { + NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); + + if (nbtTagCompound == null) + { + return Integer.parseInt(Colors.PURE_WHITE, 16); + } + else + { + NBTTagCompound displayTagCompound = nbtTagCompound.getCompoundTag(Names.NBT.DISPLAY); + return displayTagCompound == null ? Integer.parseInt(Colors.PURE_WHITE, 16) : displayTagCompound.hasKey(Names.NBT.COLOR) ? displayTagCompound.getInteger(Names.NBT.COLOR) : Integer.parseInt(Colors.PURE_WHITE, 16); + } + } + + public static void setColor(ItemStack itemStack, int color) + { + if (itemStack != null) + { + NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); + + if (nbtTagCompound == null) + { + nbtTagCompound = new NBTTagCompound(); + itemStack.setTagCompound(nbtTagCompound); + } + + NBTTagCompound colourTagCompound = nbtTagCompound.getCompoundTag(Names.NBT.DISPLAY); + + if (!nbtTagCompound.hasKey(Names.NBT.DISPLAY)) + { + nbtTagCompound.setTag(Names.NBT.DISPLAY, colourTagCompound); + } + + colourTagCompound.setInteger(Names.NBT.COLOR, color); + } + } +} diff --git a/src/main/java/com/pahimar/ee3/helper/LogHelper.java b/src/main/java/com/pahimar/ee3/util/LogHelper.java similarity index 76% rename from src/main/java/com/pahimar/ee3/helper/LogHelper.java rename to src/main/java/com/pahimar/ee3/util/LogHelper.java index 2c4248f9..686c6cc7 100644 --- a/src/main/java/com/pahimar/ee3/helper/LogHelper.java +++ b/src/main/java/com/pahimar/ee3/util/LogHelper.java @@ -1,23 +1,14 @@ -package com.pahimar.ee3.helper; +package com.pahimar.ee3.util; +import com.pahimar.ee3.reference.Reference; import cpw.mods.fml.common.FMLLog; import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.Logger; -/** - * Equivalent-Exchange-3 - *

- * LogHelper - * - * @author pahimar - */ public class LogHelper { - private static final Logger EE_LOGGER = FMLLog.getLogger(); - public static void log(Level logLevel, Object object) { - EE_LOGGER.log(logLevel, String.valueOf(object)); + FMLLog.log(Reference.MOD_NAME, logLevel, String.valueOf(object)); } public static void all(Object object) diff --git a/src/main/java/com/pahimar/ee3/helper/ItemStackNBTHelper.java b/src/main/java/com/pahimar/ee3/util/NBTHelper.java similarity index 83% rename from src/main/java/com/pahimar/ee3/helper/ItemStackNBTHelper.java rename to src/main/java/com/pahimar/ee3/util/NBTHelper.java index 3afef387..028758d9 100644 --- a/src/main/java/com/pahimar/ee3/helper/ItemStackNBTHelper.java +++ b/src/main/java/com/pahimar/ee3/util/NBTHelper.java @@ -1,21 +1,13 @@ -package com.pahimar.ee3.helper; +package com.pahimar.ee3.util; -import com.pahimar.ee3.lib.Strings; +import com.pahimar.ee3.reference.Names; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import java.util.UUID; -/** - * Equivalent-Exchange-3 - *

- * NBTHelper - * - * @author pahimar - */ -public class ItemStackNBTHelper +public class NBTHelper { - /** * Initializes the NBT Tag Compound for the given ItemStack if it is null * @@ -43,9 +35,25 @@ public class ItemStackNBTHelper } } + public static void clearStatefulNBTTags(ItemStack itemStack) + { + if (NBTHelper.hasTag(itemStack, Names.NBT.CRAFTING_GUI_OPEN)) + { + NBTHelper.removeTag(itemStack, Names.NBT.CRAFTING_GUI_OPEN); + } + else if (NBTHelper.hasTag(itemStack, Names.NBT.TRANSMUTATION_GUI_OPEN)) + { + NBTHelper.removeTag(itemStack, Names.NBT.TRANSMUTATION_GUI_OPEN); + } + else if (NBTHelper.hasTag(itemStack, Names.NBT.ALCHEMICAL_BAG_GUI_OPEN)) + { + NBTHelper.removeTag(itemStack, Names.NBT.ALCHEMICAL_BAG_GUI_OPEN); + } + } + public static boolean hasUUID(ItemStack itemStack) { - return hasTag(itemStack, Strings.NBT_ITEM_UUID_MOST_SIG) && hasTag(itemStack, Strings.NBT_ITEM_UUID_LEAST_SIG); + return hasTag(itemStack, Names.NBT.UUID_MOST_SIG) && hasTag(itemStack, Names.NBT.UUID_LEAST_SIG); } public static void setUUID(ItemStack itemStack) @@ -53,11 +61,11 @@ public class ItemStackNBTHelper initNBTTagCompound(itemStack); // Set a UUID on the Alchemical Bag, if one doesn't exist already - if (!hasTag(itemStack, Strings.NBT_ITEM_UUID_MOST_SIG) && !hasTag(itemStack, Strings.NBT_ITEM_UUID_LEAST_SIG)) + if (!hasTag(itemStack, Names.NBT.UUID_MOST_SIG) && !hasTag(itemStack, Names.NBT.UUID_LEAST_SIG)) { UUID itemUUID = UUID.randomUUID(); - setLong(itemStack, Strings.NBT_ITEM_UUID_MOST_SIG, itemUUID.getMostSignificantBits()); - setLong(itemStack, Strings.NBT_ITEM_UUID_LEAST_SIG, itemUUID.getLeastSignificantBits()); + setLong(itemStack, Names.NBT.UUID_MOST_SIG, itemUUID.getMostSignificantBits()); + setLong(itemStack, Names.NBT.UUID_LEAST_SIG, itemUUID.getLeastSignificantBits()); } } @@ -220,4 +228,4 @@ public class ItemStackNBTHelper itemStack.stackTagCompound.setDouble(keyName, keyValue); } -} +} \ No newline at end of file diff --git a/src/main/resources/assets/ee3/sounds/sounds.json b/src/main/resources/assets/ee3/sounds/sounds.json deleted file mode 100644 index a30d9976..00000000 --- a/src/main/resources/assets/ee3/sounds/sounds.json +++ /dev/null @@ -1,17 +0,0 @@ -{ -"chargeDown": {"category": "master","sounds": [{"name": "chargeDown","stream": false}]}, -"chargeUp": {"category": "master","sounds": [{"name": "chargeUp","stream": false}]}, -"destruct": {"category": "master","sounds": [{"name": "destruct","stream": false}]}, -"fail": {"category": "master","sounds": [{"name": "fail","stream": false}]}, -"gust": {"category": "master","sounds": [{"name": "gust","stream": false}]}, -"heal": {"category": "master","sounds": [{"name": "heal","stream": false}]}, -"kinesis": {"category": "master","sounds": [{"name": "kinesis","stream": false}]}, -"launch": {"category": "master","sounds": [{"name": "launch","stream": false}]}, -"nova": {"category": "master","sounds": [{"name": "nova","stream": false}]}, -"philball": {"category": "master","sounds": [{"name": "philball","stream": false}]}, -"tock": {"category": "master","sounds": [{"name": "tock","stream": false}]}, -"transmute": {"category": "master","sounds": [{"name": "transmute","stream": false}]}, -"wall": {"category": "master","sounds": [{"name": "wall","stream": false}]}, -"waterball": {"category": "master","sounds": [{"name": "waterball","stream": false}]}, -"wind": {"category": "master","sounds": [{"name": "wind","stream": false}]} -} \ No newline at end of file diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta deleted file mode 100644 index 1f7b6fb9..00000000 --- a/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack":{ - "pack_format":1, - "description":"Equivalent Exchange 3 contents" - } -} diff --git a/src/main/resources/version.properties b/src/main/resources/version.properties deleted file mode 100644 index 37eaea22..00000000 --- a/src/main/resources/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -version=${version} -build_number=${buildnumber} \ No newline at end of file