diff options
Diffstat (limited to 'src/Java/gtPlusPlus')
4 files changed, 164 insertions, 139 deletions
diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index 6ba9453467..909d87fe57 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -30,53 +30,57 @@ public class BaseItemDust extends Item{ protected String materialName; protected String pileType; String name = ""; - private final int mTier; - private final Material dustInfo; + private int mTier; + private Material dustInfo; - public BaseItemDust(final String unlocalizedName, final String materialName, final Material matInfo, final int colour, final String pileSize, final int tier, final int sRadioactivity){ - this(unlocalizedName, materialName, matInfo, colour, pileSize, tier, sRadioactivity, true); + public BaseItemDust(final String unlocalizedName, final String materialName, final Material matInfo, final int colour, final String pileSize, final int tier){ + this(unlocalizedName, materialName, matInfo, colour, pileSize, tier, true); } - public BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, int sRadioactivity, boolean addRecipes) { - this.setUnlocalizedName(unlocalizedName); - this.setMaxStackSize(64); - this.setTextureName(this.getCorrectTexture(pileSize)); - - this.setCreativeTab(tabMisc); - this.colour = colour; - this.mTier = tier; - this.materialName = materialName; - this.dustInfo = matInfo; - this.sRadiation = sRadioactivity; - GameRegistry.registerItem(this, unlocalizedName); - - String temp = ""; - Logger.WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); - if (this.getUnlocalizedName().contains("item.")){ - temp = this.getUnlocalizedName().replace("item.", ""); - Logger.WARNING("Generating OreDict Name: "+temp); - } - else { - temp = this.getUnlocalizedName(); - } - if (temp.contains("DustTiny")){ - temp = temp.replace("itemD", "d"); - Logger.WARNING("Generating OreDict Name: "+temp); - } - else if (temp.contains("DustSmall")){ - temp = temp.replace("itemD", "d"); - Logger.WARNING("Generating OreDict Name: "+temp); - } - else { - temp = temp.replace("itemD", "d"); - Logger.WARNING("Generating OreDict Name: "+temp); - } - if ((temp != null) && !temp.equals("")){ - GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); + public BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, boolean addRecipes) { + try { + this.setUnlocalizedName(unlocalizedName); + this.setMaxStackSize(64); + + this.setCreativeTab(tabMisc); + this.colour = colour; + this.mTier = tier; + this.materialName = materialName; + this.dustInfo = matInfo; + this.setTextureName(this.getCorrectTexture(pileSize)); + GameRegistry.registerItem(this, unlocalizedName); + + String temp = ""; + Logger.WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); + if (this.getUnlocalizedName().contains("item.")){ + temp = this.getUnlocalizedName().replace("item.", ""); + Logger.WARNING("Generating OreDict Name: "+temp); + } + else { + temp = this.getUnlocalizedName(); + } + if (temp.contains("DustTiny")){ + temp = temp.replace("itemD", "d"); + Logger.WARNING("Generating OreDict Name: "+temp); + } + else if (temp.contains("DustSmall")){ + temp = temp.replace("itemD", "d"); + Logger.WARNING("Generating OreDict Name: "+temp); + } + else { + temp = temp.replace("itemD", "d"); + Logger.WARNING("Generating OreDict Name: "+temp); + } + if ((temp != null) && !temp.equals("")){ + GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); + } + if (addRecipes){ + this.addFurnaceRecipe(); + this.addMacerationRecipe(); + } } - if (addRecipes){ - this.addFurnaceRecipe(); - this.addMacerationRecipe(); + catch (Throwable t) { + t.printStackTrace(); } } @@ -88,13 +92,15 @@ public class BaseItemDust extends Item{ this.setTextureName(CORE.MODID + ":" + "dust"+pileSize); } } + + if (pileSize.toLowerCase().contains("small")){ - return "gregtech" + ":" + "materialicons/METALLIC/dustSmall"; + return "gregtech" + ":" + "materialicons/"+this.dustInfo.getTextureSet().mSetName+"/dustSmall"; } else if (pileSize.toLowerCase().contains("tiny")){ - return "gregtech" + ":" + "materialicons/METALLIC/dustTiny"; + return "gregtech" + ":" + "materialicons/"+this.dustInfo.getTextureSet().mSetName+"/dustTiny"; } - return "gregtech" + ":" + "materialicons/METALLIC/dust"; + return "gregtech" + ":" + "materialicons/"+this.dustInfo.getTextureSet().mSetName+"/dust"; } @Override @@ -108,43 +114,37 @@ public class BaseItemDust extends Item{ return unlocal; } - /*if (this.getUnlocalizedName().contains("DustTiny")){ - this.name = "Tiny Pile of "+this.materialName + " Dust"; - } - else if (this.getUnlocalizedName().contains("DustSmall")){ - this.name = "Small Pile of "+this.materialName + " Dust"; - } - else { - this.name = this.materialName + " Dust"; - } - return this.name;*/ } - protected final int sRadiation; @Override public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - - if (this.dustInfo != null){ - if (entityHolding instanceof EntityPlayer){ - if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.dustInfo.vRadiationLevel, world, entityHolding); + + try { + if (this.dustInfo != null){ + if (entityHolding instanceof EntityPlayer){ + if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ + EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.dustInfo.vRadiationLevel, world, entityHolding); + } } - } + } } - + catch (Throwable t) { + t.printStackTrace(); + } + } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (stack.getDisplayName().equalsIgnoreCase("fluorite")){ + if (stack.getDisplayName().toLowerCase().contains("fluorite")){ list.add("Mined from Sandstone and Limestone."); } if (this.dustInfo != null){ list.add(this.dustInfo.vChemicalFormula); } - if (this.sRadiation > 0){ + if (this.dustInfo.vRadiationLevel > 0){ list.add(CORE.GT_Tooltip_Radioactive); } @@ -168,60 +168,82 @@ public class BaseItemDust extends Item{ private void addMacerationRecipe(){ - Logger.MATERIALS("Adding Maceration recipe for "+this.materialName+" Ingot -> Dusts"); - final int chance = (this.mTier*10)/MathUtils.randInt(10, 20); - GT_ModHandler.addPulverisationRecipe(dustInfo.getIngot(1), dustInfo.getDust(1), null, chance); - + try { + Logger.MATERIALS("Adding Maceration recipe for "+this.materialName+" Ingot -> Dusts"); + final int chance = (this.mTier*10)/MathUtils.randInt(10, 20); + GT_ModHandler.addPulverisationRecipe(dustInfo.getIngot(1), dustInfo.getDust(1), null, chance); + } + catch (Throwable t) { + t.printStackTrace(); + } + } private void addFurnaceRecipe(){ ItemStack aDust = dustInfo.getDust(1); ItemStack aOutput; - - if (this.dustInfo.requiresBlastFurnace()) { - aOutput = dustInfo.getHotIngot(1); - if (addBlastFurnaceRecipe(aDust, null, aOutput, null, dustInfo.getMeltingPointK())){ - Logger.MATERIALS("Successfully added a blast furnace recipe for "+this.materialName); + try { + if (this.dustInfo.requiresBlastFurnace()) { + aOutput = dustInfo.getHotIngot(1); + if (aOutput != null) { + if (addBlastFurnaceRecipe(aDust, null, aOutput, null, dustInfo.getMeltingPointK())){ + Logger.MATERIALS("Successfully added a blast furnace recipe for "+this.materialName); + } + else { + Logger.MATERIALS("Failed to add a blast furnace recipe for "+this.materialName); + } + } + else { + Logger.MATERIALS("Failed to add a blast furnace recipe for "+this.materialName); + } } else { - Logger.MATERIALS("Failed to add a blast furnace recipe for "+this.materialName); - } + aOutput = dustInfo.getIngot(1); + if (aOutput != null) { + if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(aDust, aOutput)){ + Logger.MATERIALS("Successfully added a furnace recipe for "+this.materialName); + } + else { + Logger.MATERIALS("Failed to add a furnace recipe for "+this.materialName); + } + } + } } - else { - aOutput = dustInfo.getIngot(1); - if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(aDust, aOutput)){ - Logger.MATERIALS("Successfully added a furnace recipe for "+this.materialName); - } - else { - Logger.MATERIALS("Failed to add a furnace recipe for "+this.materialName); - } + catch (Throwable t) { + t.printStackTrace(); } - + } private boolean addBlastFurnaceRecipe(final ItemStack input1, final ItemStack input2, final ItemStack output1, final ItemStack output2, final int tempRequired){ - int timeTaken = 125*this.mTier*10; + try { + int timeTaken = 125*this.mTier*10; - if (this.mTier <= 4){ - timeTaken = 25*this.mTier*10; - } - int aSlot = mTier - 2; - if (aSlot < 2) { - aSlot = 2; + if (this.mTier <= 4){ + timeTaken = 25*this.mTier*10; + } + int aSlot = mTier - 2; + if (aSlot < 2) { + aSlot = 2; + } + long aVoltage = GT_Values.V[aSlot >= 2 ? aSlot : 2]; + + return GT_Values.RA.addBlastRecipe( + input1, + input2, + GT_Values.NF, GT_Values.NF, + output1, + output2, + timeTaken, + (int) aVoltage, + tempRequired); + } + catch (Throwable t) { + t.printStackTrace(); + return false; } - long aVoltage = GT_Values.V[aSlot >= 2 ? aSlot : 2]; - - return GT_Values.RA.addBlastRecipe( - input1, - input2, - GT_Values.NF, GT_Values.NF, - output1, - output2, - timeTaken, - (int) aVoltage, - tempRequired); diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java index 23aa162610..01353a71d9 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java +++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java @@ -108,9 +108,9 @@ public class MaterialGenerator { tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); temp = new BaseItemIngot(matInfo); - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation); + temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier); + temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier); + temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier); temp = new BaseItemNugget(matInfo); temp = new BaseItemPlate(matInfo); temp = new BaseItemRod(matInfo); @@ -124,9 +124,9 @@ public class MaterialGenerator { if (hotIngot){ temp = new BaseItemIngotHot(matInfo); } - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation); + temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier); + temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier); + temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier); temp = new BaseItemNugget(matInfo); temp = new BaseItemPlate(matInfo); temp = new BaseItemPlateDouble(matInfo); @@ -142,9 +142,9 @@ public class MaterialGenerator { tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); temp = new BaseItemIngot(matInfo); - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation); + temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier); + temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier); + temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier); temp = new BaseItemNugget(matInfo); temp = new BaseItemPlate(matInfo); temp = new BaseItemPlateDouble(matInfo); @@ -155,9 +155,9 @@ public class MaterialGenerator { tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); } temp = new BaseItemIngot(matInfo); - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation); + temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier); + temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier); + temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier); temp = new BaseItemNugget(matInfo); temp = new BaseItemPlate(matInfo); temp = new BaseItemPlateDouble(matInfo); @@ -211,9 +211,9 @@ public class MaterialGenerator { } if (matInfo.getState() == MaterialState.SOLID){ - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation, false); - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation, false); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation, false); + temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, false); + temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, false); + temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, false); } //Add A jillion Recipes - old code @@ -247,13 +247,13 @@ public class MaterialGenerator { } tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", 3, sRadiation); - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", 2, sRadiation); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", 1, sRadiation); + temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", 3); + temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", 2); + temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", 1); temp = new BaseItemIngot(matInfo); temp = new BaseItemNugget(matInfo); - + if (generatePlates) { temp = new BaseItemPlate(matInfo); temp = new BaseItemPlateDouble(matInfo); @@ -266,7 +266,7 @@ public class MaterialGenerator { new RecipeGen_Fluids(matInfo); new RecipeGen_MaterialProcessing(matInfo); new RecipeGen_DustGeneration(matInfo, true); - new RecipeGen_Recycling(matInfo); + new RecipeGen_Recycling(matInfo); } catch (final Throwable t){ Logger.MATERIALS(""+matInfo.getLocalizedName()+" failed to generate."); @@ -308,11 +308,11 @@ public class MaterialGenerator { } if (generateDust) { - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", matInfo.vTier, sRadiation, false); + temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", matInfo.vTier, false); } if (generateSmallTinyDusts) { - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", matInfo.vTier, sRadiation, false); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", matInfo.vTier, sRadiation, false); + temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", matInfo.vTier, false); + temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", matInfo.vTier, false); } temp = new BaseItemCrushedOre(matInfo); diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index cf9cc22eb8..219dbc2ca5 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -923,13 +923,14 @@ public class RECIPES_GREGTECH { FluidUtils.getFluidStack("chlorine", 2400), ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 3), ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 4), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 5), chances, 30 * 20, 240); - chances = new int[]{9000, 7500, 1000}; - GT_Values.RA.addChemicalBathRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustRutile", 10), - FluidUtils.getFluidStack("chlorine", 3000), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 5), - ItemUtils.getItemStackOfAmountFromOreDict("dustHafnium", 4), - ItemUtils.getItemStackOfAmountFromOreDict("dustTitanium", 1), chances, 30 * 20, 240); + ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 5), chances, 30 * 20, 480); + chances = new int[]{9000, 3000, 1000}; + GT_Values.RA.addChemicalBathRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustRutile", 5), + FluidUtils.getFluidStack("chlorine", 4000), + ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 3), + ItemUtils.getItemStackOfAmountFromOreDict("dustTitanium", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustHafnium", 1), + chances, 30 * 20, 1024); GT_Values.RA.addChemicalBathRecipe(FLUORIDES.FLUORITE.getCrushed(2), FluidUtils.getFluidStack("hydrogen", 2000), FLUORIDES.FLUORITE.getCrushedPurified(8), FLUORIDES.FLUORITE.getDustImpure(4), @@ -1184,7 +1185,7 @@ public class RECIPES_GREGTECH { ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1), ItemUtils.getItemStackOfAmountFromOreDict("dustHafnium", 1), ItemUtils.getItemStackOfAmountFromOreDict("dustHafnium", 1) }, - new int[] { 5000, 2500, 1000, 1000, 1000, 1000 }, 20 * 30, 500); + new int[] { 5000, 2500, 1000, 1000, 300, 300 }, 20 * 30, 500); // Zirconium GT_Values.RA.addSifterRecipe(ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedTin", 1), diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index fdc50bf269..27ba5c2733 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -263,13 +263,15 @@ public class ItemUtils { public static ItemStack getItemStackOfAmountFromOreDict(final String oredictName, final int amount){ String mTemp = oredictName; - //Banned Materials and replacements for GT5.8 compat. + //Banned Materials and replacements for GT5.8 compat. + if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { if (oredictName.toLowerCase().contains("rutile")){ mTemp = oredictName.replace("Rutile", "Titanium"); } if (oredictName.toLowerCase().contains("vanadiumsteel")){ mTemp = oredictName.replace("VanadiumSteel", "StainlessSteel"); } + } final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(mTemp); if (!oreDictList.isEmpty()){ final ItemStack returnValue = oreDictList.get(0).copy(); @@ -331,9 +333,9 @@ public class ItemUtils { public static Item[] generateDusts(final String unlocalizedName, final String materialName, final int materialTier, final Material matInfo, final int Colour){ final int radioactive = getRadioactivityLevel(materialName); final Item[] output = { - new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, radioactive), - new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, radioactive), - new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, radioactive)}; + new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier), + new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier), + new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier)}; return output; } |