From 769a8a8e0c1bff204d094cbeff299936bbbfba80 Mon Sep 17 00:00:00 2001 From: "Aidan C. Brady" Date: Sat, 18 Jan 2014 11:26:24 -0500 Subject: [PATCH] Work on things! --- .../nei/AdvancedMachineRecipeHandler.java | 32 +++++++----- .../render/block/BasicRenderingHandler.java | 4 +- .../common/integration/MekanismHooks.java | 51 +++++++++---------- .../common/integration/OreDictManager.java | 36 +++++++++---- .../mekanism/common/recipe/RecipeHandler.java | 2 +- 5 files changed, 73 insertions(+), 52 deletions(-) diff --git a/common/mekanism/client/nei/AdvancedMachineRecipeHandler.java b/common/mekanism/client/nei/AdvancedMachineRecipeHandler.java index ff9eaa07e..71c7ec548 100644 --- a/common/mekanism/client/nei/AdvancedMachineRecipeHandler.java +++ b/common/mekanism/client/nei/AdvancedMachineRecipeHandler.java @@ -47,11 +47,16 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler @Override public void drawExtras(int i) { - /*float f = ticksPassed >= 20 && ticksPassed < 40 ? (ticksPassed - 20) % 20 / 20.0F : 1.0F; + CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i); + + float f = ticksPassed >= 20 ? (ticksPassed - 20) % 20 / 20.0F : 0; drawProgressBar(63, 34, 176, 0, 24, 7, f, 0); - int displayInt = ticksPassed < 20 ? (); - displayGauge(61, 37 + 12 - displayInt, 6, displayInt, tileEntity.gasTank.getGas());*/ + if(recipe.input.gasType != null) + { + int displayInt = ticksPassed < 20 ? ticksPassed*12 / 20 : 12; + displayGauge(45, 32 + 12 - displayInt, 6, displayInt, new GasStack(recipe.input.gasType, 1)); + } } @Override @@ -128,11 +133,12 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) { Point point = GuiDraw.getMousePosition(); + Point offset = gui.getRecipePosition(recipe); - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); + int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft)-offset.x; + int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop)-offset.y; - if(xAxis >= 61 && xAxis <= 67 && yAxis >= 37+13 && yAxis <= 49+13) + if(xAxis >= 45 && xAxis <= 51 && yAxis >= 33 && yAxis <= 45) { currenttip.add(((CachedIORecipe)arecipes.get(recipe)).input.gasType.getLocalizedName()); } @@ -144,13 +150,14 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) { Point point = GuiDraw.getMousePosition(); + Point offset = gui.getRecipePosition(recipe); - int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); + int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft)-offset.x; + int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop)-offset.y; GasStack stack = null; - if(xAxis >= 61 && xAxis <= 67 && yAxis >= 37+13 && yAxis <= 49+13) + if(xAxis >= 45 && xAxis <= 51 && yAxis >= 33 && yAxis <= 45) { stack = new GasStack(((CachedIORecipe)arecipes.get(recipe)).input.gasType, 1); } @@ -180,13 +187,14 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler public boolean mouseClicked(GuiRecipe gui, int button, int recipe) { Point point = GuiDraw.getMousePosition(); + Point offset = gui.getRecipePosition(recipe); - int xAxis = point.x - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); - int yAxis = point.y - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); + int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft)-offset.x; + int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop)-offset.y; GasStack stack = null; - if(xAxis >= 61 && xAxis <= 67 && yAxis >= 37+13 && yAxis <= 49+13) + if(xAxis >= 45 && xAxis <= 51 && yAxis >= 33 && yAxis <= 45) { stack = new GasStack(((CachedIORecipe)arecipes.get(recipe)).input.gasType, 1); } diff --git a/common/mekanism/client/render/block/BasicRenderingHandler.java b/common/mekanism/client/render/block/BasicRenderingHandler.java index ea510d9c6..64d6bdd83 100644 --- a/common/mekanism/client/render/block/BasicRenderingHandler.java +++ b/common/mekanism/client/render/block/BasicRenderingHandler.java @@ -22,7 +22,7 @@ public class BasicRenderingHandler implements ISimpleBlockRenderingHandler GL11.glPushMatrix(); GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); - if(block.blockID == Mekanism.basicBlockID) + if(block.blockID == Mekanism.basicBlockID || block.blockID == Mekanism.basicBlock2ID) { MekanismRenderer.renderItem(renderer, metadata, block); } @@ -33,7 +33,7 @@ public class BasicRenderingHandler implements ISimpleBlockRenderingHandler @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - if(block.blockID == Mekanism.basicBlockID) + if(block.blockID == Mekanism.basicBlockID || block.blockID == Mekanism.basicBlock2ID) { int metadata = world.getBlockMetadata(x, y, z); diff --git a/common/mekanism/common/integration/MekanismHooks.java b/common/mekanism/common/integration/MekanismHooks.java index 7191af15c..0b1cc7dfe 100644 --- a/common/mekanism/common/integration/MekanismHooks.java +++ b/common/mekanism/common/integration/MekanismHooks.java @@ -57,6 +57,30 @@ public final class MekanismHooks if(IC2Loaded) { + for(Map.Entry entry : Recipes.macerator.getRecipes().entrySet()) + { + if(!entry.getKey().getInputs().isEmpty()) + { + List names = MekanismUtils.getOreDictName(entry.getKey().getInputs().get(0)); + + for(String name : names) + { + boolean did = false; + + if(name.startsWith("ingot")) + { + RecipeHandler.addCrusherRecipe(entry.getKey().getInputs().get(0), entry.getValue().items.get(0)); + did = true; + } + + if(did) + { + break; + } + } + } + } + try { Recipes.macerator.addRecipe(new RecipeInputOreDict("oreOsmium"), null, new ItemStack(Mekanism.Dust, 2, 2)); } catch(Exception e) {} @@ -77,33 +101,6 @@ public final class MekanismHooks Recipes.macerator.addRecipe(new RecipeInputOreDict("clumpSilver"), null, new ItemStack(Mekanism.DirtyDust, 1, 5)); } catch(Exception e) {} - for(Map.Entry entry : Recipes.macerator.getRecipes().entrySet()) - { - if(!entry.getKey().getInputs().isEmpty()) - { - List names = MekanismUtils.getOreDictName(entry.getKey().getInputs().get(0)); - - for(String name : names) - { - boolean did = false; - - if(name.startsWith("ingot")) - { - if(!Recipe.CRUSHER.containsRecipe(entry.getKey().getInputs().get(0))) - { - RecipeHandler.addCrusherRecipe(entry.getKey().getInputs().get(0), entry.getValue().items.get(0)); - did = true; - } - } - - if(did) - { - break; - } - } - } - } - NBTTagCompound tag = new NBTTagCompound(); tag.setInteger("amplification", 50000); diff --git a/common/mekanism/common/integration/OreDictManager.java b/common/mekanism/common/integration/OreDictManager.java index f028ecdd5..464e128bb 100644 --- a/common/mekanism/common/integration/OreDictManager.java +++ b/common/mekanism/common/integration/OreDictManager.java @@ -4,6 +4,8 @@ import ic2.api.recipe.RecipeInputOreDict; import ic2.api.recipe.Recipes; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import mekanism.api.ChanceOutput; import mekanism.api.gas.GasRegistry; @@ -263,6 +265,23 @@ public final class OreDictManager RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Shard, 4, 7)); } + for(ItemStack ore : OreDictionary.getOres("oreNickel")) + { + try { + RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), StackUtils.size(OreDictionary.getOres("dustNickel").get(0), 2)); + } catch(Exception e) {} + } + + for(ItemStack ore : OreDictionary.getOres("ingotCopper")) + { + RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Dust, 1, 6)); + } + + for(ItemStack ore : OreDictionary.getOres("ingotTin")) + { + RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Dust, 1, 7)); + } + for(ItemStack ore : OreDictionary.getOres("ingotLead")) { RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Dust, 1, 9)); @@ -293,6 +312,13 @@ public final class OreDictManager RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(Item.glowstone)); } + for(ItemStack ore : OreDictionary.getOres("ingotNickel")) + { + try { + RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), StackUtils.size(OreDictionary.getOres("dustNickel").get(0), 1)); + } catch(Exception e) {} + } + try { RecipeHandler.addCrusherRecipe(new ItemStack(Mekanism.Ingot, 1, 2), MekanismUtils.size(OreDictionary.getOres("dustBronze").get(0), 1)); @@ -318,16 +344,6 @@ public final class OreDictManager RecipeHandler.addCrusherRecipe(new ItemStack(Item.coal, 1, 1), MekanismUtils.size(OreDictionary.getOres("dustCharcoal").get(0), 1)); } catch(Exception e) {} - for(ItemStack ore : OreDictionary.getOres("ingotCopper")) - { - RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Dust, 1, 6)); - } - - for(ItemStack ore : OreDictionary.getOres("ingotTin")) - { - RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(Mekanism.Dust, 1, 7)); - } - try { for(ItemStack ore : OreDictionary.getOres("ingotSilver")) { diff --git a/common/mekanism/common/recipe/RecipeHandler.java b/common/mekanism/common/recipe/RecipeHandler.java index 45eab6f26..ac0f50ea5 100644 --- a/common/mekanism/common/recipe/RecipeHandler.java +++ b/common/mekanism/common/recipe/RecipeHandler.java @@ -420,7 +420,7 @@ public final class RecipeHandler return true; } } - if(entry.getKey() instanceof FluidStack) + else if(entry.getKey() instanceof FluidStack) { if(((FluidStack)entry.getKey()).isFluidEqual(input)) {