diff --git a/ee3_client/ee3/client/core/ClientProxy.java b/ee3_client/ee3/client/core/ClientProxy.java index dc8b8125..9bd196ff 100644 --- a/ee3_client/ee3/client/core/ClientProxy.java +++ b/ee3_client/ee3/client/core/ClientProxy.java @@ -8,13 +8,16 @@ import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.KeyBindingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; import ee3.client.core.handlers.KeyBindingHandler; import ee3.client.core.handlers.SoundHandler; -import ee3.client.lib.KeyBindings; +import ee3.client.core.helper.KeyBindingHelper; import ee3.client.render.RenderCalcinator; +import ee3.client.render.RenderItemCalcinator; import ee3.client.render.TextureRedWaterFX; import ee3.client.render.TextureRedWaterFlowFX; import ee3.common.core.CommonProxy; +import ee3.common.lib.BlockIds; import ee3.common.lib.Reference; import ee3.common.lib.RenderIds; import ee3.common.tile.TileCalcinator; @@ -38,8 +41,8 @@ public class ClientProxy extends CommonProxy { @Override public void setKeyBinding(String name, int value) { - KeyBindings.addKeyBinding(name, value); - KeyBindings.addIsRepeating(false); + KeyBindingHelper.addKeyBinding(LanguageRegistry.instance().getStringLocalization(name), value); + KeyBindingHelper.addIsRepeating(false); } @Override @@ -74,6 +77,8 @@ public class ClientProxy extends CommonProxy { FMLClientHandler.instance().getClient().renderEngine.registerTextureFX(new TextureRedWaterFX()); FMLClientHandler.instance().getClient().renderEngine.registerTextureFX(new TextureRedWaterFlowFX()); + + MinecraftForgeClient.registerItemRenderer(BlockIds.CALCINATOR, new RenderItemCalcinator()); } @Override diff --git a/ee3_client/ee3/client/core/handlers/KeyBindingHandler.java b/ee3_client/ee3/client/core/handlers/KeyBindingHandler.java index 2f60abdc..24b1427e 100644 --- a/ee3_client/ee3/client/core/handlers/KeyBindingHandler.java +++ b/ee3_client/ee3/client/core/handlers/KeyBindingHandler.java @@ -10,7 +10,8 @@ import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.KeyBindingRegistry; import cpw.mods.fml.common.TickType; import cpw.mods.fml.common.network.PacketDispatcher; -import ee3.client.lib.KeyBindings; +import cpw.mods.fml.common.registry.LanguageRegistry; +import ee3.client.core.helper.KeyBindingHelper; import ee3.common.EquivalentExchange3; import ee3.common.item.ModItems; import ee3.common.lib.GuiIds; @@ -31,7 +32,7 @@ import ee3.common.network.PacketTypeHandler; public class KeyBindingHandler extends KeyBindingRegistry.KeyHandler { public KeyBindingHandler() { - super(KeyBindings.gatherKeyBindings(), KeyBindings.gatherIsRepeating()); + super(KeyBindingHelper.gatherKeyBindings(), KeyBindingHelper.gatherIsRepeating()); } @Override @@ -45,7 +46,7 @@ public class KeyBindingHandler extends KeyBindingRegistry.KeyHandler { if (tickEnd) { // If we are not in a GUI of any kind, continue execution if (FMLClientHandler.instance().getClient().currentScreen == null) { - if (kb.keyDescription == Reference.KEYBINDING_EXTRA) { + if (kb.keyDescription == getLocalizedKey(Reference.KEYBINDING_EXTRA)) { ItemStack currentItem = FMLClientHandler.instance().getClient().thePlayer.getCurrentEquippedItem(); if (currentItem != null) { @@ -72,4 +73,7 @@ public class KeyBindingHandler extends KeyBindingRegistry.KeyHandler { return EnumSet.of(TickType.CLIENT); } + private static String getLocalizedKey(String key) { + return LanguageRegistry.instance().getStringLocalization(key); + } } diff --git a/ee3_client/ee3/client/lib/KeyBindings.java b/ee3_client/ee3/client/core/helper/KeyBindingHelper.java similarity index 95% rename from ee3_client/ee3/client/lib/KeyBindings.java rename to ee3_client/ee3/client/core/helper/KeyBindingHelper.java index 6dfd8513..a7935779 100644 --- a/ee3_client/ee3/client/lib/KeyBindings.java +++ b/ee3_client/ee3/client/core/helper/KeyBindingHelper.java @@ -1,4 +1,4 @@ -package ee3.client.lib; +package ee3.client.core.helper; import java.util.ArrayList; import net.minecraft.src.KeyBinding; @@ -12,7 +12,7 @@ import net.minecraft.src.KeyBinding; * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) * */ -public class KeyBindings { +public class KeyBindingHelper { public static ArrayList keyBindingsList; public static ArrayList isRepeatingList; diff --git a/ee3_client/ee3/client/gui/GuiCalcinator.java b/ee3_client/ee3/client/gui/GuiCalcinator.java index 703bd424..7b2944f4 100644 --- a/ee3_client/ee3/client/gui/GuiCalcinator.java +++ b/ee3_client/ee3/client/gui/GuiCalcinator.java @@ -4,6 +4,7 @@ import org.lwjgl.opengl.GL11; import cpw.mods.fml.common.Side; import cpw.mods.fml.common.asm.SideOnly; +import cpw.mods.fml.common.registry.LanguageRegistry; import ee3.common.container.ContainerCalcinator; import ee3.common.lib.Reference; import ee3.common.tile.TileCalcinator; @@ -20,12 +21,13 @@ public class GuiCalcinator extends GuiContainer { public GuiCalcinator(InventoryPlayer player, TileCalcinator calcinator) { super(new ContainerCalcinator(player, calcinator)); + this.ySize = 176; this.calcinator = calcinator; } protected void drawGuiContainerForegroundLayer() { - this.fontRenderer.drawString("Calcinator", 60, 6, 4210752); + this.fontRenderer.drawString(LanguageRegistry.instance().getStringLocalization(Reference.GUI_CALCINATOR_NAME), 60, 6, 4210752); this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); } diff --git a/ee3_client/ee3/client/render/ModelCalcinator.java b/ee3_client/ee3/client/render/ModelCalcinator.java new file mode 100644 index 00000000..0d3cec8f --- /dev/null +++ b/ee3_client/ee3/client/render/ModelCalcinator.java @@ -0,0 +1,142 @@ +package ee3.client.render; + +import org.lwjgl.opengl.GL11; + +import ee3.common.lib.Reference; +import ee3.common.tile.TileCalcinator; +import net.minecraft.src.ModelBase; +import net.minecraft.src.ModelRenderer; +import net.minecraftforge.client.ForgeHooksClient; + +public class ModelCalcinator extends ModelBase { + + private static final int TEXTURE_HEIGHT = 128; + private static final int TEXTURE_WIDTH = 128; + + private ModelRenderer firePotBottom, firePotLeft, firePotRight, firePotFront, firePotBack; + private ModelRenderer legFrontLeft, legFrontRight, legBackLeft, legBackRight; + private ModelRenderer armFrontLeft, armFrontRight, armBackLeft, armBackRight; + private ModelRenderer bowlBottom, bowlLeft, bowlRight, bowlFront, bowlBack; + private ModelRenderer firePotEmbers, bowlEmbers; + + private float scale; + + public ModelCalcinator(float scale) { + this.scale = scale; + this.textureHeight = TEXTURE_HEIGHT; + this.textureWidth = TEXTURE_WIDTH; + + this.firePotLeft = new ModelRenderer(this, 0, 36); + this.firePotLeft.addBox(-0.5F, -1.5F, -4F, 1, 3, 8, scale); + this.firePotLeft.setRotationPoint(3.5F, 1F, 0F); + this.firePotRight = new ModelRenderer(this, 0, 36); + this.firePotRight.addBox(-0.5F, -1.5F, -4F, 1, 3, 8, scale); + this.firePotRight.setRotationPoint(-3.5F, 1F, 0F); + this.firePotBack = new ModelRenderer(this, 0, 36); + this.firePotBack.addBox(-3F, -1.5F, -0.5F, 6, 3, 1, scale); + this.firePotBack.setRotationPoint(0F, 1F, -3.5F); + this.firePotFront = new ModelRenderer(this, 0, 36); + this.firePotFront.addBox(-3F, -1.5F, -0.5F, 6, 3, 1, scale); + this.firePotFront.setRotationPoint(0F, 1F, 3.5F); + this.firePotBottom = new ModelRenderer(this, 0, 36); + this.firePotBottom.addBox(-3F, -0.5F, -3F, 6, 1, 6, scale); + this.firePotBottom.setRotationPoint(8, 2, 8); + + this.firePotBottom.addChild(this.firePotBack); + this.firePotBottom.addChild(this.firePotFront); + this.firePotBottom.addChild(this.firePotLeft); + this.firePotBottom.addChild(this.firePotRight); + + this.legFrontLeft = new ModelRenderer(this, 0, 0); + this.legFrontLeft.addBox(-1F, -8F, -1F, 2, 8, 2, scale); + this.legFrontLeft.setRotationPoint(-9F, 6, 0); + this.legFrontRight = new ModelRenderer(this, 0, 0); + this.legFrontRight.addBox(-1F, -8F, -1F, 2, 8, 2, scale); + this.legFrontRight.setRotationPoint(9F, 6, 0); + this.legBackLeft = new ModelRenderer(this, 0, 0); + this.legBackLeft.addBox(-1F, -8F, -1F, 2, 8, 2, scale); + this.legBackLeft.setRotationPoint(0, 6, -9F); + this.legBackRight = new ModelRenderer(this, 0, 0); + this.legBackRight.addBox(-1F, -8F, -1F, 2, 8, 2, scale); + this.legBackRight.setRotationPoint(0, 6, 9F); + + this.armFrontLeft = new ModelRenderer(this, 0, 10); + this.armFrontLeft.addBox(-2F, -0.5F, -1F, 4, 1, 2, scale); + this.armFrontLeft.setRotationPoint(6, 1, 0); + this.armFrontRight = new ModelRenderer(this, 0, 10); + this.armFrontRight.addBox(-2F, -0.5F, -1F, 4, 1, 2, scale); + this.armFrontRight.setRotationPoint(-6, 1, 0); + this.armBackLeft = new ModelRenderer(this, 12, 10); + this.armBackLeft.addBox(-1F, -0.5F, -2.0F, 2, 1, 4, scale); + this.armBackLeft.setRotationPoint(0, 1, 6); + this.armBackRight = new ModelRenderer(this, 12, 10); + this.armBackRight.addBox(-1F, -0.5F, -2.0F, 2, 1, 4, scale); + this.armBackRight.setRotationPoint(0, 1, -6); + + this.firePotBottom.addChild(this.legFrontLeft); + this.firePotBottom.addChild(this.legFrontRight); + this.firePotBottom.addChild(this.legBackLeft); + this.firePotBottom.addChild(this.legBackRight); + this.firePotBottom.addChild(this.armFrontLeft); + this.firePotBottom.addChild(this.armFrontRight); + this.firePotBottom.addChild(this.armBackLeft); + this.firePotBottom.addChild(this.armBackRight); + this.firePotBottom.rotateAngleY = (float)(Math.PI / 4F); + + this.bowlBack = new ModelRenderer(this, 0, 36); + this.bowlBack.addBox(-8F, -3.5F, -0.5F, 16, 7, 1, scale); + this.bowlBack.setRotationPoint(0F, 3.6F, 7.5F); + this.bowlFront = new ModelRenderer(this, 0, 36); + this.bowlFront.addBox(-8F, -3.5F, -0.5F, 16, 7, 1, scale); + this.bowlFront.setRotationPoint(0, 3.6F, -7.5F); + this.bowlLeft = new ModelRenderer(this, 0, 44); + this.bowlLeft.addBox(-0.5F, -3.5F, -7F, 1, 7, 14, scale); + this.bowlLeft.setRotationPoint(7.5F, 3.6F, 0); + this.bowlRight = new ModelRenderer(this, 0, 44); + this.bowlRight.addBox(-0.5F, -3.5F, -7F, 1, 7, 14, scale); + this.bowlRight.setRotationPoint(-7.5F, 3.6F, 0); + + this.bowlBottom = new ModelRenderer(this, 0, 19); + this.bowlBottom.addBox(-8F, -1F, -8F, 16, 1, 16, scale); + this.bowlBottom.setRotationPoint(8, 9, 8); + this.bowlBottom.addChild(this.bowlBack); + this.bowlBottom.addChild(this.bowlFront); + this.bowlBottom.addChild(this.bowlLeft); + this.bowlBottom.addChild(this.bowlRight); + + this.bowlEmbers = new ModelRenderer(this, 0, 65); + this.bowlEmbers.addBox(-7F, -0.5F, -7F, 14, 1, 14, scale); + this.bowlEmbers.setRotationPoint(8, 9, 8); + this.bowlEmbers.mirror = true; + + this.firePotEmbers = new ModelRenderer(this, 0, 65); + this.firePotEmbers.addBox(-3F, -0.5F, -3F, 6, 1, 6, scale); + this.firePotEmbers.setRotationPoint(8, 3, 8); + this.firePotEmbers.rotateAngleY = (float)(Math.PI / 4F); + + } + + public void render(TileCalcinator calcinator, double x, double y, double z) { + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + + GL11.glTranslated(x, y, z); + ForgeHooksClient.bindTexture(Reference.SPRITE_SHEET_LOCATION + "calcinator.png", 0); + + firePotBottom.render(scale); + bowlBottom.render(scale); + firePotEmbers.render(scale); + bowlEmbers.render(scale); + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + + public void render(float scale) { + firePotBottom.render(scale); + bowlBottom.render(scale); + firePotEmbers.render(scale); + bowlEmbers.render(scale); + } + +} diff --git a/ee3_client/ee3/client/render/RenderCalcinator.java b/ee3_client/ee3/client/render/RenderCalcinator.java index cacb654b..c415b2c7 100644 --- a/ee3_client/ee3/client/render/RenderCalcinator.java +++ b/ee3_client/ee3/client/render/RenderCalcinator.java @@ -2,116 +2,22 @@ package ee3.client.render; import org.lwjgl.opengl.GL11; -import ee3.common.lib.Reference; +import ee3.common.tile.TileCalcinator; import net.minecraft.src.ModelBase; import net.minecraft.src.ModelRenderer; -import net.minecraft.src.Tessellator; import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntitySpecialRenderer; -import net.minecraftforge.client.ForgeHooksClient; public class RenderCalcinator extends TileEntitySpecialRenderer { - private static final int TEXTURE_HEIGHT = 128; - private static final int TEXTURE_WIDTH = 128; + static final float scale = (float) (1.0 / 16.0); - private ModelBase model = new ModelBase() {}; - static final float factor = (float) (1.0 / 16.0); - - /* The four support legs of the Calcinator */ - private final ModelRenderer[] legs = new ModelRenderer[4]; - - /* The four support arms for the fire plateof the Calcinator */ - private final ModelRenderer[] supportArms = new ModelRenderer[4]; - - /* The five faces (four sides and the bottom) of the Calcinator bowl */ - private final ModelRenderer[] bowlParts = new ModelRenderer[5]; - - private final ModelRenderer firePlate; - private final ModelRenderer ashLayer; - - public RenderCalcinator() { - model.textureHeight = TEXTURE_HEIGHT; - model.textureWidth = TEXTURE_WIDTH; - - legs[0] = new ModelRenderer(model, 0, 0); - legs[0].addBox(-1F, -8F, -1F, 2, 8, 2).setRotationPoint(2, 8, 2); - legs[0].rotateAngleY = ((float)Math.PI / 4F); - legs[1] = new ModelRenderer(model, 0, 0); - legs[1].addBox(-1F, -8F, -1F, 2, 8, 2).setRotationPoint(2, 8, 14); - legs[1].rotateAngleY = ((float)Math.PI / 4F); - legs[2] = new ModelRenderer(model, 0, 0); - legs[2].addBox(-1F, -8F, -1F, 2, 8, 2).setRotationPoint(14, 8, 2); - legs[2].rotateAngleY = ((float)Math.PI / 4F); - legs[3] = new ModelRenderer(model, 0, 0); - legs[3].addBox(-1F, -8F, -1F, 2, 8, 2).setRotationPoint(14, 8, 14); - legs[3].rotateAngleY = ((float)Math.PI / 4F); - - firePlate = new ModelRenderer(model, 0, 10); - firePlate.addBox(-4F, -0.5F, -4F, 8, 1, 8).setRotationPoint(8, 3, 8); - firePlate.rotateAngleY = ((float)Math.PI / 4F); - - supportArms[0] = new ModelRenderer(model, 8, 0); - supportArms[0].addBox(-2F, -0.5F, -0.5F, 4, 1, 1).setRotationPoint(4, 3, 4); - supportArms[0].rotateAngleY = ((float)Math.PI * 3 / 4F); - supportArms[1] = new ModelRenderer(model, 8, 0); - supportArms[1].addBox(-2F, -0.5F, -0.5F, 4, 1, 1).setRotationPoint(12, 3, 4); - supportArms[1].rotateAngleY = ((float)Math.PI / 4F); - supportArms[2] = new ModelRenderer(model, 8, 0); - supportArms[2].addBox(-2F, -0.5F, -0.5F, 4, 1, 1).setRotationPoint(12, 3, 12); - supportArms[2].rotateAngleY = ((float)Math.PI * 7 / 4F); - supportArms[3] = new ModelRenderer(model, 8, 0); - supportArms[3].addBox(-2F, -0.5F, -0.5F, 4, 1, 1).setRotationPoint(4, 3, 12); - supportArms[3].rotateAngleY = ((float)Math.PI * 5 / 4F); - - bowlParts[0] = new ModelRenderer(model, 0, 19); - bowlParts[0].addBox(-8F, -1F, -8F, 16, 1, 16).setRotationPoint(8, 9, 8); - bowlParts[1] = new ModelRenderer(model, 0, 36); - bowlParts[1].addBox(-8F, -3.5F, -0.5F, 16, 7, 1).setRotationPoint(8, 12.5F, 15.5F); - bowlParts[2] = new ModelRenderer(model, 0, 44); - bowlParts[2].addBox(-0.5F, -3.5F, -7F, 1, 7, 14).setRotationPoint(15.5F, 12.5F, 8); - bowlParts[3] = new ModelRenderer(model, 0, 44); - bowlParts[3].addBox(-0.5F, -3.5F, -7F, 1, 7, 14).setRotationPoint(0.5F, 12.5F, 8); - bowlParts[4] = new ModelRenderer(model, 0, 36); - bowlParts[4].addBox(-8F, -3.5F, -0.5F, 16, 7, 1).setRotationPoint(8F, 12.5F, 0.5F); - - ashLayer = new ModelRenderer(model, 0, 65); - ashLayer.addBox(-7F, -0.5F, -7F, 14, 1, 14).setRotationPoint(8, 9, 8); - ashLayer.mirror = true; - - } + private ModelCalcinator modelCalcinator = new ModelCalcinator(scale); @Override - public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) { - render(x, y, z); - } - - private void render(double x, double y, double z) { - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - - GL11.glTranslated(x, y, z); - ForgeHooksClient.bindTexture(Reference.SPRITE_SHEET_LOCATION + "calcinator.png", 0); - - firePlate.render(factor); - - for (ModelRenderer leg : legs) { - leg.render(factor); - } - - for (ModelRenderer supportArm : supportArms) { - supportArm.render(factor); - } - - for (ModelRenderer bowlPart : bowlParts) { - bowlPart.render(factor); - } - - ashLayer.render(factor); - - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { + modelCalcinator.render((TileCalcinator)tileEntity, x, y, z); } } diff --git a/ee3_client/ee3/client/render/RenderItemCalcinator.java b/ee3_client/ee3/client/render/RenderItemCalcinator.java new file mode 100644 index 00000000..72062a06 --- /dev/null +++ b/ee3_client/ee3/client/render/RenderItemCalcinator.java @@ -0,0 +1,49 @@ +package ee3.client.render; + +import org.lwjgl.opengl.GL11; + +import ee3.common.lib.Reference; +import net.minecraft.src.ItemStack; +import net.minecraft.src.Tessellator; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.IItemRenderer; + +public class RenderItemCalcinator implements IItemRenderer { + + private ModelCalcinator calcinatorModel; + + public RenderItemCalcinator() { + calcinatorModel = new ModelCalcinator(1/16F); + } + + @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.5F, -0.5F); break; + case EQUIPPED: renderCalcinator(0F, 0.4F, 0F); break; + case INVENTORY: renderCalcinator(1F, 0.65F, 1F); break; + default: break; + } + + } + + private void renderCalcinator(float x, float y, float z) { + Tessellator tesselator = Tessellator.instance; + ForgeHooksClient.bindTexture(Reference.SPRITE_SHEET_LOCATION + "calcinator.png", 0); + GL11.glPushMatrix(); //start + GL11.glTranslatef(x, y, z); //size + calcinatorModel.render(0.0625F); + GL11.glPopMatrix(); //end + } + +} diff --git a/ee3_common/ee3/common/EquivalentExchange3.java b/ee3_common/ee3/common/EquivalentExchange3.java index 5f1a1b16..8e3c4832 100644 --- a/ee3_common/ee3/common/EquivalentExchange3.java +++ b/ee3_common/ee3/common/EquivalentExchange3.java @@ -18,18 +18,21 @@ import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.TickRegistry; import ee3.common.block.ModBlocks; import ee3.common.core.CommonProxy; -import ee3.common.core.RecipesTransmutationStone; import ee3.common.core.handlers.AddonHandler; import ee3.common.core.handlers.ConfigurationHandler; import ee3.common.core.handlers.EntityLivingHandler; +import ee3.common.core.handlers.FuelHandler; import ee3.common.core.handlers.ItemPickupHandler; import ee3.common.core.handlers.LocalizationHandler; import ee3.common.core.handlers.PacketHandler; import ee3.common.core.handlers.PlayerDestroyItemHandler; import ee3.common.core.handlers.VersionCheckTickHandler; +import ee3.common.core.helper.LogHelper; import ee3.common.core.helper.VersionHelper; import ee3.common.item.ModItems; +import ee3.common.lib.ConfigurationSettings; import ee3.common.lib.Reference; +import ee3.common.recipe.RecipesTransmutationStone; /** * EquivalentExchange3 @@ -44,24 +47,29 @@ import ee3.common.lib.Reference; @NetworkMod(channels = { Reference.CHANNEL_NAME }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class) public class EquivalentExchange3 { - @Instance + @Instance(Reference.MOD_ID) public static EquivalentExchange3 instance; - @SidedProxy(clientSide = "ee3.client.core.ClientProxy", serverSide = "ee3.common.core.CommonProxy") + @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS) public static CommonProxy proxy; @PreInit public void preInit(FMLPreInitializationEvent event) { + // Initialize the log helper + LogHelper.init(); + + // Load the localization files into the LanguageRegistry + LocalizationHandler.loadLanguages(); + // Initialize the configuration ConfigurationHandler.init(event.getSuggestedConfigurationFile()); - - // Load the localization files into the LanguageRegistry - LocalizationHandler.instance().loadLanguages(); // Conduct the version check and log the result - VersionHelper.checkVersion(); - VersionHelper.logResult(); + if (ConfigurationSettings.ENABLE_VERSION_CHECK) { + VersionHelper.checkVersion(); + } + VersionHelper.logResult(); // Initialize the Version Check Tick Handler (Client only) TickRegistry.registerTickHandler(new VersionCheckTickHandler(), Side.CLIENT); @@ -106,6 +114,9 @@ public class EquivalentExchange3 { // Load the Transmutation Stone recipes RecipesTransmutationStone.init(); + + // Register the Fuel Handler + GameRegistry.registerFuelHandler(new FuelHandler()); } diff --git a/ee3_common/ee3/common/container/ContainerCalcinator.java b/ee3_common/ee3/common/container/ContainerCalcinator.java index 7588ff2a..2b61e9af 100644 --- a/ee3_common/ee3/common/container/ContainerCalcinator.java +++ b/ee3_common/ee3/common/container/ContainerCalcinator.java @@ -31,14 +31,14 @@ public class ContainerCalcinator extends Container { { for (int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) { - this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 84 + inventoryRowIndex * 18)); + 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, 142)); + this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 152)); } } @@ -48,76 +48,76 @@ public class ContainerCalcinator extends Container { } // TODO Write our own version - this is taken from ContainerFurnace - public ItemStack transferStackInSlot(int par1) + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { - ItemStack var2 = null; - Slot var3 = (Slot)this.inventorySlots.get(par1); + ItemStack var3 = null; + Slot var4 = (Slot)this.inventorySlots.get(par2); - if (var3 != null && var3.getHasStack()) + if (var4 != null && var4.getHasStack()) { - ItemStack var4 = var3.getStack(); - var2 = var4.copy(); + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); - if (par1 == 2) + if (par2 == 2) { - if (!this.mergeItemStack(var4, 3, 39, true)) + if (!this.mergeItemStack(var5, 3, 39, true)) { return null; } - var3.onSlotChange(var4, var2); + var4.onSlotChange(var5, var3); } - else if (par1 != 1 && par1 != 0) + else if (par2 != 1 && par2 != 0) { - if (FurnaceRecipes.smelting().getSmeltingResult(var4) != null) + if (FurnaceRecipes.smelting().getSmeltingResult(var5) != null) { - if (!this.mergeItemStack(var4, 0, 1, false)) + if (!this.mergeItemStack(var5, 0, 1, false)) { return null; } } - else if (TileEntityFurnace.isItemFuel(var4)) + else if (TileEntityFurnace.isItemFuel(var5)) { - if (!this.mergeItemStack(var4, 1, 2, false)) + if (!this.mergeItemStack(var5, 1, 2, false)) { return null; } } - else if (par1 >= 3 && par1 < 30) + else if (par2 >= 3 && par2 < 30) { - if (!this.mergeItemStack(var4, 30, 39, false)) + if (!this.mergeItemStack(var5, 30, 39, false)) { return null; } } - else if (par1 >= 30 && par1 < 39 && !this.mergeItemStack(var4, 3, 30, false)) + else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(var5, 3, 30, false)) { return null; } } - else if (!this.mergeItemStack(var4, 3, 39, false)) + else if (!this.mergeItemStack(var5, 3, 39, false)) { return null; } - if (var4.stackSize == 0) + if (var5.stackSize == 0) { - var3.putStack((ItemStack)null); + var4.putStack((ItemStack)null); } else { - var3.onSlotChanged(); + var4.onSlotChanged(); } - if (var4.stackSize == var2.stackSize) + if (var5.stackSize == var3.stackSize) { return null; } - var3.onPickupFromSlot(var4); + var4.func_82870_a(par1EntityPlayer, var5); } - return var2; + return var3; } } diff --git a/ee3_common/ee3/common/core/handlers/ConfigurationHandler.java b/ee3_common/ee3/common/core/handlers/ConfigurationHandler.java index 97fb8e45..b226ac97 100644 --- a/ee3_common/ee3/common/core/handlers/ConfigurationHandler.java +++ b/ee3_common/ee3/common/core/handlers/ConfigurationHandler.java @@ -33,6 +33,9 @@ public class ConfigurationHandler { configuration.load(); /* General Configs */ + ConfigurationSettings.ENABLE_VERSION_CHECK = configuration + .get(CATEGORY_GENERAL, Reference.ENABLE_VERSION_CHECK, ConfigurationSettings.ENABLE_VERSION_CHECK_DEFAULT) + .getBoolean(ConfigurationSettings.ENABLE_VERSION_CHECK_DEFAULT); ConfigurationSettings.ENABLE_SOUNDS = configuration .get(CATEGORY_GENERAL, Reference.ENABLE_SOUNDS, ConfigurationSettings.ENABLE_SOUNDS_DEFAULT) .getBoolean(ConfigurationSettings.ENABLE_SOUNDS_DEFAULT); diff --git a/ee3_common/ee3/common/core/handlers/EquivalencyHandler.java b/ee3_common/ee3/common/core/handlers/EquivalencyHandler.java index 12b0e8d0..e66ba9a8 100644 --- a/ee3_common/ee3/common/core/handlers/EquivalencyHandler.java +++ b/ee3_common/ee3/common/core/handlers/EquivalencyHandler.java @@ -7,44 +7,57 @@ import net.minecraft.src.ItemStack; public class EquivalencyHandler { - public static ArrayList> equivalencyList = new ArrayList>(); + 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 static void addObjectToEquivalencyList(Object obj1, Object obj2) { + public void addObjects(Object obj1, Object obj2) { ItemStack stack1 = GeneralHelper.convertObjectToItemStack(obj1); ItemStack stack2 = GeneralHelper.convertObjectToItemStack(obj2); ArrayList currentList = new ArrayList(); - Integer stack1Index = getEquivalencyIndexForItem(stack1); - Integer stack2Index = getEquivalencyIndexForItem(stack2); + Integer stack1Index = getIndexInList(stack1); + Integer stack2Index = getIndexInList(stack2); if ((stack1Index != null) && (stack2Index != null)) { return; - } else if ((stack1Index != null) && (stack2Index == null)) { + } + else if ((stack1Index != null) && (stack2Index == null)) { currentList = equivalencyList.get(stack1Index.intValue()); currentList.add(stack2); equivalencyList.set(stack1Index.intValue(), currentList); - } else if ((stack1Index == null) && (stack2Index != null)) { + } + else if ((stack1Index == null) && (stack2Index != null)) { currentList = equivalencyList.get(stack2Index.intValue()); currentList.add(stack1); equivalencyList.set(stack2Index.intValue(), currentList); - } else if ((stack1Index == null) && (stack2Index == null)) { + } + else if ((stack1Index == null) && (stack2Index == null)) { currentList.add(stack1); currentList.add(stack2); equivalencyList.add(currentList); } } - public static void addObjectsToEquivalencyLists(Object... objList) { + public void addObjects(Object... objList) { if (objList.length < 2) return; for (int i = 0; i < objList.length - 1; i++) { - addObjectToEquivalencyList(objList[i], objList[i + 1]); + addObjects(objList[i], objList[i + 1]); } } - public static Integer getEquivalencyIndexForItem(Object obj) { + public Integer getIndexInList(Object obj) { ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj); ArrayList currentList; int i = 0; @@ -52,7 +65,7 @@ public class EquivalencyHandler { while (i < equivalencyList.size()) { currentList = equivalencyList.get(i); for (ItemStack currentStack : currentList) { - if (checkStack.isStackEqual(currentStack)) { + if (ItemStack.areItemStacksEqual(checkStack, currentStack)) { return new Integer(i); } } @@ -61,8 +74,25 @@ public class EquivalencyHandler { return null; } + + public Integer getIndexinList(int id, int meta) { + ArrayList currentList; + int i = 0; - public static ArrayList getEquivalencyListForItem(Object obj) { + while (i < equivalencyList.size()) { + currentList = equivalencyList.get(i); + for (ItemStack currentStack : currentList) { + if ((id == currentStack.itemID) && (meta == currentStack.getItemDamage())) { + return new Integer(i); + } + } + ++i; + } + + return null; + } + + public ArrayList getEquivalencyList(Object obj) { ItemStack checkStack = GeneralHelper.convertObjectToItemStack(obj); if (checkStack == null) @@ -70,7 +100,7 @@ public class EquivalencyHandler { for (ArrayList list : equivalencyList) { for (ItemStack currentStack : list) { - if (checkStack.isStackEqual(currentStack)) { + if (ItemStack.areItemStacksEqual(checkStack, currentStack)) { return list; } } @@ -78,8 +108,87 @@ public class EquivalencyHandler { 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; + } + } + } - public static void debug() { + 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) { + 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) { + 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 void debug() { int i = 0; for (ArrayList list : equivalencyList) { System.out.println("equivalencyList[" + i + "]: " + list.toString()); diff --git a/ee3_common/ee3/common/core/handlers/FuelHandler.java b/ee3_common/ee3/common/core/handlers/FuelHandler.java new file mode 100644 index 00000000..5b63302d --- /dev/null +++ b/ee3_common/ee3/common/core/handlers/FuelHandler.java @@ -0,0 +1,14 @@ +package ee3.common.core.handlers; + +import net.minecraft.src.ItemStack; +import cpw.mods.fml.common.IFuelHandler; + +public class FuelHandler implements IFuelHandler { + + @Override + public int getBurnTime(ItemStack fuel) { + // TODO Add in fuel values for EE3 fuel related items + return 0; + } + +} diff --git a/ee3_common/ee3/common/core/handlers/LocalizationHandler.java b/ee3_common/ee3/common/core/handlers/LocalizationHandler.java index 13eb2438..ca8fbe8b 100644 --- a/ee3_common/ee3/common/core/handlers/LocalizationHandler.java +++ b/ee3_common/ee3/common/core/handlers/LocalizationHandler.java @@ -1,10 +1,5 @@ package ee3.common.core.handlers; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Iterator; -import java.util.Properties; import cpw.mods.fml.common.registry.LanguageRegistry; import ee3.common.core.helper.LocalizationHelper; import ee3.common.lib.Localizations; @@ -20,61 +15,14 @@ import ee3.common.lib.Localizations; */ public class LocalizationHandler { - private static final LocalizationHandler INSTANCE = new LocalizationHandler(); - - public static LocalizationHandler instance() { - return INSTANCE; - } - /*** * Loads in all the localization files from the Localizations library class */ - public void loadLanguages() { - InputStream languageStream = null; - Properties languageMappings = new Properties(); - Iterator keyIter = null; - String currentKey, currentLang; - - try { - // For every file specified in the Localization library class, load them into the Language Registry - for (String localizationFile : Localizations.localeFiles) { - URL localizationFileURL = this.getClass().getResource(localizationFile); - - languageStream = localizationFileURL.openStream(); - - // If this file is a XML file, load it from XML - if (LocalizationHelper.isXMLLanguageFile(localizationFile)) { - languageMappings.loadFromXML(languageStream); - } - // Otherwise, load it like any other Java Properties file - else { - languageMappings.load(languageStream); - } - - // Read the locale from the file name of the localization file - currentLang = LocalizationHelper.getLocaleFromFileName(localizationFile); - - // For every key in the localization file, add its key:value pair to the Language Registry for the given locale - keyIter = (Iterator)languageMappings.keys(); - while (keyIter.hasNext()) { - currentKey = keyIter.next(); - LanguageRegistry.instance().addStringLocalization(currentKey, currentLang, languageMappings.getProperty(currentKey)); - } - } - - } catch (Exception e) { - e.printStackTrace(System.err); - } finally { - // Close the input stream when we are done with it - try { - if (languageStream != null) { - languageStream.close(); - } - } catch (IOException ex) { - ex.printStackTrace(System.err); - } + public static void loadLanguages() { + // For every file specified in the Localization library class, load them into the Language Registry + for (String localizationFile : Localizations.localeFiles) { + LanguageRegistry.instance().loadLocalization(localizationFile, LocalizationHelper.getLocaleFromFileName(localizationFile), LocalizationHelper.isXMLLanguageFile(localizationFile)); } - } } diff --git a/ee3_common/ee3/common/core/handlers/PacketHandler.java b/ee3_common/ee3/common/core/handlers/PacketHandler.java index 1a2fe33a..ed87498d 100644 --- a/ee3_common/ee3/common/core/handlers/PacketHandler.java +++ b/ee3_common/ee3/common/core/handlers/PacketHandler.java @@ -3,7 +3,7 @@ package ee3.common.core.handlers; import java.io.ByteArrayInputStream; import java.io.DataInputStream; -import net.minecraft.src.NetworkManager; +import net.minecraft.src.INetworkManager; import net.minecraft.src.Packet250CustomPayload; import cpw.mods.fml.common.network.IPacketHandler; import cpw.mods.fml.common.network.Player; @@ -28,7 +28,7 @@ public class PacketHandler implements IPacketHandler { * @param player The Player associated with the packet */ @Override - public void onPacketData(NetworkManager manager, Packet250CustomPayload packet, Player player) { + 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); diff --git a/ee3_common/ee3/common/core/handlers/PlayerDestroyItemHandler.java b/ee3_common/ee3/common/core/handlers/PlayerDestroyItemHandler.java index a09b98d4..584825d7 100644 --- a/ee3_common/ee3/common/core/handlers/PlayerDestroyItemHandler.java +++ b/ee3_common/ee3/common/core/handlers/PlayerDestroyItemHandler.java @@ -8,7 +8,7 @@ public class PlayerDestroyItemHandler { @ForgeSubscribe public void onPlayerDestroyItemEvent(PlayerDestroyItemEvent event) { // TODO Come back and actually do what I want here - System.out.println(event.original.getItemNameandInformation()); + System.out.println(event.original.func_82833_r()); } } diff --git a/ee3_common/ee3/common/core/handlers/VersionCheckTickHandler.java b/ee3_common/ee3/common/core/handlers/VersionCheckTickHandler.java index 1a800ac2..e5a62299 100644 --- a/ee3_common/ee3/common/core/handlers/VersionCheckTickHandler.java +++ b/ee3_common/ee3/common/core/handlers/VersionCheckTickHandler.java @@ -6,6 +6,7 @@ import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; import ee3.common.core.helper.VersionHelper; +import ee3.common.lib.ConfigurationSettings; import ee3.common.lib.Reference; public class VersionCheckTickHandler implements ITickHandler { @@ -17,12 +18,14 @@ public class VersionCheckTickHandler implements ITickHandler { @Override public void tickEnd(EnumSet type, Object... tickData) { - if (!initialized) { - for (TickType tickType : type) { - if (tickType == TickType.CLIENT) { - if (FMLClientHandler.instance().getClient().currentScreen == null) { - initialized = true; - FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(VersionHelper.getResultMessage()); + if (ConfigurationSettings.ENABLE_VERSION_CHECK) { + if (!initialized) { + for (TickType tickType : type) { + if (tickType == TickType.CLIENT) { + if (FMLClientHandler.instance().getClient().currentScreen == null) { + initialized = true; + FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(Reference.VERSION_CHECK_COLOUR_PREFIX + "[" + Reference.MOD_NAME + "] " + VersionHelper.getResultMessage()); + } } } } diff --git a/ee3_common/ee3/common/core/helper/LocalizationHelper.java b/ee3_common/ee3/common/core/helper/LocalizationHelper.java index 93228e1c..35e064af 100644 --- a/ee3_common/ee3/common/core/helper/LocalizationHelper.java +++ b/ee3_common/ee3/common/core/helper/LocalizationHelper.java @@ -1,12 +1,5 @@ package ee3.common.core.helper; -import java.util.HashMap; -import java.util.Properties; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.ReflectionHelper; -import net.minecraft.src.StringTranslate; -import ee3.common.core.handlers.LocalizationHandler; - /** * LocalizationHelper * @@ -18,40 +11,6 @@ import ee3.common.core.handlers.LocalizationHandler; */ public class LocalizationHelper { - // The language data field name for localization data in the Language Registry - private static final String LANGUAGE_REGISTRY_LANGUAGE_DATA_FIELD = "modLanguageData"; - - /*** - * Returns the localized version of the text represented by key for the current language from the Language Registry - * @param key The key that represents the text we are attempting to localize - * @return The localized string for the specified key for the current language, null if no localized version of the key exists in the Language Registry - */ - public static String localize(String key) { - return localize(StringTranslate.getInstance().getCurrentLanguage(), key); - } - - /*** - * Returns the localized version of the text represented by key for the specified language from the Language Registry - * @param language The language for which to search for the localized version of the key - * @param key The key that represents the text we are attempting to localize - * @return The localized string for the specified key for the specified language, null if no localized version of the key exists in the Language Registry - */ - public static String localize(String language, String key) { - String localizedValue = ""; - HashMap modLanguageData = null; - Properties languageMapping = null; - - try { - modLanguageData = ReflectionHelper.getPrivateValue(cpw.mods.fml.common.registry.LanguageRegistry.class, LanguageRegistry.instance(), LANGUAGE_REGISTRY_LANGUAGE_DATA_FIELD); - languageMapping = modLanguageData.get(language); - localizedValue = languageMapping.getProperty(key); - } catch (Exception e) { - e.printStackTrace(System.err); - } - - return localizedValue; - } - /*** * Simple test to determine if a specified file name represents a XML file or not * @param fileName String representing the file name of the file in question diff --git a/ee3_common/ee3/common/core/helper/LogHelper.java b/ee3_common/ee3/common/core/helper/LogHelper.java index 2aa2b54b..871eb4d0 100644 --- a/ee3_common/ee3/common/core/helper/LogHelper.java +++ b/ee3_common/ee3/common/core/helper/LogHelper.java @@ -1,15 +1,24 @@ package ee3.common.core.helper; import java.util.logging.Level; +import java.util.logging.Logger; import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.FMLLog; +import ee3.common.EquivalentExchange3; import ee3.common.lib.Reference; public class LogHelper { + private static Logger eeLogger = Logger.getLogger(Reference.MOD_NAME); + + public static void init() { + eeLogger.setParent(FMLLog.getLogger()); + } + public static void log(Level logLevel, String message) { - System.out.println(Reference.LOGGER_PREFIX + message); - FMLCommonHandler.instance().getFMLLogger().log(logLevel, Reference.LOGGER_PREFIX + message); + //System.out.println(Reference.LOGGER_PREFIX + message); + eeLogger.log(logLevel, message); } } diff --git a/ee3_common/ee3/common/core/helper/QualityHelper.java b/ee3_common/ee3/common/core/helper/QualityHelper.java new file mode 100644 index 00000000..b14df137 --- /dev/null +++ b/ee3_common/ee3/common/core/helper/QualityHelper.java @@ -0,0 +1,48 @@ +package ee3.common.core.helper; + +import net.minecraft.src.ItemStack; + +public class QualityHelper { + + /* + * Legend for the dust table quality lookup, comparison is based off of quality tiers + * + * Item Quality + * |_0_|_1_|_2_|_3_|_4_|_5_| + * Fuel 0 | 0 | 0 | 0 | 1 | 1 | 1 | + * Quality 1 | 0 | 1 | 1 | 1 | 2 | 2 | + * 2 | 0 | 1 | 2 | 2 | 2 | 2 | + * 3 | 1 | 1 | 2 | 3 | 3 | 3 | + * 4 | 1 | 2 | 2 | 3 | 4 | 4 | + * 5 | 1 | 2 | 2 | 3 | 4 | 5 | + */ + private static int[][] dustTable = { + {0, 0, 0, 1, 1, 1}, + {0, 1, 1, 1, 2, 2}, + {0, 1, 2, 2, 2, 2}, + {1, 1, 2, 3, 3, 3}, + {1, 2, 2, 3, 4, 4}, + {1, 2, 2, 3, 4, 5}, + }; + + public static int getItemTierQuality(ItemStack item) { + // TODO Return the 'Tier' level of the given ItemStack + return -1; + } + + public static int getFuelTierQuality(ItemStack fuel) { + // TODO Return the 'Tier' level of the given ItemStack + return -1; + } + + public static int getDustTierQuality(ItemStack item, ItemStack fuel) { + if ((getItemTierQuality(item) >= 0) && (getItemTierQuality(item) <= 5)) { + if ((getFuelTierQuality(fuel) >= 0) && (getFuelTierQuality(fuel) <= 5)) { + return dustTable[getItemTierQuality(item)][getFuelTierQuality(fuel)]; + } + } + + return -1; + } + +} diff --git a/ee3_common/ee3/common/core/helper/TransmutationHelper.java b/ee3_common/ee3/common/core/helper/TransmutationHelper.java index ba6af687..910254dd 100644 --- a/ee3_common/ee3/common/core/helper/TransmutationHelper.java +++ b/ee3_common/ee3/common/core/helper/TransmutationHelper.java @@ -19,8 +19,7 @@ public class TransmutationHelper { } /* - * @TODO Clean up later tonight - ItemStack nextItem = TransmuteEquivalencyList.getNextBlockInEquivalencyList(id, meta, player.isSneaking()); + ItemStack nextItem = EquivalencyHandler.getNextBlockInEquivalencyList(id, meta, player.isSneaking()); if (nextItem != null) { if (Block.blocksList[nextItem.itemID] != null) { @@ -30,7 +29,7 @@ public class TransmutationHelper { } } */ - + return false; } diff --git a/ee3_common/ee3/common/core/helper/VersionHelper.java b/ee3_common/ee3/common/core/helper/VersionHelper.java index b8bdee29..48d39417 100644 --- a/ee3_common/ee3/common/core/helper/VersionHelper.java +++ b/ee3_common/ee3/common/core/helper/VersionHelper.java @@ -7,6 +7,8 @@ import java.util.logging.Level; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.LanguageRegistry; +import ee3.common.lib.ConfigurationSettings; import ee3.common.lib.Reference; /** @@ -31,12 +33,14 @@ public class VersionHelper { public static final byte CONNECTION_ERROR = 3; // Localization keys + private static final String VERSION_CHECK_DISABLED = "version.check_disabled"; + private static final String VERSION_CHECK_INIT_LOG_MESSAGE = "version.init_log_message"; private static final String UNINITIALIZED_MESSAGE = "version.uninitialized"; private static final String CURRENT_MESSAGE = "version.current"; private static final String OUTDATED_MESSAGE = "version.outdated"; private static final String CONNECTION_ERROR_MESSAGE = "version.connection_error"; - // Var to hold the result of the remote version check + // Var to hold the result of the remote version check, initially set to uninitialized public static byte result = UNINITIALIZED; /*** @@ -87,29 +91,40 @@ public class VersionHelper { } public static void logResult() { - if ((result == CURRENT) || (result == OUTDATED)) { - LogHelper.log(Level.FINE, getResultMessage()); + if (ConfigurationSettings.ENABLE_VERSION_CHECK) { + LogHelper.log(Level.INFO, LanguageRegistry.instance().getStringLocalization(VERSION_CHECK_INIT_LOG_MESSAGE) + " " + REMOTE_VERSION_FILE); + if ((result == CURRENT) || (result == OUTDATED)) { + LogHelper.log(Level.INFO, getResultMessage()); + } + else { + LogHelper.log(Level.WARNING, getResultMessage()); + } } else { - LogHelper.log(Level.WARNING, getResultMessage()); + LogHelper.log(Level.INFO, getResultMessage()); } } public static String getResultMessage() { - if (result == UNINITIALIZED) { - return LocalizationHelper.localize(UNINITIALIZED_MESSAGE); - } - else if (result == CURRENT) { - return LocalizationHelper.localize(CURRENT_MESSAGE); - } - else if (result == OUTDATED) { - return LocalizationHelper.localize(OUTDATED_MESSAGE); - } - else if (result == CONNECTION_ERROR) { - return LocalizationHelper.localize(CONNECTION_ERROR_MESSAGE); + if (ConfigurationSettings.ENABLE_VERSION_CHECK) { + if (result == UNINITIALIZED) { + return LanguageRegistry.instance().getStringLocalization(UNINITIALIZED_MESSAGE); + } + else if (result == CURRENT) { + return LanguageRegistry.instance().getStringLocalization(CURRENT_MESSAGE); + } + else if (result == OUTDATED) { + return LanguageRegistry.instance().getStringLocalization(OUTDATED_MESSAGE); + } + else if (result == CONNECTION_ERROR) { + return LanguageRegistry.instance().getStringLocalization(CONNECTION_ERROR_MESSAGE); + } + else { + return null; + } } else { - return null; + return LanguageRegistry.instance().getStringLocalization(VERSION_CHECK_DISABLED); } } diff --git a/ee3_common/ee3/common/emc/EMCEntry.java b/ee3_common/ee3/common/emc/EMCEntry.java new file mode 100644 index 00000000..db21da1e --- /dev/null +++ b/ee3_common/ee3/common/emc/EMCEntry.java @@ -0,0 +1,87 @@ +package ee3.common.emc; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +public class EMCEntry { + + private float cost, recoveryPercentage; + private boolean learnable, recoverable; + private Map breakdown; + + public EMCEntry(float cost) { + this.cost = cost; + recoveryPercentage = 1F; + learnable = true; + recoverable = true; + breakdown = Collections.synchronizedMap(new HashMap()); + } + + public EMCEntry(float cost, float recoveryPercentage, boolean learnable, boolean recoverable) { + this.cost = cost; + this.recoveryPercentage = recoveryPercentage; + this.learnable = learnable; + this.recoverable = recoverable; + breakdown = Collections.synchronizedMap(new HashMap()); + } + + public float getCost() { + return cost; + } + + public float getRecoveryPercentage() { + return recoveryPercentage; + } + + public boolean isLearnable() { + return learnable; + } + + public boolean isRecoverable() { + return recoverable; + } + + public Map getEMCBreakDown() { + return breakdown; + } + + public float getEMCBreakdownByType(EMCType emcType) { + if (breakdown.containsKey(emcType)) { + if (breakdown.get(emcType) != null) { + return breakdown.get(emcType).floatValue(); + } + } + + return -1F; + } + + public void setCost(float cost) { + this.cost = cost; + } + + public void setRecoveryPercentage(float recoveryPercentage) { + this.recoveryPercentage = recoveryPercentage; + } + + public void setLearnable(boolean learnable) { + this.learnable = learnable; + } + + public void setRecoverable(boolean recoverable) { + this.recoverable = recoverable; + } + + public void addEMCBreakDown(EMCType emcType, Float breakdownPercentage) { + if (!(breakdown.containsKey(emcType))) { + breakdown.put(emcType, breakdownPercentage); + } + } + + public void setEMCBreakDown(EMCType emcType, Float breakdownPercentage) { + if (breakdown.containsKey(emcType)) { + breakdown.put(emcType, breakdownPercentage); + } + } + +} diff --git a/ee3_common/ee3/common/emc/EMCRegistry.java b/ee3_common/ee3/common/emc/EMCRegistry.java new file mode 100644 index 00000000..48387402 --- /dev/null +++ b/ee3_common/ee3/common/emc/EMCRegistry.java @@ -0,0 +1,93 @@ +package ee3.common.emc; + +import java.util.HashMap; +import java.util.Map; + +import net.minecraft.src.Block; +import net.minecraft.src.Item; +import net.minecraft.src.ItemStack; + +public class EMCRegistry { + + private static final EMCRegistry emcRegistry = new EMCRegistry(); + + private HashMap> emcMap = new HashMap>(); + + public static EMCRegistry instance() { + return emcRegistry; + } + + public EMCEntry getEMCValue(Block block) { + if (block != null) { + return getEMCValue(block.blockID, 0); + } + + return null; + } + + public EMCEntry getEMCValue(Item item) { + if (item != null) { + return getEMCValue(item.shiftedIndex, 0); + } + + return null; + } + + public EMCEntry getEMCValue(ItemStack itemStack) { + if (itemStack != null) { + return getEMCValue(itemStack.itemID, itemStack.getItemDamage()); + } + + return null; + } + + public EMCEntry getEMCValue(int id) { + return getEMCValue(id, 0); + } + + public EMCEntry getEMCValue(int id, int meta) { + if (emcMap.containsKey(id)) { + if (emcMap.get(id).containsKey(meta)) { + return emcMap.get(id).get(meta); + } + } + + return null; + } + + public void addEMCValue(Block block, EMCEntry emcEntry) { + addEMCValue(block.blockID, 0, emcEntry); + } + + public void addEMCValue(Block block, int meta, EMCEntry emcEntry) { + addEMCValue(block.blockID, meta, emcEntry); + } + + public void addEMCValue(Item item, EMCEntry emcEntry) { + addEMCValue(item.shiftedIndex, 0, emcEntry); + } + + public void addEMCValue(ItemStack itemStack, EMCEntry emcEntry) { + addEMCValue(itemStack.itemID, itemStack.getItemDamage(), emcEntry); + } + + public void addEMCValue(int id, EMCEntry emcEntry) { + addEMCValue(id, 0, emcEntry); + } + + public void addEMCValue(int id, int meta, EMCEntry emcEntry) { + HashMap tempMap = new HashMap(); + + if (emcMap.containsKey(id)) { + tempMap = emcMap.get(id); + + if (tempMap.containsKey(meta)) { + return; + } + } + + tempMap.put(meta, emcEntry); + emcMap.put(id, tempMap); + } + +} diff --git a/ee3_common/ee3/common/emc/EMCType.java b/ee3_common/ee3/common/emc/EMCType.java new file mode 100644 index 00000000..79844d02 --- /dev/null +++ b/ee3_common/ee3/common/emc/EMCType.java @@ -0,0 +1,5 @@ +package ee3.common.emc; + +public enum EMCType { + CORPOREAL, KINETIC, TEMPORAL, ESSENTIA, AMORPHOUS, VOID, OMNI +} diff --git a/ee3_common/ee3/common/item/ItemMiniumStone.java b/ee3_common/ee3/common/item/ItemMiniumStone.java index 53647d81..f0b0142d 100644 --- a/ee3_common/ee3/common/item/ItemMiniumStone.java +++ b/ee3_common/ee3/common/item/ItemMiniumStone.java @@ -1,12 +1,16 @@ package ee3.common.item; +import net.minecraft.src.EntityPlayer; import net.minecraft.src.EnumRarity; import net.minecraft.src.ItemStack; +import net.minecraft.src.World; import cpw.mods.fml.common.Side; import cpw.mods.fml.common.asm.SideOnly; import ee3.common.EquivalentExchange3; +import ee3.common.core.helper.TransmutationHelper; import ee3.common.lib.ConfigurationSettings; import ee3.common.lib.CustomItemRarity; +import ee3.common.lib.Reference; /** * ItemMiniumStone @@ -46,4 +50,15 @@ public class ItemMiniumStone extends ItemEE { return itemStack; } + @Override + public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int l, float f1, float f2, float f3) { + boolean result = TransmutationHelper.transmuteInWorld(world, entityPlayer, itemStack, x, y, z); + + if (result) { + itemStack.damageItem(1, entityPlayer); + } + + return result; + } + } diff --git a/ee3_common/ee3/common/lib/ConfigurationSettings.java b/ee3_common/ee3/common/lib/ConfigurationSettings.java index cdd5c3d5..7efa81bf 100644 --- a/ee3_common/ee3/common/lib/ConfigurationSettings.java +++ b/ee3_common/ee3/common/lib/ConfigurationSettings.java @@ -19,6 +19,10 @@ public class ConfigurationSettings { public static boolean ENABLE_PARTICLE_FX; public static final boolean ENABLE_PARTICLE_FX_DEFAULT = true; + // Whether or not EE3 will do a version check when loaded + public static boolean ENABLE_VERSION_CHECK; + public static final boolean ENABLE_VERSION_CHECK_DEFAULT = true; + /* * Minium stone config settings */ diff --git a/ee3_common/ee3/common/lib/Reference.java b/ee3_common/ee3/common/lib/Reference.java index 97b0d33a..51584e70 100644 --- a/ee3_common/ee3/common/lib/Reference.java +++ b/ee3_common/ee3/common/lib/Reference.java @@ -22,21 +22,27 @@ public class Reference { public static final String LOGGER_PREFIX = "[" + MOD_ID + "] "; public static final int SECOND_IN_TICKS = 20; public static final int SHIFTED_ID_RANGE_CORRECTION = 256; + public static final String SERVER_PROXY_CLASS = "ee3.common.core.CommonProxy"; + public static final String CLIENT_PROXY_CLASS = "ee3.client.core.ClientProxy"; /* Configuration related constants */ + public static final String ENABLE_VERSION_CHECK = "enable_version_check"; public static final String ENABLE_SOUNDS = "enable_sounds"; public static final String ENABLE_PARTICLE_FX = "enable_particle_fx"; public static final String AUTO_RESOLVE_BLOCK_IDS = "auto_resolve_block_ids"; + /* Text colour related constants */ + public static final String VERSION_CHECK_COLOUR_PREFIX = "\u00a7e"; + /* KeyBinding related constants */ // TODO: Localize keybinding names - public static final String KEYBINDING_EXTRA = "mod.ee3.extra_key"; + public static final String KEYBINDING_EXTRA = "key.extra"; public static final int KEYBINDING_EXTRA_DEFAULT = 46; - public static final String KEYBINDING_RELEASE = "mod.ee3.release_key"; + public static final String KEYBINDING_RELEASE = "key.release"; public static final int KEYBINDING_RELEASE_DEFAULT = 19; - public static final String KEYBINDING_TOGGLE = "mod.ee3.toggle_key"; + public static final String KEYBINDING_TOGGLE = "key.toggle"; public static final int KEYBINDING_TOGGLE_DEFAULT = 34; - public static final String KEYBINDING_CHARGE = "mod.ee3.charge_key"; + public static final String KEYBINDING_CHARGE = "key.charge"; public static final int KEYBINDING_CHARGE_DEFAULT = 47; /* Texture related constants */ @@ -45,7 +51,10 @@ public class Reference { public static final String GUI_SHEET_LOCATION = "/ee3/art/gui/"; public static final String ITEM_SPRITE_SHEET = "ee3_items.png"; public static final String BLOCK_SPRITE_SHEET = "ee3_blocks.png"; - + + /* Gui related constants */ + public static final String GUI_CALCINATOR_NAME = "gui.calcinator.name"; + /* General Tile Entity related constants */ public static final String TE_GEN_OWNER_NBT_TAG_LABEL = "owner"; public static final String TE_GEN_STATE_NBT_TAG_LABEL = "state"; diff --git a/ee3_common/ee3/common/network/PacketEE.java b/ee3_common/ee3/common/network/PacketEE.java index 5fa0493e..0f0bd8e4 100644 --- a/ee3_common/ee3/common/network/PacketEE.java +++ b/ee3_common/ee3/common/network/PacketEE.java @@ -5,7 +5,7 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import cpw.mods.fml.common.network.Player; -import net.minecraft.src.NetworkManager; +import net.minecraft.src.INetworkManager; public class PacketEE { @@ -43,7 +43,7 @@ public class PacketEE { public void writeData(DataOutputStream dos) throws IOException { } - public void execute(NetworkManager network, Player player) { } + public void execute(INetworkManager network, Player player) { } public void setKey(int key) { } } diff --git a/ee3_common/ee3/common/network/PacketKeyPressed.java b/ee3_common/ee3/common/network/PacketKeyPressed.java index e8052486..ac201702 100644 --- a/ee3_common/ee3/common/network/PacketKeyPressed.java +++ b/ee3_common/ee3/common/network/PacketKeyPressed.java @@ -11,7 +11,7 @@ import ee3.common.lib.ItemIds; import ee3.common.lib.Reference; import net.minecraft.src.EntityPlayer; -import net.minecraft.src.NetworkManager; +import net.minecraft.src.INetworkManager; import net.minecraft.src.Packet250CustomPayload; public class PacketKeyPressed extends PacketEE { @@ -40,7 +40,7 @@ public class PacketKeyPressed extends PacketEE { this.key = key; } - public void execute(NetworkManager manager, Player player) { + public void execute(INetworkManager manager, Player player) { EntityPlayer thePlayer = (EntityPlayer) player; if ((this.key.equals(Reference.KEYBINDING_EXTRA)) && (thePlayer.getCurrentEquippedItem().getItem().shiftedIndex == ItemIds.MINIUM_STONE)) { diff --git a/ee3_common/ee3/common/network/PacketTileUpdate.java b/ee3_common/ee3/common/network/PacketTileUpdate.java index 7e4ff247..4614473f 100644 --- a/ee3_common/ee3/common/network/PacketTileUpdate.java +++ b/ee3_common/ee3/common/network/PacketTileUpdate.java @@ -6,7 +6,7 @@ import java.io.IOException; import cpw.mods.fml.common.network.Player; -import net.minecraft.src.NetworkManager; +import net.minecraft.src.INetworkManager; import net.minecraftforge.common.ForgeDirection; public class PacketTileUpdate extends PacketEE { @@ -62,7 +62,7 @@ public class PacketTileUpdate extends PacketEE { this.player = data.readUTF(); } - public void execute(NetworkManager manager, Player player) { + public void execute(INetworkManager manager, Player player) { // TODO: Stuff here } diff --git a/ee3_common/ee3/common/recipe/RecipesCalcinator.java b/ee3_common/ee3/common/recipe/RecipesCalcinator.java new file mode 100644 index 00000000..15efa825 --- /dev/null +++ b/ee3_common/ee3/common/recipe/RecipesCalcinator.java @@ -0,0 +1,5 @@ +package ee3.common.recipe; + +public class RecipesCalcinator { + +} diff --git a/ee3_common/ee3/common/core/RecipesTransmutationStone.java b/ee3_common/ee3/common/recipe/RecipesTransmutationStone.java similarity index 81% rename from ee3_common/ee3/common/core/RecipesTransmutationStone.java rename to ee3_common/ee3/common/recipe/RecipesTransmutationStone.java index 1dfe1f74..c6035571 100644 --- a/ee3_common/ee3/common/core/RecipesTransmutationStone.java +++ b/ee3_common/ee3/common/recipe/RecipesTransmutationStone.java @@ -1,194 +1,193 @@ -package ee3.common.core; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import cpw.mods.fml.common.ObfuscationReflectionHelper; - -import net.minecraft.src.Block; -import net.minecraft.src.FurnaceRecipes; -import net.minecraft.src.Item; -import net.minecraft.src.ItemStack; -import ee3.common.core.handlers.EquivalencyHandler; -import ee3.common.core.helper.GeneralHelper; -import ee3.common.core.helper.RecipeHelper; -import ee3.common.item.ModItems; -import ee3.common.lib.Reference; - -public class RecipesTransmutationStone { - - private static ItemStack philStone = new ItemStack(ModItems.philStone, 1, -1); - private static ItemStack miniumStone = new ItemStack(ModItems.miniumStone, 1, -1); - private static List transmutationStones = Arrays.asList(miniumStone, philStone); - - - private static ItemStack anyCoal = new ItemStack(Item.coal, 1, -1); - private static ItemStack anyWood = new ItemStack(Block.wood, 1, -1); - private static ItemStack anyPlank = new ItemStack(Block.planks, 1, -1); - private static ItemStack anySandStone = new ItemStack(Block.sandStone, 1, -1); - private static ItemStack dyeBoneMeal = new ItemStack(Item.dyePowder, 1, 15); - - public static void init() { - initEquivalencyList(); - - for (ItemStack stone: transmutationStones) { - initTransmutationRecipes(stone); - initEquivalenceRecipes(stone); - initReconstructiveRecipes(stone); - initDestructorRecipes(stone); - initPortableSmeltingRecipes(stone); - } - - if (Reference.DEBUG_MODE) { - EquivalencyHandler.debug(); - } - } - - public static void initTransmutationRecipes(ItemStack transmutationStone) { - /* 4 Cobble <-> 1 Flint */ - RecipeHelper.addRecipe(Item.flint, transmutationStone, Block.cobblestone, Block.cobblestone, Block.cobblestone, Block.cobblestone); - RecipeHelper.addRecipe(new ItemStack(Block.cobblestone, 4), transmutationStone, Item.flint); - - /* 4 Dirt <-> 1 Gravel */ - RecipeHelper.addRecipe(Block.gravel, transmutationStone, Block.dirt, Block.dirt, Block.dirt, Block.dirt); - RecipeHelper.addRecipe(new ItemStack(Block.dirt, 4), transmutationStone, Block.gravel); - - /* 4 Sand <-> 1 Sandstone */ - // Vanilla Recipes exist to make SandStone from 4 Sand - RecipeHelper.addRecipe(new ItemStack(Block.sand, 4), transmutationStone, anySandStone); - - /* 2 Sticks -> Wood Plank */ - RecipeHelper.addRecipe(Block.planks, transmutationStone, Item.stick, Item.stick); - // Vanilla recipe exists to make sticks from planks - - /* 4 Wood Planks -> Wood Block */ - RecipeHelper.addRecipe(Block.wood, transmutationStone, anyPlank, anyPlank, anyPlank, anyPlank); - // Vanilla recipes exist to make planks from any wood log - - /* 4 Gravel/Sandstone/Flint -> 1 Clay Ball, 1 Clay Ball -> 4 Gravel */ - RecipeHelper.addRecipe(Item.clay, transmutationStone, Block.gravel, Block.gravel, Block.gravel, Block.gravel); - RecipeHelper.addRecipe(Item.clay, transmutationStone, anySandStone, anySandStone, anySandStone, anySandStone); - RecipeHelper.addRecipe(Item.clay, transmutationStone, Item.flint, Item.flint, Item.flint, Item.flint); - RecipeHelper.addRecipe(new ItemStack(Block.gravel, 4), transmutationStone, Item.clay); - - /* 2 Wood Log <-> 1 Obsidian */ - RecipeHelper.addRecipe(Block.obsidian, transmutationStone, anyWood, anyWood); - RecipeHelper.addRecipe(new ItemStack(Block.wood, 2), transmutationStone, Block.obsidian); - - /* 4 Clay Ball <-> 1 Clay Block */ - // Vanilla recipe exists to make clay blocks from clay balls - RecipeHelper.addRecipe(new ItemStack(Item.clay, 4), transmutationStone, Block.blockClay); - - /* 4 Obsidian/Clay Block -> 1 Iron Ingot, Iron Ingot -> Clay Block */ - RecipeHelper.addRecipe(Item.ingotIron, transmutationStone, Block.obsidian, Block.obsidian, Block.obsidian, Block.obsidian); - RecipeHelper.addRecipe(Item.ingotIron, transmutationStone, Block.blockClay, Block.blockClay, Block.blockClay, Block.blockClay); - RecipeHelper.addRecipe(new ItemStack(Block.blockClay, 4), transmutationStone, Item.ingotIron); - - /* 8 Iron Ingot <-> 1 Gold Ingot */ - RecipeHelper.addRecipe(Item.ingotGold, transmutationStone, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron); - RecipeHelper.addRecipe(new ItemStack(Item.ingotIron, 8), transmutationStone, Item.ingotGold); - - /* 4 Gold Ingot <-> 1 Diamond */ - RecipeHelper.addRecipe(Item.diamond, transmutationStone, Item.ingotGold, Item.ingotGold, Item.ingotGold, Item.ingotGold); - RecipeHelper.addRecipe(new ItemStack(Item.ingotGold, 4), transmutationStone, Item.diamond); - - /* 8 Iron Block <-> 1 Gold Block */ - RecipeHelper.addRecipe(Block.blockGold, transmutationStone, Block.blockSteel, Block.blockSteel, Block.blockSteel, Block.blockSteel, Block.blockSteel, Block.blockSteel, Block.blockSteel, Block.blockSteel); - RecipeHelper.addRecipe(new ItemStack(Block.blockSteel, 8), transmutationStone, Block.blockGold); - - /* 4 Gold Block <-> 1 Diamond Block */ - RecipeHelper.addRecipe(Block.blockDiamond, transmutationStone, Block.blockGold, Block.blockGold, Block.blockGold, Block.blockGold); - RecipeHelper.addRecipe(new ItemStack(Block.blockGold, 4), transmutationStone, Block.blockDiamond); - - /* 1 Ender Pearl <-> 4 Iron Ingot */ - RecipeHelper.addRecipe(Item.enderPearl, transmutationStone, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron); - RecipeHelper.addRecipe(new ItemStack(Item.ingotIron, 4), transmutationStone, Item.enderPearl); - } - - public static void initEquivalenceRecipes(ItemStack stone) { - int outputI; - - for (ArrayList itemStackList : EquivalencyHandler.equivalencyList) { - ItemStack[] currentList = new ItemStack[itemStackList.size()]; - currentList = itemStackList.toArray(currentList); - - for (int i = 0; i < currentList.length; i++) { - outputI = (i == currentList.length - 1 ? 0 : i + 1); - - RecipeHelper.addRecipe(currentList[outputI], stone, GeneralHelper.convertSingleStackToPluralStacks(currentList[i])); - } - } - } - - public static void initReconstructiveRecipes(ItemStack stone) { - /* 3 Bone Meal --> 1 Bone */ - RecipeHelper.addRecipe(Item.bone, stone, dyeBoneMeal, dyeBoneMeal, dyeBoneMeal); - - /* 2 Blaze Powder --> 1 Blaze Rod */ - RecipeHelper.addRecipe(Item.blazeRod, stone, Item.blazePowder, Item.blazePowder); - } - - - public static void initDestructorRecipes(ItemStack stone) { - /* Smooth Stone -> Cobble Stone */ - RecipeHelper.addRecipe(Block.cobblestone, stone, Block.stone); - - /* Glass -> Sand */ - RecipeHelper.addRecipe(Block.sand, stone, Block.glass); - - /* Glowstone Block -> 4 Glowstone Dust */ - RecipeHelper.addRecipe(new ItemStack(Item.lightStoneDust, 4), stone, Block.glowStone); - - /* Brick Block -> 4 Bricks */ - RecipeHelper.addRecipe(new ItemStack(Item.brick, 4), stone, Block.brick); - } - - public static void initPortableSmeltingRecipes(ItemStack stone) { - Map furnaceMap = FurnaceRecipes.smelting().getSmeltingList(); - Map furnaceMetaMap = ObfuscationReflectionHelper.getPrivateValue(FurnaceRecipes.class, FurnaceRecipes.smelting(), "metaSmeltingList"); - - Iterator iterFurnaceKeyMap = furnaceMap.keySet().iterator(); - Iterator iterFurnaceMetaKeyMap = furnaceMetaMap.keySet().iterator(); - - Integer furnaceMapKey; - List furnaceMetaMapKey; - - ItemStack unSmeltedStack; - - while (iterFurnaceKeyMap.hasNext()) { - furnaceMapKey = (Integer) iterFurnaceKeyMap.next(); - unSmeltedStack = new ItemStack(furnaceMapKey, 1, 0); - - RecipeHelper.addSmeltingRecipe(unSmeltedStack, stone, anyCoal); - } - - while (iterFurnaceMetaKeyMap.hasNext()) { - furnaceMetaMapKey = (List)iterFurnaceMetaKeyMap.next(); - unSmeltedStack = new ItemStack((Integer)furnaceMetaMapKey.get(0), 1, (Integer)furnaceMetaMapKey.get(1)); - - RecipeHelper.addSmeltingRecipe(unSmeltedStack, stone, anyCoal); - } - } - - protected static void initEquivalencyList() { - EquivalencyHandler.addObjectsToEquivalencyLists(Block.sand, Block.dirt, Block.cobblestone, Block.grass); - EquivalencyHandler.addObjectsToEquivalencyLists(Block.plantYellow, Block.plantRed); - EquivalencyHandler.addObjectsToEquivalencyLists(Block.mushroomRed, Block.mushroomBrown); - EquivalencyHandler.addObjectsToEquivalencyLists(Item.pumpkinSeeds, Item.melonSeeds); - EquivalencyHandler.addObjectsToEquivalencyLists(Block.pumpkin, Block.melon); - EquivalencyHandler.addObjectsToEquivalencyLists(new ItemStack(Item.paper, 3), new ItemStack(Item.reed, 3)); - EquivalencyHandler.addObjectsToEquivalencyLists(new ItemStack(Item.flint, 2), new ItemStack(Block.gravel, 2), new ItemStack(Block.sandStone, 2, 0), new ItemStack(Block.sandStone, 2, 1), new ItemStack(Block.sandStone, 2, 2)); - EquivalencyHandler.addObjectsToEquivalencyLists(RecipeHelper.getMetaCycle(Block.planks, 4)); - EquivalencyHandler.addObjectsToEquivalencyLists(RecipeHelper.getMetaCycle(Block.wood, 4)); - EquivalencyHandler.addObjectsToEquivalencyLists(RecipeHelper.getMetaCycle(Block.sapling, 4)); - EquivalencyHandler.addObjectsToEquivalencyLists(RecipeHelper.getMetaCycle(Block.leaves, 4)); - EquivalencyHandler.addObjectsToEquivalencyLists(RecipeHelper.getMetaCycle(Block.tallGrass, 3)); - EquivalencyHandler.addObjectsToEquivalencyLists(RecipeHelper.getMetaCycle(Block.cloth, 16)); - EquivalencyHandler.addObjectsToEquivalencyLists(RecipeHelper.getMetaCycle(Block.stoneBrick, 4)); - EquivalencyHandler.addObjectsToEquivalencyLists(RecipeHelper.getMetaCycle(Item.dyePowder, 16, 3, 4, 15)); - } - -} +package ee3.common.recipe; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import cpw.mods.fml.common.ObfuscationReflectionHelper; + +import net.minecraft.src.Block; +import net.minecraft.src.FurnaceRecipes; +import net.minecraft.src.Item; +import net.minecraft.src.ItemStack; +import ee3.common.core.handlers.EquivalencyHandler; +import ee3.common.core.helper.GeneralHelper; +import ee3.common.core.helper.RecipeHelper; +import ee3.common.item.ModItems; +import ee3.common.lib.Reference; + +public class RecipesTransmutationStone { + + private static ItemStack philStone = new ItemStack(ModItems.philStone, 1, -1); + private static ItemStack miniumStone = new ItemStack(ModItems.miniumStone, 1, -1); + private static List transmutationStones = Arrays.asList(miniumStone, philStone); + + private static ItemStack anyCoal = new ItemStack(Item.coal, 1, -1); + private static ItemStack anyWood = new ItemStack(Block.wood, 1, -1); + private static ItemStack anyPlank = new ItemStack(Block.planks, 1, -1); + private static ItemStack anySandStone = new ItemStack(Block.sandStone, 1, -1); + private static ItemStack dyeBoneMeal = new ItemStack(Item.dyePowder, 1, 15); + + public static void init() { + initEquivalencyList(); + + for (ItemStack stone: transmutationStones) { + initTransmutationRecipes(stone); + initEquivalenceRecipes(stone); + initReconstructiveRecipes(stone); + initDestructorRecipes(stone); + initPortableSmeltingRecipes(stone); + } + + if (Reference.DEBUG_MODE) { + EquivalencyHandler.instance().debug(); + } + } + + public static void initTransmutationRecipes(ItemStack transmutationStone) { + /* 4 Cobble <-> 1 Flint */ + RecipeHelper.addRecipe(Item.flint, transmutationStone, Block.cobblestone, Block.cobblestone, Block.cobblestone, Block.cobblestone); + RecipeHelper.addRecipe(new ItemStack(Block.cobblestone, 4), transmutationStone, Item.flint); + + /* 4 Dirt <-> 1 Gravel */ + RecipeHelper.addRecipe(Block.gravel, transmutationStone, Block.dirt, Block.dirt, Block.dirt, Block.dirt); + RecipeHelper.addRecipe(new ItemStack(Block.dirt, 4), transmutationStone, Block.gravel); + + /* 4 Sand <-> 1 Sandstone */ + // Vanilla Recipes exist to make SandStone from 4 Sand + RecipeHelper.addRecipe(new ItemStack(Block.sand, 4), transmutationStone, anySandStone); + + /* 2 Sticks -> Wood Plank */ + RecipeHelper.addRecipe(Block.planks, transmutationStone, Item.stick, Item.stick); + // Vanilla recipe exists to make sticks from planks + + /* 4 Wood Planks -> Wood Block */ + RecipeHelper.addRecipe(Block.wood, transmutationStone, anyPlank, anyPlank, anyPlank, anyPlank); + // Vanilla recipes exist to make planks from any wood log + + /* 4 Gravel/Sandstone/Flint -> 1 Clay Ball, 1 Clay Ball -> 4 Gravel */ + RecipeHelper.addRecipe(Item.clay, transmutationStone, Block.gravel, Block.gravel, Block.gravel, Block.gravel); + RecipeHelper.addRecipe(Item.clay, transmutationStone, anySandStone, anySandStone, anySandStone, anySandStone); + RecipeHelper.addRecipe(Item.clay, transmutationStone, Item.flint, Item.flint, Item.flint, Item.flint); + RecipeHelper.addRecipe(new ItemStack(Block.gravel, 4), transmutationStone, Item.clay); + + /* 2 Wood Log <-> 1 Obsidian */ + RecipeHelper.addRecipe(Block.obsidian, transmutationStone, anyWood, anyWood); + RecipeHelper.addRecipe(new ItemStack(Block.wood, 2), transmutationStone, Block.obsidian); + + /* 4 Clay Ball <-> 1 Clay Block */ + // Vanilla recipe exists to make clay blocks from clay balls + RecipeHelper.addRecipe(new ItemStack(Item.clay, 4), transmutationStone, Block.blockClay); + + /* 4 Obsidian/Clay Block -> 1 Iron Ingot, Iron Ingot -> Clay Block */ + RecipeHelper.addRecipe(Item.ingotIron, transmutationStone, Block.obsidian, Block.obsidian, Block.obsidian, Block.obsidian); + RecipeHelper.addRecipe(Item.ingotIron, transmutationStone, Block.blockClay, Block.blockClay, Block.blockClay, Block.blockClay); + RecipeHelper.addRecipe(new ItemStack(Block.blockClay, 4), transmutationStone, Item.ingotIron); + + /* 8 Iron Ingot <-> 1 Gold Ingot */ + RecipeHelper.addRecipe(Item.ingotGold, transmutationStone, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron); + RecipeHelper.addRecipe(new ItemStack(Item.ingotIron, 8), transmutationStone, Item.ingotGold); + + /* 4 Gold Ingot <-> 1 Diamond */ + RecipeHelper.addRecipe(Item.diamond, transmutationStone, Item.ingotGold, Item.ingotGold, Item.ingotGold, Item.ingotGold); + RecipeHelper.addRecipe(new ItemStack(Item.ingotGold, 4), transmutationStone, Item.diamond); + + /* 8 Iron Block <-> 1 Gold Block */ + RecipeHelper.addRecipe(Block.blockGold, transmutationStone, Block.blockSteel, Block.blockSteel, Block.blockSteel, Block.blockSteel, Block.blockSteel, Block.blockSteel, Block.blockSteel, Block.blockSteel); + RecipeHelper.addRecipe(new ItemStack(Block.blockSteel, 8), transmutationStone, Block.blockGold); + + /* 4 Gold Block <-> 1 Diamond Block */ + RecipeHelper.addRecipe(Block.blockDiamond, transmutationStone, Block.blockGold, Block.blockGold, Block.blockGold, Block.blockGold); + RecipeHelper.addRecipe(new ItemStack(Block.blockGold, 4), transmutationStone, Block.blockDiamond); + + /* 1 Ender Pearl <-> 4 Iron Ingot */ + RecipeHelper.addRecipe(Item.enderPearl, transmutationStone, Item.ingotIron, Item.ingotIron, Item.ingotIron, Item.ingotIron); + RecipeHelper.addRecipe(new ItemStack(Item.ingotIron, 4), transmutationStone, Item.enderPearl); + } + + public static void initEquivalenceRecipes(ItemStack stone) { + int outputI; + + for (ArrayList itemStackList : EquivalencyHandler.instance().getAllLists()) { + ItemStack[] currentList = new ItemStack[itemStackList.size()]; + currentList = itemStackList.toArray(currentList); + + for (int i = 0; i < currentList.length; i++) { + outputI = (i == currentList.length - 1 ? 0 : i + 1); + + RecipeHelper.addRecipe(currentList[outputI], stone, GeneralHelper.convertSingleStackToPluralStacks(currentList[i])); + } + } + } + + public static void initReconstructiveRecipes(ItemStack stone) { + /* 3 Bone Meal --> 1 Bone */ + RecipeHelper.addRecipe(Item.bone, stone, dyeBoneMeal, dyeBoneMeal, dyeBoneMeal); + + /* 2 Blaze Powder --> 1 Blaze Rod */ + RecipeHelper.addRecipe(Item.blazeRod, stone, Item.blazePowder, Item.blazePowder); + } + + + public static void initDestructorRecipes(ItemStack stone) { + /* Smooth Stone -> Cobble Stone */ + RecipeHelper.addRecipe(Block.cobblestone, stone, Block.stone); + + /* Glass -> Sand */ + RecipeHelper.addRecipe(Block.sand, stone, Block.glass); + + /* Glowstone Block -> 4 Glowstone Dust */ + RecipeHelper.addRecipe(new ItemStack(Item.lightStoneDust, 4), stone, Block.glowStone); + + /* Brick Block -> 4 Bricks */ + RecipeHelper.addRecipe(new ItemStack(Item.brick, 4), stone, Block.brick); + } + + public static void initPortableSmeltingRecipes(ItemStack stone) { + Map furnaceMap = FurnaceRecipes.smelting().getSmeltingList(); + Map furnaceMetaMap = ObfuscationReflectionHelper.getPrivateValue(FurnaceRecipes.class, FurnaceRecipes.smelting(), "metaSmeltingList"); + + Iterator iterFurnaceKeyMap = furnaceMap.keySet().iterator(); + Iterator iterFurnaceMetaKeyMap = furnaceMetaMap.keySet().iterator(); + + Integer furnaceMapKey; + List furnaceMetaMapKey; + + ItemStack unSmeltedStack; + + while (iterFurnaceKeyMap.hasNext()) { + furnaceMapKey = (Integer) iterFurnaceKeyMap.next(); + unSmeltedStack = new ItemStack(furnaceMapKey, 1, 0); + + RecipeHelper.addSmeltingRecipe(unSmeltedStack, stone, anyCoal); + } + + while (iterFurnaceMetaKeyMap.hasNext()) { + furnaceMetaMapKey = (List)iterFurnaceMetaKeyMap.next(); + unSmeltedStack = new ItemStack((Integer)furnaceMetaMapKey.get(0), 1, (Integer)furnaceMetaMapKey.get(1)); + + RecipeHelper.addSmeltingRecipe(unSmeltedStack, stone, anyCoal); + } + } + + protected static void initEquivalencyList() { + EquivalencyHandler.instance().addObjects(Block.sand, Block.dirt, Block.cobblestone, Block.grass); + EquivalencyHandler.instance().addObjects(Block.plantYellow, Block.plantRed); + EquivalencyHandler.instance().addObjects(Block.mushroomRed, Block.mushroomBrown); + EquivalencyHandler.instance().addObjects(Item.pumpkinSeeds, Item.melonSeeds); + EquivalencyHandler.instance().addObjects(Block.pumpkin, Block.melon); + EquivalencyHandler.instance().addObjects(new ItemStack(Item.paper, 3), new ItemStack(Item.reed, 3)); + EquivalencyHandler.instance().addObjects(new ItemStack(Item.flint, 2), new ItemStack(Block.gravel, 2), new ItemStack(Block.sandStone, 2, 0), new ItemStack(Block.sandStone, 2, 1), new ItemStack(Block.sandStone, 2, 2)); + EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.planks, 4)); + EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.wood, 4)); + EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.sapling, 4)); + EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.leaves, 4)); + EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.tallGrass, 3)); + EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.cloth, 16)); + EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.stoneBrick, 4)); + EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Item.dyePowder, 16, 3, 4, 15)); + } + +} diff --git a/ee3_common/ee3/common/tile/TileCalcinator.java b/ee3_common/ee3/common/tile/TileCalcinator.java index 1b6d954f..87d26ac6 100644 --- a/ee3_common/ee3/common/tile/TileCalcinator.java +++ b/ee3_common/ee3/common/tile/TileCalcinator.java @@ -4,6 +4,7 @@ import ee3.common.block.ModBlocks; import net.minecraft.src.IInventory; import net.minecraft.src.ItemStack; import net.minecraft.src.NBTTagCompound; +import net.minecraft.src.NBTTagList; public class TileCalcinator extends TileEE implements IInventory { @@ -14,10 +15,35 @@ public class TileCalcinator extends TileEE implements IInventory { public void readFromNBT(NBTTagCompound nbtTagCompound) { super.readFromNBT(nbtTagCompound); + + // Read in the ItemStacks in the inventory from NBT + NBTTagList tagList = nbtTagCompound.getTagList("Items"); + this.calcinatorItemStacks = new ItemStack[this.getSizeInventory()]; + for (int i = 0; i < tagList.tagCount(); ++i) { + NBTTagCompound tagCompound = (NBTTagCompound)tagList.tagAt(i); + byte slot = tagCompound.getByte("Slot"); + if (slot >= 0 && slot < this.calcinatorItemStacks.length) { + this.calcinatorItemStacks[slot] = ItemStack.loadItemStackFromNBT(tagCompound); + } + } + } 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 < this.calcinatorItemStacks.length; ++currentIndex) { + if (this.calcinatorItemStacks[currentIndex] != null) { + NBTTagCompound tagCompound = new NBTTagCompound(); + tagCompound.setByte("Slot", (byte)currentIndex); + this.calcinatorItemStacks[currentIndex].writeToNBT(tagCompound); + tagList.appendTag(tagCompound); + } + } + nbtTagCompound.setTag("Items", tagList); + } /** @@ -57,7 +83,6 @@ public class TileCalcinator extends TileEE implements IInventory { return 64; } - public void openChest() { } public void closeChest() { } diff --git a/resources/ee3/art/gui/calcinator-moarfire.png b/resources/ee3/art/gui/calcinator-moarfire.png deleted file mode 100644 index a3986a42..00000000 Binary files a/resources/ee3/art/gui/calcinator-moarfire.png and /dev/null differ diff --git a/resources/ee3/art/gui/calcinator.png b/resources/ee3/art/gui/calcinator.png index f0427de5..444c09c1 100644 Binary files a/resources/ee3/art/gui/calcinator.png and b/resources/ee3/art/gui/calcinator.png differ diff --git a/resources/ee3/art/gui/xcf/calcinator_gui.xcf b/resources/ee3/art/gui/xcf/calcinator_gui.xcf new file mode 100644 index 00000000..25c27b60 Binary files /dev/null and b/resources/ee3/art/gui/xcf/calcinator_gui.xcf differ diff --git a/resources/ee3/art/sprite_sheet_template.xcf b/resources/ee3/art/sprite_sheet_template.xcf new file mode 100644 index 00000000..fdce0c29 Binary files /dev/null and b/resources/ee3/art/sprite_sheet_template.xcf differ diff --git a/resources/ee3/art/sprites/calcinator.png b/resources/ee3/art/sprites/calcinator.png index 6b56782d..f63038fb 100644 Binary files a/resources/ee3/art/sprites/calcinator.png and b/resources/ee3/art/sprites/calcinator.png differ diff --git a/resources/ee3/art/sprites/xcf/calcinator.xcf b/resources/ee3/art/sprites/xcf/calcinator.xcf new file mode 100644 index 00000000..44e10bad Binary files /dev/null and b/resources/ee3/art/sprites/xcf/calcinator.xcf differ diff --git a/resources/ee3/art/sprites/xcf/ee3_blocks.xcf b/resources/ee3/art/sprites/xcf/ee3_blocks.xcf new file mode 100644 index 00000000..8d09a991 Binary files /dev/null and b/resources/ee3/art/sprites/xcf/ee3_blocks.xcf differ diff --git a/resources/ee3/art/sprites/xcf/ee3_items.xcf b/resources/ee3/art/sprites/xcf/ee3_items.xcf new file mode 100644 index 00000000..821c52f7 Binary files /dev/null and b/resources/ee3/art/sprites/xcf/ee3_items.xcf differ diff --git a/resources/ee3/lang/en_US.xml b/resources/ee3/lang/en_US.xml index eb3ac0b2..b5f02cd4 100644 --- a/resources/ee3/lang/en_US.xml +++ b/resources/ee3/lang/en_US.xml @@ -2,14 +2,21 @@ English (US) Localization File + Extra + Release + Toggle + Charge Shard of Minium Minium Stone Philosopher's Stone Red Water (Still) Red Water (Flowing) Calcinator - Uninitialized - Current - Outdated - Connection Error + Calcinator + Initializing version check against the remote version authority file, located at + The version check did not complete successfully (version check did not initialize properly) + You are currently using the most up to date version for your version of Minecraft + You are currently using an out of date version; consider updating here - http://goo.gl/sNcGl + Error connecting to the remote version authority file (check your Internet connection?) + Remote version check disabled, skipping diff --git a/resources/ee3/lang/nl_NL.xml b/resources/ee3/lang/nl_NL.xml index b53f845d..e7dec311 100644 --- a/resources/ee3/lang/nl_NL.xml +++ b/resources/ee3/lang/nl_NL.xml @@ -2,14 +2,21 @@ Dutch (NL) Localization File + Extra + Ontlaad + Wissel + Opladen Minium Scherf Minium Steen Steen der Wijzen Rood Water (Stilstaand) Rood Water (Vloeiend) Calcinator - Ongestart - Huidig - Verouderd - Verbindingsfout + Calcinator + Initialisatie versiecontrole tegen extern versie bestand, te vinden op + De versiecontrole is niet geslaagd (versiecontrole niet correct gestart) + Je gebruikt momenteel de meest recente versie voor jouw Minecraft versie + Je gebruikt momenteel een verouderde versie; overweeg om up te daten - http://goo.gl/sNcGl + Fout bij het verbinden met het extern versiecontrole bestand (controleer je internetverbinding) + Externe versiecontrole uitgeschakeld, wordt overgeslagen diff --git a/resources/ee3/lang/ru_RU.xml b/resources/ee3/lang/ru_RU.xml index 4681acf6..6e1dc740 100644 --- a/resources/ee3/lang/ru_RU.xml +++ b/resources/ee3/lang/ru_RU.xml @@ -1,15 +1,22 @@ - - - - Russian (RU) Localization File - Осколок Миниума - Миниум - Философский Камень - Красная Вода (Стоящая) - Красная Вода (Текущая) - Кальцинатор - Неинициализированная - Текущая - Устаревшая - Ошибка подключения - + + + + Russian (RU) Localization File + Дополнительная функция + Выпуск + Переключение + Заряд + Осколок Сурика + Сурик + Философский Камень + Красная Вода (Стоящая) + Красная Вода (Текущая) + Кальцинатор + Кальцинатор + Инициализация проверки версии в удаленном файле, находящемся на + Проверка версии не была завершена успешно (проверка версии не инициализирована правильно) + Вы используете самую последнюю версию для вашей версии Minecraft + Вы используете устаревшую версию, обновите здесь - http://goo.gl/sNcGl + Ошибка подключения к удаленному файлу (проверьте подключение к Интернету) + Удаленная проверка версии отключена, пропуск +