diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2017-03-04 12:58:47 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2017-03-04 12:58:47 +1000 |
commit | ae21012d216df71f31aed6fbc9d76215fc24ceed (patch) | |
tree | cc89accbe6ce5c04b72ed3c5e46b2a185f88be6a /src/Java | |
parent | ba89972a22a316030f8c3bd99974f915b1d7aefc (diff) | |
download | GT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.tar.gz GT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.tar.bz2 GT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.zip |
+ New texture for the slow builders ring.
+ Added the Alkalus Disk.
$ Fixed Frame Box Assembler Recipes.
$ Fixed Missing 7Li material.
$ Fixed Tiered Tanks not showing their capacity in the tooltip.
$ Fixed tooltips for alloys containing Bronze or Steel.
$ Fixed Clay Pipe Extruder Recipes.
- Removed a handful of Plasma cells for misc. materials.
% Changed the Industrial Coke Oven's tooltip, to better describe the input/output requirements.
% Cleaned up The Entire Project.
Diffstat (limited to 'src/Java')
442 files changed, 29505 insertions, 27356 deletions
diff --git a/src/Java/gregtech/api/util/CustomRecipeMap.java b/src/Java/gregtech/api/util/CustomRecipeMap.java index ad3ecc2943..d2149bd332 100644 --- a/src/Java/gregtech/api/util/CustomRecipeMap.java +++ b/src/Java/gregtech/api/util/CustomRecipeMap.java @@ -1,263 +1,315 @@ package gregtech.api.util; import static gregtech.api.enums.GT_Values.*; -import gregtech.api.GregTech_API; -import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; -import gregtech.api.objects.GT_ItemStack; import java.util.*; +import gregtech.api.GregTech_API; +import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; +import gregtech.api.objects.GT_ItemStack; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; public class CustomRecipeMap/* extends GT_Recipe_Map*/{ - /** - * Contains all Recipe Maps - */ - public static final Collection<CustomRecipeMap> sMappings = new ArrayList<CustomRecipeMap>(); + /** + * Contains all Recipe Maps + */ + public static final Collection<CustomRecipeMap> sMappings = new ArrayList<>(); + + //public static final CustomRecipeMap sOreWasherRecipes = new GT_Recipe_Map_OreWasher(new HashSet<GT_Recipe>(0), "ic.recipe.orewasher", "Ore Washer", "ic2.blockOreWashingPlant", RES_PATH_GUI + "basicmachines/OreWasher", 1, 3, 1, 1, 1, E, 1, E, true, false); + //Fission Fuel Plant Recipes + public static final CustomRecipeMap sFissionFuelProcessing = new CustomRecipeMap(new HashSet<GT_Recipe>(50), "gt.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 9, 1, E, 1, E, true, true); - //public static final CustomRecipeMap sOreWasherRecipes = new GT_Recipe_Map_OreWasher(new HashSet<GT_Recipe>(0), "ic.recipe.orewasher", "Ore Washer", "ic2.blockOreWashingPlant", RES_PATH_GUI + "basicmachines/OreWasher", 1, 3, 1, 1, 1, E, 1, E, true, false); - //Fission Fuel Plant Recipes - public static final CustomRecipeMap sFissionFuelProcessing = new CustomRecipeMap(new HashSet<GT_Recipe>(50), "gt.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 9, 1, E, 1, E, true, true); - - /** - * HashMap of Recipes based on their Items - */ - public final Map<GT_ItemStack, Collection<GT_Recipe>> mRecipeItemMap = new HashMap<GT_ItemStack, Collection<GT_Recipe>>(); - /** - * HashMap of Recipes based on their Fluids - */ - public final Map<Fluid, Collection<GT_Recipe>> mRecipeFluidMap = new HashMap<Fluid, Collection<GT_Recipe>>(); - /** - * The List of all Recipes - */ - public final Collection<GT_Recipe> mRecipeList; - /** - * String used as an unlocalised Name. - */ - public final String mUnlocalizedName; - /** - * String used in NEI for the Recipe Lists. If null it will use the unlocalised Name instead - */ - public final String mNEIName; - /** - * GUI used for NEI Display. Usually the GUI of the Machine itself - */ - public final String mNEIGUIPath; - public final String mNEISpecialValuePre, mNEISpecialValuePost; - public final int mUsualInputCount, mUsualOutputCount, mNEISpecialValueMultiplier, mMinimalInputItems, mMinimalInputFluids, mAmperage; - public final boolean mNEIAllowed, mShowVoltageAmperageInNEI; + /** + * HashMap of Recipes based on their Items + */ + public final Map<GT_ItemStack, Collection<GT_Recipe>> mRecipeItemMap = new HashMap<>(); + /** + * HashMap of Recipes based on their Fluids + */ + public final Map<Fluid, Collection<GT_Recipe>> mRecipeFluidMap = new HashMap<>(); + /** + * The List of all Recipes + */ + public final Collection<GT_Recipe> mRecipeList; + /** + * String used as an unlocalised Name. + */ + public final String mUnlocalizedName; + /** + * String used in NEI for the Recipe Lists. If null it will use the unlocalised Name instead + */ + public final String mNEIName; + /** + * GUI used for NEI Display. Usually the GUI of the Machine itself + */ + public final String mNEIGUIPath; + public final String mNEISpecialValuePre, mNEISpecialValuePost; + public final int mUsualInputCount, mUsualOutputCount, mNEISpecialValueMultiplier, mMinimalInputItems, mMinimalInputFluids, mAmperage; + public final boolean mNEIAllowed, mShowVoltageAmperageInNEI; - /** - * Initialises a new type of Recipe Handler. - * - * @param aRecipeList a List you specify as Recipe List. Usually just an ArrayList with a pre-initialised Size. - * @param aUnlocalizedName the unlocalised Name of this Recipe Handler, used mainly for NEI. - * @param aLocalName the displayed Name inside the NEI Recipe GUI. - * @param aNEIGUIPath the displayed GUI Texture, usually just a Machine GUI. Auto-Attaches ".png" if forgotten. - * @param aUsualInputCount the usual amount of Input Slots this Recipe Class has. - * @param aUsualOutputCount the usual amount of Output Slots this Recipe Class has. - * @param aNEISpecialValuePre the String in front of the Special Value in NEI. - * @param aNEISpecialValueMultiplier the Value the Special Value is getting Multiplied with before displaying - * @param aNEISpecialValuePost the String after the Special Value. Usually for a Unit or something. - * @param aNEIAllowed if NEI is allowed to display this Recipe Handler in general. - */ - public CustomRecipeMap(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { - //super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); - sMappings.add(this); - mNEIAllowed = aNEIAllowed; - mShowVoltageAmperageInNEI = aShowVoltageAmperageInNEI; - mRecipeList = aRecipeList; - mNEIName = aNEIName == null ? aUnlocalizedName : aNEIName; - mNEIGUIPath = aNEIGUIPath.endsWith(".png") ? aNEIGUIPath : aNEIGUIPath + ".png"; - mNEISpecialValuePre = aNEISpecialValuePre; - mNEISpecialValueMultiplier = aNEISpecialValueMultiplier; - mNEISpecialValuePost = aNEISpecialValuePost; - mAmperage = aAmperage; - mUsualInputCount = aUsualInputCount; - mUsualOutputCount = aUsualOutputCount; - mMinimalInputItems = aMinimalInputItems; - mMinimalInputFluids = aMinimalInputFluids; - GregTech_API.sFluidMappings.add(mRecipeFluidMap); - GregTech_API.sItemStackMappings.add(mRecipeItemMap); - GT_LanguageManager.addStringLocalization(mUnlocalizedName = aUnlocalizedName, aLocalName); - } + /** + * Initialises a new type of Recipe Handler. + * + * @param aRecipeList a List you specify as Recipe List. Usually just an ArrayList with a pre-initialised Size. + * @param aUnlocalizedName the unlocalised Name of this Recipe Handler, used mainly for NEI. + * @param aLocalName the displayed Name inside the NEI Recipe GUI. + * @param aNEIGUIPath the displayed GUI Texture, usually just a Machine GUI. Auto-Attaches ".png" if forgotten. + * @param aUsualInputCount the usual amount of Input Slots this Recipe Class has. + * @param aUsualOutputCount the usual amount of Output Slots this Recipe Class has. + * @param aNEISpecialValuePre the String in front of the Special Value in NEI. + * @param aNEISpecialValueMultiplier the Value the Special Value is getting Multiplied with before displaying + * @param aNEISpecialValuePost the String after the Special Value. Usually for a Unit or something. + * @param aNEIAllowed if NEI is allowed to display this Recipe Handler in general. + */ + public CustomRecipeMap(final Collection<GT_Recipe> aRecipeList, final String aUnlocalizedName, final String aLocalName, final String aNEIName, final String aNEIGUIPath, final int aUsualInputCount, final int aUsualOutputCount, final int aMinimalInputItems, final int aMinimalInputFluids, final int aAmperage, final String aNEISpecialValuePre, final int aNEISpecialValueMultiplier, final String aNEISpecialValuePost, final boolean aShowVoltageAmperageInNEI, final boolean aNEIAllowed) { + //super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + sMappings.add(this); + this.mNEIAllowed = aNEIAllowed; + this.mShowVoltageAmperageInNEI = aShowVoltageAmperageInNEI; + this.mRecipeList = aRecipeList; + this.mNEIName = aNEIName == null ? aUnlocalizedName : aNEIName; + this.mNEIGUIPath = aNEIGUIPath.endsWith(".png") ? aNEIGUIPath : aNEIGUIPath + ".png"; + this.mNEISpecialValuePre = aNEISpecialValuePre; + this.mNEISpecialValueMultiplier = aNEISpecialValueMultiplier; + this.mNEISpecialValuePost = aNEISpecialValuePost; + this.mAmperage = aAmperage; + this.mUsualInputCount = aUsualInputCount; + this.mUsualOutputCount = aUsualOutputCount; + this.mMinimalInputItems = aMinimalInputItems; + this.mMinimalInputFluids = aMinimalInputFluids; + GregTech_API.sFluidMappings.add(this.mRecipeFluidMap); + GregTech_API.sItemStackMappings.add(this.mRecipeItemMap); + GT_LanguageManager.addStringLocalization(this.mUnlocalizedName = aUnlocalizedName, aLocalName); + } - public GT_Recipe addRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addRecipe(new GT_Recipe(aOptimize, aInputs, aOutputs, aSpecial, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); - } + public GT_Recipe addRecipe(final boolean aOptimize, final ItemStack[] aInputs, final ItemStack[] aOutputs, final Object aSpecial, final int[] aOutputChances, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { + return this.addRecipe(new GT_Recipe(aOptimize, aInputs, aOutputs, aSpecial, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); + } - public GT_Recipe addRecipe(int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addRecipe(new GT_Recipe(false, null, null, null, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue), false, false, false); - } + public GT_Recipe addRecipe(final int[] aOutputChances, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { + return this.addRecipe(new GT_Recipe(false, null, null, null, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue), false, false, false); + } - public GT_Recipe addRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addRecipe(new GT_Recipe(aOptimize, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); - } + public GT_Recipe addRecipe(final boolean aOptimize, final ItemStack[] aInputs, final ItemStack[] aOutputs, final Object aSpecial, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { + return this.addRecipe(new GT_Recipe(aOptimize, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); + } - public GT_Recipe addRecipe(GT_Recipe aRecipe) { - return addRecipe(aRecipe, true, false, false); - } + public GT_Recipe addRecipe(final GT_Recipe aRecipe) { + return this.addRecipe(aRecipe, true, false, false); + } - protected GT_Recipe addRecipe(GT_Recipe aRecipe, boolean aCheckForCollisions, boolean aFakeRecipe, boolean aHidden) { - aRecipe.mHidden = aHidden; - aRecipe.mFakeRecipe = aFakeRecipe; - if (aRecipe.mFluidInputs.length < mMinimalInputFluids && aRecipe.mInputs.length < mMinimalInputItems) - return null; - if (aCheckForCollisions && findRecipe(null, false, Long.MAX_VALUE, aRecipe.mFluidInputs, aRecipe.mInputs) != null) - return null; - return add(aRecipe); - } + protected GT_Recipe addRecipe(final GT_Recipe aRecipe, final boolean aCheckForCollisions, final boolean aFakeRecipe, final boolean aHidden) { + aRecipe.mHidden = aHidden; + aRecipe.mFakeRecipe = aFakeRecipe; + if ((aRecipe.mFluidInputs.length < this.mMinimalInputFluids) && (aRecipe.mInputs.length < this.mMinimalInputItems)) { + return null; + } + if (aCheckForCollisions && (this.findRecipe(null, false, Long.MAX_VALUE, aRecipe.mFluidInputs, aRecipe.mInputs) != null)) { + return null; + } + return this.add(aRecipe); + } - /** - * Only used for fake Recipe Handlers to show something in NEI, do not use this for adding actual Recipes! findRecipe wont find fake Recipes, containsInput WILL find fake Recipes - */ - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); - } + /** + * Only used for fake Recipe Handlers to show something in NEI, do not use this for adding actual Recipes! findRecipe wont find fake Recipes, containsInput WILL find fake Recipes + */ + public GT_Recipe addFakeRecipe(final boolean aCheckForCollisions, final ItemStack[] aInputs, final ItemStack[] aOutputs, final Object aSpecial, final int[] aOutputChances, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { + return this.addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); + } - /** - * Only used for fake Recipe Handlers to show something in NEI, do not use this for adding actual Recipes! findRecipe wont find fake Recipes, containsInput WILL find fake Recipes - */ - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); - } + /** + * Only used for fake Recipe Handlers to show something in NEI, do not use this for adding actual Recipes! findRecipe wont find fake Recipes, containsInput WILL find fake Recipes + */ + public GT_Recipe addFakeRecipe(final boolean aCheckForCollisions, final ItemStack[] aInputs, final ItemStack[] aOutputs, final Object aSpecial, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { + return this.addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); + } - /** - * Only used for fake Recipe Handlers to show something in NEI, do not use this for adding actual Recipes! findRecipe wont find fake Recipes, containsInput WILL find fake Recipes - */ - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, GT_Recipe aRecipe) { - return addRecipe(aRecipe, aCheckForCollisions, true, false); - } + /** + * Only used for fake Recipe Handlers to show something in NEI, do not use this for adding actual Recipes! findRecipe wont find fake Recipes, containsInput WILL find fake Recipes + */ + public GT_Recipe addFakeRecipe(final boolean aCheckForCollisions, final GT_Recipe aRecipe) { + return this.addRecipe(aRecipe, aCheckForCollisions, true, false); + } - public GT_Recipe add(GT_Recipe aRecipe) { - mRecipeList.add(aRecipe); - for (FluidStack aFluid : aRecipe.mFluidInputs) - if (aFluid != null) { - Collection<GT_Recipe> tList = mRecipeFluidMap.get(aFluid.getFluid()); - if (tList == null) mRecipeFluidMap.put(aFluid.getFluid(), tList = new HashSet<GT_Recipe>(1)); - tList.add(aRecipe); - } - return addToItemMap(aRecipe); - } + public GT_Recipe add(final GT_Recipe aRecipe) { + this.mRecipeList.add(aRecipe); + for (final FluidStack aFluid : aRecipe.mFluidInputs) { + if (aFluid != null) { + Collection<GT_Recipe> tList = this.mRecipeFluidMap.get(aFluid.getFluid()); + if (tList == null) { + this.mRecipeFluidMap.put(aFluid.getFluid(), tList = new HashSet<>(1)); + } + tList.add(aRecipe); + } + } + return this.addToItemMap(aRecipe); + } - public void reInit() { - Map<GT_ItemStack, Collection<GT_Recipe>> tMap = mRecipeItemMap; - if (tMap != null) tMap.clear(); - for (GT_Recipe tRecipe : mRecipeList) { - GT_OreDictUnificator.setStackArray(true, tRecipe.mInputs); - GT_OreDictUnificator.setStackArray(true, tRecipe.mOutputs); - if (tMap != null) addToItemMap(tRecipe); - } - } + public void reInit() { + final Map<GT_ItemStack, Collection<GT_Recipe>> tMap = this.mRecipeItemMap; + if (tMap != null) { + tMap.clear(); + } + for (final GT_Recipe tRecipe : this.mRecipeList) { + GT_OreDictUnificator.setStackArray(true, tRecipe.mInputs); + GT_OreDictUnificator.setStackArray(true, tRecipe.mOutputs); + if (tMap != null) { + this.addToItemMap(tRecipe); + } + } + } - /** - * @return if this Item is a valid Input for any for the Recipes - */ - public boolean containsInput(ItemStack aStack) { - return aStack != null && (mRecipeItemMap.containsKey(new GT_ItemStack(aStack)) || mRecipeItemMap.containsKey(new GT_ItemStack(GT_Utility.copyMetaData(W, aStack)))); - } + /** + * @return if this Item is a valid Input for any for the Recipes + */ + public boolean containsInput(final ItemStack aStack) { + return (aStack != null) && (this.mRecipeItemMap.containsKey(new GT_ItemStack(aStack)) || this.mRecipeItemMap.containsKey(new GT_ItemStack(GT_Utility.copyMetaData(W, aStack)))); + } - /** - * @return if this Fluid is a valid Input for any for the Recipes - */ - public boolean containsInput(FluidStack aFluid) { - return aFluid != null && containsInput(aFluid.getFluid()); - } + /** + * @return if this Fluid is a valid Input for any for the Recipes + */ + public boolean containsInput(final FluidStack aFluid) { + return (aFluid != null) && this.containsInput(aFluid.getFluid()); + } - /** - * @return if this Fluid is a valid Input for any for the Recipes - */ - public boolean containsInput(Fluid aFluid) { - return aFluid != null && mRecipeFluidMap.containsKey(aFluid); - } + /** + * @return if this Fluid is a valid Input for any for the Recipes + */ + public boolean containsInput(final Fluid aFluid) { + return (aFluid != null) && this.mRecipeFluidMap.containsKey(aFluid); + } - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack... aInputs) { - return findRecipe(aTileEntity, null, aNotUnificated, aVoltage, aFluids, null, aInputs); - } + public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, final ItemStack... aInputs) { + return this.findRecipe(aTileEntity, null, aNotUnificated, aVoltage, aFluids, null, aInputs); + } - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack... aInputs) { - return findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, null, aInputs); - } + public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, final ItemStack... aInputs) { + return this.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, null, aInputs); + } - /** - * finds a Recipe matching the aFluid and ItemStack Inputs. - * - * @param aTileEntity an Object representing the current coordinates of the executing Block/Entity/Whatever. This may be null, especially during Startup. - * @param aRecipe in case this is != null it will try to use this Recipe first when looking things up. - * @param aNotUnificated if this is T the Recipe searcher will unificate the ItemStack Inputs - * @param aVoltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage - * @param aFluids the Fluid Inputs - * @param aSpecialSlot the content of the Special Slot, the regular Manager doesn't do anything with this, but some custom ones do. - * @param aInputs the Item Inputs - * @return the Recipe it has found or null for no matching Recipe - */ - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { - // No Recipes? Well, nothing to be found then. - if (mRecipeList.isEmpty()) return null; + /** + * finds a Recipe matching the aFluid and ItemStack Inputs. + * + * @param aTileEntity an Object representing the current coordinates of the executing Block/Entity/Whatever. This may be null, especially during Startup. + * @param aRecipe in case this is != null it will try to use this Recipe first when looking things up. + * @param aNotUnificated if this is T the Recipe searcher will unificate the ItemStack Inputs + * @param aVoltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage + * @param aFluids the Fluid Inputs + * @param aSpecialSlot the content of the Special Slot, the regular Manager doesn't do anything with this, but some custom ones do. + * @param aInputs the Item Inputs + * @return the Recipe it has found or null for no matching Recipe + */ + public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, final ItemStack aSpecialSlot, ItemStack... aInputs) { + // No Recipes? Well, nothing to be found then. + if (this.mRecipeList.isEmpty()) { + return null; + } - // Some Recipe Classes require a certain amount of Inputs of certain kinds. Like "at least 1 Fluid + 1 Stack" or "at least 2 Stacks" before they start searching for Recipes. - // This improves Performance massively, especially if people leave things like Circuits, Molds or Shapes in their Machines to select Sub Recipes. - if (GregTech_API.sPostloadFinished) { - if (mMinimalInputFluids > 0) { - if (aFluids == null) return null; - int tAmount = 0; - for (FluidStack aFluid : aFluids) if (aFluid != null) tAmount++; - if (tAmount < mMinimalInputFluids) return null; - } - if (mMinimalInputItems > 0) { - if (aInputs == null) return null; - int tAmount = 0; - for (ItemStack aInput : aInputs) if (aInput != null) tAmount++; - if (tAmount < mMinimalInputItems) return null; - } - } + // Some Recipe Classes require a certain amount of Inputs of certain kinds. Like "at least 1 Fluid + 1 Stack" or "at least 2 Stacks" before they start searching for Recipes. + // This improves Performance massively, especially if people leave things like Circuits, Molds or Shapes in their Machines to select Sub Recipes. + if (GregTech_API.sPostloadFinished) { + if (this.mMinimalInputFluids > 0) { + if (aFluids == null) { + return null; + } + int tAmount = 0; + for (final FluidStack aFluid : aFluids) { + if (aFluid != null) { + tAmount++; + } + } + if (tAmount < this.mMinimalInputFluids) { + return null; + } + } + if (this.mMinimalInputItems > 0) { + if (aInputs == null) { + return null; + } + int tAmount = 0; + for (final ItemStack aInput : aInputs) { + if (aInput != null) { + tAmount++; + } + } + if (tAmount < this.mMinimalInputItems) { + return null; + } + } + } - // Unification happens here in case the Input isn't already unificated. - if (aNotUnificated) aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs); + // Unification happens here in case the Input isn't already unificated. + if (aNotUnificated) { + aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs); + } - // Check the Recipe which has been used last time in order to not have to search for it again, if possible. - if (aRecipe != null) - if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - return aRecipe.mEnabled && aVoltage * mAmperage >= aRecipe.mEUt ? aRecipe : null; + // Check the Recipe which has been used last time in order to not have to search for it again, if possible. + if (aRecipe != null) { + if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { + return aRecipe.mEnabled && ((aVoltage * this.mAmperage) >= aRecipe.mEUt) ? aRecipe : null; + } + } - // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items. - if (mUsualInputCount > 0 && aInputs != null) for (ItemStack tStack : aInputs) - if (tStack != null) { - Collection<GT_Recipe> - tRecipes = mRecipeItemMap.get(new GT_ItemStack(tStack)); - if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; - tRecipes = mRecipeItemMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W, tStack))); - if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; - } + // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items. + if ((this.mUsualInputCount > 0) && (aInputs != null)) { + for (final ItemStack tStack : aInputs) { + if (tStack != null) { + Collection<GT_Recipe> + tRecipes = this.mRecipeItemMap.get(new GT_ItemStack(tStack)); + if (tRecipes != null) { + for (final GT_Recipe tRecipe : tRecipes) { + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { + return tRecipe.mEnabled && ((aVoltage * this.mAmperage) >= tRecipe.mEUt) ? tRecipe : null; + } + } + } + tRecipes = this.mRecipeItemMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W, tStack))); + if (tRecipes != null) { + for (final GT_Recipe tRecipe : tRecipes) { + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { + return tRecipe.mEnabled && ((aVoltage * this.mAmperage) >= tRecipe.mEUt) ? tRecipe : null; + } + } + } + } + } + } - // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that Map too. - if (mMinimalInputItems == 0 && aFluids != null) for (FluidStack aFluid : aFluids) - if (aFluid != null) { - Collection<GT_Recipe> - tRecipes = mRecipeFluidMap.get(aFluid.getFluid()); - if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; - } + // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that Map too. + if ((this.mMinimalInputItems == 0) && (aFluids != null)) { + for (final FluidStack aFluid : aFluids) { + if (aFluid != null) { + final Collection<GT_Recipe> + tRecipes = this.mRecipeFluidMap.get(aFluid.getFluid()); + if (tRecipes != null) { + for (final GT_Recipe tRecipe : tRecipes) { + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { + return tRecipe.mEnabled && ((aVoltage * this.mAmperage) >= tRecipe.mEUt) ? tRecipe : null; + } + } + } + } + } + } - // And nothing has been found. - return null; - } + // And nothing has been found. + return null; + } - protected GT_Recipe addToItemMap(GT_Recipe aRecipe) { - for (ItemStack aStack : aRecipe.mInputs) - if (aStack != null) { - GT_ItemStack tStack = new GT_ItemStack(aStack); - Collection<GT_Recipe> tList = mRecipeItemMap.get(tStack); - if (tList == null) mRecipeItemMap.put(tStack, tList = new HashSet<GT_Recipe>(1)); - tList.add(aRecipe); - } - return aRecipe; - } - }
\ No newline at end of file + protected GT_Recipe addToItemMap(final GT_Recipe aRecipe) { + for (final ItemStack aStack : aRecipe.mInputs) { + if (aStack != null) { + final GT_ItemStack tStack = new GT_ItemStack(aStack); + Collection<GT_Recipe> tList = this.mRecipeItemMap.get(tStack); + if (tList == null) { + this.mRecipeItemMap.put(tStack, tList = new HashSet<>(1)); + } + tList.add(aRecipe); + } + } + return aRecipe; + } +}
\ No newline at end of file diff --git a/src/Java/gregtech/api/util/Recipe_GT.java b/src/Java/gregtech/api/util/Recipe_GT.java index af421610b1..b073d264df 100644 --- a/src/Java/gregtech/api/util/Recipe_GT.java +++ b/src/Java/gregtech/api/util/Recipe_GT.java @@ -1,15 +1,15 @@ package gregtech.api.util; import static gregtech.api.enums.GT_Values.*; + +import java.util.*; + import gregtech.api.GregTech_API; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.api.objects.GT_ItemStack; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; - -import java.util.*; - import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -25,28 +25,28 @@ import net.minecraftforge.fluids.FluidStack; */ public class Recipe_GT extends GT_Recipe{ - public static volatile int VERSION = 508; - - protected Recipe_GT(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + public static volatile int VERSION = 508; + + protected Recipe_GT(final boolean aOptimize, final ItemStack[] aInputs, final ItemStack[] aOutputs, final Object aSpecialItems, final int[] aChances, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { super(aOptimize, aInputs, aOutputs, aSpecialItems, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); Utils.LOG_SPECIFIC_WARNING(this.getClass().getName()+" | [GregtechRecipe]", "Created new recipe instance for "+ItemUtils.getArrayStackNames(aInputs), 167); } - public Recipe_GT(ItemStack aInput1, ItemStack aOutput1, int aFuelValue, int aType) { + public Recipe_GT(final ItemStack aInput1, final ItemStack aOutput1, final int aFuelValue, final int aType) { this(aInput1, aOutput1, null, null, null, aFuelValue, aType); } // aSpecialValue = EU per Liter! If there is no Liquid for this Object, then it gets multiplied with 1000! - public Recipe_GT(ItemStack aInput1, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, int aSpecialValue, int aType) { + public Recipe_GT(final ItemStack aInput1, final ItemStack aOutput1, final ItemStack aOutput2, final ItemStack aOutput3, final ItemStack aOutput4, final int aSpecialValue, final int aType) { this(true, new ItemStack[]{aInput1}, new ItemStack[]{aOutput1, aOutput2, aOutput3, aOutput4}, null, null, null, null, 0, 0, Math.max(1, aSpecialValue)); Utils.LOG_INFO("Switch case method for adding fuels"); - if (mInputs.length > 0 && aSpecialValue > 0) { + if ((this.mInputs.length > 0) && (aSpecialValue > 0)) { switch (aType) { // Diesel Generator case 0: Utils.LOG_INFO("Added fuel "+aInput1.getDisplayName()+" is ROCKET FUEL - continuing"); - Gregtech_Recipe_Map.sRocketFuels.addRecipe(this); + Gregtech_Recipe_Map.sRocketFuels.addRecipe(this); break; // Gas Turbine case 1: @@ -71,130 +71,158 @@ public class Recipe_GT extends GT_Recipe{ } } } - + //Custom Recipe Handlers - public Recipe_GT(ItemStack aInput, FluidStack aFluid, ItemStack[] aOutput, int aDuration, int aEUt) { - this(true, new ItemStack[]{aInput}, aOutput.clone(), null, null, new FluidStack[]{aFluid}, null, aDuration, aEUt, 0); - if (mInputs.length > 0 && mOutputs[0] != null) { - Gregtech_Recipe_Map.sChemicalDehydratorRecipes.addRecipe(this); - } - } - - public Recipe_GT(FluidStack aInput1, FluidStack aInput2, FluidStack aOutput1, int aDuration, int aEUt, int aSpecialValue) { - this(true, null, null, null, null, new FluidStack[]{aInput1, aInput2}, new FluidStack[]{aOutput1}, Math.max(aDuration, 1), aEUt, Math.max(Math.min(aSpecialValue, 160000000), 0)); - if (mInputs.length > 1) { - Gregtech_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.addRecipe(this); - } - } - + public Recipe_GT(final ItemStack aInput, final FluidStack aFluid, final ItemStack[] aOutput, final int aDuration, final int aEUt) { + this(true, new ItemStack[]{aInput}, aOutput.clone(), null, null, new FluidStack[]{aFluid}, null, aDuration, aEUt, 0); + if ((this.mInputs.length > 0) && (this.mOutputs[0] != null)) { + Gregtech_Recipe_Map.sChemicalDehydratorRecipes.addRecipe(this); + } + } + + public Recipe_GT(final FluidStack aInput1, final FluidStack aInput2, final FluidStack aOutput1, final int aDuration, final int aEUt, final int aSpecialValue) { + this(true, null, null, null, null, new FluidStack[]{aInput1, aInput2}, new FluidStack[]{aOutput1}, Math.max(aDuration, 1), aEUt, Math.max(Math.min(aSpecialValue, 160000000), 0)); + if (this.mInputs.length > 1) { + Gregtech_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.addRecipe(this); + } + } + public Recipe_GT( - FluidStack aInput1, FluidStack aInput2, FluidStack aInput3, - FluidStack aInput4, FluidStack aInput5, FluidStack aInput6, - FluidStack aInput7, FluidStack aInput8, FluidStack aInput9, - FluidStack aOutput1, FluidStack aOutput2, - int aDuration, int aEUt) { - this(true, null, null, null, null, new FluidStack[]{aInput1, aInput2, aInput3, aInput4, aInput5, aInput6, aInput7, aInput8, aInput9}, new FluidStack[]{aOutput1, aOutput2}, Math.max(aDuration, 1), aEUt, 0); - if (mInputs.length > 1) { - CustomRecipeMap.sFissionFuelProcessing.addRecipe(this); - } - } - + final FluidStack aInput1, final FluidStack aInput2, final FluidStack aInput3, + final FluidStack aInput4, final FluidStack aInput5, final FluidStack aInput6, + final FluidStack aInput7, final FluidStack aInput8, final FluidStack aInput9, + final FluidStack aOutput1, final FluidStack aOutput2, + final int aDuration, final int aEUt) { + this(true, null, null, null, null, new FluidStack[]{aInput1, aInput2, aInput3, aInput4, aInput5, aInput6, aInput7, aInput8, aInput9}, new FluidStack[]{aOutput1, aOutput2}, Math.max(aDuration, 1), aEUt, 0); + if (this.mInputs.length > 1) { + CustomRecipeMap.sFissionFuelProcessing.addRecipe(this); + } + } + /*public GregtechRecipe(ItemStack aInput, FluidStack aFluid, ItemStack[] aOutput, int aDuration, int aEUt) { this(true, new ItemStack[]{aInput}, aOutput.clone(), null, null, new FluidStack[]{aFluid}, null, aDuration, aEUt, 0); if (mInputs.length > 0 && mOutputs[0] != null) { Gregtech_Recipe_Map.sChemicalDehydratorRecipes.addRecipe(this); } }*/ - + public static void reInit() { GT_Log.out.println("GT_Mod: Re-Unificating Recipes."); - for (Gregtech_Recipe_Map tMapEntry : Gregtech_Recipe_Map.sMappings) tMapEntry.reInit(); + for (final Gregtech_Recipe_Map tMapEntry : Gregtech_Recipe_Map.sMappings) { + tMapEntry.reInit(); + } + } + + @Override + public ItemStack getRepresentativeInput(final int aIndex) { + if ((aIndex < 0) || (aIndex >= this.mInputs.length)) { + return null; + } + return GT_Utility.copy(this.mInputs[aIndex]); + } + + @Override + public ItemStack getOutput(final int aIndex) { + if ((aIndex < 0) || (aIndex >= this.mOutputs.length)) { + return null; + } + return GT_Utility.copy(this.mOutputs[aIndex]); } - + @Override - public ItemStack getRepresentativeInput(int aIndex) { - if (aIndex < 0 || aIndex >= mInputs.length) return null; - return GT_Utility.copy(mInputs[aIndex]); - } - - @Override - public ItemStack getOutput(int aIndex) { - if (aIndex < 0 || aIndex >= mOutputs.length) return null; - return GT_Utility.copy(mOutputs[aIndex]); - } - - @Override - public int getOutputChance(int aIndex) { - if (aIndex < 0 || aIndex >= mChances.length) return 10000; - return mChances[aIndex]; - } - - @Override - public FluidStack getRepresentativeFluidInput(int aIndex) { - if (aIndex < 0 || aIndex >= mFluidInputs.length || mFluidInputs[aIndex] == null) return null; - return mFluidInputs[aIndex].copy(); - } - - @Override - public FluidStack getFluidOutput(int aIndex) { - if (aIndex < 0 || aIndex >= mFluidOutputs.length || mFluidOutputs[aIndex] == null) return null; - return mFluidOutputs[aIndex].copy(); - } + public int getOutputChance(final int aIndex) { + if ((aIndex < 0) || (aIndex >= this.mChances.length)) { + return 10000; + } + return this.mChances[aIndex]; + } @Override - public boolean isRecipeInputEqual(boolean aDecreaseStacksizeBySuccess, FluidStack[] aFluidInputs, ItemStack... aInputs) { - return isRecipeInputEqual(aDecreaseStacksizeBySuccess, false, aFluidInputs, aInputs); + public FluidStack getRepresentativeFluidInput(final int aIndex) { + if ((aIndex < 0) || (aIndex >= this.mFluidInputs.length) || (this.mFluidInputs[aIndex] == null)) { + return null; + } + return this.mFluidInputs[aIndex].copy(); } @Override - public boolean isRecipeInputEqual(boolean aDecreaseStacksizeBySuccess, boolean aDontCheckStackSizes, FluidStack[] aFluidInputs, ItemStack... aInputs) { - if (mFluidInputs.length > 0 && aFluidInputs == null) return false; - for (FluidStack tFluid : mFluidInputs) + public FluidStack getFluidOutput(final int aIndex) { + if ((aIndex < 0) || (aIndex >= this.mFluidOutputs.length) || (this.mFluidOutputs[aIndex] == null)) { + return null; + } + return this.mFluidOutputs[aIndex].copy(); + } + + @Override + public boolean isRecipeInputEqual(final boolean aDecreaseStacksizeBySuccess, final FluidStack[] aFluidInputs, final ItemStack... aInputs) { + return this.isRecipeInputEqual(aDecreaseStacksizeBySuccess, false, aFluidInputs, aInputs); + } + + @Override + public boolean isRecipeInputEqual(final boolean aDecreaseStacksizeBySuccess, final boolean aDontCheckStackSizes, final FluidStack[] aFluidInputs, final ItemStack... aInputs) { + if ((this.mFluidInputs.length > 0) && (aFluidInputs == null)) { + return false; + } + for (final FluidStack tFluid : this.mFluidInputs) { if (tFluid != null) { boolean temp = true; - for (FluidStack aFluid : aFluidInputs) - if (aFluid != null && aFluid.isFluidEqual(tFluid) && (aDontCheckStackSizes || aFluid.amount >= tFluid.amount)) { + for (final FluidStack aFluid : aFluidInputs) { + if ((aFluid != null) && aFluid.isFluidEqual(tFluid) && (aDontCheckStackSizes || (aFluid.amount >= tFluid.amount))) { temp = false; break; } - if (temp) return false; + } + if (temp) { + return false; + } } + } - if (mInputs.length > 0 && aInputs == null) return false; + if ((this.mInputs.length > 0) && (aInputs == null)) { + return false; + } - for (ItemStack tStack : mInputs) + for (final ItemStack tStack : this.mInputs) { if (tStack != null) { boolean temp = true; - for (ItemStack aStack : aInputs) - if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) && (aDontCheckStackSizes || aStack.stackSize >= tStack.stackSize)) { + for (final ItemStack aStack : aInputs) { + if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) && (aDontCheckStackSizes || (aStack.stackSize >= tStack.stackSize))) { temp = false; break; } - if (temp) return false; + } + if (temp) { + return false; + } } + } if (aDecreaseStacksizeBySuccess) { if (aFluidInputs != null) { - for (FluidStack tFluid : mFluidInputs) + for (final FluidStack tFluid : this.mFluidInputs) { if (tFluid != null) { - for (FluidStack aFluid : aFluidInputs) - if (aFluid != null && aFluid.isFluidEqual(tFluid) && (aDontCheckStackSizes || aFluid.amount >= tFluid.amount)) { + for (final FluidStack aFluid : aFluidInputs) { + if ((aFluid != null) && aFluid.isFluidEqual(tFluid) && (aDontCheckStackSizes || (aFluid.amount >= tFluid.amount))) { aFluid.amount -= tFluid.amount; break; } + } } + } } if (aInputs != null) { - for (ItemStack tStack : mInputs) + for (final ItemStack tStack : this.mInputs) { if (tStack != null) { - for (ItemStack aStack : aInputs) - if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) && (aDontCheckStackSizes || aStack.stackSize >= tStack.stackSize)) { + for (final ItemStack aStack : aInputs) { + if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) && (aDontCheckStackSizes || (aStack.stackSize >= tStack.stackSize))) { aStack.stackSize -= tStack.stackSize; break; } + } } + } } } @@ -205,7 +233,7 @@ public class Recipe_GT extends GT_Recipe{ /** * Contains all Recipe Maps */ - public static final Collection<Gregtech_Recipe_Map> sMappings = new ArrayList<Gregtech_Recipe_Map>(); + public static final Collection<Gregtech_Recipe_Map> sMappings = new ArrayList<>(); //public static final GT_Recipe_Map sChemicalBathRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gt.recipe.chemicalbath", "Chemical Bath", null, RES_PATH_GUI + "basicmachines/ChemicalBath", 1, 3, 1, 1, 1, E, 1, E, true, true); public static final GT_Recipe_Map sCokeOvenRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gt.recipe.cokeoven", "Coke Oven", null, RES_PATH_GUI + "basicmachines/Dehydrator", 2, 2, 1, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sMatterFab2Recipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gt.recipe.matterfab2", "Matter Fabricator", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, E, 1, E, true, true); @@ -214,20 +242,20 @@ public class Recipe_GT extends GT_Recipe{ public static final Gregtech_Recipe_Map_Fuel sGeoThermalFuels = new Gregtech_Recipe_Map_Fuel(new HashSet<GT_Recipe>(10), "gt.recipe.geothermalfuel", "GeoThermal Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); public static final GT_Recipe_Map sChemicalDehydratorRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gt.recipe.chemicaldehydrator", "Chemical Dehydrator", null, RES_PATH_GUI + "basicmachines/Dehydrator", 2, 9, 0, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sAlloyBlastSmelterRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gt.recipe.alloyblastsmelter", "Alloy Blast Smelter", null, RES_PATH_GUI + "basicmachines/BlastSmelter", 9, 1, 1, 0, 1, E, 1, E, true, true); - + //LFTR recipes public static final GT_Recipe_Map sLiquidFluorineThoriumReactorRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(50), "gt.recipe.lftr", "Liquid Fluoride Thorium Reactor", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 2, 1, "Start: ", 1, " EU", true, true); //Fission Fuel Plant Recipes //public static final GT_Recipe_Map sFissionFuelProcessing = new GT_Recipe_Map(new HashSet<GT_Recipe>(50), "gt.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 9, 1, E, 1, E, true, true); - + /** * HashMap of Recipes based on their Items */ - public final Map<GT_ItemStack, Collection<GT_Recipe>> mRecipeItemMap = new HashMap<GT_ItemStack, Collection<GT_Recipe>>(); + public final Map<GT_ItemStack, Collection<GT_Recipe>> mRecipeItemMap = new HashMap<>(); /** * HashMap of Recipes based on their Fluids */ - public final Map<Fluid, Collection<GT_Recipe>> mRecipeFluidMap = new HashMap<Fluid, Collection<GT_Recipe>>(); + public final Map<Fluid, Collection<GT_Recipe>> mRecipeFluidMap = new HashMap<>(); /** * The List of all Recipes */ @@ -262,47 +290,47 @@ public class Recipe_GT extends GT_Recipe{ * @param aNEISpecialValuePost the String after the Special Value. Usually for a Unit or something. * @param aNEIAllowed if NEI is allowed to display this Recipe Handler in general. */ - public Gregtech_Recipe_Map(Collection<GT_Recipe> aRecipeList, - String aUnlocalizedName, String aLocalName, String aNEIName, - String aNEIGUIPath, int aUsualInputCount, - int aUsualOutputCount, int aMinimalInputItems, - int aMinimalInputFluids, int aAmperage, - String aNEISpecialValuePre, int aNEISpecialValueMultiplier, - String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, - boolean aNEIAllowed) { + public Gregtech_Recipe_Map(final Collection<GT_Recipe> aRecipeList, + final String aUnlocalizedName, final String aLocalName, final String aNEIName, + final String aNEIGUIPath, final int aUsualInputCount, + final int aUsualOutputCount, final int aMinimalInputItems, + final int aMinimalInputFluids, final int aAmperage, + final String aNEISpecialValuePre, final int aNEISpecialValueMultiplier, + final String aNEISpecialValuePost, final boolean aShowVoltageAmperageInNEI, + final boolean aNEIAllowed) { sMappings.add(this); - mNEIAllowed = aNEIAllowed; - mShowVoltageAmperageInNEI = aShowVoltageAmperageInNEI; - mRecipeList = aRecipeList; - mNEIName = aNEIName == null ? aUnlocalizedName : aNEIName; - mNEIGUIPath = aNEIGUIPath.endsWith(".png") ? aNEIGUIPath : aNEIGUIPath + ".png"; - mNEISpecialValuePre = aNEISpecialValuePre; - mNEISpecialValueMultiplier = aNEISpecialValueMultiplier; - mNEISpecialValuePost = aNEISpecialValuePost; - mAmperage = aAmperage; - mUsualInputCount = aUsualInputCount; - mUsualOutputCount = aUsualOutputCount; - mMinimalInputItems = aMinimalInputItems; - mMinimalInputFluids = aMinimalInputFluids; - GregTech_API.sFluidMappings.add(mRecipeFluidMap); - GregTech_API.sItemStackMappings.add(mRecipeItemMap); - GT_LanguageManager.addStringLocalization(mUnlocalizedName = aUnlocalizedName, aLocalName); + this.mNEIAllowed = aNEIAllowed; + this.mShowVoltageAmperageInNEI = aShowVoltageAmperageInNEI; + this.mRecipeList = aRecipeList; + this.mNEIName = aNEIName == null ? aUnlocalizedName : aNEIName; + this.mNEIGUIPath = aNEIGUIPath.endsWith(".png") ? aNEIGUIPath : aNEIGUIPath + ".png"; + this.mNEISpecialValuePre = aNEISpecialValuePre; + this.mNEISpecialValueMultiplier = aNEISpecialValueMultiplier; + this.mNEISpecialValuePost = aNEISpecialValuePost; + this.mAmperage = aAmperage; + this.mUsualInputCount = aUsualInputCount; + this.mUsualOutputCount = aUsualOutputCount; + this.mMinimalInputItems = aMinimalInputItems; + this.mMinimalInputFluids = aMinimalInputFluids; + GregTech_API.sFluidMappings.add(this.mRecipeFluidMap); + GregTech_API.sItemStackMappings.add(this.mRecipeItemMap); + GT_LanguageManager.addStringLocalization(this.mUnlocalizedName = aUnlocalizedName, aLocalName); } - public GT_Recipe addRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addRecipe(new GT_Recipe(aOptimize, aInputs, aOutputs, aSpecial, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); + public GT_Recipe addRecipe(final boolean aOptimize, final ItemStack[] aInputs, final ItemStack[] aOutputs, final Object aSpecial, final int[] aOutputChances, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { + return this.addRecipe(new GT_Recipe(aOptimize, aInputs, aOutputs, aSpecial, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); } - public GT_Recipe addRecipe(int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addRecipe(new GT_Recipe(false, null, null, null, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue), false, false, false); + public GT_Recipe addRecipe(final int[] aOutputChances, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { + return this.addRecipe(new GT_Recipe(false, null, null, null, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue), false, false, false); } - public GT_Recipe addRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addRecipe(new GT_Recipe(aOptimize, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); + public GT_Recipe addRecipe(final boolean aOptimize, final ItemStack[] aInputs, final ItemStack[] aOutputs, final Object aSpecial, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { + return this.addRecipe(new GT_Recipe(aOptimize, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); } - public GT_Recipe addRecipe(boolean aOptimize, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addRecipe(new GT_Recipe(aOptimize, null, null, null, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); + public GT_Recipe addRecipe(final boolean aOptimize, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { + return this.addRecipe(new GT_Recipe(aOptimize, null, null, null, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); } /*public GregtechRecipe addRecipe(boolean aOptimize, FluidStack aInput1, FluidStack aOutput1, ItemStack[] bInput1, ItemStack[] bOutput1, int aDuration, int aEUt, int aSpecialValue) { @@ -310,102 +338,109 @@ public class Recipe_GT extends GT_Recipe{ }*/ - public GT_Recipe addRecipe(GT_Recipe aRecipe) { + public GT_Recipe addRecipe(final GT_Recipe aRecipe) { Utils.LOG_INFO("Adding Recipe Method 1"); - return addRecipe(aRecipe, true, false, false); + return this.addRecipe(aRecipe, true, false, false); } - protected GT_Recipe addRecipe(GT_Recipe aRecipe, boolean aCheckForCollisions, boolean aFakeRecipe, boolean aHidden) { + protected GT_Recipe addRecipe(final GT_Recipe aRecipe, final boolean aCheckForCollisions, final boolean aFakeRecipe, final boolean aHidden) { Utils.LOG_INFO("Adding Recipe Method 2 - This Checks if hidden, fake or if duplicate recipes exists, I think."); aRecipe.mHidden = aHidden; aRecipe.mFakeRecipe = aFakeRecipe; Utils.LOG_INFO("Logging some data about this method: GregtechRecipe["+aRecipe.toString()+"] | aCheckForCollisions["+aCheckForCollisions+"] | aFakeRecipe["+aFakeRecipe+"] | aHidden["+aHidden+"]"); - Utils.LOG_INFO("Logging some data about this method: mMinimalInputFluids["+mMinimalInputFluids+"] | mMinimalInputItems["+mMinimalInputItems+"] | aRecipe.mFluidInputs.length["+aRecipe.mFluidInputs.length+"] | aRecipe.mInputs.length["+aRecipe.mInputs.length+"]"); - if (aRecipe.mFluidInputs.length < mMinimalInputFluids && aRecipe.mInputs.length < mMinimalInputItems){ + Utils.LOG_INFO("Logging some data about this method: mMinimalInputFluids["+this.mMinimalInputFluids+"] | mMinimalInputItems["+this.mMinimalInputItems+"] | aRecipe.mFluidInputs.length["+aRecipe.mFluidInputs.length+"] | aRecipe.mInputs.length["+aRecipe.mInputs.length+"]"); + if ((aRecipe.mFluidInputs.length < this.mMinimalInputFluids) && (aRecipe.mInputs.length < this.mMinimalInputItems)){ Utils.LOG_INFO("Step 2 failed"); return null;} - Utils.LOG_INFO("Logging some data about this method: aCheckForCollisions["+aCheckForCollisions+"] | findRecipe != null ["+(findRecipe(null, false, Long.MAX_VALUE, aRecipe.mFluidInputs, aRecipe.mInputs) != null)+"]"); - if (aCheckForCollisions && findRecipe(null, false, Long.MAX_VALUE, aRecipe.mFluidInputs, aRecipe.mInputs) != null){ + Utils.LOG_INFO("Logging some data about this method: aCheckForCollisions["+aCheckForCollisions+"] | findRecipe != null ["+(this.findRecipe(null, false, Long.MAX_VALUE, aRecipe.mFluidInputs, aRecipe.mInputs) != null)+"]"); + if (aCheckForCollisions && (this.findRecipe(null, false, Long.MAX_VALUE, aRecipe.mFluidInputs, aRecipe.mInputs) != null)){ Utils.LOG_INFO("Step 2 failed - 2"); return null; - } - return add(aRecipe); + } + return this.add(aRecipe); } - - + + /** * Only used for fake Recipe Handlers to show something in NEI, do not use this for adding actual Recipes! findRecipe wont find fake Recipes, containsInput WILL find fake Recipes */ - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); + public GT_Recipe addFakeRecipe(final boolean aCheckForCollisions, final ItemStack[] aInputs, final ItemStack[] aOutputs, final Object aSpecial, final int[] aOutputChances, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { + return this.addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, aOutputChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); } /** * Only used for fake Recipe Handlers to show something in NEI, do not use this for adding actual Recipes! findRecipe wont find fake Recipes, containsInput WILL find fake Recipes */ - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - return addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); + public GT_Recipe addFakeRecipe(final boolean aCheckForCollisions, final ItemStack[] aInputs, final ItemStack[] aOutputs, final Object aSpecial, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { + return this.addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); } /** * Only used for fake Recipe Handlers to show something in NEI, do not use this for adding actual Recipes! findRecipe wont find fake Recipes, containsInput WILL find fake Recipes */ - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, GT_Recipe aRecipe) { - return addRecipe(aRecipe, aCheckForCollisions, true, false); + public GT_Recipe addFakeRecipe(final boolean aCheckForCollisions, final GT_Recipe aRecipe) { + return this.addRecipe(aRecipe, aCheckForCollisions, true, false); } - public GT_Recipe add(GT_Recipe aRecipe) { + public GT_Recipe add(final GT_Recipe aRecipe) { Utils.LOG_INFO("Adding Recipe Method 3"); - mRecipeList.add(aRecipe); - for (FluidStack aFluid : aRecipe.mFluidInputs) + this.mRecipeList.add(aRecipe); + for (final FluidStack aFluid : aRecipe.mFluidInputs) { if (aFluid != null) { Utils.LOG_INFO("Fluid is valid - getting some kind of fluid instance to add to the recipe hashmap."); - Collection<GT_Recipe> tList = mRecipeFluidMap.get(aFluid.getFluid()); - if (tList == null) mRecipeFluidMap.put(aFluid.getFluid(), tList = new HashSet<GT_Recipe>(1)); + Collection<GT_Recipe> tList = this.mRecipeFluidMap.get(aFluid.getFluid()); + if (tList == null) { + this.mRecipeFluidMap.put(aFluid.getFluid(), tList = new HashSet<>(1)); + } tList.add(aRecipe); } - return addToItemMap(aRecipe); + } + return this.addToItemMap(aRecipe); } public void reInit() { - Map<GT_ItemStack, Collection<GT_Recipe>> tMap = mRecipeItemMap; - if (tMap != null) tMap.clear(); - for (GT_Recipe tRecipe : mRecipeList) { + final Map<GT_ItemStack, Collection<GT_Recipe>> tMap = this.mRecipeItemMap; + if (tMap != null) { + tMap.clear(); + } + for (final GT_Recipe tRecipe : this.mRecipeList) { GT_OreDictUnificator.setStackArray(true, tRecipe.mInputs); GT_OreDictUnificator.setStackArray(true, tRecipe.mOutputs); - if (tMap != null) addToItemMap(tRecipe); + if (tMap != null) { + this.addToItemMap(tRecipe); + } } } /** * @return if this Item is a valid Input for any for the Recipes */ - public boolean containsInput(ItemStack aStack) { - return aStack != null && (mRecipeItemMap.containsKey(new GT_ItemStack(aStack)) || mRecipeItemMap.containsKey(new GT_ItemStack(GT_Utility.copyMetaData(W, aStack)))); + public boolean containsInput(final ItemStack aStack) { + return (aStack != null) && (this.mRecipeItemMap.containsKey(new GT_ItemStack(aStack)) || this.mRecipeItemMap.containsKey(new GT_ItemStack(GT_Utility.copyMetaData(W, aStack)))); } /** * @return if this Fluid is a valid Input for any for the Recipes */ - public boolean containsInput(FluidStack aFluid) { - return aFluid != null && containsInput(aFluid.getFluid()); + public boolean containsInput(final FluidStack aFluid) { + return (aFluid != null) && this.containsInput(aFluid.getFluid()); } /** * @return if this Fluid is a valid Input for any for the Recipes */ - public boolean containsInput(Fluid aFluid) { - return aFluid != null && mRecipeFluidMap.containsKey(aFluid); + public boolean containsInput(final Fluid aFluid) { + return (aFluid != null) && this.mRecipeFluidMap.containsKey(aFluid); } - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack... aInputs) { - return findRecipe(aTileEntity, null, aNotUnificated, aVoltage, aFluids, null, aInputs); + public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, final ItemStack... aInputs) { + return this.findRecipe(aTileEntity, null, aNotUnificated, aVoltage, aFluids, null, aInputs); } - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack... aInputs) { - return findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, null, aInputs); + public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, final ItemStack... aInputs) { + return this.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, null, aInputs); } /** @@ -420,148 +455,229 @@ public class Recipe_GT extends GT_Recipe{ * @param aInputs the Item Inputs * @return the Recipe it has found or null for no matching Recipe */ - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { + public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, final ItemStack aSpecialSlot, ItemStack... aInputs) { // No Recipes? Well, nothing to be found then. - if (mRecipeList.isEmpty()) return null; + if (this.mRecipeList.isEmpty()) { + return null; + } // Some Recipe Classes require a certain amount of Inputs of certain kinds. Like "at least 1 Fluid + 1 Stack" or "at least 2 Stacks" before they start searching for Recipes. // This improves Performance massively, especially if people leave things like Circuits, Molds or Shapes in their Machines to select Sub Recipes. if (GregTech_API.sPostloadFinished) { - if (mMinimalInputFluids > 0) { - if (aFluids == null) return null; + if (this.mMinimalInputFluids > 0) { + if (aFluids == null) { + return null; + } int tAmount = 0; - for (FluidStack aFluid : aFluids) if (aFluid != null) tAmount++; - if (tAmount < mMinimalInputFluids) return null; + for (final FluidStack aFluid : aFluids) { + if (aFluid != null) { + tAmount++; + } + } + if (tAmount < this.mMinimalInputFluids) { + return null; + } } - if (mMinimalInputItems > 0) { - if (aInputs == null) return null; + if (this.mMinimalInputItems > 0) { + if (aInputs == null) { + return null; + } int tAmount = 0; - for (ItemStack aInput : aInputs) if (aInput != null) tAmount++; - if (tAmount < mMinimalInputItems) return null; + for (final ItemStack aInput : aInputs) { + if (aInput != null) { + tAmount++; + } + } + if (tAmount < this.mMinimalInputItems) { + return null; + } } } // Unification happens here in case the Input isn't already unificated. - if (aNotUnificated) aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs); + if (aNotUnificated) { + aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs); + } // Check the Recipe which has been used last time in order to not have to search for it again, if possible. - if (aRecipe != null) - if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - return aRecipe.mEnabled && aVoltage * mAmperage >= aRecipe.mEUt ? aRecipe : null; - - // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items. - if (mUsualInputCount > 0 && aInputs != null) for (ItemStack tStack : aInputs) - if (tStack != null) { - Collection<GT_Recipe> - tRecipes = mRecipeItemMap.get(new GT_ItemStack(tStack)); - if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; - tRecipes = mRecipeItemMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W, tStack))); - if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; + if (aRecipe != null) { + if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { + return aRecipe.mEnabled && ((aVoltage * this.mAmperage) >= aRecipe.mEUt) ? aRecipe : null; + } + } + + // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items. + if ((this.mUsualInputCount > 0) && (aInputs != null)) { + for (final ItemStack tStack : aInputs) { + if (tStack != null) { + Collection<GT_Recipe> + tRecipes = this.mRecipeItemMap.get(new GT_ItemStack(tStack)); + if (tRecipes != null) { + for (final GT_Recipe tRecipe : tRecipes) { + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { + return tRecipe.mEnabled && ((aVoltage * this.mAmperage) >= tRecipe.mEUt) ? tRecipe : null; + } + } + } + tRecipes = this.mRecipeItemMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W, tStack))); + if (tRecipes != null) { + for (final GT_Recipe tRecipe : tRecipes) { + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { + return tRecipe.mEnabled && ((aVoltage * this.mAmperage) >= tRecipe.mEUt) ? tRecipe : null; + } + } } + } + } + } - // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that Map too. - if (mMinimalInputItems == 0 && aFluids != null) for (FluidStack aFluid : aFluids) - if (aFluid != null) { - Collection<GT_Recipe> - tRecipes = mRecipeFluidMap.get(aFluid.getFluid()); - if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; + // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that Map too. + if ((this.mMinimalInputItems == 0) && (aFluids != null)) { + for (final FluidStack aFluid : aFluids) { + if (aFluid != null) { + final Collection<GT_Recipe> + tRecipes = this.mRecipeFluidMap.get(aFluid.getFluid()); + if (tRecipes != null) { + for (final GT_Recipe tRecipe : tRecipes) { + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { + return tRecipe.mEnabled && ((aVoltage * this.mAmperage) >= tRecipe.mEUt) ? tRecipe : null; + } + } } + } + } + } - // And nothing has been found. - return null; + // And nothing has been found. + return null; } - protected GT_Recipe addToItemMap(GT_Recipe aRecipe) { + protected GT_Recipe addToItemMap(final GT_Recipe aRecipe) { Utils.LOG_INFO("Adding Recipe Method 4"); - for (ItemStack aStack : aRecipe.mInputs) + for (final ItemStack aStack : aRecipe.mInputs) { if (aStack != null) { Utils.LOG_INFO("Method 4 - Manipulating "+aStack.getDisplayName()); - GT_ItemStack tStack = new GT_ItemStack(aStack); + final GT_ItemStack tStack = new GT_ItemStack(aStack); Utils.LOG_INFO("Method 4 - Made gt stack of item "+tStack.toStack().getDisplayName()); - Collection<GT_Recipe> tList = mRecipeItemMap.get(tStack); + Collection<GT_Recipe> tList = this.mRecipeItemMap.get(tStack); if (tList != null){ Utils.LOG_INFO("Method 4 - Gt Recipe Hashmap: "+tList.toString()); - } - if (tList == null){ - Utils.LOG_INFO("Method 4 - brrr list was NUll"); - mRecipeItemMap.put(tStack, tList = new HashSet<GT_Recipe>(1)); + } + if (tList == null){ + Utils.LOG_INFO("Method 4 - brrr list was NUll"); + this.mRecipeItemMap.put(tStack, tList = new HashSet<>(1)); Utils.LOG_INFO("Method 4 - Attemping backup method for Gt Recipe Hashmap:"); - + while (tList.iterator().hasNext()){ Utils.LOG_INFO(tList.iterator().next().toString()); } - + } tList.add(aRecipe); - Utils.LOG_INFO("Method 4 - Added recipe to map? I think."); + Utils.LOG_INFO("Method 4 - Added recipe to map? I think."); } + } return aRecipe; } - public GT_Recipe findRecipe(IGregTechTileEntity baseMetaTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, - long aVoltage, FluidStack[] aFluids, FluidStack[] fluidStacks) { + public GT_Recipe findRecipe(final IGregTechTileEntity baseMetaTileEntity, final GT_Recipe aRecipe, final boolean aNotUnificated, + final long aVoltage, final FluidStack[] aFluids, final FluidStack[] fluidStacks) { ItemStack aInputs[] = null; // No Recipes? Well, nothing to be found then. - if (mRecipeList.isEmpty()) return null; + if (this.mRecipeList.isEmpty()) { + return null; + } // Some Recipe Classes require a certain amount of Inputs of certain kinds. Like "at least 1 Fluid + 1 Stack" or "at least 2 Stacks" before they start searching for Recipes. // This improves Performance massively, especially if people leave things like Circuits, Molds or Shapes in their Machines to select Sub Recipes. if (GregTech_API.sPostloadFinished) { - if (mMinimalInputFluids > 0) { - if (aFluids == null) return null; + if (this.mMinimalInputFluids > 0) { + if (aFluids == null) { + return null; + } int tAmount = 0; - for (FluidStack aFluid : aFluids) if (aFluid != null) tAmount++; - if (tAmount < mMinimalInputFluids) return null; + for (final FluidStack aFluid : aFluids) { + if (aFluid != null) { + tAmount++; + } + } + if (tAmount < this.mMinimalInputFluids) { + return null; + } } - if (mMinimalInputItems > 0) { - if (aInputs == null) return null; + if (this.mMinimalInputItems > 0) { + if (aInputs == null) { + return null; + } int tAmount = 0; - for (ItemStack aInput : aInputs) if (aInput != null) tAmount++; - if (tAmount < mMinimalInputItems) return null; + for (final ItemStack aInput : aInputs) { + if (aInput != null) { + tAmount++; + } + } + if (tAmount < this.mMinimalInputItems) { + return null; + } } } // Unification happens here in case the Input isn't already unificated. - if (aNotUnificated) aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs); + if (aNotUnificated) { + aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs); + } // Check the Recipe which has been used last time in order to not have to search for it again, if possible. - if (aRecipe != null) - if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - return aRecipe.mEnabled && aVoltage * mAmperage >= aRecipe.mEUt ? aRecipe : null; - - // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items. - if (mUsualInputCount > 0 && aInputs != null) for (ItemStack tStack : aInputs) - if (tStack != null) { - Collection<GT_Recipe> - tRecipes = mRecipeItemMap.get(new GT_ItemStack(tStack)); - if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; - tRecipes = mRecipeItemMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W, tStack))); - if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; + if (aRecipe != null) { + if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { + return aRecipe.mEnabled && ((aVoltage * this.mAmperage) >= aRecipe.mEUt) ? aRecipe : null; + } + } + + // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items. + if ((this.mUsualInputCount > 0) && (aInputs != null)) { + for (final ItemStack tStack : aInputs) { + if (tStack != null) { + Collection<GT_Recipe> + tRecipes = this.mRecipeItemMap.get(new GT_ItemStack(tStack)); + if (tRecipes != null) { + for (final GT_Recipe tRecipe : tRecipes) { + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { + return tRecipe.mEnabled && ((aVoltage * this.mAmperage) >= tRecipe.mEUt) ? tRecipe : null; + } + } } + tRecipes = this.mRecipeItemMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W, tStack))); + if (tRecipes != null) { + for (final GT_Recipe tRecipe : tRecipes) { + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { + return tRecipe.mEnabled && ((aVoltage * this.mAmperage) >= tRecipe.mEUt) ? tRecipe : null; + } + } + } + } + } + } - // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that Map too. - if (mMinimalInputItems == 0 && aFluids != null) for (FluidStack aFluid : aFluids) - if (aFluid != null) { - Collection<GT_Recipe> - tRecipes = mRecipeFluidMap.get(aFluid.getFluid()); - if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) - return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; + // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that Map too. + if ((this.mMinimalInputItems == 0) && (aFluids != null)) { + for (final FluidStack aFluid : aFluids) { + if (aFluid != null) { + final Collection<GT_Recipe> + tRecipes = this.mRecipeFluidMap.get(aFluid.getFluid()); + if (tRecipes != null) { + for (final GT_Recipe tRecipe : tRecipes) { + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { + return tRecipe.mEnabled && ((aVoltage * this.mAmperage) >= tRecipe.mEUt) ? tRecipe : null; + } + } } + } + } + } - // And nothing has been found. - return null; + // And nothing has been found. + return null; } } @@ -573,57 +689,57 @@ public class Recipe_GT extends GT_Recipe{ * Abstract Class for general Recipe Handling of non GT Recipes */ public static abstract class GT_Recipe_Map_NonGTRecipes extends Gregtech_Recipe_Map { - public GT_Recipe_Map_NonGTRecipes(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { + public GT_Recipe_Map_NonGTRecipes(final Collection<GT_Recipe> aRecipeList, final String aUnlocalizedName, final String aLocalName, final String aNEIName, final String aNEIGUIPath, final int aUsualInputCount, final int aUsualOutputCount, final int aMinimalInputItems, final int aMinimalInputFluids, final int aAmperage, final String aNEISpecialValuePre, final int aNEISpecialValueMultiplier, final String aNEISpecialValuePost, final boolean aShowVoltageAmperageInNEI, final boolean aNEIAllowed) { super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); } @Override - public boolean containsInput(ItemStack aStack) { + public boolean containsInput(final ItemStack aStack) { return false; } @Override - public boolean containsInput(FluidStack aFluid) { + public boolean containsInput(final FluidStack aFluid) { return false; } @Override - public boolean containsInput(Fluid aFluid) { + public boolean containsInput(final Fluid aFluid) { return false; } @Override - public GT_Recipe addRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + public GT_Recipe addRecipe(final boolean aOptimize, final ItemStack[] aInputs, final ItemStack[] aOutputs, final Object aSpecial, final int[] aOutputChances, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { return null; } @Override - public Recipe_GT addRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + public Recipe_GT addRecipe(final boolean aOptimize, final ItemStack[] aInputs, final ItemStack[] aOutputs, final Object aSpecial, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { return null; } @Override - public GT_Recipe addRecipe(GT_Recipe aRecipe) { + public GT_Recipe addRecipe(final GT_Recipe aRecipe) { return null; } @Override - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, int[] aOutputChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + public GT_Recipe addFakeRecipe(final boolean aCheckForCollisions, final ItemStack[] aInputs, final ItemStack[] aOutputs, final Object aSpecial, final int[] aOutputChances, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { return null; } @Override - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { + public GT_Recipe addFakeRecipe(final boolean aCheckForCollisions, final ItemStack[] aInputs, final ItemStack[] aOutputs, final Object aSpecial, final FluidStack[] aFluidInputs, final FluidStack[] aFluidOutputs, final int aDuration, final int aEUt, final int aSpecialValue) { return null; } @Override - public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, GT_Recipe aRecipe) { + public GT_Recipe addFakeRecipe(final boolean aCheckForCollisions, final GT_Recipe aRecipe) { return null; } @Override - public GT_Recipe add(GT_Recipe aRecipe) { + public GT_Recipe add(final GT_Recipe aRecipe) { return null; } @@ -631,42 +747,42 @@ public class Recipe_GT extends GT_Recipe{ public void reInit() {/**/} @Override - protected GT_Recipe addToItemMap(GT_Recipe aRecipe) { + protected GT_Recipe addToItemMap(final GT_Recipe aRecipe) { return null; - } + } } /** * Just a Recipe Map with Utility specifically for Fuels. */ public static class Gregtech_Recipe_Map_Fuel extends Gregtech_Recipe_Map { - public Gregtech_Recipe_Map_Fuel(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { + public Gregtech_Recipe_Map_Fuel(final Collection<GT_Recipe> aRecipeList, final String aUnlocalizedName, final String aLocalName, final String aNEIName, final String aNEIGUIPath, final int aUsualInputCount, final int aUsualOutputCount, final int aMinimalInputItems, final int aMinimalInputFluids, final int aAmperage, final String aNEISpecialValuePre, final int aNEISpecialValueMultiplier, final String aNEISpecialValuePost, final boolean aShowVoltageAmperageInNEI, final boolean aNEIAllowed) { super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); } - public GT_Recipe addFuel(ItemStack aInput, ItemStack aOutput, int aFuelValueInEU) { + public GT_Recipe addFuel(final ItemStack aInput, final ItemStack aOutput, final int aFuelValueInEU) { Utils.LOG_INFO("Adding Fuel using method 1"); - return addFuel(aInput, aOutput, null, null, 10000, aFuelValueInEU); + return this.addFuel(aInput, aOutput, null, null, 10000, aFuelValueInEU); } - public GT_Recipe addFuel(ItemStack aInput, ItemStack aOutput, int aChance, int aFuelValueInEU) { + public GT_Recipe addFuel(final ItemStack aInput, final ItemStack aOutput, final int aChance, final int aFuelValueInEU) { Utils.LOG_INFO("Adding Fuel using method 2"); - return addFuel(aInput, aOutput, null, null, aChance, aFuelValueInEU); + return this.addFuel(aInput, aOutput, null, null, aChance, aFuelValueInEU); } - public GT_Recipe addFuel(FluidStack aFluidInput, FluidStack aFluidOutput, int aFuelValueInEU) { + public GT_Recipe addFuel(final FluidStack aFluidInput, final FluidStack aFluidOutput, final int aFuelValueInEU) { Utils.LOG_INFO("Adding Fuel using method 3"); - return addFuel(null, null, aFluidInput, aFluidOutput, 10000, aFuelValueInEU); + return this.addFuel(null, null, aFluidInput, aFluidOutput, 10000, aFuelValueInEU); } - public GT_Recipe addFuel(ItemStack aInput, ItemStack aOutput, FluidStack aFluidInput, FluidStack aFluidOutput, int aFuelValueInEU) { + public GT_Recipe addFuel(final ItemStack aInput, final ItemStack aOutput, final FluidStack aFluidInput, final FluidStack aFluidOutput, final int aFuelValueInEU) { Utils.LOG_INFO("Adding Fuel using method 4"); - return addFuel(aInput, aOutput, aFluidInput, aFluidOutput, 10000, aFuelValueInEU); + return this.addFuel(aInput, aOutput, aFluidInput, aFluidOutput, 10000, aFuelValueInEU); } - public GT_Recipe addFuel(ItemStack aInput, ItemStack aOutput, FluidStack aFluidInput, FluidStack aFluidOutput, int aChance, int aFuelValueInEU) { + public GT_Recipe addFuel(final ItemStack aInput, final ItemStack aOutput, final FluidStack aFluidInput, final FluidStack aFluidOutput, final int aChance, final int aFuelValueInEU) { Utils.LOG_INFO("Adding Fuel using method 5"); - return addRecipe(true, new ItemStack[]{aInput}, new ItemStack[]{aOutput}, null, new int[]{aChance}, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, 0, 0, aFuelValueInEU); + return this.addRecipe(true, new ItemStack[]{aInput}, new ItemStack[]{aOutput}, null, new int[]{aChance}, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, 0, 0, aFuelValueInEU); } } diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 79e943d9bd..045e0a535b 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -2,7 +2,19 @@ package gtPlusPlus; import static gtPlusPlus.core.lib.CORE.DEBUG; import static gtPlusPlus.core.lib.CORE.configSwitches.*; -import gregtech.api.util.*; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.util.Collection; + +import cpw.mods.fml.common.*; +import cpw.mods.fml.common.Mod.EventHandler; +import cpw.mods.fml.common.event.*; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.util.GT_Config; +import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; import gtPlusPlus.core.commands.CommandMath; @@ -18,23 +30,12 @@ import gtPlusPlus.xmod.gregtech.HANDLER_GT; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.util.Collection; - import net.minecraftforge.common.config.Configuration; -import cpw.mods.fml.common.*; -import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.event.*; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; @Mod(modid=CORE.MODID, name=CORE.name, version=CORE.VERSION, dependencies="required-after:Forge; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO;") public class GTplusplus implements ActionListener -{ +{ @Mod.Instance(CORE.MODID) public static GTplusplus instance; @@ -46,16 +47,16 @@ implements ActionListener - public static void handleConfigFile(FMLPreInitializationEvent event) { - Configuration config = new Configuration(new File(event.getModConfigurationDirectory(), "GTplusplus/GTplusplus.cfg")); + public static void handleConfigFile(final FMLPreInitializationEvent event) { + final Configuration config = new Configuration(new File(event.getModConfigurationDirectory(), "GTplusplus/GTplusplus.cfg")); config.load(); - + //Debug DEBUG = config.getBoolean("debugMode", "debug", false, "Enables all sorts of debug logging. (Don't use unless told to, breaks other things.)"); disableEnderIOIntegration = config.getBoolean("disableEnderIO", "debug", false, "Disables EnderIO Integration."); - - + + //Machines enableThaumcraftShardUnification = config.getBoolean("enableThaumcraftShardUnification", "machines", false, "Allows the use of TC shards across many recipes by oreDicting them into a common group."); enableAlternativeBatteryAlloy = config.getBoolean("enableAlternativeBatteryAlloy", "machines", false, "Adds a non-Antimony using Battery Alloy. Not Balanced at all.."); @@ -65,16 +66,16 @@ implements ActionListener //Tools CORE.configSwitches.enableSkookumChoochers = config.getBoolean("enableSkookumChoochers", "gregtech", true, "Adds Custom GT Tools, called Skookum Choochers, functioning as a hard hammer and a wrench."); CORE.configSwitches.enableMultiSizeTools = config.getBoolean("enableMultiSizeTools", "gregtech", true, "Adds Custom GT Shovels and Pickaxes which mine in a 3x3 style. One of each whill be generated for each Gregtech Material which has Dense Plates and Long Rods available."); - + //Pipes & Cables CORE.configSwitches.enableCustom_Pipes = config.getBoolean("enableCustom_Pipes", "gregtech", true, "Adds Custom GT Fluid Pipes."); CORE.configSwitches.enableCustom_Cables = config.getBoolean("enableCustom_Cables", "gregtech", true, "Adds Custom GT Cables."); - + //Block Drops CORE.configSwitches.chanceToDropDrainedShard = config.getInt("chanceToDropDrainedShard", "blockdrops", 196, 0, 10000, "Drained shards have a 1 in X chance to drop."); CORE.configSwitches.chanceToDropFluoriteOre = config.getInt("chanceToDropFluoriteOre", "blockdrops", 32, 0, 10000, "Fluorite Ore has a 1 in X chance to drop from Limestone and a 1 in X*20 from Sandstone.."); - - + + //Single machines CORE.configSwitches.enableMachine_SolarGenerators = config.getBoolean("enableSolarGenerators", "gregtech", false, "These may be overpowered, Consult a local electrician."); CORE.configSwitches.enableMachine_Safes = config.getBoolean("enableMachineSafes", "gregtech", true, "These protect your goodies/rare stuff."); @@ -83,8 +84,8 @@ implements ActionListener CORE.configSwitches.enableMachine_FluidTanks = config.getBoolean("enableMachineFluidTanks", "gregtech", true, "Portable fluid tanks."); CORE.configSwitches.enableMachine_RocketEngines = config.getBoolean("enableMachineRocketEngines", "gregtech", true, "Diesel egines with different internals, they consume less fuel overall."); CORE.configSwitches.enableMachine_GeothermalEngines = config.getBoolean("enableMachineGeothermalEngines", "gregtech", true, "These may be overpowered, Consult a local geologist."); - - + + //Multi machines CORE.configSwitches.enableMultiblock_AlloyBlastSmelter = config.getBoolean("enableMultiblockAlloyBlastSmelter", "gregtech", true, "Required to smelt most high tier materials from GT++. Also smelts everything else to molten metal."); CORE.configSwitches.enableMultiblock_IndustrialCentrifuge = config.getBoolean("enableMultiblockIndustrialCentrifuge", "gregtech", true, "Spin, Spin, Spiiiin."); @@ -99,15 +100,15 @@ implements ActionListener CORE.configSwitches.enableMultiblock_PowerSubstation = config.getBoolean("enableMultiblockPowerSubstation", "gregtech", true, "For managing large power grids."); CORE.configSwitches.enableMultiblock_LiquidFluorideThoriumReactor = config.getBoolean("enableMultiblockLiquidFluorideThoriumReactor", "gregtech", true, "For supplying large power grids."); CORE.configSwitches.enableMultiblock_NuclearFuelRefinery = config.getBoolean("enableMultiblock_NuclearFuelRefinery", "gregtech", true, "Refines molten chemicals into nuclear fuels."); - - + + //Options RF2EU_Battery.rfPerEU = config.getInt("rfUsedPerEUForUniversalBatteries", "configurables", 4, 1, 1000, "How much RF is a single unit of EU worth? (Most mods use 4:1 ratio)"); //Features enableCustomAlvearyBlocks = config.getBoolean("enableCustomAlvearyBlocks", "features", false, "Enables Custom Alveary Blocks."); - config.save(); + config.save(); } public static String randomDust_A; @@ -117,15 +118,15 @@ implements ActionListener protected void FirstCall(){ Utils.LOG_WARNING("Summoning up mystic powers."); - String[] infusedDusts = {"Fire", "Water", "Earth", "Air", "Order", "Entropy"}; - int a = MathUtils.randInt(0, 5); - int b = MathUtils.randInt(0, 5); - int c = MathUtils.randInt(0, 5); - int d = MathUtils.randInt(0, 5); - String infusedDust1 = "dustInfused"+infusedDusts[a]; - String infusedDust2 = "dustInfused"+infusedDusts[b]; - String infusedDust3 = "dustInfused"+infusedDusts[c]; - String infusedDust4 = "dustInfused"+infusedDusts[d]; + final String[] infusedDusts = {"Fire", "Water", "Earth", "Air", "Order", "Entropy"}; + final int a = MathUtils.randInt(0, 5); + final int b = MathUtils.randInt(0, 5); + final int c = MathUtils.randInt(0, 5); + final int d = MathUtils.randInt(0, 5); + final String infusedDust1 = "dustInfused"+infusedDusts[a]; + final String infusedDust2 = "dustInfused"+infusedDusts[b]; + final String infusedDust3 = "dustInfused"+infusedDusts[c]; + final String infusedDust4 = "dustInfused"+infusedDusts[d]; Utils.LOG_INFO("Found the aspect of "+infusedDusts[a]+" to embody into energy crystals."); Utils.LOG_INFO("Found the aspect of "+infusedDusts[b]+" to embody into energy crystals."); Utils.LOG_INFO("Found the aspect of "+infusedDusts[c]+" to embody into energy crystals."); @@ -137,7 +138,7 @@ implements ActionListener //ItemStack a1 = UtilsItems.getItemStackOfAmountFromOreDict("dustInfused"+infusedDusts[a], 8); //ItemStack b1 = UtilsItems.getItemStackOfAmountFromOreDict("dustInfused"+infusedDusts[b], 8); //ItemStack c1 = UtilsItems.getItemStackOfAmountFromOreDict("dustInfused"+infusedDusts[c], 8); - //ItemStack d1 = UtilsItems.getItemStackOfAmountFromOreDict("dustInfused"+infusedDusts[d], 8); + //ItemStack d1 = UtilsItems.getItemStackOfAmountFromOreDict("dustInfused"+infusedDusts[d], 8); } @@ -157,12 +158,12 @@ implements ActionListener //Pre-Init @Mod.EventHandler - public void preInit(FMLPreInitializationEvent event) + public void preInit(final FMLPreInitializationEvent event) { Utils.LOG_INFO("Loading "+CORE.name+" V"+CORE.VERSION); Utils.LOG_INFO("Latest is "+CORE.MASTER_VERSION+". Updated? "+Utils.isModUpToDate()); //FirstCall(); - FMLCommonHandler.instance().bus().register(new LoginEventHandler()); + FMLCommonHandler.instance().bus().register(new LoginEventHandler()); Utils.LOG_INFO("Login Handler Initialized"); handleConfigFile(event); @@ -174,9 +175,9 @@ implements ActionListener //Init @Mod.EventHandler - public void init(FMLInitializationEvent event) + public void init(final FMLInitializationEvent event) { - proxy.init(event); + proxy.init(event); //MinecraftForge.EVENT_BUS.register(this); //FMLCommonHandler.instance().bus().register(this); proxy.registerNetworkStuff(); @@ -184,14 +185,14 @@ implements ActionListener //Post-Init @Mod.EventHandler - public void postInit(FMLPostInitializationEvent event) { - proxy.postInit(event); + public void postInit(final FMLPostInitializationEvent event) { + proxy.postInit(event); if (DEBUG){ - dumpGtRecipeMap(Gregtech_Recipe_Map.sChemicalDehydratorRecipes); - dumpGtRecipeMap(Gregtech_Recipe_Map.sCokeOvenRecipes); - dumpGtRecipeMap(Gregtech_Recipe_Map.sMatterFab2Recipes); - dumpGtRecipeMap(Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes); + this.dumpGtRecipeMap(Gregtech_Recipe_Map.sChemicalDehydratorRecipes); + this.dumpGtRecipeMap(Gregtech_Recipe_Map.sCokeOvenRecipes); + this.dumpGtRecipeMap(Gregtech_Recipe_Map.sMatterFab2Recipes); + this.dumpGtRecipeMap(Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes); } //~ @@ -206,26 +207,26 @@ implements ActionListener } @EventHandler - public void serverStarting(FMLServerStartingEvent event) + public void serverStarting(final FMLServerStartingEvent event) { event.registerServerCommand(new CommandMath()); } @Mod.EventHandler - public void serverStopping(FMLServerStoppingEvent event) + public void serverStopping(final FMLServerStoppingEvent event) { } @Override - public void actionPerformed(ActionEvent arg0) { + public void actionPerformed(final ActionEvent arg0) { } - protected void dumpGtRecipeMap(GT_Recipe_Map r){ - Collection<GT_Recipe> x = r.mRecipeList; + protected void dumpGtRecipeMap(final GT_Recipe_Map r){ + final Collection<GT_Recipe> x = r.mRecipeList; Utils.LOG_INFO("Dumping "+r.mUnlocalizedName+" Recipes for Debug."); - for(GT_Recipe newBo : x){ + for(final GT_Recipe newBo : x){ Utils.LOG_INFO("========================"); Utils.LOG_INFO("Dumping Input: "+ItemUtils.getArrayStackNames(newBo.mInputs)); Utils.LOG_INFO("Dumping Inputs "+ItemUtils.getFluidArrayStackNames(newBo.mFluidInputs)); diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index 1f8ca23b30..8acb757063 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.block; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.block.base.BasicBlock.BlockTypes; import gtPlusPlus.core.block.base.BlockBaseOre; import gtPlusPlus.core.block.general.FirePit; @@ -11,7 +12,6 @@ import gtPlusPlus.core.util.Utils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraftforge.fluids.Fluid; -import cpw.mods.fml.common.registry.GameRegistry; public final class ModBlocks { @@ -34,9 +34,9 @@ public final class ModBlocks { public static Fluid fluidJackDaniels = new Fluid("fluidJackDaniels"); public static Block blockFluidJackDaniels; public static Block blockCasings2Misc; - + public static Block blockFirePit; - + public static Block blockOreFluorite; @@ -45,7 +45,7 @@ public final class ModBlocks { Utils.LOG_INFO("Initializing Blocks."); //blockGriefSaver = new TowerDevice().setBlockName("blockGriefSaver").setCreativeTab(AddToCreativeTab.tabBlock).setBlockTextureName("blockDefault"); - registerBlocks(); + registerBlocks(); } public static void registerBlocks(){ @@ -63,7 +63,7 @@ public final class ModBlocks { blockFishTrap = new FishTrap(); blockOreFluorite = new BlockBaseOre("oreFluorite", "Fluorite", Material.rock, BlockTypes.ORE, Utils.rgbtoHexValue(120, 120, 30), 3); - + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java b/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java index b7ac24a71b..7a0b715138 100644 --- a/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/AdvancedBlock.java @@ -9,23 +9,23 @@ import net.minecraft.world.World; public class AdvancedBlock extends Block { - protected AdvancedBlock(String unlocalizedName, Material material, CreativeTabs x, float blockHardness, float blockResistance, float blockLightLevel, - String blockHarvestTool, int blockHarvestLevel, SoundType BlockSound) { - super(material); - this.setBlockName(unlocalizedName); - this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(x); - this.setHardness(blockHardness); //block Hardness - this.setResistance(blockResistance); - this.setLightLevel(blockLightLevel); - this.setHarvestLevel(blockHarvestTool, blockHarvestLevel); - this.setStepSound(BlockSound); - } - - @Override - public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) - { - return false; - } + protected AdvancedBlock(final String unlocalizedName, final Material material, final CreativeTabs x, final float blockHardness, final float blockResistance, final float blockLightLevel, + final String blockHarvestTool, final int blockHarvestLevel, final SoundType BlockSound) { + super(material); + this.setBlockName(unlocalizedName); + this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(x); + this.setHardness(blockHardness); //block Hardness + this.setResistance(blockResistance); + this.setLightLevel(blockLightLevel); + this.setHarvestLevel(blockHarvestTool, blockHarvestLevel); + this.setStepSound(BlockSound); + } + + @Override + public boolean onBlockActivated(final World p_149727_1_, final int p_149727_2_, final int p_149727_3_, final int p_149727_4_, final EntityPlayer p_149727_5_, final int p_149727_6_, final float p_149727_7_, final float p_149727_8_, final float p_149727_9_) + { + return false; + } } diff --git a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java index 2823fcc5b7..9e3a5fc37f 100644 --- a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java @@ -10,56 +10,56 @@ import net.minecraft.world.World; public class BasicBlock extends BlockContainer { - public BasicBlock(final String unlocalizedName, final Material material) { - this(unlocalizedName, material, 2); - } - - public BasicBlock(final String unlocalizedName, final Material material, int harvestLevel) { - super(material); - this.setBlockName(Utils.sanitizeString(unlocalizedName)); - this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabBlock); - this.setHardness(2.0F); - this.setResistance(6.0F); - this.setLightLevel(0.0F); - this.setHarvestLevel("pickaxe", harvestLevel); - this.setStepSound(soundTypeMetal); - } + public BasicBlock(final String unlocalizedName, final Material material) { + this(unlocalizedName, material, 2); + } + + public BasicBlock(final String unlocalizedName, final Material material, final int harvestLevel) { + super(material); + this.setBlockName(Utils.sanitizeString(unlocalizedName)); + this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(AddToCreativeTab.tabBlock); + this.setHardness(2.0F); + this.setResistance(6.0F); + this.setLightLevel(0.0F); + this.setHarvestLevel("pickaxe", harvestLevel); + this.setStepSound(soundTypeMetal); + } + + + public static enum BlockTypes { + STANDARD("blockBlock", "pickaxe", soundTypeMetal), + FRAME("blockFrameGt", "wrench", soundTypeMetal), + ORE("blockStone", "pickaxe", soundTypeStone); - - public static enum BlockTypes { - STANDARD("blockBlock", "pickaxe", soundTypeMetal), - FRAME("blockFrameGt", "wrench", soundTypeMetal), - ORE("blockStone", "pickaxe", soundTypeStone); - - private String TEXTURE_NAME; - private String HARVEST_TOOL; - private SoundType soundOfBlock; - private BlockTypes (final String textureName, final String harvestTool, final SoundType blockSound) - { - this.TEXTURE_NAME = textureName; - this.HARVEST_TOOL = harvestTool; - this.soundOfBlock = blockSound; - } + private String TEXTURE_NAME; + private String HARVEST_TOOL; + private SoundType soundOfBlock; + private BlockTypes (final String textureName, final String harvestTool, final SoundType blockSound) + { + this.TEXTURE_NAME = textureName; + this.HARVEST_TOOL = harvestTool; + this.soundOfBlock = blockSound; + } - public String getTexture() { - return TEXTURE_NAME; - } - - public String getHarvestTool(){ - return HARVEST_TOOL; - } - - public SoundType getBlockSoundType(){ - return soundOfBlock; - } - - } + public String getTexture() { + return this.TEXTURE_NAME; + } + + public String getHarvestTool(){ + return this.HARVEST_TOOL; + } + + public SoundType getBlockSoundType(){ + return this.soundOfBlock; + } + + } @Override - public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) { return null; } - + } diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java index d694557f55..c8923a9301 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java @@ -1,5 +1,9 @@ package gtPlusPlus.core.block.base; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.item.base.itemblock.ItemBlockGtBlock; import gtPlusPlus.core.item.base.itemblock.ItemBlockGtFrameBox; import gtPlusPlus.core.lib.CORE; @@ -8,10 +12,6 @@ import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.world.IBlockAccess; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class BlockBaseModular extends BasicBlock{ @@ -21,11 +21,11 @@ public class BlockBaseModular extends BasicBlock{ protected final String thisBlockType; - public BlockBaseModular(String unlocalizedName, String blockMaterial, BlockTypes blockType, int colour) { + public BlockBaseModular(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType, final int colour) { this(unlocalizedName, blockMaterial, Material.iron, blockType, colour, 2); } - - public BlockBaseModular(String unlocalizedName, String blockMaterial, Material vanillaMaterial, BlockTypes blockType, int colour, int miningLevel) { + + public BlockBaseModular(final String unlocalizedName, final String blockMaterial, final Material vanillaMaterial, final BlockTypes blockType, final int colour, final int miningLevel) { super(unlocalizedName, vanillaMaterial); this.setHarvestLevel(blockType.getHarvestTool(), miningLevel); this.setBlockTextureName(CORE.MODID+":"+blockType.getTexture()); @@ -33,8 +33,8 @@ public class BlockBaseModular extends BasicBlock{ this.thisBlock = blockType; this.thisBlockMaterial = blockMaterial; this.thisBlockType = blockType.name().toUpperCase(); - this.setBlockName(GetProperName()); - + this.setBlockName(this.GetProperName()); + if (!CORE.DEBUG){ //Utils.LOG_INFO("=============Block Info Dump============="); //Utils.LOG_INFO("thisBlock.name().toLowerCase() - "+thisBlock.name().toLowerCase()); @@ -44,43 +44,43 @@ public class BlockBaseModular extends BasicBlock{ //Utils.LOG_INFO("blockMaterial - "+blockMaterial); //Utils.LOG_INFO("=========================================="); } - - if (thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())){ + + if (this.thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())){ LanguageRegistry.addName(this, "Block of "+blockMaterial); //Utils.LOG_INFO("Registered Block in Language Registry as: "+"Block of "+blockMaterial); } - else if (thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())){ + else if (this.thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())){ LanguageRegistry.addName(this, blockMaterial+ " Frame Box"); //Utils.LOG_INFO("Registered Block in Language Registry as: "+blockMaterial+ " Frame Box"); } - else if (thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())){ + else if (this.thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())){ LanguageRegistry.addName(this, blockMaterial+ " Ore"); //Utils.LOG_INFO("Registered Block in Language Registry as: "+blockMaterial+ " Frame Box"); } else { LanguageRegistry.addName(this, blockMaterial); //Utils.LOG_INFO("Registered Block in Language Registry as: "+blockMaterial); - } - + } + //setOreDict(unlocalizedName, blockType); - if (thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())){ - GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName)); - //Utils.LOG_INFO("Registered Block in Block Registry as: "+"Block of "+blockMaterial); + if (this.thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())){ + GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName)); + //Utils.LOG_INFO("Registered Block in Block Registry as: "+"Block of "+blockMaterial); } - else if (thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())){ + else if (this.thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())){ GameRegistry.registerBlock(this, ItemBlockGtFrameBox.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName)); - //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial+" Frame Box"); + //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial+" Frame Box"); } - else if (thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())){ + else if (this.thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())){ GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName)); - //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial+" Frame Box"); + //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial+" Frame Box"); } else { GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName)); - //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial); + //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial); } - - + + } /** @@ -90,15 +90,15 @@ public class BlockBaseModular extends BasicBlock{ @SideOnly(Side.CLIENT) public int getRenderBlockPass() { - if (thisBlock == BlockTypes.FRAME){ - return 1; + if (this.thisBlock == BlockTypes.FRAME){ + return 1; } return 0; } - + /*@Override public String getLocalizedName() { - String tempIngot; + String tempIngot; if (thisBlock == BlockTypes.STANDARD){ tempIngot = "Block of "+thisBlockMaterial; } @@ -111,55 +111,55 @@ public class BlockBaseModular extends BasicBlock{ } return tempIngot; }*/ - + public String GetProperName() { - String tempIngot; - if (thisBlock == BlockTypes.STANDARD){ - tempIngot = "Block of "+thisBlockMaterial; + String tempIngot; + if (this.thisBlock == BlockTypes.STANDARD){ + tempIngot = "Block of "+this.thisBlockMaterial; } - else if (thisBlock == BlockTypes.FRAME){ - tempIngot = thisBlockMaterial + " Frame Box"; + else if (this.thisBlock == BlockTypes.FRAME){ + tempIngot = this.thisBlockMaterial + " Frame Box"; } - else if (thisBlock == BlockTypes.ORE){ - tempIngot = thisBlockMaterial + " Ore"; + else if (this.thisBlock == BlockTypes.ORE){ + tempIngot = this.thisBlockMaterial + " Ore"; } else { - tempIngot = getUnlocalizedName().replace("tile.blockGt", "ingot"); + tempIngot = this.getUnlocalizedName().replace("tile.blockGt", "ingot"); } return tempIngot; } @Override public boolean isOpaqueCube() - { - return false; - } + { + return false; + } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iIcon) + public void registerBlockIcons(final IIconRegister iIcon) { - this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + thisBlock.getTexture()); + this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + this.thisBlock.getTexture()); } @Override - public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4){ - + public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4){ + if (this.blockColour == 0){ return MathUtils.generateSingularRandomHexValue(); } - + return this.blockColour; } - - @Override - public int getRenderColor(int aMeta) { - if (this.blockColour == 0){ + + @Override + public int getRenderColor(final int aMeta) { + if (this.blockColour == 0){ return MathUtils.generateSingularRandomHexValue(); } - + return this.blockColour; - } + } } diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java index c57aa248b4..c1e58e9393 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java @@ -1,13 +1,13 @@ package gtPlusPlus.core.block.base; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class BlockBaseOre extends BlockBaseModular{ @@ -21,18 +21,18 @@ public class BlockBaseOre extends BlockBaseModular{ return true; }*/ - public BlockBaseOre(String unlocalizedName, String blockMaterial, BlockTypes blockType, int colour) { + public BlockBaseOre(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType, final int colour) { this(unlocalizedName, blockMaterial, Material.iron, blockType, colour, 2); } - - public BlockBaseOre(String unlocalizedName, String blockMaterial, Material vanillaMaterial, BlockTypes blockType, int colour, int miningLevel) { - super(unlocalizedName, blockMaterial, vanillaMaterial, blockType, colour, miningLevel); + + public BlockBaseOre(final String unlocalizedName, final String blockMaterial, final Material vanillaMaterial, final BlockTypes blockType, final int colour, final int miningLevel) { + super(unlocalizedName, blockMaterial, vanillaMaterial, blockType, colour, miningLevel); } /** * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha */ - + /*@Override @SideOnly(Side.CLIENT) public int getRenderBlockPass() @@ -48,30 +48,30 @@ public class BlockBaseOre extends BlockBaseModular{ @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iIcon) + public void registerBlockIcons(final IIconRegister iIcon) { - this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + thisBlock.getTexture()); - //this.base = iIcon.registerIcon(CORE.MODID + ":" + "blockStone"); + this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + this.thisBlock.getTexture()); + //this.base = iIcon.registerIcon(CORE.MODID + ":" + "blockStone"); //this.overlay = iIcon.registerIcon(CORE.MODID + ":" + "blockOre_Overlay"); } @Override - public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4){ + public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4){ if (this.blockColour == 0){ return MathUtils.generateSingularRandomHexValue(); - } + } return this.blockColour; } - - @Override - public int getRenderColor(int aMeta) { - if (this.blockColour == 0){ + + @Override + public int getRenderColor(final int aMeta) { + if (this.blockColour == 0){ return MathUtils.generateSingularRandomHexValue(); } return this.blockColour; - } - - - + } + + + } diff --git a/src/Java/gtPlusPlus/core/block/base/MetaBlock.java b/src/Java/gtPlusPlus/core/block/base/MetaBlock.java index 4009c36726..3e116eeb7f 100644 --- a/src/Java/gtPlusPlus/core/block/base/MetaBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/MetaBlock.java @@ -7,22 +7,22 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class MetaBlock extends MultiTextureBlock { +public class MetaBlock extends MultiTextureBlock { - protected MetaBlock(String unlocalizedName, Material material, SoundType soundType) { - super(unlocalizedName, material, soundType); - } - - @Override - public int damageDropped(int meta) { - return meta; - } - - @Override - public void getSubBlocks(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 6; i ++) { - list.add(new ItemStack(item, 1, i)); - } - } - -}
\ No newline at end of file + protected MetaBlock(final String unlocalizedName, final Material material, final SoundType soundType) { + super(unlocalizedName, material, soundType); + } + + @Override + public int damageDropped(final int meta) { + return meta; + } + + @Override + public void getSubBlocks(final Item item, final CreativeTabs tab, final List list) { + for (int i = 0; i < 6; i ++) { + list.add(new ItemStack(item, 1, i)); + } + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java b/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java index 4f022bae6d..4e91509c6e 100644 --- a/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java +++ b/src/Java/gtPlusPlus/core/block/base/MultiTextureBlock.java @@ -7,30 +7,30 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; -public class MultiTextureBlock extends Block { +public class MultiTextureBlock extends Block { public IIcon[] icons = new IIcon[6]; - - protected MultiTextureBlock(String unlocalizedName, Material material, SoundType blockSound) - { - super(material); - this.setBlockName(unlocalizedName); - this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabBlock); - this.setHardness(2.0F); - this.setResistance(6.0F); - this.setStepSound(blockSound); - } - - @Override - public void registerBlockIcons(IIconRegister reg) { - for (int i = 0; i < 6; i ++) { - this.icons[i] = reg.registerIcon(this.textureName + "_" + i); - } - } - - @Override - public IIcon getIcon(int side, int meta) { - return this.icons[side]; - } + + protected MultiTextureBlock(final String unlocalizedName, final Material material, final SoundType blockSound) + { + super(material); + this.setBlockName(unlocalizedName); + this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(AddToCreativeTab.tabBlock); + this.setHardness(2.0F); + this.setResistance(6.0F); + this.setStepSound(blockSound); + } + + @Override + public void registerBlockIcons(final IIconRegister reg) { + for (int i = 0; i < 6; i ++) { + this.icons[i] = reg.registerIcon(this.textureName + "_" + i); + } + } + + @Override + public IIcon getIcon(final int side, final int meta) { + return this.icons[side]; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/general/FirePit.java b/src/Java/gtPlusPlus/core/block/general/FirePit.java index 4dd58df6a4..cf24025124 100644 --- a/src/Java/gtPlusPlus/core/block/general/FirePit.java +++ b/src/Java/gtPlusPlus/core/block/general/FirePit.java @@ -1,13 +1,17 @@ package gtPlusPlus.core.block.general; import static net.minecraftforge.common.util.ForgeDirection.*; -import gtPlusPlus.core.block.base.BasicBlock; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.tileentities.general.TileEntityFirepit; import java.util.List; import java.util.Random; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.block.base.BasicBlock; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.tileentities.general.TileEntityFirepit; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -19,10 +23,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class FirePit extends BasicBlock{ private static IIcon[] TEXTURE; @@ -40,44 +40,44 @@ public class FirePit extends BasicBlock{ GameRegistry.registerBlock(this, "blockFirePit"); LanguageRegistry.addName(this, "Fire Pit"); } - + @Override - public int tickRate(World aParWorld) { - return 30; - } - - @Override - public TileEntity createNewTileEntity(World world, int i) { - return new TileEntityFirepit(); - } - + public int tickRate(final World aParWorld) { + return 30; + } + + @Override + public TileEntity createNewTileEntity(final World world, final int i) { + return new TileEntityFirepit(); + } + @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister par1IconRegister){ + public void registerBlockIcons(final IIconRegister par1IconRegister){ TEXTURE = new IIcon[] {par1IconRegister.registerIcon(this.getTextureName() + "_layer_0"), par1IconRegister.registerIcon(this.getTextureName() + "_layer_1")}; } @SuppressWarnings({ "rawtypes", "unchecked" }) @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List){ par3List.add(new ItemStack(par1, 1, 2)); } @Override - public void updateTick(World par1World, int x, int y, int z, Random par5Random){ + public void updateTick(final World par1World, final int x, final int y, final int z, final Random par5Random){ if (!par1World.isRemote){ //Sets meta. - meta = par1World.getBlockMetadata(x, y, z); + this.meta = par1World.getBlockMetadata(x, y, z); //If Raining, Put out. - if (par1World.isRaining() - && (par1World.canLightningStrikeAt(x, y, z) - || par1World.canLightningStrikeAt(x - 1, y, z) - || par1World.canLightningStrikeAt(x + 1, y, z) - || par1World.canLightningStrikeAt(x, y, z - 1) - || par1World.canLightningStrikeAt(x, y, z + 1))){ + if (par1World.isRaining() + && (par1World.canLightningStrikeAt(x, y, z) + || par1World.canLightningStrikeAt(x - 1, y, z) + || par1World.canLightningStrikeAt(x + 1, y, z) + || par1World.canLightningStrikeAt(x, y, z - 1) + || par1World.canLightningStrikeAt(x, y, z + 1))){ //Fire goes out - par1World.setBlockMetadataWithNotify(x, y, z, 1, 4); - } + par1World.setBlockMetadataWithNotify(x, y, z, 1, 4); + } if (isNeighborBurning(par1World, x, y, z)){ //Fire can ignite from a nearby flame source. par1World.setBlockMetadataWithNotify(x, y, z, 2, 4); @@ -86,9 +86,9 @@ public class FirePit extends BasicBlock{ } @Override - public Item getItemDropped(int meta, Random par2Random, int par3){ + public Item getItemDropped(final int meta, final Random par2Random, final int par3){ switch (meta){ - case 0: + case 0: return null; default: break; @@ -97,20 +97,20 @@ public class FirePit extends BasicBlock{ } @Override - public int damageDropped(int meta){ + public int damageDropped(final int meta){ return meta; } - + @Override public boolean isOpaqueCube(){ - return false; - } + return false; + } @Override public int getRenderType(){ - return -1; - } - + return -1; + } + @Override @SideOnly(Side.CLIENT) public int getRenderBlockPass(){ @@ -121,7 +121,7 @@ public class FirePit extends BasicBlock{ public boolean renderAsNormalBlock(){ return false; } - + /*@Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World aParWorld, int x, int y, int z){ return null; @@ -134,92 +134,95 @@ public class FirePit extends BasicBlock{ @Override @SideOnly(Side.CLIENT) - public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_){ + public void randomDisplayTick(final World p_149734_1_, final int p_149734_2_, final int p_149734_3_, final int p_149734_4_, final Random p_149734_5_){ int l; float f; float f1; float f2; - if (meta == 2) - if (p_149734_5_.nextInt(24) == 0){ - p_149734_1_.playSound((double)((float)p_149734_2_ + 0.5F), (double)((float)p_149734_3_ + 0.5F), (double)((float)p_149734_4_ + 0.5F), "fire.fire", 1.0F + p_149734_5_.nextFloat(), p_149734_5_.nextFloat() * 0.7F + 0.3F, false); + if (this.meta == 2) { + if (p_149734_5_.nextInt(24) == 0){ + p_149734_1_.playSound(p_149734_2_ + 0.5F, p_149734_3_ + 0.5F, p_149734_4_ + 0.5F, "fire.fire", 1.0F + p_149734_5_.nextFloat(), (p_149734_5_.nextFloat() * 0.7F) + 0.3F, false); + } } - if (meta == 2) - if (!World.doesBlockHaveSolidTopSurface(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_, UP)){ - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_, EAST)){ - for (l = 0; l < 2; ++l){ - f = (float)p_149734_2_ + p_149734_5_.nextFloat() * 0.1F; - f1 = (float)p_149734_3_ + p_149734_5_.nextFloat(); - f2 = (float)p_149734_4_ + p_149734_5_.nextFloat(); - p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D); + if (this.meta == 2) { + if (!World.doesBlockHaveSolidTopSurface(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_, UP)){ + if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_, EAST)){ + for (l = 0; l < 2; ++l){ + f = p_149734_2_ + (p_149734_5_.nextFloat() * 0.1F); + f1 = p_149734_3_ + p_149734_5_.nextFloat(); + f2 = p_149734_4_ + p_149734_5_.nextFloat(); + p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); + } } - } - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_, WEST)){ - for (l = 0; l < 2; ++l){ - f = (float)(p_149734_2_ + 1) - p_149734_5_.nextFloat() * 0.1F; - f1 = (float)p_149734_3_ + p_149734_5_.nextFloat(); - f2 = (float)p_149734_4_ + p_149734_5_.nextFloat(); - p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D); + if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_, WEST)){ + for (l = 0; l < 2; ++l){ + f = p_149734_2_ + 1 - (p_149734_5_.nextFloat() * 0.1F); + f1 = p_149734_3_ + p_149734_5_.nextFloat(); + f2 = p_149734_4_ + p_149734_5_.nextFloat(); + p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); + } } - } - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1, SOUTH)){ - for (l = 0; l < 2; ++l){ - f = (float)p_149734_2_ + p_149734_5_.nextFloat(); - f1 = (float)p_149734_3_ + p_149734_5_.nextFloat(); - f2 = (float)p_149734_4_ + p_149734_5_.nextFloat() * 0.1F; - p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D); + if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1, SOUTH)){ + for (l = 0; l < 2; ++l){ + f = p_149734_2_ + p_149734_5_.nextFloat(); + f1 = p_149734_3_ + p_149734_5_.nextFloat(); + f2 = p_149734_4_ + (p_149734_5_.nextFloat() * 0.1F); + p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); + } } - } - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1, NORTH)){ - for (l = 0; l < 2; ++l){ - f = (float)p_149734_2_ + p_149734_5_.nextFloat(); - f1 = (float)p_149734_3_ + p_149734_5_.nextFloat(); - f2 = (float)(p_149734_4_ + 1) - p_149734_5_.nextFloat() * 0.1F; - p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D); + if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1, NORTH)){ + for (l = 0; l < 2; ++l){ + f = p_149734_2_ + p_149734_5_.nextFloat(); + f1 = p_149734_3_ + p_149734_5_.nextFloat(); + f2 = p_149734_4_ + 1 - (p_149734_5_.nextFloat() * 0.1F); + p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); + } } - } - if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_, DOWN)){ - for (l = 0; l < 2; ++l){ - f = (float)p_149734_2_ + p_149734_5_.nextFloat(); - f1 = (float)(p_149734_3_ + 1) - p_149734_5_.nextFloat() * 0.1F; - f2 = (float)p_149734_4_ + p_149734_5_.nextFloat(); - p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D); + if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_, DOWN)){ + for (l = 0; l < 2; ++l){ + f = p_149734_2_ + p_149734_5_.nextFloat(); + f1 = p_149734_3_ + 1 - (p_149734_5_.nextFloat() * 0.1F); + f2 = p_149734_4_ + p_149734_5_.nextFloat(); + p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); + } } } - } - else{ - if (meta == 2) - for (l = 0; l < 3; ++l){ - f = (float)p_149734_2_ + p_149734_5_.nextFloat(); - f1 = (float)p_149734_3_ + p_149734_5_.nextFloat() * 0.5F + 0.5F; - f2 = (float)p_149734_4_ + p_149734_5_.nextFloat(); - p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D); + else{ + if (this.meta == 2) { + for (l = 0; l < 3; ++l){ + f = p_149734_2_ + p_149734_5_.nextFloat(); + f1 = p_149734_3_ + (p_149734_5_.nextFloat() * 0.5F) + 0.5F; + f2 = p_149734_4_ + p_149734_5_.nextFloat(); + p_149734_1_.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); + } + } } } } - @SideOnly(Side.CLIENT) - public static IIcon getFireIcon(int p_149840_1_){ - return FirePit.TEXTURE[p_149840_1_]; - } + @SideOnly(Side.CLIENT) + public static IIcon getFireIcon(final int p_149840_1_){ + return FirePit.TEXTURE[p_149840_1_]; + } - @Override + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int p_149691_2_){ - return FirePit.TEXTURE[0]; - } - - private static boolean isNeighborBurning(World world, int x, int y, int z){ - return canCatchFire(world, x + 1, y, z, WEST ) || - canCatchFire(world, x - 1, y, z, EAST ) || - canCatchFire(world, x, y - 1, z, UP ) || - canCatchFire(world, x, y + 1, z, DOWN ) || - canCatchFire(world, x, y, z - 1, SOUTH) || - canCatchFire(world, x, y, z + 1, NORTH); - } - - public static boolean canCatchFire(World world, int x, int y, int z, ForgeDirection face) - { - return world.getBlock(x, y, z).isFireSource(world, x, y, z, face); - } - + public IIcon getIcon(final int p_149691_1_, final int p_149691_2_){ + return FirePit.TEXTURE[0]; + } + + private static boolean isNeighborBurning(final World world, final int x, final int y, final int z){ + return canCatchFire(world, x + 1, y, z, WEST ) || + canCatchFire(world, x - 1, y, z, EAST ) || + canCatchFire(world, x, y - 1, z, UP ) || + canCatchFire(world, x, y + 1, z, DOWN ) || + canCatchFire(world, x, y, z - 1, SOUTH) || + canCatchFire(world, x, y, z + 1, NORTH); + } + + public static boolean canCatchFire(final World world, final int x, final int y, final int z, final ForgeDirection face) + { + return world.getBlock(x, y, z).isFireSource(world, x, y, z, face); + } + } diff --git a/src/Java/gtPlusPlus/core/block/general/LightGlass.java b/src/Java/gtPlusPlus/core/block/general/LightGlass.java index 5aa9f5b818..fd2d575158 100644 --- a/src/Java/gtPlusPlus/core/block/general/LightGlass.java +++ b/src/Java/gtPlusPlus/core/block/general/LightGlass.java @@ -1,29 +1,28 @@ package gtPlusPlus.core.block.general; +import java.util.Random; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; - -import java.util.Random; - import net.minecraft.block.BlockBreakable; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class LightGlass extends BlockBreakable { private int state = 0; - private int a = 255; + private final int a = 255; private int r = 255; private int g = 0; private int b = 0; private int hex; - public LightGlass(Material mat, boolean bool) + public LightGlass(final Material mat, final boolean bool) { super("blockMFEffect", mat, bool); this.setCreativeTab(AddToCreativeTab.tabBlock); @@ -38,7 +37,7 @@ public class LightGlass extends BlockBreakable * Returns the quantity of items to drop on block destruction. */ @Override - public int quantityDropped(Random rand) + public int quantityDropped(final Random rand) { return 0; } @@ -73,47 +72,53 @@ public class LightGlass extends BlockBreakable @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iIcon) + public void registerBlockIcons(final IIconRegister iIcon) { this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + "blockMFEffect"); } @Override //http://stackoverflow.com/questions/31784658/how-can-i-loop-through-all-rgb-combinations-in-rainbow-order-in-java - public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) { - if(state == 0){ - g++; - if(g == 255) - state = 1; + if(this.state == 0){ + this.g++; + if(this.g == 255) { + this.state = 1; + } } - if(state == 1){ - r--; - if(r == 0) - state = 2; + if(this.state == 1){ + this.r--; + if(this.r == 0) { + this.state = 2; + } } - if(state == 2){ - b++; - if(b == 255) - state = 3; + if(this.state == 2){ + this.b++; + if(this.b == 255) { + this.state = 3; + } } - if(state == 3){ - g--; - if(g == 0) - state = 4; + if(this.state == 3){ + this.g--; + if(this.g == 0) { + this.state = 4; + } } - if(state == 4){ - r++; - if(r == 255) - state = 5; + if(this.state == 4){ + this.r++; + if(this.r == 255) { + this.state = 5; + } } - if(state == 5){ - b--; - if(b == 0) - state = 0; + if(this.state == 5){ + this.b--; + if(this.b == 0) { + this.state = 0; + } } - hex = (a << 24) + (r << 16) + (g << 8) + (b); - return hex; + this.hex = (this.a << 24) + (this.r << 16) + (this.g << 8) + (this.b); + return this.hex; } /** @@ -121,8 +126,8 @@ public class LightGlass extends BlockBreakable */ @Override @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int posX, int posY, int posZ, Random random){ + public void randomDisplayTick(final World world, final int posX, final int posY, final int posZ, final Random random){ Utils.spawnFX(world, posX, posY, posZ, "smoke", "cloud"); - + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java b/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java index 7fa890b6c8..8ac4e2df8d 100644 --- a/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java +++ b/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java @@ -1,14 +1,16 @@ package gtPlusPlus.core.block.general.antigrief; import static gtPlusPlus.core.block.ModBlocks.blockGriefSaver; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityReverter; -import gtPlusPlus.core.util.Utils; import java.util.List; import java.util.Random; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.general.TileEntityReverter; +import gtPlusPlus.core.util.Utils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -23,254 +25,267 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class TowerDevice extends Block { - private static IIcon TEX_ANTIBUILDER; - public static final int META_ANTIBUILDER = 9; - private boolean bUnbreakable; - - public TowerDevice() - { - super(Material.wood); - setHardness(10.0F); - setResistance(35.0F); - setStepSound(Block.soundTypeWood); - setCreativeTab(AddToCreativeTab.tabMachines); - } - - public int tickRate() - { - return 15; - } - - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setBoolean("bUnbreakable", bUnbreakable); + private static IIcon TEX_ANTIBUILDER; + public static final int META_ANTIBUILDER = 9; + private boolean bUnbreakable; + + public TowerDevice() + { + super(Material.wood); + this.setHardness(10.0F); + this.setResistance(35.0F); + this.setStepSound(Block.soundTypeWood); + this.setCreativeTab(AddToCreativeTab.tabMachines); + } + + public int tickRate() + { + return 15; + } + + public void saveNBTData(final NBTTagCompound aNBT) { + aNBT.setBoolean("bUnbreakable", this.bUnbreakable); + } + + public void loadNBTData(final NBTTagCompound aNBT) { + this.bUnbreakable = aNBT.getBoolean("bUnbreakable"); + } + + @Override + public IIcon getIcon(final int side, final int meta) + { + return TEX_ANTIBUILDER; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(final IIconRegister par1IconRegister) + { + TEX_ANTIBUILDER = par1IconRegister.registerIcon(CORE.MODID + ":" + "blockAntiGrief"); + } + + @Override + public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) + { + par3List.add(new ItemStack(par1, 1, 9)); + } + + @Override + public boolean onBlockActivated(final World par1World, final int x, final int y, final int z, final EntityPlayer par5EntityPlayer, final int par6, final float par7, final float par8, final float par9) + { + final int meta = par1World.getBlockMetadata(x, y, z); + return false; + } + + @Override + public float getExplosionResistance(final Entity par1Entity, final World world, final int x, final int y, final int z, final double explosionX, final double explosionY, final double explosionZ) + { + final int meta = world.getBlockMetadata(x, y, z); + return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ); + } + + @Override + public float getBlockHardness(final World world, final int x, final int y, final int z) + { + final int meta = world.getBlockMetadata(x, y, z); + return super.getBlockHardness(world, x, y, z); + } + + public static boolean areNearbyLockBlocks(final World world, final int x, final int y, final int z) + { + boolean locked = false; + for (int dx = x - 2; dx <= (x + 2); dx++) { + for (int dy = y - 2; dy <= (y + 2); dy++) { + for (int dz = z - 2; dz <= (z + 2); dz++) { + if ((world.getBlock(dx, dy, dz) == blockGriefSaver) && (world.getBlockMetadata(dx, dy, dz) == 4)) { + locked = true; + } + } + } + } + return locked; + } + + public static void unlockBlock(final World par1World, final int x, final int y, final int z) + { + final Block thereBlockID = par1World.getBlock(x, y, z); + final int thereBlockMeta = par1World.getBlockMetadata(x, y, z); + if ((thereBlockID == blockGriefSaver) || (thereBlockMeta == 4)) + { + changeToBlockMeta(par1World, x, y, z, 5); + par1World.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.click", 0.3F, 0.6F); + } + } + + private static void changeToBlockMeta(final World par1World, final int x, final int y, final int z, final int meta) + { + final Block thereBlockID = par1World.getBlock(x, y, z); + if ((thereBlockID == blockGriefSaver)) + { + par1World.setBlock(x, y, z, thereBlockID, meta, 3); + par1World.markBlockRangeForRenderUpdate(x, y, z, x, y, z); + par1World.notifyBlocksOfNeighborChange(x, y, z, thereBlockID); + } + } + + @Override + public void onBlockAdded(final World par1World, final int x, final int y, final int z) + { + final int meta = par1World.getBlockMetadata(x, y, z); + if (!par1World.isRemote) { + + } + } + + @Override + public void onNeighborBlockChange(final World par1World, final int x, final int y, final int z, final Block myBlockID) + { + final int meta = par1World.getBlockMetadata(x, y, z); + if (!par1World.isRemote) + { + + } + } + + @Override + public void updateTick(final World par1World, final int x, final int y, final int z, final Random par5Random) + { + if (!par1World.isRemote) + { + final int meta = par1World.getBlockMetadata(x, y, z); + } + } + + private void letsBuild(final World par1World, final int x, final int y, final int z) + { + + } + + private boolean isInactiveTrapCharged(final World par1World, final int x, final int y, final int z) + { + return false; + } + + private boolean isReactorReady(final World world, final int x, final int y, final int z) + { + if ((world.getBlock(x, y + 1, z) != Blocks.redstone_block) || + (world.getBlock(x, y - 1, z) != Blocks.redstone_block) || + (world.getBlock(x + 1, y, z) != Blocks.redstone_block) || + (world.getBlock(x - 1, y, z) != Blocks.redstone_block) || + (world.getBlock(x, y, z + 1) != Blocks.redstone_block) || + (world.getBlock(x, y, z - 1) != Blocks.redstone_block)) { + return false; + } + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public void randomDisplayTick(final World par1World, final int x, final int y, final int z, final Random par5Random) + { + final int meta = par1World.getBlockMetadata(x, y, z); + if ((meta == 3) || (meta == 1) || (meta == 9)) { + for (int i = 0; i < 1; i++) { + this.sparkle(par1World, x, y, z, par5Random); + } + } + } + + public void sparkle(final World world, final int x, final int y, final int z, final Random rand) + { + final double offset = 0.0625D; + for (int side = 0; side < 6; side++) + { + double rx = x + rand.nextFloat(); + double ry = y + rand.nextFloat(); + double rz = z + rand.nextFloat(); + if ((side == 0) && (!world.getBlock(x, y + 1, z).isOpaqueCube())) { + ry = y + 1 + offset; + } + if ((side == 1) && (!world.getBlock(x, y - 1, z).isOpaqueCube())) { + ry = (y + 0) - offset; + } + if ((side == 2) && (!world.getBlock(x, y, z + 1).isOpaqueCube())) { + rz = z + 1 + offset; + } + if ((side == 3) && (!world.getBlock(x, y, z - 1).isOpaqueCube())) { + rz = (z + 0) - offset; + } + if ((side == 4) && (!world.getBlock(x + 1, y, z).isOpaqueCube())) { + rx = x + 1 + offset; + } + if ((side == 5) && (!world.getBlock(x - 1, y, z).isOpaqueCube())) { + rx = (x + 0) - offset; + } + if ((rx < x) || (rx > (x + 1)) || (ry < 0.0D) || (ry > (y + 1)) || (rz < z) || (rz > (z + 1))) { + world.spawnParticle("reddust", rx, ry, rz, 0.0D, 0.0D, 0.0D); + } + } + } + + public static void checkAndActivateVanishBlock(final World world, final int x, final int y, final int z) + { + final Block thereID = world.getBlock(x, y, z); + final int thereMeta = world.getBlockMetadata(x, y, z); + } + + public static void changeToActiveVanishBlock(final World par1World, final int x, final int y, final int z, final int meta) + { + changeToBlockMeta(par1World, x, y, z, meta); + par1World.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.pop", 0.3F, 0.6F); + + final Block thereBlockID = par1World.getBlock(x, y, z); + par1World.scheduleBlockUpdate(x, y, z, thereBlockID, getTickRateFor(thereBlockID, meta, par1World.rand)); + } + + private static int getTickRateFor(final Block thereBlockID, final int meta, final Random rand) + { + return 15; + } + + @Override + public int getLightValue(final IBlockAccess world, final int x, final int y, final int z) + { + final Block blockID = world.getBlock(x, y, z); + final int meta = world.getBlockMetadata(x, y, z); + if (blockID != this) { + return 0; + } + return 10; + } + + @Override + public boolean hasTileEntity(final int metadata) + { + return (metadata == 0); + } + + @Override + public TileEntity createTileEntity(final World world, final int metadata) + { + if (metadata == 0) { + Utils.LOG_INFO("I have been created. [Antigriefer]"+this.getLocalizedName()); + return new TileEntityReverter(); + } + return null; + } + + @Override + public Item getItemDropped(final int meta, final Random par2Random, final int par3) + { + switch (meta) + { + case 0: + return null; + } + return Item.getItemFromBlock(this); } - public void loadNBTData(NBTTagCompound aNBT) { - bUnbreakable = aNBT.getBoolean("bUnbreakable"); + @Override + public int damageDropped(final int meta) + { + return meta; } - - public IIcon getIcon(int side, int meta) - { - return TEX_ANTIBUILDER; - } - - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister par1IconRegister) - { - TEX_ANTIBUILDER = par1IconRegister.registerIcon(CORE.MODID + ":" + "blockAntiGrief"); - } - - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - par3List.add(new ItemStack(par1, 1, 9)); - } - - public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) - { - int meta = par1World.getBlockMetadata(x, y, z); - return false; - } - - public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) - { - int meta = world.getBlockMetadata(x, y, z); - return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ); - } - - public float getBlockHardness(World world, int x, int y, int z) - { - int meta = world.getBlockMetadata(x, y, z); - return super.getBlockHardness(world, x, y, z); - } - - public static boolean areNearbyLockBlocks(World world, int x, int y, int z) - { - boolean locked = false; - for (int dx = x - 2; dx <= x + 2; dx++) { - for (int dy = y - 2; dy <= y + 2; dy++) { - for (int dz = z - 2; dz <= z + 2; dz++) { - if ((world.getBlock(dx, dy, dz) == blockGriefSaver) && (world.getBlockMetadata(dx, dy, dz) == 4)) { - locked = true; - } - } - } - } - return locked; - } - - public static void unlockBlock(World par1World, int x, int y, int z) - { - Block thereBlockID = par1World.getBlock(x, y, z); - int thereBlockMeta = par1World.getBlockMetadata(x, y, z); - if ((thereBlockID == blockGriefSaver) || (thereBlockMeta == 4)) - { - changeToBlockMeta(par1World, x, y, z, 5); - par1World.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.click", 0.3F, 0.6F); - } - } - - private static void changeToBlockMeta(World par1World, int x, int y, int z, int meta) - { - Block thereBlockID = par1World.getBlock(x, y, z); - if ((thereBlockID == blockGriefSaver)) - { - par1World.setBlock(x, y, z, thereBlockID, meta, 3); - par1World.markBlockRangeForRenderUpdate(x, y, z, x, y, z); - par1World.notifyBlocksOfNeighborChange(x, y, z, thereBlockID); - } - } - - public void onBlockAdded(World par1World, int x, int y, int z) - { - int meta = par1World.getBlockMetadata(x, y, z); - if (!par1World.isRemote) { - - } - } - - public void onNeighborBlockChange(World par1World, int x, int y, int z, Block myBlockID) - { - int meta = par1World.getBlockMetadata(x, y, z); - if (!par1World.isRemote) - { - - } - } - - public void updateTick(World par1World, int x, int y, int z, Random par5Random) - { - if (!par1World.isRemote) - { - int meta = par1World.getBlockMetadata(x, y, z); - } - } - - private void letsBuild(World par1World, int x, int y, int z) - { - - } - - private boolean isInactiveTrapCharged(World par1World, int x, int y, int z) - { - return false; - } - - private boolean isReactorReady(World world, int x, int y, int z) - { - if ((world.getBlock(x, y + 1, z) != Blocks.redstone_block) || - (world.getBlock(x, y - 1, z) != Blocks.redstone_block) || - (world.getBlock(x + 1, y, z) != Blocks.redstone_block) || - (world.getBlock(x - 1, y, z) != Blocks.redstone_block) || - (world.getBlock(x, y, z + 1) != Blocks.redstone_block) || - (world.getBlock(x, y, z - 1) != Blocks.redstone_block)) { - return false; - } - return true; - } - - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World par1World, int x, int y, int z, Random par5Random) - { - int meta = par1World.getBlockMetadata(x, y, z); - if ((meta == 3) || (meta == 1) || (meta == 9)) { - for (int i = 0; i < 1; i++) { - sparkle(par1World, x, y, z, par5Random); - } - } - } - - public void sparkle(World world, int x, int y, int z, Random rand) - { - double offset = 0.0625D; - for (int side = 0; side < 6; side++) - { - double rx = x + rand.nextFloat(); - double ry = y + rand.nextFloat(); - double rz = z + rand.nextFloat(); - if ((side == 0) && (!world.getBlock(x, y + 1, z).isOpaqueCube())) { - ry = y + 1 + offset; - } - if ((side == 1) && (!world.getBlock(x, y - 1, z).isOpaqueCube())) { - ry = y + 0 - offset; - } - if ((side == 2) && (!world.getBlock(x, y, z + 1).isOpaqueCube())) { - rz = z + 1 + offset; - } - if ((side == 3) && (!world.getBlock(x, y, z - 1).isOpaqueCube())) { - rz = z + 0 - offset; - } - if ((side == 4) && (!world.getBlock(x + 1, y, z).isOpaqueCube())) { - rx = x + 1 + offset; - } - if ((side == 5) && (!world.getBlock(x - 1, y, z).isOpaqueCube())) { - rx = x + 0 - offset; - } - if ((rx < x) || (rx > x + 1) || (ry < 0.0D) || (ry > y + 1) || (rz < z) || (rz > z + 1)) { - world.spawnParticle("reddust", rx, ry, rz, 0.0D, 0.0D, 0.0D); - } - } - } - - public static void checkAndActivateVanishBlock(World world, int x, int y, int z) - { - Block thereID = world.getBlock(x, y, z); - int thereMeta = world.getBlockMetadata(x, y, z); - } - - public static void changeToActiveVanishBlock(World par1World, int x, int y, int z, int meta) - { - changeToBlockMeta(par1World, x, y, z, meta); - par1World.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.pop", 0.3F, 0.6F); - - Block thereBlockID = par1World.getBlock(x, y, z); - par1World.scheduleBlockUpdate(x, y, z, thereBlockID, getTickRateFor(thereBlockID, meta, par1World.rand)); - } - - private static int getTickRateFor(Block thereBlockID, int meta, Random rand) - { - return 15; - } - - public int getLightValue(IBlockAccess world, int x, int y, int z) - { - Block blockID = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - if (blockID != this) { - return 0; - } - return 10; - } - - public boolean hasTileEntity(int metadata) - { - return (metadata == 0); - } - - public TileEntity createTileEntity(World world, int metadata) - { - if (metadata == 0) { - Utils.LOG_INFO("I have been created. [Antigriefer]"+this.getLocalizedName()); - return new TileEntityReverter(); - } - return null; - } - - public Item getItemDropped(int meta, Random par2Random, int par3) - { - switch (meta) - { - case 0: - return null; - } - return Item.getItemFromBlock(this); - } - - public int damageDropped(int meta) - { - return meta; - } } diff --git a/src/Java/gtPlusPlus/core/block/general/fluids/BlockFluidJackDaniels.java b/src/Java/gtPlusPlus/core/block/general/fluids/BlockFluidJackDaniels.java index 6096da7054..9d80072b61 100644 --- a/src/Java/gtPlusPlus/core/block/general/fluids/BlockFluidJackDaniels.java +++ b/src/Java/gtPlusPlus/core/block/general/fluids/BlockFluidJackDaniels.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.block.general.fluids; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import net.minecraft.block.material.Material; @@ -9,43 +11,45 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class BlockFluidJackDaniels extends BlockFluidClassic { - @SideOnly(Side.CLIENT) - protected IIcon stillIcon; - @SideOnly(Side.CLIENT) - protected IIcon flowingIcon; - - public BlockFluidJackDaniels(Fluid fluid, Material material) { - super(fluid, material); - setCreativeTab(AddToCreativeTab.tabMisc); - } - - @Override - public IIcon getIcon(int side, int meta) { - return (side == 0 || side == 1)? stillIcon : flowingIcon; - } - - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister register) { - stillIcon = register.registerIcon(CORE.MODID+":fluids/fluid.jackdaniels"); - flowingIcon = register.registerIcon(CORE.MODID+":fluids/fluid.jackdaniels"); - } - - @Override - public boolean canDisplace(IBlockAccess world, int x, int y, int z) { - if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; - return super.canDisplace(world, x, y, z); - } - - @Override - public boolean displaceIfPossible(World world, int x, int y, int z) { - if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; - return super.displaceIfPossible(world, x, y, z); - } - -} + @SideOnly(Side.CLIENT) + protected IIcon stillIcon; + @SideOnly(Side.CLIENT) + protected IIcon flowingIcon; + + public BlockFluidJackDaniels(final Fluid fluid, final Material material) { + super(fluid, material); + this.setCreativeTab(AddToCreativeTab.tabMisc); + } + + @Override + public IIcon getIcon(final int side, final int meta) { + return ((side == 0) || (side == 1))? this.stillIcon : this.flowingIcon; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(final IIconRegister register) { + this.stillIcon = register.registerIcon(CORE.MODID+":fluids/fluid.jackdaniels"); + this.flowingIcon = register.registerIcon(CORE.MODID+":fluids/fluid.jackdaniels"); + } + + @Override + public boolean canDisplace(final IBlockAccess world, final int x, final int y, final int z) { + if (world.getBlock(x, y, z).getMaterial().isLiquid()) { + return false; + } + return super.canDisplace(world, x, y, z); + } + + @Override + public boolean displaceIfPossible(final World world, final int x, final int y, final int z) { + if (world.getBlock(x, y, z).getMaterial().isLiquid()) { + return false; + } + return super.displaceIfPossible(world, x, y, z); + } + +} diff --git a/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java b/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java index 6de87e522b..cab02f9db6 100644 --- a/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java +++ b/src/Java/gtPlusPlus/core/block/machine/BlockGtFrameBox.java @@ -10,25 +10,25 @@ public class BlockGtFrameBox extends MetaBlock { private int[] colours; private int totalColours; - + public BlockGtFrameBox( - String unlocalizedName, Material material, - BlockTypes blockTypeENUM, boolean recolour, int... colour) { + final String unlocalizedName, final Material material, + final BlockTypes blockTypeENUM, final boolean recolour, final int... colour) { super(unlocalizedName, material, blockTypeENUM.getBlockSoundType()); - this.setBlockTextureName(CORE.MODID + ":" + "blockGtFrame"); - this.setHarvestLevel(blockTypeENUM.getHarvestTool(), 2); - if (recolour && (colour != null && colour.length > 0)){ - colours = colour; - totalColours = colours.length; - } + this.setBlockTextureName(CORE.MODID + ":" + "blockGtFrame"); + this.setHarvestLevel(blockTypeENUM.getHarvestTool(), 2); + if (recolour && ((colour != null) && (colour.length > 0))){ + this.colours = colour; + this.totalColours = this.colours.length; + } } @Override - public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, - int p_149720_3_, int p_149720_4_) { - for (int i : colours){ - - } + public int colorMultiplier(final IBlockAccess p_149720_1_, final int p_149720_2_, + final int p_149720_3_, final int p_149720_4_) { + for (final int i : this.colours){ + + } return super.colorMultiplier(p_149720_1_, p_149720_2_, p_149720_3_, p_149720_4_); } diff --git a/src/Java/gtPlusPlus/core/block/machine/FishTrap.java b/src/Java/gtPlusPlus/core/block/machine/FishTrap.java index 089e63597b..a8e842f882 100644 --- a/src/Java/gtPlusPlus/core/block/machine/FishTrap.java +++ b/src/Java/gtPlusPlus/core/block/machine/FishTrap.java @@ -1,5 +1,9 @@ package gtPlusPlus.core.block.machine; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; @@ -11,65 +15,63 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class FishTrap extends BlockContainer { - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; + @SideOnly(Side.CLIENT) + private IIcon textureTop; + @SideOnly(Side.CLIENT) + private IIcon textureBottom; + @SideOnly(Side.CLIENT) + private IIcon textureFront; + - @SuppressWarnings("deprecation") public FishTrap() - { - super(Material.wood); - this.setBlockName("blockFishTrap"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, "blockFishTrap"); + { + super(Material.wood); + this.setBlockName("blockFishTrap"); + this.setCreativeTab(AddToCreativeTab.tabMachines); + GameRegistry.registerBlock(this, "blockFishTrap"); LanguageRegistry.addName(this, "Fish Catcher"); - - } - /** - * Gets the block's texture. Args: side, meta - */ - @Override + } + + /** + * Gets the block's texture. Args: side, meta + */ + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : (p_149691_1_ != 2 && p_149691_1_ != 4 ? this.blockIcon : this.textureFront)); - } + public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) + { + return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); + } - @Override + @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); - } + public void registerBlockIcons(final IIconRegister p_149651_1_) + { + this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); + this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); + this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); + this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "fishtrap"); + } - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) + /** + * Called upon block activation (right click on the block.) + */ + @Override + public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) { - if (world.isRemote) return true; + if (world.isRemote) { + return true; + } - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityFishTrap){ - player.openGui(GTplusplus.instance, 5, world, x, y, z); - return true; - } + final TileEntity te = world.getTileEntity(x, y, z); + if ((te != null) && (te instanceof TileEntityFishTrap)){ + player.openGui(GTplusplus.instance, 5, world, x, y, z); + return true; + } return false; } @@ -84,8 +86,8 @@ public class FishTrap extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int p_149915_2_) { + public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { return new TileEntityFishTrap(); } - + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java index 9d33550bc3..64a5c5af8b 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java @@ -1,5 +1,10 @@ package gtPlusPlus.core.block.machine; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; @@ -17,81 +22,76 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import buildcraft.api.tools.IToolWrench; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.Optional.Interface; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; @Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIO") public class Machine_Workbench extends BlockContainer { - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - @SuppressWarnings("deprecation") + @SideOnly(Side.CLIENT) + private IIcon textureTop; + @SideOnly(Side.CLIENT) + private IIcon textureBottom; + @SideOnly(Side.CLIENT) + private IIcon textureFront; + + @SuppressWarnings("deprecation") public Machine_Workbench() - { - super(Material.iron); - this.setBlockName("blockWorkbenchGT"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, "blockWorkbenchGT"); + { + super(Material.iron); + this.setBlockName("blockWorkbenchGT"); + this.setCreativeTab(AddToCreativeTab.tabMachines); + GameRegistry.registerBlock(this, "blockWorkbenchGT"); LanguageRegistry.addName(this, "Bronze Workbench"); - - } - /** - * Gets the block's texture. Args: side, meta - */ - @Override + } + + /** + * Gets the block's texture. Args: side, meta + */ + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : (p_149691_1_ != 2 && p_149691_1_ != 4 ? this.blockIcon : this.textureFront)); - } + public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) + { + return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); + } - @Override + @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_top_crafting"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) + public void registerBlockIcons(final IIconRegister p_149651_1_) + { + this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet"); + this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_top_crafting"); + this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side"); + this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet"); + } + + /** + * Called upon block activation (right click on the block.) + */ + @Override + public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) { ItemStack heldItem = null; - if (world.isRemote){ - heldItem = PlayerUtils.getItemStackInPlayersHand(); - } + if (world.isRemote){ + heldItem = PlayerUtils.getItemStackInPlayersHand(); + } boolean holdingWrench = false; if (heldItem != null){ - holdingWrench = isWrench(heldItem); + holdingWrench = isWrench(heldItem); } - if (world.isRemote) return true; + if (world.isRemote) { + return true; + } - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityWorkbench) + final TileEntity te = world.getTileEntity(x, y, z); + if ((te != null) && (te instanceof TileEntityWorkbench)) { if (!holdingWrench){ player.openGui(GTplusplus.instance, 3, world, x, y, z); - return true; + return true; } Utils.LOG_INFO("Holding a Wrench, doing wrench things instead."); } @@ -99,11 +99,11 @@ public class Machine_Workbench extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int p_149915_2_) { + public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { return new TileEntityWorkbench(); } - - public static boolean isWrench(ItemStack item){ + + public static boolean isWrench(final ItemStack item){ if (item.getItem() instanceof ItemToolWrench){ return true; } @@ -112,12 +112,12 @@ public class Machine_Workbench extends BlockContainer } if (LoadedMods.EnderIO){ return checkEnderIOWrench(item); - } + } return false; } - + @Optional.Method(modid = "EnderIO") - private static boolean checkEnderIOWrench(ItemStack item){ + private static boolean checkEnderIOWrench(final ItemStack item){ if (ReflectionUtils.doesClassExist("crazypants.enderio.api.tool.ITool")){ Class<?> wrenchClass; try { @@ -126,15 +126,15 @@ public class Machine_Workbench extends BlockContainer return true; } } - catch (ClassNotFoundException e1) { + catch (final ClassNotFoundException e1) { return false; - } - } + } + } return false; } - + @Optional.Method(modid = "Buildcraft") - private static boolean checkBuildcraftWrench(ItemStack item){ + private static boolean checkBuildcraftWrench(final ItemStack item){ if (ReflectionUtils.doesClassExist("buildcraft.api.tools.IToolWrench")){ Class<?> wrenchClass; try { @@ -143,11 +143,11 @@ public class Machine_Workbench extends BlockContainer return true; } } - catch (ClassNotFoundException e1) { + catch (final ClassNotFoundException e1) { return false; - } - } + } + } return false; } - + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java index d634535699..436fc5bf39 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java @@ -1,5 +1,10 @@ package gtPlusPlus.core.block.machine; +import buildcraft.api.tools.IToolWrench; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; @@ -15,11 +20,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import buildcraft.api.tools.IToolWrench; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class Machine_WorkbenchAdvanced extends BlockContainer { @@ -46,14 +46,14 @@ public class Machine_WorkbenchAdvanced extends BlockContainer */ @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int p_149691_2_) + public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : (p_149691_1_ != 2 && p_149691_1_ != 4 ? this.blockIcon : this.textureFront)); + return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister p_149651_1_) + public void registerBlockIcons(final IIconRegister p_149651_1_) { this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "cover_crafting"); @@ -65,11 +65,13 @@ public class Machine_WorkbenchAdvanced extends BlockContainer * Called upon block activation (right click on the block.) */ @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) + public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) { - ItemStack heldItem = PlayerUtils.getItemStackInPlayersHand(player); - if (world.isRemote) return true; + final ItemStack heldItem = PlayerUtils.getItemStackInPlayersHand(player); + if (world.isRemote) { + return true; + } boolean holdingWrench = false; if (heldItem != null){ @@ -94,12 +96,12 @@ public class Machine_WorkbenchAdvanced extends BlockContainer } - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityWorkbenchAdvanced) + final TileEntity te = world.getTileEntity(x, y, z); + if ((te != null) && (te instanceof TileEntityWorkbenchAdvanced)) { if (!holdingWrench){ player.openGui(GTplusplus.instance, 4, world, x, y, z); - return true; + return true; } Utils.LOG_INFO("Holding a Wrench, doing wrench things instead."); } @@ -107,7 +109,7 @@ public class Machine_WorkbenchAdvanced extends BlockContainer } @Override - public TileEntity createNewTileEntity(World world, int p_149915_2_) { + public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { return new TileEntityWorkbenchAdvanced(128000, 2); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java index 7a76b09cca..ddfcf62306 100644 --- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java +++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/block/HeliumGenerator.java @@ -1,12 +1,13 @@ package gtPlusPlus.core.block.machine.heliumgen.block; +import java.util.Random; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenerator; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; - -import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -21,145 +22,152 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class HeliumGenerator extends BlockContainer { - private IIcon top, sides, front; - private Random randy = new Random(); - - public HeliumGenerator(){ - super(Material.iron); - setStepSound(Block.soundTypeMetal); - setHardness(20.0F); - setBlockName("helium_collector"); - setHarvestLevel("pickaxe", 3); - setCreativeTab(AddToCreativeTab.tabMachines); - } - - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons (IIconRegister iconRegister) - { - this.top = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_SIDE"); - this.sides = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_SIDE"); - this.front = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_FRONT"); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ - if(side == 1) - return top; - int facing = 2; - TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator)world.getTileEntity(x, y, z); - if(machine != null) - facing = machine.getFacing(); - if(side == facing) - return front; - else - return sides; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int metadata) - { - if(side == 1) - return top; - if(side == 3) - return front; - return sides; - } - - @Override - public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) - { - if (world.isRemote) - { - return true; - } + private IIcon top, sides, front; + private final Random randy = new Random(); + + public HeliumGenerator(){ + super(Material.iron); + this.setStepSound(Block.soundTypeMetal); + this.setHardness(20.0F); + this.setBlockName("helium_collector"); + this.setHarvestLevel("pickaxe", 3); + this.setCreativeTab(AddToCreativeTab.tabMachines); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons (final IIconRegister iconRegister) + { + this.top = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_SIDE"); + this.sides = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_SIDE"); + this.front = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_FRONT"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side){ + if(side == 1) { + return this.top; + } + int facing = 2; + final TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator)world.getTileEntity(x, y, z); + if(machine != null) { + facing = machine.getFacing(); + } + if(side == facing) { + return this.front; + } else { + return this.sides; + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon (final int side, final int metadata) + { + if(side == 1) { + return this.top; + } + if(side == 3) { + return this.front; + } + return this.sides; + } + + @Override + public boolean onBlockActivated (final World world, final int x, final int y, final int z, final EntityPlayer player, final int par6, final float par7, final float par8, final float par9) + { + if (world.isRemote) + { + return true; + } player.openGui(GTplusplus.instance, 2, world, x, y, z); return true; - } - - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityHeliumGenerator(); - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack item) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile instanceof TileEntityHeliumGenerator) { - TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator)tile; - int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; - - if (l == 0) - machine.setFacing((short) 2); - - if (l == 1) - machine.setFacing((short) 5); - - if (l == 2) - machine.setFacing((short) 3); - - if (l == 3) - machine.setFacing((short) 4); - } - - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int wut) - { - TileEntityHeliumGenerator collector = (TileEntityHeliumGenerator)world.getTileEntity(x, y, z); - - if (collector != null) - { - int i = 0; - for (i = 0; i < collector.getSizeInventory(); i++){ - - ItemStack itemstack = collector.getStackInSlot(i); - - if (itemstack != null) - { - float f = this.randy.nextFloat() * 0.8F + 0.1F; - float f1 = this.randy.nextFloat() * 0.8F + 0.1F; - float f2 = this.randy.nextFloat() * 0.8F + 0.1F; - - while (itemstack.stackSize > 0) - { - int j1 = this.randy.nextInt(21) + 10; - - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } - - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } - - float f3 = 0.05F; - entityitem.motionX = (double)((float)this.randy.nextGaussian() * f3); - entityitem.motionY = (double)((float)this.randy.nextGaussian() * f3 + 0.2F); - entityitem.motionZ = (double)((float)this.randy.nextGaussian() * f3); - world.spawnEntityInWorld(entityitem); - } - } - - world.func_147453_f(x, y, z, block); - } - } - - super.breakBlock(world, x, y, z, block, wut); - } + } + + @Override + public TileEntity createNewTileEntity(final World world, final int meta) + { + return new TileEntityHeliumGenerator(); + } + + @Override + public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase player, final ItemStack item) + { + final TileEntity tile = world.getTileEntity(x, y, z); + if(tile instanceof TileEntityHeliumGenerator) { + final TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator)tile; + final int l = MathHelper.floor_double((player.rotationYaw * 4.0F) / 360.0F + 0.5D) & 3; + + if (l == 0) { + machine.setFacing((short) 2); + } + + if (l == 1) { + machine.setFacing((short) 5); + } + + if (l == 2) { + machine.setFacing((short) 3); + } + + if (l == 3) { + machine.setFacing((short) 4); + } + } + + } + + @Override + public void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int wut) + { + final TileEntityHeliumGenerator collector = (TileEntityHeliumGenerator)world.getTileEntity(x, y, z); + + if (collector != null) + { + int i = 0; + for (i = 0; i < collector.getSizeInventory(); i++){ + + final ItemStack itemstack = collector.getStackInSlot(i); + + if (itemstack != null) + { + final float f = (this.randy.nextFloat() * 0.8F) + 0.1F; + final float f1 = (this.randy.nextFloat() * 0.8F) + 0.1F; + final float f2 = (this.randy.nextFloat() * 0.8F) + 0.1F; + + while (itemstack.stackSize > 0) + { + int j1 = this.randy.nextInt(21) + 10; + + if (j1 > itemstack.stackSize) + { + j1 = itemstack.stackSize; + } + + itemstack.stackSize -= j1; + final EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + + if (itemstack.hasTagCompound()) + { + entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); + } + + final float f3 = 0.05F; + entityitem.motionX = (float)this.randy.nextGaussian() * f3; + entityitem.motionY = ((float)this.randy.nextGaussian() * f3) + 0.2F; + entityitem.motionZ = (float)this.randy.nextGaussian() * f3; + world.spawnEntityInWorld(entityitem); + } + } + + world.func_147453_f(x, y, z, block); + } + } + + super.breakBlock(world, x, y, z, block, wut); + } } diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java index d701f6f125..4ce1238bde 100644 --- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java +++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java @@ -1,11 +1,10 @@ package gtPlusPlus.core.block.machine.heliumgen.container; +import java.util.List; + import gtPlusPlus.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenerator; import ic2.core.ContainerBase; import ic2.core.slot.SlotInvSlot; - -import java.util.List; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotFurnace; @@ -15,11 +14,11 @@ extends ContainerBase<TileEntityHeliumGenerator> { public short size; - public ContainerHeliumGenerator(InventoryPlayer player, TileEntityHeliumGenerator machine) + public ContainerHeliumGenerator(final InventoryPlayer player, final TileEntityHeliumGenerator machine) { super(machine); //Utils.LOG_WARNING("containerHeliumGenerator"); - short sr = machine.getReactorSize(); + final short sr = machine.getReactorSize(); this.addSlotToContainer(new SlotFurnace(player.player, machine, 2, 80, 35)); this.size = sr; int startX = 16; @@ -27,31 +26,31 @@ extends ContainerBase<TileEntityHeliumGenerator> int i = 0; for (i = 0; i < 9; i++) { - int x = i % this.size; - int y = i / this.size; + final int x = i % this.size; + final int y = i / this.size; - addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); + this.addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + (18 * x), startY + (18 * y))); } startX = 108; startY = 16; for (i = 9; i < 18; i++) { - int x = i % this.size; - int y = (i-9) / this.size; + final int x = i % this.size; + final int y = (i-9) / this.size; - addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); + this.addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + (18 * x), startY + (18 * y))); } for (i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { - this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + this.addSlotToContainer(new Slot(player, j + (i * 9) + 9, 8 + (j * 18), 84 + (i * 18))); } } for (i = 0; i < 9; ++i) { - this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142)); + this.addSlotToContainer(new Slot(player, i, 8 + (i * 18), 142)); } // addSlotToContainer(new SlotInvSlot(machine.coolantinputSlot, 0, 8, 25)); //addSlotToContainer(new SlotInvSlot(machine.hotcoolinputSlot, 0, 188, 25)); @@ -62,7 +61,7 @@ extends ContainerBase<TileEntityHeliumGenerator> @Override public List<String> getNetworkedFields() { - List<String> ret = super.getNetworkedFields(); + final List<String> ret = super.getNetworkedFields(); ret.add("heat"); ret.add("maxHeat"); @@ -71,5 +70,5 @@ extends ContainerBase<TileEntityHeliumGenerator> ret.add("outputTank"); ret.add("fluidcoolreactor");*/ return ret; - } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java index 2106f144be..70e13d57e1 100644 --- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java +++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java @@ -1,5 +1,9 @@ package gtPlusPlus.core.block.machine.heliumgen.gui; +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.block.machine.heliumgen.container.ContainerHeliumGenerator; import gtPlusPlus.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenerator; import gtPlusPlus.core.lib.CORE; @@ -8,65 +12,60 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) public class GUIHeliumGenerator extends GuiContainer { - private static final ResourceLocation collectorGuiTexture = new ResourceLocation(CORE.MODID, "textures/gui/helium_collector_gui.png"); + private static final ResourceLocation collectorGuiTexture = new ResourceLocation(CORE.MODID, "textures/gui/helium_collector_gui.png"); + + public GUIHeliumGenerator(final InventoryPlayer player, final TileEntityHeliumGenerator machine) + { + super(new ContainerHeliumGenerator(player, machine)); + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + @Override + protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) + { + final String s = StatCollector.translateToLocal("Helium Collector"); + this.fontRendererObj.drawString(s, (this.xSize / 2) - (this.fontRendererObj.getStringWidth(s) / 2), 6, 4210752); + this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, (this.ySize - 96) + 2, 4210752); + + this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+-1), 80, 35, 2); - public GUIHeliumGenerator(InventoryPlayer player, TileEntityHeliumGenerator machine) - { - super(new ContainerHeliumGenerator(player, machine)); - } + final short sr = 3; + final int size = sr; + int startX = 16; + int startY = 16; + int i = 0; + for (i = 0; i < 9; i++) + { + final int x = i % size; + final int y = i / size; + this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + (18 * x), startY + (18 * y), 4210752); + //addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); + } + startX = 108; + startY = 16; + for (i = 9; i < 18; i++) + { + final int x = i % size; + final int y = (i-9) / size; + this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + (18 * x), startY + (18 * y), 4210752); + // addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); + } - /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) - */ - @Override - protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) - { - String s = StatCollector.translateToLocal("Helium Collector"); - this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); - this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); - - this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+-1), 80, 35, 2); - - short sr = 3; - int size = sr; - int startX = 16; - int startY = 16; - int i = 0; - for (i = 0; i < 9; i++) - { - int x = i % size; - int y = i / size; - this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + 18 * x, startY + 18 * y, 4210752); - //addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); - } - startX = 108; - startY = 16; - for (i = 9; i < 18; i++) - { - int x = i % size; - int y = (i-9) / size; - this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + 18 * x, startY + 18 * y, 4210752); - // addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); - } - - } + } - @Override - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(collectorGuiTexture); - int k = (this.width - this.xSize) / 2; - int l = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); + @Override + protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(collectorGuiTexture); + final int k = (this.width - this.xSize) / 2; + final int l = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/slots/InvSlotRadiation.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/slots/InvSlotRadiation.java index 86507a2d64..d5c6ed5a96 100644 --- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/slots/InvSlotRadiation.java +++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/slots/InvSlotRadiation.java @@ -6,15 +6,15 @@ import net.minecraft.item.ItemStack; public class InvSlotRadiation extends InvSlot { - public InvSlotRadiation(TileEntityHeliumGenerator base, String name1, int oldStartIndex1, int count) + public InvSlotRadiation(final TileEntityHeliumGenerator base, final String name1, final int oldStartIndex1, final int count) { super(base, name1, oldStartIndex1, InvSlot.Access.IO, count); - setStackSizeLimit(1); + this.setStackSizeLimit(1); } @Override - public boolean accepts(ItemStack itemStack) + public boolean accepts(final ItemStack itemStack) { return ((TileEntityHeliumGenerator)this.base).isUsefulItem(itemStack, true); } @@ -32,45 +32,45 @@ public class InvSlotRadiation extends InvSlot } @Override - public ItemStack get(int index) + public ItemStack get(final int index) { - return super.get(mapIndex(index)); + return super.get(this.mapIndex(index)); } - public ItemStack get(int x, int y) + public ItemStack get(final int x, final int y) { - return super.get(y * 9 + x); + return super.get((y * 9) + x); } @Override - public void put(int index, ItemStack content) + public void put(final int index, final ItemStack content) { - super.put(mapIndex(index), content); + super.put(this.mapIndex(index), content); } - public void put(int x, int y, ItemStack content) + public void put(final int x, final int y, final ItemStack content) { - super.put(y * 9 + x, content); + super.put((y * 9) + x, content); } private int mapIndex(int index) { - int size = size(); - int cols = size / 6; + final int size = this.size(); + final int cols = size / 6; if (index < size) { - int row = index / cols; - int col = index % cols; + final int row = index / cols; + final int col = index % cols; - return row * 9 + col; + return (row * 9) + col; } index -= size; - int remCols = 9 - cols; + final int remCols = 9 - cols; - int row = index / remCols; - int col = cols + index % remCols; + final int row = index / remCols; + final int col = cols + (index % remCols); - return row * 9 + col; + return (row * 9) + col; } private final int rows = 6; diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java index ffc4745059..53d6f1d68f 100644 --- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java +++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.block.machine.heliumgen.tileentity; +import java.util.List; + import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.block.machine.heliumgen.slots.InvSlotRadiation; import gtPlusPlus.core.item.ModItems; @@ -13,11 +15,7 @@ import ic2.core.*; import ic2.core.block.TileEntityInventory; import ic2.core.init.MainConfig; import ic2.core.item.reactor.ItemReactorHeatStorage; -import ic2.core.network.NetworkManager; import ic2.core.util.ConfigUtil; - -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; @@ -43,28 +41,29 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II private int facing = 2; private int progress; - + public void update2Entity(){ Utils.LOG_WARNING("updateEntity"); - if(++progress >= 40){ + if(++this.progress >= 40){ //if(++progress >= 300){ - if(heliumStack == null) - heliumStack = ItemUtils.getSimpleStack(ModItems.itemHeliumBlob); - else if(heliumStack.getItem() == ModItems.itemHeliumBlob && heliumStack.stackSize < 64) - heliumStack.stackSize++; - progress = 0; - markDirty(); + if(this.heliumStack == null) { + this.heliumStack = ItemUtils.getSimpleStack(ModItems.itemHeliumBlob); + } else if((this.heliumStack.getItem() == ModItems.itemHeliumBlob) && (this.heliumStack.stackSize < 64)) { + this.heliumStack.stackSize++; + } + this.progress = 0; + this.markDirty(); } } @Override public short getFacing(){ - return (short) facing; + return (short) this.facing; } @Override - public void setFacing(short dir){ - facing = dir; + public void setFacing(final short dir){ + this.facing = dir; } /*@Override @@ -95,17 +94,17 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II @Override - public void readFromNBT(NBTTagCompound nbttagcompound) + public void readFromNBT(final NBTTagCompound nbttagcompound) { super.readFromNBT(nbttagcompound); //this.heliumStack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("Helium")); - NBTTagList list = nbttagcompound.getTagList("Items", 10); - for (int i = 0; i < list.tagCount(); ++i) { - NBTTagCompound stackTag = list.getCompoundTagAt(i); - int slot = stackTag.getByte("Slot") & 255; - this.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(stackTag)); - } + final NBTTagList list = nbttagcompound.getTagList("Items", 10); + for (int i = 0; i < list.tagCount(); ++i) { + final NBTTagCompound stackTag = list.getCompoundTagAt(i); + final int slot = stackTag.getByte("Slot") & 255; + this.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(stackTag)); + } this.progress = nbttagcompound.getInteger("Progress"); this.facing = nbttagcompound.getShort("Facing"); this.heat = nbttagcompound.getInteger("heat"); @@ -114,14 +113,14 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public void writeToNBT(NBTTagCompound nbttagcompound) + public void writeToNBT(final NBTTagCompound nbttagcompound) { super.writeToNBT(nbttagcompound); nbttagcompound.setInteger("Progress", this.progress); nbttagcompound.setShort("Facing", (short) this.facing); nbttagcompound.setInteger("heat", this.heat); - nbttagcompound.setShort("output", (short)(int)getReactorEnergyOutput()); + nbttagcompound.setShort("output", (short)(int)this.getReactorEnergyOutput()); nbttagcompound.setBoolean("active", this.active); /*if(heliumStack != null) { NBTTagCompound produce = new NBTTagCompound(); @@ -130,30 +129,30 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } else nbttagcompound.removeTag("Helium");*/ - NBTTagList list = new NBTTagList(); - for (int i = 0; i < this.getSizeInventory(); ++i) { - if (this.getStackInSlot(i) != null) { - NBTTagCompound stackTag = new NBTTagCompound(); - stackTag.setByte("Slot", (byte) i); - this.getStackInSlot(i).writeToNBT(stackTag); - list.appendTag(stackTag); - } - } - nbttagcompound.setTag("Items", list); + final NBTTagList list = new NBTTagList(); + for (int i = 0; i < this.getSizeInventory(); ++i) { + if (this.getStackInSlot(i) != null) { + final NBTTagCompound stackTag = new NBTTagCompound(); + stackTag.setByte("Slot", (byte) i); + this.getStackInSlot(i).writeToNBT(stackTag); + list.appendTag(stackTag); + } + } + nbttagcompound.setTag("Items", list); } @Override public Packet getDescriptionPacket() { - NBTTagCompound tag = new NBTTagCompound(); - writeToNBT(tag); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, tag); + final NBTTagCompound tag = new NBTTagCompound(); + this.writeToNBT(tag); + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, -999, tag); } @Override - public void onDataPacket(net.minecraft.network.NetworkManager net, S35PacketUpdateTileEntity packet) { + public void onDataPacket(final net.minecraft.network.NetworkManager net, final S35PacketUpdateTileEntity packet) { super.onDataPacket(net, packet); - readFromNBT(packet.func_148857_g()); + this.readFromNBT(packet.func_148857_g()); } @@ -164,23 +163,25 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public ItemStack getStackInSlot(int slot){ - return heliumStack; + public ItemStack getStackInSlot(final int slot){ + return this.heliumStack; } @Override - public ItemStack decrStackSize(int slot, int decrement){ + public ItemStack decrStackSize(final int slot, final int decrement){ Utils.LOG_WARNING("decrStackSize"); - if(heliumStack == null) + if(this.heliumStack == null) { return null; - if(decrement < heliumStack.stackSize){ - ItemStack take = heliumStack.splitStack(decrement); - if(heliumStack.stackSize <= 0) - heliumStack = null; + } + if(decrement < this.heliumStack.stackSize){ + final ItemStack take = this.heliumStack.splitStack(decrement); + if(this.heliumStack.stackSize <= 0) { + this.heliumStack = null; + } return take; } - ItemStack take = heliumStack; - heliumStack = null; + final ItemStack take = this.heliumStack; + this.heliumStack = null; return take; } @@ -190,13 +191,13 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II public void closeInventory() {} @Override - public boolean isUseableByPlayer(EntityPlayer player) + public boolean isUseableByPlayer(final EntityPlayer player) { - return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this && player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; + return (this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this) && (player.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D); } @Override - public boolean isItemValidForSlot(int slot, ItemStack stack){ + public boolean isItemValidForSlot(final int slot, final ItemStack stack){ return false; } @@ -206,12 +207,12 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public void setInventorySlotContents(int slot, ItemStack stack){ - heliumStack = stack; + public void setInventorySlotContents(final int slot, final ItemStack stack){ + this.heliumStack = stack; } @Override - public ItemStack getStackInSlotOnClosing(int slot){ + public ItemStack getStackInSlotOnClosing(final int slot){ return null; } @@ -247,7 +248,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II private int EmitHeatbuffer = 0; public int EmitHeat = 0; private boolean redstone = false; - private boolean fluidcoolreactor = false; + private final boolean fluidcoolreactor = false; private boolean active = true; @@ -260,9 +261,9 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } short cols = 3; //Utils.LOG_WARNING("getReactorSize == "+cols); - for (Direction direction : Direction.directions) + for (final Direction direction : Direction.directions) { - TileEntity target = direction.applyToTileEntity(this); + final TileEntity target = direction.applyToTileEntity(this); if ((target instanceof TileEntityHeliumGenerator)) { cols = (short)(cols + 1); Utils.LOG_WARNING("getReactorSize =1= "+cols); @@ -278,7 +279,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II Utils.LOG_WARNING("updateEntityServer"); super.updateEntity(); - if (this.updateTicker++ % getTickRate() != 0) { + if ((this.updateTicker++ % this.getTickRate()) != 0) { return; } if (!this.worldObj.doChunksNearChunkExist(this.xCoord, this.yCoord, this.zCoord, 2)) @@ -288,31 +289,31 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II else { - dropAllUnfittingStuff(); + this.dropAllUnfittingStuff(); this.output = 0.0F; this.maxHeat = 10000; this.hem = 1.0F; - processChambers(); + this.processChambers(); this.EmitHeatbuffer = 0; - if (calculateHeatEffects()) { + if (this.calculateHeatEffects()) { return; } - setActive((this.heat >= 1000) || (this.output > 0.0F)); + this.setActive((this.heat >= 1000) || (this.output > 0.0F)); - markDirty(); + this.markDirty(); } - ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "output"); + IC2.network.get().updateTileEntityField(this, "output"); } @Override - public void setActive(boolean active1) + public void setActive(final boolean active1) { Utils.LOG_WARNING("setActive"); this.active = active1; if (this.prevActive != active1) { - ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "active"); + IC2.network.get().updateTileEntityField(this, "active"); } this.prevActive = active1; } @@ -322,43 +323,43 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II Utils.LOG_WARNING("dropAllUnfittingStuff"); for (int i = 0; i < this.reactorSlot.size(); i++) { - ItemStack stack = this.reactorSlot.get(i); - if ((stack != null) && (!isUsefulItem(stack, false))) + final ItemStack stack = this.reactorSlot.get(i); + if ((stack != null) && (!this.isUsefulItem(stack, false))) { this.reactorSlot.put(i, null); - eject(stack); + this.eject(stack); } } for (int i = this.reactorSlot.size(); i < this.reactorSlot.rawSize(); i++) { - ItemStack stack = this.reactorSlot.get(i); + final ItemStack stack = this.reactorSlot.get(i); this.reactorSlot.put(i, null); - eject(stack); + this.eject(stack); } } - public void eject(ItemStack drop) + public void eject(final ItemStack drop) { Utils.LOG_WARNING("eject"); if ((!IC2.platform.isSimulating()) || (drop == null)) { return; } - float f = 0.7F; - double d = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D; - double d1 = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D; - double d2 = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItem(this.worldObj, this.xCoord + d, this.yCoord + d1, this.zCoord + d2, drop); + final float f = 0.7F; + final double d = (this.worldObj.rand.nextFloat() * f) + ((1.0F - f) * 0.5D); + final double d1 = (this.worldObj.rand.nextFloat() * f) + ((1.0F - f) * 0.5D); + final double d2 = (this.worldObj.rand.nextFloat() * f) + ((1.0F - f) * 0.5D); + final EntityItem entityitem = new EntityItem(this.worldObj, this.xCoord + d, this.yCoord + d1, this.zCoord + d2, drop); entityitem.delayBeforeCanPickup = 10; this.worldObj.spawnEntityInWorld(entityitem); } - public boolean isUsefulItem(ItemStack stack, boolean forInsertion) + public boolean isUsefulItem(final ItemStack stack, final boolean forInsertion) { //Utils.LOG_WARNING("isUsefulItem"); - Item item = stack.getItem(); - if ((forInsertion) && (this.fluidcoolreactor) && - ((item instanceof ItemReactorHeatStorage)) && + final Item item = stack.getItem(); + if ((forInsertion) && (this.fluidcoolreactor) && + ((item instanceof ItemReactorHeatStorage)) && (((ItemReactorHeatStorage)item).getCustomDamage(stack) > 0)) { return false; } @@ -374,25 +375,25 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II if ((this.heat < 8000) || (!IC2.platform.isSimulating()) || (ConfigUtil.getFloat(MainConfig.get(), "protection/reactorExplosionPowerLimit") <= 0.0F)) { return false; } - float power = this.heat / this.maxHeat; + final float power = this.heat / this.maxHeat; if (power >= 1.0F) { - explode(); + this.explode(); return true; } - if ((power >= 0.85F) && (this.worldObj.rand.nextFloat() <= 0.2F * this.hem)) + if ((power >= 0.85F) && (this.worldObj.rand.nextFloat() <= (0.2F * this.hem))) { - int[] coord = getRandCoord(2); + final int[] coord = this.getRandCoord(2); if (coord != null) { - Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + final Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); if (block.isAir(this.worldObj, coord[0], coord[1], coord[2])) { this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); } else if ((block.getBlockHardness(this.worldObj, coord[0], coord[1], coord[2]) >= 0.0F) && (this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null)) { - Material mat = block.getMaterial(); + final Material mat = block.getMaterial(); if ((mat == Material.rock) || (mat == Material.iron) || (mat == Material.lava) || (mat == Material.ground) || (mat == Material.clay)) { this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.flowing_lava, 15, 7); } else { @@ -403,19 +404,19 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } if (power >= 0.7F) { - List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.xCoord - 3, this.yCoord - 3, this.zCoord - 3, this.xCoord + 4, this.yCoord + 4, this.zCoord + 4)); + final List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.xCoord - 3, this.yCoord - 3, this.zCoord - 3, this.xCoord + 4, this.yCoord + 4, this.zCoord + 4)); for (int l = 0; l < list1.size(); l++) { - Entity ent = (Entity)list1.get(l); + final Entity ent = (Entity)list1.get(l); ent.attackEntityFrom(IC2DamageSource.radiation, (int)(this.worldObj.rand.nextInt(4) * this.hem)); } } if ((power >= 0.5F) && (this.worldObj.rand.nextFloat() <= this.hem)) { - int[] coord = getRandCoord(2); + final int[] coord = this.getRandCoord(2); if (coord != null) { - Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + final Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); if (block.getMaterial() == Material.water) { this.worldObj.setBlockToAir(coord[0], coord[1], coord[2]); } @@ -423,12 +424,12 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } if ((power >= 0.4F) && (this.worldObj.rand.nextFloat() <= this.hem)) { - int[] coord = getRandCoord(2); - if ((coord != null) && + final int[] coord = this.getRandCoord(2); + if ((coord != null) && (this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null)) { - Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); - Material mat = block.getMaterial(); + final Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + final Material mat = block.getMaterial(); if ((mat == Material.wood) || (mat == Material.leaves) || (mat == Material.cloth)) { this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); } @@ -437,15 +438,15 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II return false; } - public int[] getRandCoord(int radius) + public int[] getRandCoord(final int radius) { if (radius <= 0) { return null; } - int[] c = new int[3]; - c[0] = (this.xCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius); - c[1] = (this.yCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius); - c[2] = (this.zCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius); + final int[] c = new int[3]; + c[0] = ((this.xCoord + this.worldObj.rand.nextInt((2 * radius) + 1)) - radius); + c[1] = ((this.yCoord + this.worldObj.rand.nextInt((2 * radius) + 1)) - radius); + c[2] = ((this.zCoord + this.worldObj.rand.nextInt((2 * radius) + 1)) - radius); if ((c[0] == this.xCoord) && (c[1] == this.yCoord) && (c[2] == this.zCoord)) { return null; } @@ -455,15 +456,15 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II public void processChambers() { Utils.LOG_WARNING("processChambers"); - int size = getReactorSize(); + final int size = this.getReactorSize(); for (int pass = 0; pass < 6; pass++) { for (int y = 0; y < 3; y++) { for (int x = 0; x < size; x++) { - ItemStack stack = this.reactorSlot.get(x, y); + final ItemStack stack = this.reactorSlot.get(x, y); if ((stack != null) && ((stack.getItem() instanceof IReactorComponent))) { - IReactorComponent comp = (IReactorComponent)stack.getItem(); + final IReactorComponent comp = (IReactorComponent)stack.getItem(); comp.processChamber(this, stack, x, y, pass == 0); } } @@ -488,13 +489,13 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public void setHeat(int heat1) + public void setHeat(final int heat1) { this.heat = heat1; } @Override - public int addHeat(int amount) + public int addHeat(final int amount) { this.heat += amount; return this.heat; @@ -507,13 +508,13 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public void setMaxHeat(int newMaxHeat) + public void setMaxHeat(final int newMaxHeat) { this.maxHeat = newMaxHeat; } @Override - public void addEmitHeat(int heat) + public void addEmitHeat(final int heat) { this.EmitHeatbuffer += heat; } @@ -525,7 +526,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public void setHeatEffectModifier(float newHEM) + public void setHeatEffectModifier(final float newHEM) { this.hem = newHEM; } @@ -539,42 +540,42 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II @Override public double getReactorEUEnergyOutput() { - return getOfferedEnergy(); + return this.getOfferedEnergy(); } public double getOfferedEnergy() { - return getReactorEnergyOutput() * 5.0F * 1.0F; + return this.getReactorEnergyOutput() * 5.0F * 1.0F; } @Override - public float addOutput(float energy) + public float addOutput(final float energy) { return this.output += energy; } @Override - public ItemStack getItemAt(int x, int y) + public ItemStack getItemAt(final int x, final int y) { Utils.LOG_WARNING("getItemAt"); - if ((x < 0) || (x >= getReactorSize()) || (y < 0) || (y >= 6)) { + if ((x < 0) || (x >= this.getReactorSize()) || (y < 0) || (y >= 6)) { return null; } return this.reactorSlot.get(x, y); } @Override - public void setItemAt(int x, int y, ItemStack item) + public void setItemAt(final int x, final int y, final ItemStack item) { Utils.LOG_WARNING("setItemAt"); - if ((x < 0) || (x >= getReactorSize()) || (y < 0) || (y >= 6)) { + if ((x < 0) || (x >= this.getReactorSize()) || (y < 0) || (y >= 6)) { return; } this.reactorSlot.put(x, y, item); } public TileEntityHeliumGenerator() { - this.updateTicker = IC2.random.nextInt(getTickRate()); + this.updateTicker = IC2.random.nextInt(this.getTickRate()); this.reactorSlot = new InvSlotRadiation(this, "helium_collector", 0, 54); //TODO } @@ -594,7 +595,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II { Utils.LOG_WARNING("receiveRedstone"); if ((this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord)) || (this.redstone)) { - decrStackSize(-1, 1); + this.decrStackSize(-1, 1); return true; } return false; @@ -604,11 +605,11 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II public boolean produceEnergy() { Utils.LOG_WARNING("produceEnergy"); - return (receiveredstone()) && (ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/generator") > 0.0F); + return (this.receiveredstone()) && (ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/generator") > 0.0F); } @Override - public void setRedstoneSignal(boolean redstone) + public void setRedstoneSignal(final boolean redstone) { this.redstone = redstone; } @@ -620,13 +621,13 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) + public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side) { return true; } @Override - public boolean wrenchCanRemove(EntityPlayer entityPlayer) + public boolean wrenchCanRemove(final EntityPlayer entityPlayer) { return true; } @@ -638,7 +639,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II } @Override - public ItemStack getWrenchDrop(EntityPlayer entityPlayer) + public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) { return new ItemStack(ModBlocks.blockHeliumGenerator, 1); } diff --git a/src/Java/gtPlusPlus/core/commands/CommandMath.java b/src/Java/gtPlusPlus/core/commands/CommandMath.java index b41745c660..966f73c589 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandMath.java +++ b/src/Java/gtPlusPlus/core/commands/CommandMath.java @@ -1,11 +1,10 @@ package gtPlusPlus.core.commands; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.player.PlayerUtils; - import java.util.ArrayList; import java.util.List; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.player.PlayerUtils; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.Entity; @@ -16,74 +15,75 @@ import net.minecraft.world.World; public class CommandMath implements ICommand -{ +{ private final List<String> aliases; - protected String fullEntityName; - protected Entity conjuredEntity; + protected String fullEntityName; + protected Entity conjuredEntity; - public CommandMath() - { - aliases = new ArrayList<String>(); + public CommandMath() + { + this.aliases = new ArrayList<>(); - aliases.add("hometele"); + this.aliases.add("hometele"); - aliases.add("warphome"); + this.aliases.add("warphome"); - } + } - @Override - public int compareTo(Object o) - { - return 0; + @Override + public int compareTo(final Object o) + { + return 0; - } + } - @Override - public String getCommandName() - { - return "bed"; + @Override + public String getCommandName() + { + return "bed"; - } + } - @Override - public String getCommandUsage(ICommandSender var1) - { - return "/bed [Teleports you to your bed for XP]"; + @Override + public String getCommandUsage(final ICommandSender var1) + { + return "/bed [Teleports you to your bed for XP]"; - } + } - @Override - public List<String> getCommandAliases() - { + @Override + public List<String> getCommandAliases() + { return this.aliases; - } + } - public void processCommand(ICommandSender S, String[] argString) - { - World W = S.getEntityWorld(); - CommandUtils C = new CommandUtils(); - EntityPlayer P = C.getPlayer(S); + @Override + public void processCommand(final ICommandSender S, final String[] argString) + { + final World W = S.getEntityWorld(); + final CommandUtils C = new CommandUtils(); + final EntityPlayer P = C.getPlayer(S); //System.out.println(P.getCommandSenderName()); //System.out.println(P.getDisplayName()); - if (W.isRemote) + if (W.isRemote) - { + { - System.out.println("Not processing on Client side"); + System.out.println("Not processing on Client side"); - } + } - else + else - { + { - System.out.println("Processing on Server side - Home Teleport engaged by: "+P.getDisplayName()); + System.out.println("Processing on Server side - Home Teleport engaged by: "+P.getDisplayName()); - int XP_TOTAL = P.experienceTotal; + final int XP_TOTAL = P.experienceTotal; Utils.LOG_WARNING("Total Xp:" + XP_TOTAL); - ChunkCoordinates X = P.getPlayerCoordinates(); + final ChunkCoordinates X = P.getPlayerCoordinates(); Utils.LOG_WARNING("Player Location: "+X); ChunkCoordinates Y = null; Utils.LOG_WARNING("Bed Location: "+Y); @@ -91,7 +91,7 @@ public class CommandMath implements ICommand if (P.getBedLocation(0) == null){ Y = W.getSpawnPoint(); Utils.LOG_WARNING("Spawn Location: "+Y); - } + } else if (P.getBedLocation(0) != null){ Y = P.getBedLocation(0); Utils.LOG_WARNING("Bed Location: "+Y); @@ -101,30 +101,30 @@ public class CommandMath implements ICommand Utils.LOG_WARNING("Spawn Location: "+Y); } } - catch(NullPointerException e) { - PlayerUtils.messagePlayer(P, "You do not have a spawn, so..."); + catch(final NullPointerException e) { + PlayerUtils.messagePlayer(P, "You do not have a spawn, so..."); } if (Y == null) { Y = W.getSpawnPoint(); Utils.LOG_WARNING("Spawn Location: "+Y); } - int x1 = X.posX; + final int x1 = X.posX; Utils.LOG_WARNING("X1: "+x1); - int x2 = Y.posX; + final int x2 = Y.posX; Utils.LOG_WARNING("X2: "+x2); - int y1 = X.posY; + final int y1 = X.posY; Utils.LOG_WARNING("Y1: "+y1); - int y2 = Y.posY; + final int y2 = Y.posY; Utils.LOG_WARNING("Y2: "+y2); - int z1 = X.posZ; + final int z1 = X.posZ; Utils.LOG_WARNING("Z1: "+z1); - int z2 = Y.posZ; + final int z2 = Y.posZ; Utils.LOG_WARNING("Z2: "+z2); - double d = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1)); - String xpCost = String.valueOf((int)(d*0.15)); + final double d = Math.sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1))+((z2-z1)*(z2-z1))); + final String xpCost = String.valueOf((int)(d*0.15)); Utils.LOG_WARNING("d:" + d); Utils.LOG_WARNING("-----------------------------------------"); @@ -141,9 +141,9 @@ public class CommandMath implements ICommand if ((XP_TOTAL-Float.valueOf(xpCost)) > 0){ - EntityXPOrb E = new EntityXPOrb(W, P.posX, P.posY + 1.62D - (double) P.yOffset, P.posZ, 1); + final EntityXPOrb E = new EntityXPOrb(W, P.posX, (P.posY + 1.62D) - P.yOffset, P.posZ, 1); //E.moveTowards((double) Y.posX + 0.5D, (int) Y.posY + 3, (double) Y.posZ + 0.5D); - E.setVelocity((double) Y.posX + 0.5D, (int) Y.posY + 0.1, (double) Y.posZ + 0.5D); + E.setVelocity(Y.posX + 0.5D, Y.posY + 0.1, Y.posZ + 0.5D); W.spawnEntityInWorld(E); W.playAuxSFXAtEntity((EntityPlayer) null, 1002, (int) P.posX, (int) P.posY, (int) P.posZ, 0); P.setPositionAndUpdate(x2, y2+1, z2); @@ -152,7 +152,7 @@ public class CommandMath implements ICommand gregtech.api.util.GT_Utility.sendChatToPlayer(P, "Distance Traveled | "+String.valueOf((int)(d)) + " Blocks & " + xpCost + "xp"); gregtech.api.util.GT_Utility.sendChatToPlayer(P, "You suddenly feel at home."); P.experienceTotal = (int) (XP_TOTAL-Float.valueOf(xpCost)); - if (!xpCost.equals("0") && Float.valueOf(xpCost) > 0){ + if (!xpCost.equals("0") && (Float.valueOf(xpCost) > 0)){ gregtech.api.util.GT_Utility.sendChatToPlayer(P, "...At the loss of "+xpCost+" xp."); } else if (xpCost.equals("0")){ @@ -168,34 +168,34 @@ public class CommandMath implements ICommand } } - } + } - @Override - public boolean canCommandSenderUseCommand(ICommandSender var1) - { + @Override + public boolean canCommandSenderUseCommand(final ICommandSender var1) + { return true; - } + } - @Override - public List<?> addTabCompletionOptions(ICommandSender var1, String[] var2) - { - // TODO Auto-generated method stub + @Override + public List<?> addTabCompletionOptions(final ICommandSender var1, final String[] var2) + { + // TODO Auto-generated method stub - return null; + return null; - } + } - @Override - public boolean isUsernameIndex(String[] var1, int var2) - { - // TODO Auto-generated method stub + @Override + public boolean isUsernameIndex(final String[] var1, final int var2) + { + // TODO Auto-generated method stub return false; } - public boolean playerUsesCommand(World W, EntityPlayer P, int cost) + public boolean playerUsesCommand(final World W, final EntityPlayer P, final int cost) { diff --git a/src/Java/gtPlusPlus/core/commands/CommandUtils.java b/src/Java/gtPlusPlus/core/commands/CommandUtils.java index 32e7a75370..4e74d53464 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandUtils.java +++ b/src/Java/gtPlusPlus/core/commands/CommandUtils.java @@ -5,7 +5,7 @@ import net.minecraft.entity.player.EntityPlayer; public class CommandUtils { - public EntityPlayer getPlayer(ICommandSender icommandsender){ + public EntityPlayer getPlayer(final ICommandSender icommandsender){ EntityPlayer player; if(icommandsender instanceof EntityPlayer){ @@ -16,5 +16,5 @@ public class CommandUtils { return null; } } - + } diff --git a/src/Java/gtPlusPlus/core/common/BasePlayer.java b/src/Java/gtPlusPlus/core/common/BasePlayer.java index 862d53d822..dffc83c2ab 100644 --- a/src/Java/gtPlusPlus/core/common/BasePlayer.java +++ b/src/Java/gtPlusPlus/core/common/BasePlayer.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.common; +import api.player.client.ClientPlayerAPI; +import api.player.client.ClientPlayerBase; import gtPlusPlus.core.handler.events.CustomMovementHandler; import gtPlusPlus.core.handler.events.SneakManager; import net.minecraft.client.Minecraft; @@ -11,16 +13,14 @@ import net.minecraft.network.play.client.C0BPacketEntityAction; import net.minecraft.potion.Potion; import net.minecraft.util.MovementInputFromOptions; import net.minecraft.util.ResourceLocation; -import api.player.client.ClientPlayerAPI; -import api.player.client.ClientPlayerBase; public class BasePlayer extends ClientPlayerBase { private final Minecraft mc = Minecraft.getMinecraft(); private final CustomMovementHandler customMovementInput = new CustomMovementHandler(); - private final GameSettings settings = mc.gameSettings; + private final GameSettings settings = this.mc.gameSettings; - public BasePlayer(ClientPlayerAPI api) + public BasePlayer(final ClientPlayerAPI api) { super(api); } @@ -50,7 +50,7 @@ public class BasePlayer extends ClientPlayerBase this.player.posX = this.player.posZ = 0.5D; this.player.posX = 0.0D; this.player.posZ = 0.0D; - this.player.rotationYaw = (float)this.player.ticksExisted / 12.0F; + this.player.rotationYaw = this.player.ticksExisted / 12.0F; this.player.rotationPitch = 10.0F; this.player.posY = 68.5D; } @@ -66,7 +66,7 @@ public class BasePlayer extends ClientPlayerBase if(this.player.timeInPortal == 0.0F) { - this.mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("portal.trigger"), this.player.getRNG().nextFloat() * 0.4F + 0.8F)); + this.mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("portal.trigger"), (this.player.getRNG().nextFloat() * 0.4F) + 0.8F)); } this.player.timeInPortal += 0.0125F; @@ -78,7 +78,7 @@ public class BasePlayer extends ClientPlayerBase this.playerAPI.setInPortalField(false); } - else if(this.player.isPotionActive(Potion.confusion) && this.player.getActivePotionEffect(Potion.confusion).getDuration() > 60) + else if(this.player.isPotionActive(Potion.confusion) && (this.player.getActivePotionEffect(Potion.confusion).getDuration() > 60)) { this.player.timeInPortal += 0.006666667F; if(this.player.timeInPortal > 1.0F) @@ -105,10 +105,10 @@ public class BasePlayer extends ClientPlayerBase --this.player.timeUntilPortal; } - boolean isJumping = this.player.movementInput.jump; + final boolean isJumping = this.player.movementInput.jump; - float minSpeed = 0.8F; - boolean isMovingForward = this.player.movementInput.moveForward >= minSpeed; + final float minSpeed = 0.8F; + final boolean isMovingForward = this.player.movementInput.moveForward >= minSpeed; this.customMovementInput.update(this.mc, (MovementInputFromOptions)this.player.movementInput, this.player); if(this.player.isUsingItem() && !this.player.isRiding()) @@ -118,29 +118,29 @@ public class BasePlayer extends ClientPlayerBase this.playerAPI.setSprintToggleTimerField(0); } - if(this.player.movementInput.sneak && this.player.ySize < 0.2F) + if(this.player.movementInput.sneak && (this.player.ySize < 0.2F)) { this.player.ySize = 0.2F; } - this.playerAPI.localPushOutOfBlocks(this.player.posX - (double)this.player.width * 0.35D, this.player.boundingBox.minY + 0.5D, this.player.posZ + (double)this.player.width * 0.35D); - this.playerAPI.localPushOutOfBlocks(this.player.posX - (double)this.player.width * 0.35D, this.player.boundingBox.minY + 0.5D, this.player.posZ - (double)this.player.width * 0.35D); - this.playerAPI.localPushOutOfBlocks(this.player.posX + (double)this.player.width * 0.35D, this.player.boundingBox.minY + 0.5D, this.player.posZ - (double)this.player.width * 0.35D); - this.playerAPI.localPushOutOfBlocks(this.player.posX + (double)this.player.width * 0.35D, this.player.boundingBox.minY + 0.5D, this.player.posZ + (double)this.player.width * 0.35D); - boolean enoughHunger = (float)this.player.getFoodStats().getFoodLevel() > 6.0F || this.player.capabilities.isFlying; + this.playerAPI.localPushOutOfBlocks(this.player.posX - (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ + (this.player.width * 0.35D)); + this.playerAPI.localPushOutOfBlocks(this.player.posX - (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ - (this.player.width * 0.35D)); + this.playerAPI.localPushOutOfBlocks(this.player.posX + (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ - (this.player.width * 0.35D)); + this.playerAPI.localPushOutOfBlocks(this.player.posX + (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ + (this.player.width * 0.35D)); + final boolean enoughHunger = (this.player.getFoodStats().getFoodLevel() > 6.0F) || this.player.capabilities.isFlying; /* * Begin ToggleSneak Changes - ToggleSprint */ - boolean isSprintDisabled = false; - boolean canDoubleTap = SneakManager.optionDoubleTap; + final boolean isSprintDisabled = false; + final boolean canDoubleTap = SneakManager.optionDoubleTap; // Detect when ToggleSprint was disabled in the in-game options menu if(SneakManager.wasSprintDisabled) { this.player.setSprinting(false); - customMovementInput.UpdateSprint(false, false); + this.customMovementInput.UpdateSprint(false, false); SneakManager.wasSprintDisabled = false; } @@ -148,60 +148,60 @@ public class BasePlayer extends ClientPlayerBase if(isSprintDisabled) { //Utils.LOG_INFO("Sprint pressed"); - if(SneakManager.optionDoubleTap && this.player.onGround && !isMovingForward && this.player.movementInput.moveForward >= minSpeed && !this.player.isSprinting() && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) + if(SneakManager.optionDoubleTap && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) { - if(this.playerAPI.getSprintToggleTimerField() <= 0 && !this.settings.keyBindSprint.getIsKeyPressed()) + if((this.playerAPI.getSprintToggleTimerField() <= 0) && !this.settings.keyBindSprint.getIsKeyPressed()) { this.playerAPI.setSprintToggleTimerField(7); } else { if (SneakManager.Sprinting()){ - this.player.setSprinting(true); - customMovementInput.UpdateSprint(true, false); + this.player.setSprinting(true); + this.customMovementInput.UpdateSprint(true, false); } else { this.player.setSprinting(false); - customMovementInput.UpdateSprint(false, false); + this.customMovementInput.UpdateSprint(false, false); } } } - if(!this.player.isSprinting() && this.player.movementInput.moveForward >= minSpeed && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && this.settings.keyBindSprint.getIsKeyPressed()) + if(!this.player.isSprinting() && (this.player.movementInput.moveForward >= minSpeed) && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && this.settings.keyBindSprint.getIsKeyPressed()) { if (SneakManager.Sprinting()){ - this.player.setSprinting(true); - customMovementInput.UpdateSprint(true, false); + this.player.setSprinting(true); + this.customMovementInput.UpdateSprint(true, false); } else { this.player.setSprinting(false); - customMovementInput.UpdateSprint(false, false); + this.customMovementInput.UpdateSprint(false, false); } } } else { - boolean state = this.customMovementInput.sprint; + final boolean state = this.customMovementInput.sprint; // Only handle changes in state under the following conditions: - // On ground, not hungry, not eating/using item, not blind, and not Vanilla - // - // 5/6/14 - onGround check removed to match vanilla's 'start sprint while jumping' behavior. + // On ground, not hungry, not eating/using item, not blind, and not Vanilla + // + // 5/6/14 - onGround check removed to match vanilla's 'start sprint while jumping' behavior. //if(this.player.onGround && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && !this.customMovementInput.sprintHeldAndReleased) if(enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && !this.customMovementInput.sprintHeldAndReleased) { - if(canDoubleTap && !this.player.isSprinting() || !canDoubleTap) + if((canDoubleTap && !this.player.isSprinting()) || !canDoubleTap) { if (SneakManager.Sprinting()){ this.player.setSprinting(state); - } - else + } else { this.player.setSprinting(false); + } } } - if(canDoubleTap && !state && this.player.onGround && !isMovingForward && this.player.movementInput.moveForward >= minSpeed && !this.player.isSprinting() && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) + if(canDoubleTap && !state && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) { if(this.playerAPI.getSprintToggleTimerField() == 0) { @@ -210,9 +210,9 @@ public class BasePlayer extends ClientPlayerBase else { if (SneakManager.Sprinting()){ - this.player.setSprinting(true); - customMovementInput.UpdateSprint(true, true); - this.playerAPI.setSprintToggleTimerField(0); + this.player.setSprinting(true); + this.customMovementInput.UpdateSprint(true, true); + this.playerAPI.setSprintToggleTimerField(0); } } } @@ -220,14 +220,14 @@ public class BasePlayer extends ClientPlayerBase // If sprinting, break the sprint in appropriate circumstances: // Player stops moving forward, runs into something, or gets too hungry - if(this.player.isSprinting() && (this.player.movementInput.moveForward < minSpeed || this.player.isCollidedHorizontally || !enoughHunger)) + if(this.player.isSprinting() && ((this.player.movementInput.moveForward < minSpeed) || this.player.isCollidedHorizontally || !enoughHunger)) { this.player.setSprinting(false); // Undo toggle if we resumed vanilla operation due to Hold&Release, DoubleTap, Fly, Ride - if (customMovementInput.sprintHeldAndReleased == true || isSprintDisabled || customMovementInput.sprintDoubleTapped || this.player.capabilities.isFlying || this.player.isRiding()) + if ((this.customMovementInput.sprintHeldAndReleased == true) || isSprintDisabled || this.customMovementInput.sprintDoubleTapped || this.player.capabilities.isFlying || this.player.isRiding()) { - customMovementInput.UpdateSprint(false, false); + this.customMovementInput.UpdateSprint(false, false); } } @@ -324,11 +324,11 @@ public class BasePlayer extends ClientPlayerBase this.playerAPI.setHorseJumpPowerCounterField(this.playerAPI.getHorseJumpPowerCounterField() + 1); if(this.playerAPI.getHorseJumpPowerCounterField() < 10) { - this.playerAPI.setHorseJumpPowerField((float)this.playerAPI.getHorseJumpPowerCounterField() * 0.1F); + this.playerAPI.setHorseJumpPowerField(this.playerAPI.getHorseJumpPowerCounterField() * 0.1F); } else { - this.playerAPI.setHorseJumpPowerField(0.8F + 2.0F / (float)(this.playerAPI.getHorseJumpPowerCounterField() - 9) * 0.1F); + this.playerAPI.setHorseJumpPowerField(0.8F + ((2.0F / (this.playerAPI.getHorseJumpPowerCounterField() - 9)) * 0.1F)); } } } diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java index d5a126ff39..405578857e 100644 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java @@ -1,6 +1,9 @@ package gtPlusPlus.core.common; import static gtPlusPlus.core.lib.CORE.DEBUG; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.event.*; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.handler.*; @@ -17,13 +20,11 @@ import gtPlusPlus.core.util.player.PlayerCache; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import net.minecraft.entity.Entity; import net.minecraftforge.common.MinecraftForge; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.event.*; public class CommonProxy { - + public static Meta_GT_Proxy GtProxy; - + public CommonProxy(){ //Should Register Gregtech Materials I've Made MinecraftForge.EVENT_BUS.register(this); @@ -36,19 +37,19 @@ public class CommonProxy { Utils.LOG_INFO("We're using Gregtech 5.08 or an equivalent fork."); } Utils.LOG_INFO("Setting up our own GT_Proxy."); - GtProxy = new Meta_GT_Proxy(); + GtProxy = new Meta_GT_Proxy(); } else { GtProxy = null; } } - public void preInit(FMLPreInitializationEvent e) { - Utils.LOG_INFO("Doing some house cleaning."); + public void preInit(final FMLPreInitializationEvent e) { + Utils.LOG_INFO("Doing some house cleaning."); LoadedMods.checkLoaded(); Utils.LOG_INFO("Making sure we're ready to party!"); - - + + if (!DEBUG){ Utils.LOG_WARNING("Development mode not enabled."); } @@ -57,18 +58,18 @@ public class CommonProxy { } else { Utils.LOG_WARNING("Development mode not set."); - } + } AddToCreativeTab.initialiseTabs(); COMPAT_IntermodStaging.preInit(); //Apparently I should do this here. Might put it in Init for a test. //Growthcraft_Handler.run(); } - public void init(FMLInitializationEvent e) { + public void init(final FMLInitializationEvent e) { //Debug Loading if (CORE.DEBUG){ - DEBUG_INIT.registerHandlers(); - } + DEBUG_INIT.registerHandlers(); + } ModItems.init(); ModBlocks.init(); RECIPE_CONSTANTS.initialise(); @@ -76,25 +77,25 @@ public class CommonProxy { MinecraftForge.EVENT_BUS.register(new PickaxeBlockBreakEventHandler()); //Block Handler for all events. MinecraftForge.EVENT_BUS.register(new BlockEventHandler()); - - //Compat Handling + + //Compat Handling COMPAT_HANDLER.registerMyModsOreDictEntries(); COMPAT_HANDLER.intermodOreDictionarySupport(); COMPAT_IntermodStaging.init(); } - public void postInit(FMLPostInitializationEvent e) { + public void postInit(final FMLPostInitializationEvent e) { Utils.LOG_INFO("Cleaning up, doing postInit."); - PlayerCache.initCache(); + PlayerCache.initCache(); //Compat Handling COMPAT_HANDLER.InitialiseHandlerThenAddRecipes(); COMPAT_HANDLER.RemoveRecipesFromOtherMods(); COMPAT_HANDLER.startLoadingGregAPIBasedRecipes(); COMPAT_IntermodStaging.postInit(); } - - - public void serverStarting(FMLServerStartingEvent e) + + + public void serverStarting(final FMLServerStartingEvent e) { COMPAT_HANDLER.InitialiseLateHandlerThenAddRecipes(); } @@ -111,11 +112,11 @@ public class CommonProxy { } - public int addArmor(String armor) { + public int addArmor(final String armor) { return 0; } - public void generateMysteriousParticles(Entity entity) { + public void generateMysteriousParticles(final Entity entity) { } } diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_BigReactors.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_BigReactors.java index 7f4aa0541a..c0536acada 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_BigReactors.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_BigReactors.java @@ -9,11 +9,11 @@ public class COMPAT_BigReactors { public static void OreDict(){ run(); } - + private static final void run(){ GT_OreDictUnificator.registerOre("plateBlutonium", new ItemStack(ModItems.itemPlateBlutonium)); GT_OreDictUnificator.registerOre("plateCyanite", new ItemStack(ModItems.itemPlateCyanite)); GT_OreDictUnificator.registerOre("plateLudicrite", new ItemStack(ModItems.itemPlateLudicrite)); } - + } diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_CompactWindmills.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_CompactWindmills.java index c64e332c50..9efd2b4a6c 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_CompactWindmills.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_CompactWindmills.java @@ -2,6 +2,7 @@ package gtPlusPlus.core.common.compat; import static gtPlusPlus.core.handler.COMPAT_HANDLER.AddRecipeQueue; import static gtPlusPlus.core.handler.COMPAT_HANDLER.RemoveRecipeQueue; + import gtPlusPlus.core.recipe.ShapedRecipeObject; import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; @@ -73,14 +74,14 @@ public class COMPAT_CompactWindmills { //Wooden Rotor public static ShapedRecipeObject Wooden_Rotor = new ShapedRecipeObject( - rotorBlade1, "ore:plateAnyIron", "ore:plateAnyIron", - "ore:screwAluminium", rotorIC1, "ore:screwAluminium", + rotorBlade1, "ore:plateAnyIron", "ore:plateAnyIron", + "ore:screwAluminium", rotorIC1, "ore:screwAluminium", rotorBlade1, "plateAnyIron", rotorBlade1, rotor1); //Alloy Rotor public static ShapedRecipeObject Alloy_Rotor = new ShapedRecipeObject( - plateAlloy, plateAlloy, plateAlloy, - plateAlloy, rotorIC3, plateAlloy, + plateAlloy, plateAlloy, plateAlloy, + plateAlloy, rotorIC3, plateAlloy, plateAlloy,plateAlloy, plateAlloy, rotor3); //Carbon Rotor @@ -92,50 +93,50 @@ public class COMPAT_CompactWindmills { //Kinetic Wind Turbine public static ShapedRecipeObject KWT = new ShapedRecipeObject( - plateCarbon, shaftIron, plateCarbon, - cableCopper, mvCasing, cableCopper, - plateRubber, plateCarbon, plateRubber, - kineticWind); - + plateCarbon, shaftIron, plateCarbon, + cableCopper, mvCasing, cableCopper, + plateRubber, plateCarbon, plateRubber, + kineticWind); + //ELV Windmill public static ShapedRecipeObject WM_ELV = new ShapedRecipeObject( - - circuitTier1, elvTransformer, circuitTier1, - plateTier1, lvCasing, plateTier1, - plateTier1, rotor1, plateTier1, - elvWindmill); - - + + circuitTier1, elvTransformer, circuitTier1, + plateTier1, lvCasing, plateTier1, + plateTier1, rotor1, plateTier1, + elvWindmill); + + //LV Windmill public static ShapedRecipeObject WM_LV = new ShapedRecipeObject( - circuitTier2, lvTransformer, circuitTier2, - plateTier2, mvCasing, plateTier2, - plateTier2, rotor2, plateTier2, - lvWindmill); - + circuitTier2, lvTransformer, circuitTier2, + plateTier2, mvCasing, plateTier2, + plateTier2, rotor2, plateTier2, + lvWindmill); + //MV Windmill public static ShapedRecipeObject WM_MV = new ShapedRecipeObject( - circuitTier3, mvTransformer, circuitTier3, - plateTier3, hvCasing, plateTier3, - plateTier3, rotor3, plateTier3, - mvWindmill); - + circuitTier3, mvTransformer, circuitTier3, + plateTier3, hvCasing, plateTier3, + plateTier3, rotor3, plateTier3, + mvWindmill); + //HV Windmill public static ShapedRecipeObject WM_HV = new ShapedRecipeObject( - circuitTier4, hvTransformer, circuitTier4, - plateTier4, evCasing, plateTier4, - plateTier4, rotor4, plateTier4, - hvWindmill); - + circuitTier4, hvTransformer, circuitTier4, + plateTier4, evCasing, plateTier4, + plateTier4, rotor4, plateTier4, + hvWindmill); + //EV Windmill public static ShapedRecipeObject WM_EV = new ShapedRecipeObject( - circuitTier5, evTransformer, circuitTier5, - plateTier5, ivCasing, plateTier5, - plateTier5, rotor5, plateTier5, - evWindmill); + circuitTier5, evTransformer, circuitTier5, + plateTier5, ivCasing, plateTier5, + plateTier5, rotor5, plateTier5, + evWindmill); public static void OreDict(){ - run(); + run(); } private static final void run(){ @@ -144,7 +145,7 @@ public class COMPAT_CompactWindmills { //RemoveRecipeQueue.add("CompactWindmills:ALLOY"); //RemoveRecipeQueue.add("CompactWindmills:CARBON"); //RemoveRecipeQueue.add("CompactWindmills:IRIDIUM"); - + //Remove Recipes RemoveRecipeQueue.add(kineticWind); RemoveRecipeQueue.add(elvWindmill); @@ -155,7 +156,7 @@ public class COMPAT_CompactWindmills { RemoveRecipeQueue.add(rotor1); RemoveRecipeQueue.add(rotor3); RemoveRecipeQueue.add(rotor4); - + //Add Recipes AddRecipeQueue.add(Wooden_Rotor); AddRecipeQueue.add(Alloy_Rotor); diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_EnderIO.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_EnderIO.java index 7a5389e37c..f5eee3e8c5 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_EnderIO.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_EnderIO.java @@ -10,7 +10,7 @@ public class COMPAT_EnderIO { public static void OreDict(){ run(); } - + private static final void run(){ ItemUtils.getItemForOreDict("EnderIO:itemAlloy", "ingotVibrantAlloy", "Vibrant Alloy Ingot", 2); GT_OreDictUnificator.registerOre("plateConductiveIron", new ItemStack(ModItems.itemPlateConductiveIron)); @@ -22,5 +22,5 @@ public class COMPAT_EnderIO { GT_OreDictUnificator.registerOre("plateSoularium", new ItemStack(ModItems.itemPlateSoularium)); GT_OreDictUnificator.registerOre("plateVibrantAlloy", new ItemStack(ModItems.itemPlateVibrantAlloy)); } - + } diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_IC2.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_IC2.java index 960afc1ea1..ce62eaac5a 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_IC2.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_IC2.java @@ -2,6 +2,7 @@ package gtPlusPlus.core.common.compat; import static gtPlusPlus.core.handler.COMPAT_HANDLER.RemoveRecipeQueue; + import gtPlusPlus.core.lib.CORE.configSwitches; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.recipe.ShapedRecipeObject; @@ -15,13 +16,13 @@ public class COMPAT_IC2 { private static ItemStack itemSolarHelmet = ItemUtils.simpleMetaStack("IC2:itemSolarHelmet", 0, 1); public static ShapedRecipeObject Cropnalyzer = new ShapedRecipeObject( - "ore:cableGt02Copper", "ore:cableGt02Copper", null, - "minecraft:redstone", "ore:blockGlass", "minecraft:redstone", - "minecraft:redstone", "ore:circuitBasic", "minecraft:redstone", + "ore:cableGt02Copper", "ore:cableGt02Copper", null, + "minecraft:redstone", "ore:blockGlass", "minecraft:redstone", + "minecraft:redstone", "ore:circuitBasic", "minecraft:redstone", itemCropnalyzer); public static ShapedRecipeObject SolarHelmet = new ShapedRecipeObject( - "ore:plateIron", "ore:plateIron", "ore:plateIron", - "ore:plateIron", "gregtech:gt.metaitem.01:32750", "ore:plateIron", + "ore:plateIron", "ore:plateIron", "ore:plateIron", + "ore:plateIron", "gregtech:gt.metaitem.01:32750", "ore:plateIron", "ore:craftingWireCopper", "ore:craftingWireCopper", "ore:craftingWireCopper", itemSolarHelmet); @@ -29,7 +30,7 @@ public class COMPAT_IC2 { public static void OreDict(){ //Get ItemStacks for results - /*itemCropnalyzer = UtilsItems.getItemStack("IC2:itemCropnalyzer", 1); + /*itemCropnalyzer = UtilsItems.getItemStack("IC2:itemCropnalyzer", 1); itemSolarHelmet = UtilsItems.getItemStack("IC2:itemSolarHelmet", 1); */ run(); } @@ -50,7 +51,7 @@ public class COMPAT_IC2 { RemoveRecipeQueue.add("IC2:itemCable:6"); RemoveRecipeQueue.add("IC2:itemCable:10"); RemoveRecipeQueue.add("IC2:itemCable:13"); - //RemoveRecipeQueue.add(itemCropnalyzer); + //RemoveRecipeQueue.add(itemCropnalyzer); //RemoveRecipeQueue.add(itemSolarHelmet); //AddRecipeQueue.add(Cropnalyzer); diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_MorePlanets.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_MorePlanets.java index 9e29458bce..bf47d2eb4b 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_MorePlanets.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_MorePlanets.java @@ -4,11 +4,11 @@ import gtPlusPlus.core.util.item.ItemUtils; public class COMPAT_MorePlanets { - + public static void OreDict(){ run(); } - + private final static void run(){ //Metals ItemUtils.getItemForOreDict("MorePlanet:kapteyn-b_item", "ingotFrozenIron", "Frozen Iron Ingot", 0); @@ -25,7 +25,7 @@ public class COMPAT_MorePlanets { ItemUtils.getItemForOreDict("MorePlanet:polongnius_item", "ingotPolongiusMeteoricIron", "Polongius Meteoric Iron Ingot", 4); ItemUtils.getItemForOreDict("MorePlanet:mercury_item", "ingotMeteoricSteel", "Meteoric Steel Ingot", 3); ItemUtils.getItemForOreDict("MorePlanet:sirius-b_item", "dustSulfur", "Sulfur Dust", 2); - + //Gems ItemUtils.getItemForOreDict("MorePlanet:fronos_item", "gemBlackDiamond", "Black Diamond Gem", 2); ItemUtils.getItemForOreDict("MorePlanet:koentus_item", "gemWhiteCrystal", "White Crystal", 0); @@ -33,5 +33,5 @@ public class COMPAT_MorePlanets { ItemUtils.getItemForOreDict("MorePlanet:pluto_item", "gemXeonius", "Xeonius Gem", 0); ItemUtils.getItemForOreDict("MorePlanet:kapteyn-b_item", "gemUranium", "Uranium Gem", 1); } - + } diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_PneumaticCraft.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_PneumaticCraft.java index d471535e81..9c4161b88d 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_PneumaticCraft.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_PneumaticCraft.java @@ -9,9 +9,9 @@ public class COMPAT_PneumaticCraft { public static void OreDict(){ run(); } - + private static final void run(){ - GT_OreDictUnificator.registerOre("plateCompressedIron", new ItemStack(ModItems.itemPlateCompressedIron)); + GT_OreDictUnificator.registerOre("plateCompressedIron", new ItemStack(ModItems.itemPlateCompressedIron)); } - + } diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_RFTools.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_RFTools.java index 4db8006a89..f8c69cc4b7 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_RFTools.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_RFTools.java @@ -9,10 +9,10 @@ public class COMPAT_RFTools { public static void OreDict(){ run(); } - + private static final void run(){ GT_OreDictUnificator.registerOre("plateDimensionShard", new ItemStack(ModItems.itemPlateDimensionShard)); - + } - + } diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_SimplyJetpacks.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_SimplyJetpacks.java index 6d7f08b55d..ea9374d1c2 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_SimplyJetpacks.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_SimplyJetpacks.java @@ -9,10 +9,10 @@ public class COMPAT_SimplyJetpacks { public static void OreDict(){ run(); } - + private static final void run(){ GT_OreDictUnificator.registerOre("plateEnrichedSoularium", new ItemStack(ModItems.itemPlateEnrichedSoularium)); - + } - + } diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java index b1b7464dd2..a257766e38 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java @@ -8,7 +8,7 @@ import gtPlusPlus.core.util.item.ItemUtils; public class COMPAT_Thaumcraft { public static void OreDict(){ - + if (configSwitches.enableThaumcraftShardUnification){ run(); } @@ -22,7 +22,7 @@ public class COMPAT_Thaumcraft { GT_OreDictUnificator.registerOre("shardAny", ItemUtils.getItemStack("Thaumcraft:ItemShard:"+i, 1)); ItemUtils.getItemForOreDict("Thaumcraft:ItemShard", "gemInfusedAnything", "TC Shard "+i, i); GT_OreDictUnificator.registerOre("gemInfusedAnything", ItemUtils.getItemStack("Thaumcraft:ItemShard:"+i, 1)); - //System.out.println("TC Shard registration count is: "+i); + //System.out.println("TC Shard registration count is: "+i); } if (LoadedMods.ForbiddenMagic){ @@ -32,12 +32,12 @@ public class COMPAT_Thaumcraft { GT_OreDictUnificator.registerOre("shardAny", ItemUtils.getItemStack("ForbiddenMagic:NetherShard:"+i, 1)); ItemUtils.getItemForOreDict("ForbiddenMagic:NetherShard", "gemInfusedAnything", "FM Shard "+i, i); GT_OreDictUnificator.registerOre("gemInfusedAnything", ItemUtils.getItemStack("ForbiddenMagic:NetherShard:"+i, 1)); - //System.out.println("TC Shard registration count is: "+i); + //System.out.println("TC Shard registration count is: "+i); } ItemUtils.getItemForOreDict("ForbiddenMagic:GluttonyShard", "shardAny", "FM Gluttony Shard", 0); GT_OreDictUnificator.registerOre("shardAny", ItemUtils.getItemStack("ForbiddenMagic:GluttonyShard", 1)); ItemUtils.getItemForOreDict("ForbiddenMagic:GluttonyShard", "gemInfusedAnything", "FM Gluttony Shard", 0); - GT_OreDictUnificator.registerOre("gemInfusedAnything", ItemUtils.getItemStack("ForbiddenMagic:GluttonyShard", 1)); + GT_OreDictUnificator.registerOre("gemInfusedAnything", ItemUtils.getItemStack("ForbiddenMagic:GluttonyShard", 1)); } } diff --git a/src/Java/gtPlusPlus/core/container/Container_BackpackBase.java b/src/Java/gtPlusPlus/core/container/Container_BackpackBase.java index f156f6dcaf..c8ddf76876 100644 --- a/src/Java/gtPlusPlus/core/container/Container_BackpackBase.java +++ b/src/Java/gtPlusPlus/core/container/Container_BackpackBase.java @@ -25,7 +25,7 @@ public class Container_BackpackBase extends Container // ARMOR_START = BaseInventoryBackpack.INV_SIZE, ARMOR_END = ARMOR_START+3, // INV_START = ARMOR_END+1, and then carry on like above. - public Container_BackpackBase(EntityPlayer par1Player, InventoryPlayer inventoryPlayer, BaseInventoryBackpack inventoryItem) + public Container_BackpackBase(final EntityPlayer par1Player, final InventoryPlayer inventoryPlayer, final BaseInventoryBackpack inventoryItem) { this.inventory = inventoryItem; @@ -41,7 +41,7 @@ public class Container_BackpackBase extends Container // from being stored within itself, but if you want to allow that and // you followed my advice at the end of the above step, then you // could get away with using the vanilla Slot class - this.addSlotToContainer(new SlotItemBackpackInv(this.inventory, i, 80 + (18 * (int)(i/4)), 8 + (18*(i%4)))); + this.addSlotToContainer(new SlotItemBackpackInv(this.inventory, i, 80 + (18 * (i/4)), 8 + (18*(i%4)))); } // If you want, you can add ARMOR SLOTS here as well, but you need to @@ -52,43 +52,44 @@ public class Container_BackpackBase extends Container // These are the standard positions for survival inventory layout this.addSlotToContainer(new SlotArmor(this.player, inventoryPlayer, inventoryPlayer.getSizeInventory() - 1 - i, 8, 8 + i * 18, i)); } - */ + */ // PLAYER INVENTORY - uses default locations for standard inventory texture file for (i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { - this.addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + this.addSlotToContainer(new Slot(inventoryPlayer, j + (i * 9) + 9, 8 + (j * 18), 84 + (i * 18))); } } // PLAYER ACTION BAR - uses default locations for standard action bar texture file for (i = 0; i < 9; ++i) { - this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); + this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + (i * 18), 142)); } } @Override - public boolean canInteractWith(EntityPlayer entityplayer) + public boolean canInteractWith(final EntityPlayer entityplayer) { // be sure to return the inventory's isUseableByPlayer method // if you defined special behavior there: - return inventory.isUseableByPlayer(entityplayer); + return this.inventory.isUseableByPlayer(entityplayer); } /** * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. */ - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int index) + @Override + public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int index) { ItemStack itemstack = null; - Slot slot = (Slot) this.inventorySlots.get(index); + final Slot slot = (Slot) this.inventorySlots.get(index); - if (slot != null && slot.getHasStack()) + if ((slot != null) && slot.getHasStack()) { - ItemStack itemstack1 = slot.getStack(); + final ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); // If item is in our custom Inventory or armor slot @@ -108,7 +109,7 @@ public class Container_BackpackBase extends Container /* If your inventory only stores certain instances of Items, you can implement shift-clicking to your inventory like this: - + // Check that the item is the right type if (itemstack1.getItem() instanceof ItemCustom) { @@ -133,9 +134,9 @@ public class Container_BackpackBase extends Container Otherwise, you have basically 2 choices: 1. shift-clicking between player inventory and custom inventory 2. shift-clicking between action bar and inventory - + Be sure to choose only ONE of the following implementations!!! - */ + */ /** * Implementation number 1: Shift-click into your custom inventory */ @@ -147,12 +148,12 @@ public class Container_BackpackBase extends Container return null; } } - + /** * Implementation number 2: Shift-click items between action bar and inventory */ // item is in player's inventory, but not in action bar - if (index >= INV_START && index < HOTBAR_START) + if ((index >= INV_START) && (index < HOTBAR_START)) { // place in action bar if (!this.mergeItemStack(itemstack1, HOTBAR_START, HOTBAR_END+1, false)) @@ -161,7 +162,7 @@ public class Container_BackpackBase extends Container } } // item in action bar - place in player inventory - else if (index >= HOTBAR_START && index < HOTBAR_END+1) + else if ((index >= HOTBAR_START) && (index < (HOTBAR_END+1))) { if (!this.mergeItemStack(itemstack1, INV_START, INV_END+1, false)) { @@ -196,9 +197,9 @@ public class Container_BackpackBase extends Container * be able to save properly */ @Override - public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) { + public ItemStack slotClick(final int slot, final int button, final int flag, final EntityPlayer player) { // this will prevent the player from interacting with the item that opened the inventory: - if (slot >= 0 && getSlot(slot) != null && getSlot(slot).getStack() == player.getHeldItem()) { + if ((slot >= 0) && (this.getSlot(slot) != null) && (this.getSlot(slot).getStack() == player.getHeldItem())) { return null; } return super.slotClick(slot, button, flag, player); diff --git a/src/Java/gtPlusPlus/core/container/Container_FishTrap.java b/src/Java/gtPlusPlus/core/container/Container_FishTrap.java index 9e69ed4d46..46b9a0c523 100644 --- a/src/Java/gtPlusPlus/core/container/Container_FishTrap.java +++ b/src/Java/gtPlusPlus/core/container/Container_FishTrap.java @@ -1,12 +1,13 @@ package gtPlusPlus.core.container; import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.*; +import gtPlusPlus.core.inventories.InventoryFishTrap; import gtPlusPlus.core.slots.SlotNoInput; import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.*; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -15,28 +16,28 @@ public class Container_FishTrap extends Container { protected TileEntityFishTrap tile_entity; public final InventoryFishTrap inventoryChest; - private World worldObj; - private int posX; - private int posY; - private int posZ; + private final World worldObj; + private final int posX; + private final int posY; + private final int posZ; public static int StorageSlotNumber = 15; //Number of slots in storage area public static int InventorySlotNumber = 36; //Inventory Slots (Inventory and Hotbar) public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; //All slots - private int[] slotStorage = new int[15]; + private final int[] slotStorage = new int[15]; - public Container_FishTrap(InventoryPlayer inventory, TileEntityFishTrap te){ + public Container_FishTrap(final InventoryPlayer inventory, final TileEntityFishTrap te){ this.tile_entity = te; this.inventoryChest = te.getInventory(); int var6; int var7; - worldObj = te.getWorldObj(); - posX = te.xCoord; - posY = te.yCoord; - posZ = te.zCoord; + this.worldObj = te.getWorldObj(); + this.posX = te.xCoord; + this.posY = te.yCoord; + this.posZ = te.zCoord; int o=0; @@ -46,8 +47,8 @@ public class Container_FishTrap extends Container { for (var7 = 0; var7 < 5; ++var7) { //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18)); - this.addSlotToContainer(new SlotNoInput(inventoryChest, var7 + var6 * 4, 36+ 8 + var7 * 18, 8 + 7 + var6 * 18)); - slotStorage[o] = o; + this.addSlotToContainer(new SlotNoInput(this.inventoryChest, var7 + (var6 * 4), 36+ 8 + (var7 * 18), 8 + 7 + (var6 * 18))); + this.slotStorage[o] = o; o++; } } @@ -59,58 +60,58 @@ public class Container_FishTrap extends Container { { for (var7 = 0; var7 < 9; ++var7) { - this.addSlotToContainer(new Slot(inventory, var7 + var6 * 9 + 9, 8 + var7 * 18, 84 + var6 * 18)); + this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); } } //Player Hotbar for (var6 = 0; var6 < 9; ++var6) { - this.addSlotToContainer(new Slot(inventory, var6, 8 + var6 * 18, 142)); - } + this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); + } } @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer){ + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer){ if (!aPlayer.worldObj.isRemote){ - if (aSlotIndex == 999 || aSlotIndex == -999){ + if ((aSlotIndex == 999) || (aSlotIndex == -999)){ //Utils.LOG_WARNING("??? - "+aSlotIndex); } } return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } - + @Override - public void onContainerClosed(EntityPlayer par1EntityPlayer){ + public void onContainerClosed(final EntityPlayer par1EntityPlayer){ super.onContainerClosed(par1EntityPlayer); } @Override - public boolean canInteractWith(EntityPlayer par1EntityPlayer){ - if (worldObj.getBlock(posX, posY, posZ) != ModBlocks.blockFishTrap){ + public boolean canInteractWith(final EntityPlayer par1EntityPlayer){ + if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockFishTrap){ return false; } - return par1EntityPlayer.getDistanceSq((double)posX + 0.5D, (double)posY + 0.5D, (double)posZ + 0.5D) <= 64D; + return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; } @Override - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { ItemStack var3 = null; - Slot var4 = (Slot)this.inventorySlots.get(par2); + final Slot var4 = (Slot)this.inventorySlots.get(par2); - if (var4 != null && var4.getHasStack()) + if ((var4 != null) && var4.getHasStack()) { - ItemStack var5 = var4.getStack(); + final ItemStack var5 = var4.getStack(); var3 = var5.copy(); /*if (par2 == 0) @@ -163,7 +164,7 @@ public class Container_FishTrap extends Container { //Can merge Slot @Override - public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_) { + public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { return super.func_94530_a(p_94530_1_, p_94530_2_); } diff --git a/src/Java/gtPlusPlus/core/container/Container_Workbench.java b/src/Java/gtPlusPlus/core/container/Container_Workbench.java index 25ea6e8fe5..fd16aa4e67 100644 --- a/src/Java/gtPlusPlus/core/container/Container_Workbench.java +++ b/src/Java/gtPlusPlus/core/container/Container_Workbench.java @@ -25,10 +25,10 @@ public class Container_Workbench extends Container { public final InventoryWorkbenchHoloSlots inventoryHolo; public final InventoryWorkbenchHoloCrafting inventoryCrafting; - private World worldObj; - private int posX; - private int posY; - private int posZ; + private final World worldObj; + private final int posX; + private final int posY; + private final int posZ; public static int HoloSlotNumber = 6; public static int InputSlotNumber = 9; //Number of Slots in the Crafting Grid @@ -39,20 +39,20 @@ public class Container_Workbench extends Container { public static int InventoryOutSlotNumber = InventorySlotNumber + 1; //Inventory Slot Number + Output public static int FullSlotNumber = InventorySlotNumber + InOutputSlotNumber; //All slots - private int slotOutput = 0; - private int[] slotHolo = new int[5]; - private int[] slotCrafting = new int[9]; - private int[] slotStorage = new int[16]; - private int[] slotTools = new int[5]; + private final int slotOutput = 0; + private final int[] slotHolo = new int[5]; + private final int[] slotCrafting = new int[9]; + private final int[] slotStorage = new int[16]; + private final int[] slotTools = new int[5]; public void moveCraftingToChest(){ //Check Chest Space for (int i=0;i<9;i++){ - if (craftMatrix.getStackInSlot(i) != null){ + if (this.craftMatrix.getStackInSlot(i) != null){ for (int r=0;r<16;r++){ - if (inventoryChest.getStackInSlot(r) == null || (inventoryChest.getStackInSlot(r).getItem() == craftMatrix.getStackInSlot(i).getItem() && (64-craftMatrix.getStackInSlot(i).stackSize) <= (64-craftMatrix.getStackInSlot(i).stackSize))){ - inventoryChest.setInventorySlotContents(r, craftMatrix.getStackInSlot(i)); - craftMatrix.setInventorySlotContents(i, null); + if ((this.inventoryChest.getStackInSlot(r) == null) || ((this.inventoryChest.getStackInSlot(r).getItem() == this.craftMatrix.getStackInSlot(i).getItem()) && ((64-this.craftMatrix.getStackInSlot(i).stackSize) <= (64-this.craftMatrix.getStackInSlot(i).stackSize)))){ + this.inventoryChest.setInventorySlotContents(r, this.craftMatrix.getStackInSlot(i)); + this.craftMatrix.setInventorySlotContents(i, null); break; } } @@ -65,11 +65,11 @@ public class Container_Workbench extends Container { public void moveChestToCrafting(){ //Check Crafting items and slots for (int i=0;i<9;i++){ - if (craftMatrix.getStackInSlot(i) == null || craftMatrix.getStackInSlot(i).stackSize > 0){ + if ((this.craftMatrix.getStackInSlot(i) == null) || (this.craftMatrix.getStackInSlot(i).stackSize > 0)){ for (int r=0;r<16;r++){ - if (inventoryChest.getStackInSlot(r) != null){ - craftMatrix.setInventorySlotContents(i, craftMatrix.getStackInSlot(r)); - inventoryChest.setInventorySlotContents(r, null); + if (this.inventoryChest.getStackInSlot(r) != null){ + this.craftMatrix.setInventorySlotContents(i, this.craftMatrix.getStackInSlot(r)); + this.inventoryChest.setInventorySlotContents(r, null); } } } @@ -79,7 +79,7 @@ public class Container_Workbench extends Container { } - public Container_Workbench(InventoryPlayer inventory, TileEntityWorkbench tile){ + public Container_Workbench(final InventoryPlayer inventory, final TileEntityWorkbench tile){ this.tile_entity = tile; this.inventoryChest = tile.inventoryChest; this.inventoryTool = tile.inventoryTool; @@ -88,44 +88,44 @@ public class Container_Workbench extends Container { int var6; int var7; - worldObj = tile.getWorldObj(); - posX = tile.xCoord; - posY = tile.yCoord; - posZ = tile.zCoord; + this.worldObj = tile.getWorldObj(); + this.posX = tile.xCoord; + this.posY = tile.yCoord; + this.posZ = tile.zCoord; int o=0; //Output slot - addSlotToContainer(new SlotOutput(inventory.player, this.craftMatrix, tile.inventoryCraftResult, 0, 136, 64)); + this.addSlotToContainer(new SlotOutput(inventory.player, this.craftMatrix, tile.inventoryCraftResult, 0, 136, 64)); //Util Slots - addSlotToContainer(new SlotBlueprint(inventoryHolo, 1, 136, 28)); //Blueprint - addSlotToContainer(new SlotNoInput(inventoryHolo, 2, 154, 28)); //Hopper - addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 3, 154, 64, false, false, 64)); //Parking + this.addSlotToContainer(new SlotBlueprint(this.inventoryHolo, 1, 136, 28)); //Blueprint + this.addSlotToContainer(new SlotNoInput(this.inventoryHolo, 2, 154, 28)); //Hopper + this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 3, 154, 64, false, false, 64)); //Parking //Holo Slots - addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 4, 154, 46, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 5, 136, 46, false, false, 1)); + this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 4, 154, 46, false, false, 1)); + this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 5, 136, 46, false, false, 1)); for (int i=1; i<6; i++){ - slotHolo[o] = o+1; + this.slotHolo[o] = o+1; o++; } o=0; - updateCraftingMatrix(); + this.updateCraftingMatrix(); //Crafting Grid for (var6 = 0; var6 < 3; ++var6) { for (var7 = 0; var7 < 3; ++var7) { - this.addSlotToContainer(new Slot(this.craftMatrix, var7 + var6 * 3, 82 + var7 * 18, 28 + var6 * 18)); + this.addSlotToContainer(new Slot(this.craftMatrix, var7 + (var6 * 3), 82 + (var7 * 18), 28 + (var6 * 18))); /*if (this.inventoryCrafting.getStackInSlot(o) != null){ - this.craftMatrix.setInventorySlotContents(o, inventoryCrafting.getStackInSlot(o)); - this.inventoryCrafting.setInventorySlotContents(o, null); - } */ - slotCrafting[o] = o+6; + this.craftMatrix.setInventorySlotContents(o, inventoryCrafting.getStackInSlot(o)); + this.inventoryCrafting.setInventorySlotContents(o, null); + } */ + this.slotCrafting[o] = o+6; o++; } } @@ -138,8 +138,8 @@ public class Container_Workbench extends Container { for (var7 = 0; var7 < 4; ++var7) { //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18)); - this.addSlotToContainer(new Slot(inventoryChest, var7 + var6 * 4, 8 + var7 * 18, 7 + var6 * 18)); - slotStorage[o] = o+15; + this.addSlotToContainer(new Slot(this.inventoryChest, var7 + (var6 * 4), 8 + (var7 * 18), 7 + (var6 * 18))); + this.slotStorage[o] = o+15; o++; } } @@ -151,64 +151,64 @@ public class Container_Workbench extends Container { { for (var7 = 0; var7 < 5; ++var7) { - this.addSlotToContainer(new SlotGtTool(inventoryTool, var7 + var6 * 3, 82 + var7 * 18, 8 + var6 * 18)); - slotTools[o] = o+31; + this.addSlotToContainer(new SlotGtTool(this.inventoryTool, var7 + (var6 * 3), 82 + (var7 * 18), 8 + (var6 * 18))); + this.slotTools[o] = o+31; o++; } - } + } //Player Inventory for (var6 = 0; var6 < 3; ++var6) { for (var7 = 0; var7 < 9; ++var7) { - this.addSlotToContainer(new Slot(inventory, var7 + var6 * 9 + 9, 8 + var7 * 18, 84 + var6 * 18)); + this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); } } //Player Hotbar for (var6 = 0; var6 < 9; ++var6) { - this.addSlotToContainer(new Slot(inventory, var6, 8 + var6 * 18, 142)); + this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); } - this.onCraftMatrixChanged(this.craftMatrix); + this.onCraftMatrixChanged(this.craftMatrix); } @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer){ + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer){ if (!aPlayer.worldObj.isRemote){ - if (aSlotIndex == 999 || aSlotIndex == -999){ + if ((aSlotIndex == 999) || (aSlotIndex == -999)){ //Utils.LOG_WARNING("??? - "+aSlotIndex); } - if (aSlotIndex == slotOutput){ + if (aSlotIndex == this.slotOutput){ Utils.LOG_WARNING("Player Clicked on the output slot"); //TODO } - for (int x : slotHolo){ + for (final int x : this.slotHolo){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); if (x == 1){ - Utils.LOG_WARNING("Player Clicked Blueprint slot in the Holo Grid"); + Utils.LOG_WARNING("Player Clicked Blueprint slot in the Holo Grid"); } else if (x == 2){ Utils.LOG_WARNING("Player Clicked Right Arrow slot in the Holo Grid"); - if (inventoryHolo.getStackInSlot(1) != null){ + if (this.inventoryHolo.getStackInSlot(1) != null){ Utils.LOG_WARNING("Found an ItemStack."); - if (inventoryHolo.getStackInSlot(1).getItem() instanceof IItemBlueprint){ + if (this.inventoryHolo.getStackInSlot(1).getItem() instanceof IItemBlueprint){ Utils.LOG_WARNING("Found a blueprint."); - ItemStack tempBlueprint = inventoryHolo.getStackInSlot(1); - ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem(); - if (inventoryHolo.getStackInSlot(0) != null && !tempItemBlueprint.hasBlueprint(tempBlueprint)){ + final ItemStack tempBlueprint = this.inventoryHolo.getStackInSlot(1); + final ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem(); + if ((this.inventoryHolo.getStackInSlot(0) != null) && !tempItemBlueprint.hasBlueprint(tempBlueprint)){ Utils.LOG_WARNING("Output slot was not empty."); Utils.LOG_WARNING("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one."); - tempItemBlueprint.setBlueprint(inventoryHolo.getStackInSlot(1), craftMatrix, inventoryHolo.getStackInSlot(0)); - ItemStack newTempBlueprint = ItemUtils.getSimpleStack(tempItemBlueprint); - inventoryHolo.setInventorySlotContents(1, newTempBlueprint); + tempItemBlueprint.setBlueprint(this.inventoryHolo.getStackInSlot(1), this.craftMatrix, this.inventoryHolo.getStackInSlot(0)); + final ItemStack newTempBlueprint = ItemUtils.getSimpleStack(tempItemBlueprint); + this.inventoryHolo.setInventorySlotContents(1, newTempBlueprint); Utils.LOG_WARNING(ItemUtils.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint))); } else { @@ -216,12 +216,12 @@ public class Container_Workbench extends Container { Utils.LOG_WARNING("Blueprint already holds a recipe."); } else { - Utils.LOG_WARNING("Output slot was empty."); + Utils.LOG_WARNING("Output slot was empty."); } } } else { - Utils.LOG_WARNING("ItemStack found was not a blueprint."); + Utils.LOG_WARNING("ItemStack found was not a blueprint."); } } else { @@ -229,60 +229,60 @@ public class Container_Workbench extends Container { } } else if (x == 3){ - Utils.LOG_WARNING("Player Clicked Big [P] slot in the Holo Grid"); + Utils.LOG_WARNING("Player Clicked Big [P] slot in the Holo Grid"); } else if (x == 4){ - Utils.LOG_WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid"); + Utils.LOG_WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid"); } else if (x == 5){ - Utils.LOG_WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid"); + Utils.LOG_WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid"); } } } - for (int x : slotCrafting){ + for (final int x : this.slotCrafting){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); } } - for (int x : slotStorage){ + for (final int x : this.slotStorage){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid"); + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid"); } } - for (int x : slotTools){ + for (final int x : this.slotTools){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid"); + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid"); } } } - //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid"); + //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid"); return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } private void updateCraftingMatrix() { - for (int i = 0; i < craftMatrix.getSizeInventory(); i++) { - craftMatrix.setInventorySlotContents(i, tile_entity.inventoryCrafting.getStackInSlot(i)); + for (int i = 0; i < this.craftMatrix.getSizeInventory(); i++) { + this.craftMatrix.setInventorySlotContents(i, this.tile_entity.inventoryCrafting.getStackInSlot(i)); } } @Override - public void onCraftMatrixChanged(IInventory iiventory) { - tile_entity.inventoryCraftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); - } + public void onCraftMatrixChanged(final IInventory iiventory) { + this.tile_entity.inventoryCraftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); + } @Override - public void onContainerClosed(EntityPlayer par1EntityPlayer) + public void onContainerClosed(final EntityPlayer par1EntityPlayer) { super.onContainerClosed(par1EntityPlayer); - saveCraftingMatrix(); + this.saveCraftingMatrix(); } private void saveCraftingMatrix() { - for (int i = 0; i < craftMatrix.getSizeInventory(); i++) { - tile_entity.inventoryCrafting.setInventorySlotContents(i, craftMatrix.getStackInSlot(i)); + for (int i = 0; i < this.craftMatrix.getSizeInventory(); i++) { + this.tile_entity.inventoryCrafting.setInventorySlotContents(i, this.craftMatrix.getStackInSlot(i)); } - } + } @@ -307,10 +307,10 @@ public class Container_Workbench extends Container { /*@Override public void onContainerClosed(EntityPlayer par1EntityPlayer) - { + { for (int o=0; o<craftMatrix.getSizeInventory(); o++){ - this.inventoryCrafting.setInventorySlotContents(o, craftMatrix.getStackInSlot(o)); - this.craftMatrix.setInventorySlotContents(o, null); + this.inventoryCrafting.setInventorySlotContents(o, craftMatrix.getStackInSlot(o)); + this.craftMatrix.setInventorySlotContents(o, null); }*/ //super.onContainerClosed(par1EntityPlayer); @@ -331,24 +331,24 @@ public class Container_Workbench extends Container { }*/ @Override - public boolean canInteractWith(EntityPlayer par1EntityPlayer){ - if (worldObj.getBlock(posX, posY, posZ) != ModBlocks.blockWorkbench){ + public boolean canInteractWith(final EntityPlayer par1EntityPlayer){ + if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockWorkbench){ return false; } - return par1EntityPlayer.getDistanceSq((double)posX + 0.5D, (double)posY + 0.5D, (double)posZ + 0.5D) <= 64D; + return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; } @Override - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { ItemStack var3 = null; - Slot var4 = (Slot)this.inventorySlots.get(par2); + final Slot var4 = (Slot)this.inventorySlots.get(par2); - if (var4 != null && var4.getHasStack()) + if ((var4 != null) && var4.getHasStack()) { - ItemStack var5 = var4.getStack(); + final ItemStack var5 = var4.getStack(); var3 = var5.copy(); if (par2 == 0) @@ -360,14 +360,14 @@ public class Container_Workbench extends Container { var4.onSlotChange(var5, var3); } - else if (par2 >= InOutputSlotNumber && par2 < InventoryOutSlotNumber) + else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) { if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) { return null; } } - else if (par2 >= InventoryOutSlotNumber && par2 < FullSlotNumber) + else if ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) { if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) { @@ -401,8 +401,8 @@ public class Container_Workbench extends Container { //Can merge Slot @Override - public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_) { - return p_94530_2_.inventory != tile_entity.inventoryCraftResult && super.func_94530_a(p_94530_1_, p_94530_2_); + public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { + return (p_94530_2_.inventory != this.tile_entity.inventoryCraftResult) && super.func_94530_a(p_94530_1_, p_94530_2_); } diff --git a/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java index 8451cd0d2d..4fefb8b3f5 100644 --- a/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java +++ b/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java @@ -25,10 +25,10 @@ public class Container_WorkbenchAdvanced extends Container { public final InventoryWorkbenchHoloSlots inventoryHolo; public final InventoryWorkbenchHoloCrafting inventoryCrafting; - private World worldObj; - private int posX; - private int posY; - private int posZ; + private final World worldObj; + private final int posX; + private final int posY; + private final int posZ; public static int HoloSlotNumber = 6; public static int InputSlotNumber = 9; //Number of Slots in the Crafting Grid @@ -39,13 +39,13 @@ public class Container_WorkbenchAdvanced extends Container { public static int InventoryOutSlotNumber = InventorySlotNumber + 1; //Inventory Slot Number + Output public static int FullSlotNumber = InventorySlotNumber + InOutputSlotNumber; //All slots - private int slotOutput = 0; - private int[] slotHolo = new int[5]; - private int[] slotCrafting = new int[9]; - private int[] slotStorage = new int[16]; - private int[] slotTools = new int[5]; + private final int slotOutput = 0; + private final int[] slotHolo = new int[5]; + private final int[] slotCrafting = new int[9]; + private final int[] slotStorage = new int[16]; + private final int[] slotTools = new int[5]; - public Container_WorkbenchAdvanced(InventoryPlayer inventory, TileEntityWorkbenchAdvanced tile){ + public Container_WorkbenchAdvanced(final InventoryPlayer inventory, final TileEntityWorkbenchAdvanced tile){ this.tile_entity = tile; this.inventoryChest = tile.inventoryChest; this.inventoryTool = tile.inventoryTool; @@ -54,44 +54,44 @@ public class Container_WorkbenchAdvanced extends Container { int var6; int var7; - worldObj = tile.getWorldObj(); - posX = tile.xCoord; - posY = tile.yCoord; - posZ = tile.zCoord; + this.worldObj = tile.getWorldObj(); + this.posX = tile.xCoord; + this.posY = tile.yCoord; + this.posZ = tile.zCoord; int o=0; //Output slot - addSlotToContainer(new SlotOutput(inventory.player, this.craftMatrix, tile.inventoryCraftResult, 0, 136, 64)); + this.addSlotToContainer(new SlotOutput(inventory.player, this.craftMatrix, tile.inventoryCraftResult, 0, 136, 64)); //Util Slots - addSlotToContainer(new SlotBlueprint(inventoryHolo, 1, 136, 28)); //Blueprint - addSlotToContainer(new SlotNoInput(inventoryHolo, 2, 154, 28)); //Hopper - addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 3, 154, 64, false, false, 64)); //Parking + this.addSlotToContainer(new SlotBlueprint(this.inventoryHolo, 1, 136, 28)); //Blueprint + this.addSlotToContainer(new SlotNoInput(this.inventoryHolo, 2, 154, 28)); //Hopper + this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 3, 154, 64, false, false, 64)); //Parking //Holo Slots - addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 4, 154, 46, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 5, 136, 46, false, false, 1)); + this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 4, 154, 46, false, false, 1)); + this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 5, 136, 46, false, false, 1)); for (int i=1; i<6; i++){ - slotHolo[o] = o+1; + this.slotHolo[o] = o+1; o++; } o=0; - updateCraftingMatrix(); + this.updateCraftingMatrix(); //Crafting Grid for (var6 = 0; var6 < 3; ++var6) { for (var7 = 0; var7 < 3; ++var7) { - this.addSlotToContainer(new Slot(this.craftMatrix, var7 + var6 * 3, 82 + var7 * 18, 28 + var6 * 18)); + this.addSlotToContainer(new Slot(this.craftMatrix, var7 + (var6 * 3), 82 + (var7 * 18), 28 + (var6 * 18))); /*if (this.inventoryCrafting.getStackInSlot(o) != null){ - this.craftMatrix.setInventorySlotContents(o, inventoryCrafting.getStackInSlot(o)); - this.inventoryCrafting.setInventorySlotContents(o, null); - } */ - slotCrafting[o] = o+6; + this.craftMatrix.setInventorySlotContents(o, inventoryCrafting.getStackInSlot(o)); + this.inventoryCrafting.setInventorySlotContents(o, null); + } */ + this.slotCrafting[o] = o+6; o++; } } @@ -104,8 +104,8 @@ public class Container_WorkbenchAdvanced extends Container { for (var7 = 0; var7 < 4; ++var7) { //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18)); - this.addSlotToContainer(new Slot(inventoryChest, var7 + var6 * 4, 8 + var7 * 18, 7 + var6 * 18)); - slotStorage[o] = o+15; + this.addSlotToContainer(new Slot(this.inventoryChest, var7 + (var6 * 4), 8 + (var7 * 18), 7 + (var6 * 18))); + this.slotStorage[o] = o+15; o++; } } @@ -117,64 +117,64 @@ public class Container_WorkbenchAdvanced extends Container { { for (var7 = 0; var7 < 5; ++var7) { - this.addSlotToContainer(new SlotGtToolElectric(inventoryTool, var7 + var6 * 3, 82 + var7 * 18, 8 + var6 * 18, 3, false)); - slotTools[o] = o+31; + this.addSlotToContainer(new SlotGtToolElectric(this.inventoryTool, var7 + (var6 * 3), 82 + (var7 * 18), 8 + (var6 * 18), 3, false)); + this.slotTools[o] = o+31; o++; } - } + } //Player Inventory for (var6 = 0; var6 < 3; ++var6) { for (var7 = 0; var7 < 9; ++var7) { - this.addSlotToContainer(new Slot(inventory, var7 + var6 * 9 + 9, 8 + var7 * 18, 84 + var6 * 18)); + this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); } } //Player Hotbar for (var6 = 0; var6 < 9; ++var6) { - this.addSlotToContainer(new Slot(inventory, var6, 8 + var6 * 18, 142)); + this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); } - this.onCraftMatrixChanged(this.craftMatrix); + this.onCraftMatrixChanged(this.craftMatrix); } @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer){ + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer){ if (!aPlayer.worldObj.isRemote){ - if (aSlotIndex == 999 || aSlotIndex == -999){ + if ((aSlotIndex == 999) || (aSlotIndex == -999)){ //Utils.LOG_WARNING("??? - "+aSlotIndex); } - if (aSlotIndex == slotOutput){ + if (aSlotIndex == this.slotOutput){ Utils.LOG_WARNING("Player Clicked on the output slot"); //TODO } - for (int x : slotHolo){ + for (final int x : this.slotHolo){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); if (x == 1){ - Utils.LOG_WARNING("Player Clicked Blueprint slot in the Holo Grid"); + Utils.LOG_WARNING("Player Clicked Blueprint slot in the Holo Grid"); } else if (x == 2){ Utils.LOG_WARNING("Player Clicked Right Arrow slot in the Holo Grid"); - if (inventoryHolo.getStackInSlot(1) != null){ + if (this.inventoryHolo.getStackInSlot(1) != null){ Utils.LOG_WARNING("Found an ItemStack."); - if (inventoryHolo.getStackInSlot(1).getItem() instanceof IItemBlueprint){ + if (this.inventoryHolo.getStackInSlot(1).getItem() instanceof IItemBlueprint){ Utils.LOG_WARNING("Found a blueprint."); - ItemStack tempBlueprint = inventoryHolo.getStackInSlot(1); - ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem(); - if (inventoryHolo.getStackInSlot(0) != null && !tempItemBlueprint.hasBlueprint(tempBlueprint)){ + final ItemStack tempBlueprint = this.inventoryHolo.getStackInSlot(1); + final ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem(); + if ((this.inventoryHolo.getStackInSlot(0) != null) && !tempItemBlueprint.hasBlueprint(tempBlueprint)){ Utils.LOG_WARNING("Output slot was not empty."); Utils.LOG_WARNING("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one."); - tempItemBlueprint.setBlueprint(inventoryHolo.getStackInSlot(1), craftMatrix, inventoryHolo.getStackInSlot(0)); - ItemStack newTempBlueprint = ItemUtils.getSimpleStack(tempItemBlueprint); - inventoryHolo.setInventorySlotContents(1, newTempBlueprint); + tempItemBlueprint.setBlueprint(this.inventoryHolo.getStackInSlot(1), this.craftMatrix, this.inventoryHolo.getStackInSlot(0)); + final ItemStack newTempBlueprint = ItemUtils.getSimpleStack(tempItemBlueprint); + this.inventoryHolo.setInventorySlotContents(1, newTempBlueprint); Utils.LOG_WARNING(ItemUtils.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint))); } else { @@ -182,12 +182,12 @@ public class Container_WorkbenchAdvanced extends Container { Utils.LOG_WARNING("Blueprint already holds a recipe."); } else { - Utils.LOG_WARNING("Output slot was empty."); + Utils.LOG_WARNING("Output slot was empty."); } } } else { - Utils.LOG_WARNING("ItemStack found was not a blueprint."); + Utils.LOG_WARNING("ItemStack found was not a blueprint."); } } else { @@ -195,60 +195,60 @@ public class Container_WorkbenchAdvanced extends Container { } } else if (x == 3){ - Utils.LOG_WARNING("Player Clicked Big [P] slot in the Holo Grid"); + Utils.LOG_WARNING("Player Clicked Big [P] slot in the Holo Grid"); } else if (x == 4){ - Utils.LOG_WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid"); + Utils.LOG_WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid"); } else if (x == 5){ - Utils.LOG_WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid"); + Utils.LOG_WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid"); } } } - for (int x : slotCrafting){ + for (final int x : this.slotCrafting){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); } } - for (int x : slotStorage){ + for (final int x : this.slotStorage){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid"); + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid"); } } - for (int x : slotTools){ + for (final int x : this.slotTools){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid"); + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid"); } } } - //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid"); + //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid"); return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } private void updateCraftingMatrix() { - for (int i = 0; i < craftMatrix.getSizeInventory(); i++) { - craftMatrix.setInventorySlotContents(i, tile_entity.inventoryCrafting.getStackInSlot(i)); + for (int i = 0; i < this.craftMatrix.getSizeInventory(); i++) { + this.craftMatrix.setInventorySlotContents(i, this.tile_entity.inventoryCrafting.getStackInSlot(i)); } } @Override - public void onCraftMatrixChanged(IInventory iiventory) { - tile_entity.inventoryCraftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); - } + public void onCraftMatrixChanged(final IInventory iiventory) { + this.tile_entity.inventoryCraftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); + } @Override - public void onContainerClosed(EntityPlayer par1EntityPlayer) + public void onContainerClosed(final EntityPlayer par1EntityPlayer) { super.onContainerClosed(par1EntityPlayer); - saveCraftingMatrix(); + this.saveCraftingMatrix(); } private void saveCraftingMatrix() { - for (int i = 0; i < craftMatrix.getSizeInventory(); i++) { - tile_entity.inventoryCrafting.setInventorySlotContents(i, craftMatrix.getStackInSlot(i)); + for (int i = 0; i < this.craftMatrix.getSizeInventory(); i++) { + this.tile_entity.inventoryCrafting.setInventorySlotContents(i, this.craftMatrix.getStackInSlot(i)); } - } + } @@ -273,10 +273,10 @@ public class Container_WorkbenchAdvanced extends Container { /*@Override public void onContainerClosed(EntityPlayer par1EntityPlayer) - { + { for (int o=0; o<craftMatrix.getSizeInventory(); o++){ - this.inventoryCrafting.setInventorySlotContents(o, craftMatrix.getStackInSlot(o)); - this.craftMatrix.setInventorySlotContents(o, null); + this.inventoryCrafting.setInventorySlotContents(o, craftMatrix.getStackInSlot(o)); + this.craftMatrix.setInventorySlotContents(o, null); }*/ //super.onContainerClosed(par1EntityPlayer); @@ -297,24 +297,24 @@ public class Container_WorkbenchAdvanced extends Container { }*/ @Override - public boolean canInteractWith(EntityPlayer par1EntityPlayer){ - if (worldObj.getBlock(posX, posY, posZ) != ModBlocks.blockWorkbench){ + public boolean canInteractWith(final EntityPlayer par1EntityPlayer){ + if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockWorkbench){ return false; } - return par1EntityPlayer.getDistanceSq((double)posX + 0.5D, (double)posY + 0.5D, (double)posZ + 0.5D) <= 64D; + return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; } @Override - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { ItemStack var3 = null; - Slot var4 = (Slot)this.inventorySlots.get(par2); + final Slot var4 = (Slot)this.inventorySlots.get(par2); - if (var4 != null && var4.getHasStack()) + if ((var4 != null) && var4.getHasStack()) { - ItemStack var5 = var4.getStack(); + final ItemStack var5 = var4.getStack(); var3 = var5.copy(); if (par2 == 0) @@ -326,14 +326,14 @@ public class Container_WorkbenchAdvanced extends Container { var4.onSlotChange(var5, var3); } - else if (par2 >= InOutputSlotNumber && par2 < InventoryOutSlotNumber) + else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) { if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) { return null; } } - else if (par2 >= InventoryOutSlotNumber && par2 < FullSlotNumber) + else if ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) { if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) { @@ -367,8 +367,8 @@ public class Container_WorkbenchAdvanced extends Container { //Can merge Slot @Override - public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_) { - return p_94530_2_.inventory != tile_entity.inventoryCraftResult && super.func_94530_a(p_94530_1_, p_94530_2_); + public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { + return (p_94530_2_.inventory != this.tile_entity.inventoryCraftResult) && super.func_94530_a(p_94530_1_, p_94530_2_); } diff --git a/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java b/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java index b6bbe2c0a8..8db0ba194e 100644 --- a/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java +++ b/src/Java/gtPlusPlus/core/creative/AddToCreativeTab.java @@ -19,7 +19,7 @@ public class AddToCreativeTab { tabTools = new MiscUtilCreativeTabTools("MiscUtilToolsTab"); tabMachines = new MiscUtilCreativeTabMachines("MiscUtilMachineTab"); tabOther = new MiscUtilCreativeTabOther("MiscUtilOtherTab"); - + if (CORE.DEBUG){ //tabCombat = new MiscUtilCreativeTabCombat("MiscUtilCombatTab"); } diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabBlock.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabBlock.java index 1220fb1af8..cd13e8cd6d 100644 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabBlock.java +++ b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabBlock.java @@ -6,7 +6,7 @@ import net.minecraft.item.Item; public class MiscUtilCreativeTabBlock extends CreativeTabs { - public MiscUtilCreativeTabBlock(String lable) { + public MiscUtilCreativeTabBlock(final String lable) { super(lable); } diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMachines.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMachines.java index 932f80ed7f..4df99d0f8b 100644 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMachines.java +++ b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMachines.java @@ -7,12 +7,12 @@ import net.minecraft.item.Item; public class MiscUtilCreativeTabMachines extends CreativeTabs { - public MiscUtilCreativeTabMachines(String lable) { + public MiscUtilCreativeTabMachines(final String lable) { super(lable); } @Override - public Item getTabIconItem() { + public Item getTabIconItem() { return ModItems.itemPLACEHOLDER_Circuit; } diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMisc.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMisc.java index 619803e6e1..2a819865fa 100644 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMisc.java +++ b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabMisc.java @@ -6,7 +6,7 @@ import net.minecraft.item.Item; public class MiscUtilCreativeTabMisc extends CreativeTabs { - public MiscUtilCreativeTabMisc(String lable) { + public MiscUtilCreativeTabMisc(final String lable) { super(lable); } diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabOther.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabOther.java index 6b7c55fcb8..135a1ce0c9 100644 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabOther.java +++ b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabOther.java @@ -6,7 +6,7 @@ import net.minecraft.item.Item; public class MiscUtilCreativeTabOther extends CreativeTabs { - public MiscUtilCreativeTabOther(String lable) { + public MiscUtilCreativeTabOther(final String lable) { super(lable); } diff --git a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabTools.java b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabTools.java index fe61ea6f11..738266f381 100644 --- a/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabTools.java +++ b/src/Java/gtPlusPlus/core/creative/tabs/MiscUtilCreativeTabTools.java @@ -6,7 +6,7 @@ import net.minecraft.item.Item; public class MiscUtilCreativeTabTools extends CreativeTabs { - public MiscUtilCreativeTabTools(String lable) { + public MiscUtilCreativeTabTools(final String lable) { super(lable); } diff --git a/src/Java/gtPlusPlus/core/entity/EntityTeleportFX.java b/src/Java/gtPlusPlus/core/entity/EntityTeleportFX.java index eff516c289..55ca54cbc9 100644 --- a/src/Java/gtPlusPlus/core/entity/EntityTeleportFX.java +++ b/src/Java/gtPlusPlus/core/entity/EntityTeleportFX.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.entity; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Items; @@ -7,230 +9,238 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class EntityTeleportFX extends Entity { - /** 'x' location the eye should float towards. */ - private double targetX; - /** 'y' location the eye should float towards. */ - private double targetY; - /** 'z' location the eye should float towards. */ - private double targetZ; - private int despawnTimer; - private boolean shatterOrDrop; - private static final String __OBFID = "CL_00001716"; - - public EntityTeleportFX(World p_i1757_1_) - { - super(p_i1757_1_); - this.setSize(0.25F, 0.25F); - } - - protected void entityInit() {} - - /** - * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge - * length * 64 * renderDistanceWeight Args: distance - */ - @SideOnly(Side.CLIENT) - public boolean isInRangeToRenderDist(double p_70112_1_) - { - double d1 = this.boundingBox.getAverageEdgeLength() * 4.0D; - d1 *= 64.0D; - return p_70112_1_ < d1 * d1; - } - - public EntityTeleportFX(World p_i1758_1_, double p_i1758_2_, double p_i1758_4_, double p_i1758_6_) - { - super(p_i1758_1_); - this.despawnTimer = 0; - this.setSize(0.25F, 0.25F); - this.setPosition(p_i1758_2_, p_i1758_4_, p_i1758_6_); - this.yOffset = 0.0F; - } - - /** - * The location the eye should float/move towards. Currently used for moving towards the nearest stronghold. Args: - * strongholdX, strongholdY, strongholdZ - */ - public void moveTowards(double p_70220_1_, int p_70220_3_, double p_70220_4_) - { - double d2 = p_70220_1_ - this.posX; - double d3 = p_70220_4_ - this.posZ; - float f = MathHelper.sqrt_double(d2 * d2 + d3 * d3); - - if (f > 12.0F) - { - this.targetX = this.posX + d2 / (double)f * 12.0D; - this.targetZ = this.posZ + d3 / (double)f * 12.0D; - this.targetY = this.posY + 8.0D; - } - else - { - this.targetX = p_70220_1_; - this.targetY = (double)p_70220_3_; - this.targetZ = p_70220_4_; - } - - this.despawnTimer = 0; - this.shatterOrDrop = this.rand.nextInt(5) > 0; - } - - /** - * Sets the velocity to the args. Args: x, y, z - */ - @SideOnly(Side.CLIENT) - public void setVelocity(double p_70016_1_, double p_70016_3_, double p_70016_5_) - { - this.motionX = p_70016_1_; - this.motionY = p_70016_3_; - this.motionZ = p_70016_5_; - - if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) - { - float f = MathHelper.sqrt_double(p_70016_1_ * p_70016_1_ + p_70016_5_ * p_70016_5_); - this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70016_1_, p_70016_5_) * 180.0D / Math.PI); - this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70016_3_, (double)f) * 180.0D / Math.PI); - } - } - - /** - * Called to update the entity's position/logic. - */ - public void onUpdate() - { - this.lastTickPosX = this.posX; - this.lastTickPosY = this.posY; - this.lastTickPosZ = this.posZ; - super.onUpdate(); - this.posX += this.motionX; - this.posY += this.motionY; - this.posZ += this.motionZ; - float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - - for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) - { - ; - } - - while (this.rotationPitch - this.prevRotationPitch >= 180.0F) - { - this.prevRotationPitch += 360.0F; - } - - while (this.rotationYaw - this.prevRotationYaw < -180.0F) - { - this.prevRotationYaw -= 360.0F; - } - - while (this.rotationYaw - this.prevRotationYaw >= 180.0F) - { - this.prevRotationYaw += 360.0F; - } - - this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; - this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; - - if (!this.worldObj.isRemote) - { - double d0 = this.targetX - this.posX; - double d1 = this.targetZ - this.posZ; - float f1 = (float)Math.sqrt(d0 * d0 + d1 * d1); - float f2 = (float)Math.atan2(d1, d0); - double d2 = (double)f + (double)(f1 - f) * 0.0025D; - - if (f1 < 1.0F) - { - d2 *= 0.8D; - this.motionY *= 0.8D; - } - - this.motionX = Math.cos((double)f2) * d2; - this.motionZ = Math.sin((double)f2) * d2; - - if (this.posY < this.targetY) - { - this.motionY += (1.0D - this.motionY) * 0.014999999664723873D; - } - else - { - this.motionY += (-1.0D - this.motionY) * 0.014999999664723873D; - } - } - - float f3 = 0.25F; - - if (this.isInWater()) - { - for (int i = 0; i < 4; ++i) - { - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ); - } - } - else - { - this.worldObj.spawnParticle("portal", this.posX - this.motionX * (double)f3 + this.rand.nextDouble() * 0.6D - 0.3D, this.posY - this.motionY * (double)f3 - 0.5D, this.posZ - this.motionZ * (double)f3 + this.rand.nextDouble() * 0.6D - 0.3D, this.motionX, this.motionY, this.motionZ); - } - - if (!this.worldObj.isRemote) - { - this.setPosition(this.posX, this.posY, this.posZ); - ++this.despawnTimer; - - if (this.despawnTimer > 80 && !this.worldObj.isRemote) - { - this.setDead(); - - if (this.shatterOrDrop) - { - this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Items.ender_eye))); - } - else - { - this.worldObj.playAuxSFX(2003, (int)Math.round(this.posX), (int)Math.round(this.posY), (int)Math.round(this.posZ), 0); - } - } - } - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - public void writeEntityToNBT(NBTTagCompound p_70014_1_) {} - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - public void readEntityFromNBT(NBTTagCompound p_70037_1_) {} - - @SideOnly(Side.CLIENT) - public float getShadowSize() - { - return 0.0F; - } - - /** - * Gets how bright this entity is. - */ - public float getBrightness(float p_70013_1_) - { - return 1.0F; - } - - @SideOnly(Side.CLIENT) - public int getBrightnessForRender(float p_70070_1_) - { - return 15728880; - } - - /** - * If returns false, the item will not inflict any damage against entities. - */ - public boolean canAttackWithItem() - { - return false; - } + /** 'x' location the eye should float towards. */ + private double targetX; + /** 'y' location the eye should float towards. */ + private double targetY; + /** 'z' location the eye should float towards. */ + private double targetZ; + private int despawnTimer; + private boolean shatterOrDrop; + private static final String __OBFID = "CL_00001716"; + + public EntityTeleportFX(final World p_i1757_1_) + { + super(p_i1757_1_); + this.setSize(0.25F, 0.25F); + } + + @Override + protected void entityInit() {} + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + @Override + @SideOnly(Side.CLIENT) + public boolean isInRangeToRenderDist(final double p_70112_1_) + { + double d1 = this.boundingBox.getAverageEdgeLength() * 4.0D; + d1 *= 64.0D; + return p_70112_1_ < (d1 * d1); + } + + public EntityTeleportFX(final World p_i1758_1_, final double p_i1758_2_, final double p_i1758_4_, final double p_i1758_6_) + { + super(p_i1758_1_); + this.despawnTimer = 0; + this.setSize(0.25F, 0.25F); + this.setPosition(p_i1758_2_, p_i1758_4_, p_i1758_6_); + this.yOffset = 0.0F; + } + + /** + * The location the eye should float/move towards. Currently used for moving towards the nearest stronghold. Args: + * strongholdX, strongholdY, strongholdZ + */ + public void moveTowards(final double p_70220_1_, final int p_70220_3_, final double p_70220_4_) + { + final double d2 = p_70220_1_ - this.posX; + final double d3 = p_70220_4_ - this.posZ; + final float f = MathHelper.sqrt_double((d2 * d2) + (d3 * d3)); + + if (f > 12.0F) + { + this.targetX = this.posX + ((d2 / f) * 12.0D); + this.targetZ = this.posZ + ((d3 / f) * 12.0D); + this.targetY = this.posY + 8.0D; + } + else + { + this.targetX = p_70220_1_; + this.targetY = p_70220_3_; + this.targetZ = p_70220_4_; + } + + this.despawnTimer = 0; + this.shatterOrDrop = this.rand.nextInt(5) > 0; + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + @Override + @SideOnly(Side.CLIENT) + public void setVelocity(final double p_70016_1_, final double p_70016_3_, final double p_70016_5_) + { + this.motionX = p_70016_1_; + this.motionY = p_70016_3_; + this.motionZ = p_70016_5_; + + if ((this.prevRotationPitch == 0.0F) && (this.prevRotationYaw == 0.0F)) + { + final float f = MathHelper.sqrt_double((p_70016_1_ * p_70016_1_) + (p_70016_5_ * p_70016_5_)); + this.prevRotationYaw = this.rotationYaw = (float)((Math.atan2(p_70016_1_, p_70016_5_) * 180.0D) / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)((Math.atan2(p_70016_3_, f) * 180.0D) / Math.PI); + } + } + + /** + * Called to update the entity's position/logic. + */ + @Override + public void onUpdate() + { + this.lastTickPosX = this.posX; + this.lastTickPosY = this.posY; + this.lastTickPosZ = this.posZ; + super.onUpdate(); + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + final float f = MathHelper.sqrt_double((this.motionX * this.motionX) + (this.motionZ * this.motionZ)); + this.rotationYaw = (float)((Math.atan2(this.motionX, this.motionZ) * 180.0D) / Math.PI); + + for (this.rotationPitch = (float)((Math.atan2(this.motionY, f) * 180.0D) / Math.PI); (this.rotationPitch - this.prevRotationPitch) < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while ((this.rotationPitch - this.prevRotationPitch) >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while ((this.rotationYaw - this.prevRotationYaw) < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while ((this.rotationYaw - this.prevRotationYaw) >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + ((this.rotationPitch - this.prevRotationPitch) * 0.2F); + this.rotationYaw = this.prevRotationYaw + ((this.rotationYaw - this.prevRotationYaw) * 0.2F); + + if (!this.worldObj.isRemote) + { + final double d0 = this.targetX - this.posX; + final double d1 = this.targetZ - this.posZ; + final float f1 = (float)Math.sqrt((d0 * d0) + (d1 * d1)); + final float f2 = (float)Math.atan2(d1, d0); + double d2 = f + ((f1 - f) * 0.0025D); + + if (f1 < 1.0F) + { + d2 *= 0.8D; + this.motionY *= 0.8D; + } + + this.motionX = Math.cos(f2) * d2; + this.motionZ = Math.sin(f2) * d2; + + if (this.posY < this.targetY) + { + this.motionY += (1.0D - this.motionY) * 0.014999999664723873D; + } + else + { + this.motionY += (-1.0D - this.motionY) * 0.014999999664723873D; + } + } + + final float f3 = 0.25F; + + if (this.isInWater()) + { + for (int i = 0; i < 4; ++i) + { + this.worldObj.spawnParticle("bubble", this.posX - (this.motionX * f3), this.posY - (this.motionY * f3), this.posZ - (this.motionZ * f3), this.motionX, this.motionY, this.motionZ); + } + } + else + { + this.worldObj.spawnParticle("portal", ((this.posX - (this.motionX * f3)) + (this.rand.nextDouble() * 0.6D)) - 0.3D, this.posY - (this.motionY * f3) - 0.5D, ((this.posZ - (this.motionZ * f3)) + (this.rand.nextDouble() * 0.6D)) - 0.3D, this.motionX, this.motionY, this.motionZ); + } + + if (!this.worldObj.isRemote) + { + this.setPosition(this.posX, this.posY, this.posZ); + ++this.despawnTimer; + + if ((this.despawnTimer > 80) && !this.worldObj.isRemote) + { + this.setDead(); + + if (this.shatterOrDrop) + { + this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Items.ender_eye))); + } + else + { + this.worldObj.playAuxSFX(2003, (int)Math.round(this.posX), (int)Math.round(this.posY), (int)Math.round(this.posZ), 0); + } + } + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + @Override + public void writeEntityToNBT(final NBTTagCompound p_70014_1_) {} + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + @Override + public void readEntityFromNBT(final NBTTagCompound p_70037_1_) {} + + @Override + @SideOnly(Side.CLIENT) + public float getShadowSize() + { + return 0.0F; + } + + /** + * Gets how bright this entity is. + */ + @Override + public float getBrightness(final float p_70013_1_) + { + return 1.0F; + } + + @Override + @SideOnly(Side.CLIENT) + public int getBrightnessForRender(final float p_70070_1_) + { + return 15728880; + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + @Override + public boolean canAttackWithItem() + { + return false; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/fluids/BlockFluidBase.java b/src/Java/gtPlusPlus/core/fluids/BlockFluidBase.java index 52bfa7d2d9..fb65340a09 100644 --- a/src/Java/gtPlusPlus/core/fluids/BlockFluidBase.java +++ b/src/Java/gtPlusPlus/core/fluids/BlockFluidBase.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.fluids; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; @@ -11,97 +14,98 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class BlockFluidBase extends BlockFluidClassic { - @SideOnly(Side.CLIENT) - protected IIcon stillIcon; - @SideOnly(Side.CLIENT) - protected IIcon flowingIcon; - - protected int colour; - protected Material fluidMaterial; - final String displayName; - - @SuppressWarnings("deprecation") - public BlockFluidBase(Fluid fluid, Material material) { - super(fluid, net.minecraft.block.material.Material.lava); - short[] tempColour = material.getRGBA(); - this.colour = Utils.rgbtoHexValue(tempColour[0], tempColour[1], tempColour[2]); - this.fluidMaterial = material; - setCreativeTab(AddToCreativeTab.tabOther); - this.displayName = material.getLocalizedName(); - LanguageRegistry.addName(this, "Molten "+displayName+" ["+MathUtils.celsiusToKelvin(fluidMaterial.getBoilingPointC())+"K]"); - this.setBlockName(GetProperName()); - } - - @SuppressWarnings("deprecation") - public BlockFluidBase(String fluidName, Fluid fluid, short[] colour) { - super(fluid, net.minecraft.block.material.Material.lava); - short[] tempColour = colour; - this.colour = Utils.rgbtoHexValue(tempColour[0], tempColour[1], tempColour[2]); - setCreativeTab(AddToCreativeTab.tabOther); - this.displayName = fluidName; - LanguageRegistry.addName(this, "Molten "+displayName); - this.setBlockName(GetProperName()); - } - - @Override - public IIcon getIcon(int side, int meta) { - return (side == 0 || side == 1)? stillIcon : flowingIcon; - } - - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister register) { - stillIcon = register.registerIcon(CORE.MODID+":fluids/fluid.molten.autogenerated"); - flowingIcon = register.registerIcon(CORE.MODID+":fluids/fluid.molten.autogenerated"); - } - - @Override - public boolean canDisplace(IBlockAccess world, int x, int y, int z) { - if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; - return super.canDisplace(world, x, y, z); - } - - @Override - public boolean displaceIfPossible(World world, int x, int y, int z) { - if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; - return super.displaceIfPossible(world, x, y, z); - } + @SideOnly(Side.CLIENT) + protected IIcon stillIcon; + @SideOnly(Side.CLIENT) + protected IIcon flowingIcon; + + protected int colour; + protected Material fluidMaterial; + final String displayName; + + @SuppressWarnings("deprecation") + public BlockFluidBase(final Fluid fluid, final Material material) { + super(fluid, net.minecraft.block.material.Material.lava); + final short[] tempColour = material.getRGBA(); + this.colour = Utils.rgbtoHexValue(tempColour[0], tempColour[1], tempColour[2]); + this.fluidMaterial = material; + this.setCreativeTab(AddToCreativeTab.tabOther); + this.displayName = material.getLocalizedName(); + LanguageRegistry.addName(this, "Molten "+this.displayName+" ["+MathUtils.celsiusToKelvin(this.fluidMaterial.getBoilingPointC())+"K]"); + this.setBlockName(this.GetProperName()); + } + + @SuppressWarnings("deprecation") + public BlockFluidBase(final String fluidName, final Fluid fluid, final short[] colour) { + super(fluid, net.minecraft.block.material.Material.lava); + final short[] tempColour = colour; + this.colour = Utils.rgbtoHexValue(tempColour[0], tempColour[1], tempColour[2]); + this.setCreativeTab(AddToCreativeTab.tabOther); + this.displayName = fluidName; + LanguageRegistry.addName(this, "Molten "+this.displayName); + this.setBlockName(this.GetProperName()); + } + + @Override + public IIcon getIcon(final int side, final int meta) { + return ((side == 0) || (side == 1))? this.stillIcon : this.flowingIcon; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(final IIconRegister register) { + this.stillIcon = register.registerIcon(CORE.MODID+":fluids/fluid.molten.autogenerated"); + this.flowingIcon = register.registerIcon(CORE.MODID+":fluids/fluid.molten.autogenerated"); + } + + @Override + public boolean canDisplace(final IBlockAccess world, final int x, final int y, final int z) { + if (world.getBlock(x, y, z).getMaterial().isLiquid()) { + return false; + } + return super.canDisplace(world, x, y, z); + } @Override - public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4){ - + public boolean displaceIfPossible(final World world, final int x, final int y, final int z) { + if (world.getBlock(x, y, z).getMaterial().isLiquid()) { + return false; + } + return super.displaceIfPossible(world, x, y, z); + } + + @Override + public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4){ + if (this.colour == 0){ return MathUtils.generateSingularRandomHexValue(); } - + return this.colour; } - - @Override - public int getRenderColor(int aMeta) { - if (this.colour == 0){ + + @Override + public int getRenderColor(final int aMeta) { + if (this.colour == 0){ return MathUtils.generateSingularRandomHexValue(); } - + return this.colour; - } - - public String GetProperName() { - String tempIngot; + } - tempIngot = "Molten "+displayName; + public String GetProperName() { + String tempIngot; + + tempIngot = "Molten "+this.displayName; return tempIngot; } - - public Material getFluidMaterial(){ - return fluidMaterial; - } - -} + + public Material getFluidMaterial(){ + return this.fluidMaterial; + } + +} diff --git a/src/Java/gtPlusPlus/core/fluids/FluidRegistryHandler.java b/src/Java/gtPlusPlus/core/fluids/FluidRegistryHandler.java index 477d5da944..b98e333564 100644 --- a/src/Java/gtPlusPlus/core/fluids/FluidRegistryHandler.java +++ b/src/Java/gtPlusPlus/core/fluids/FluidRegistryHandler.java @@ -2,18 +2,19 @@ package gtPlusPlus.core.fluids; import static gtPlusPlus.core.block.ModBlocks.blockFluidJackDaniels; import static gtPlusPlus.core.block.ModBlocks.fluidJackDaniels; + +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.block.general.fluids.BlockFluidJackDaniels; import gtPlusPlus.core.lib.CORE; import net.minecraft.block.material.Material; import net.minecraftforge.fluids.FluidRegistry; -import cpw.mods.fml.common.registry.GameRegistry; public class FluidRegistryHandler { - + //Fluids - /** - * - * Luminosity .setLuminosity(luminosity) + /** + * + * Luminosity .setLuminosity(luminosity) How much light does the fluid emit. Default: 0, Lava uses 15 Density .setDensity(density) How dense is the fluid, the only effect is whether or not a fluid replaces another fluid when they flow into each other. Default: 1000, the density of water at 4 degrees Celsius in kg/m³ @@ -23,30 +24,30 @@ public class FluidRegistryHandler { How thick the fluid is. Determines how fast it flows. Default: 1000 for water, lava uses 6000 Is Gaseous .setGaseous(boolean) Indicates if the fluid is gaseous. Used for rendering. Default: false - * - */ + * + */ public static void registerFluids(){ run(); } - + @SuppressWarnings("unused") private static void run(){ fluidJackDaniels(); } - + private static void fluidJackDaniels(){ //testFluid - fluidJackDaniels.setLuminosity(12); - fluidJackDaniels.setDensity(1200); - fluidJackDaniels.setTemperature(420); - fluidJackDaniels.setViscosity(750); - fluidJackDaniels.setGaseous(true); - fluidJackDaniels.setUnlocalizedName("fluidJackDaniels"); - FluidRegistry.registerFluid(fluidJackDaniels); - blockFluidJackDaniels = new BlockFluidJackDaniels(fluidJackDaniels, Material.water).setBlockName("fluidBlockJackDaniels"); - GameRegistry.registerBlock(blockFluidJackDaniels, CORE.MODID + "_" + blockFluidJackDaniels.getUnlocalizedName().substring(5)); - fluidJackDaniels.setUnlocalizedName(blockFluidJackDaniels.getUnlocalizedName()); + fluidJackDaniels.setLuminosity(12); + fluidJackDaniels.setDensity(1200); + fluidJackDaniels.setTemperature(420); + fluidJackDaniels.setViscosity(750); + fluidJackDaniels.setGaseous(true); + fluidJackDaniels.setUnlocalizedName("fluidJackDaniels"); + FluidRegistry.registerFluid(fluidJackDaniels); + blockFluidJackDaniels = new BlockFluidJackDaniels(fluidJackDaniels, Material.water).setBlockName("fluidBlockJackDaniels"); + GameRegistry.registerBlock(blockFluidJackDaniels, CORE.MODID + "_" + blockFluidJackDaniels.getUnlocalizedName().substring(5)); + fluidJackDaniels.setUnlocalizedName(blockFluidJackDaniels.getUnlocalizedName()); } - + } diff --git a/src/Java/gtPlusPlus/core/fluids/GenericFluid.java b/src/Java/gtPlusPlus/core/fluids/GenericFluid.java index 38af8774eb..e6894b6d35 100644 --- a/src/Java/gtPlusPlus/core/fluids/GenericFluid.java +++ b/src/Java/gtPlusPlus/core/fluids/GenericFluid.java @@ -1,11 +1,11 @@ package gtPlusPlus.core.fluids; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.item.base.itemblock.ItemBlockFluid; import gtPlusPlus.core.material.Material; import net.minecraft.block.Block; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; -import cpw.mods.fml.common.registry.GameRegistry; public class GenericFluid extends Fluid{ @@ -13,56 +13,56 @@ public class GenericFluid extends Fluid{ protected final Fluid fluidFactory; protected final Block blockFactory; protected final short[] rgba; - - public GenericFluid(String displayName, String fluidName, int luminosity, int density, int temperature, int viscosity, boolean isGas, short[] rgba) { + + public GenericFluid(final String displayName, final String fluidName, final int luminosity, final int density, final int temperature, final int viscosity, final boolean isGas, final short[] rgba) { super(fluidName); - fluidFactory = this; + this.fluidFactory = this; this.rgba = rgba; this.fluidName = fluidName; - fluidFactory.setLuminosity(luminosity); - fluidFactory.setDensity(density); - fluidFactory.setTemperature(temperature); - fluidFactory.setViscosity(viscosity); - fluidFactory.setGaseous(isGas); - fluidFactory.setUnlocalizedName("fluid"+fluidName); - FluidRegistry.registerFluid(fluidFactory); - blockFactory = new BlockFluidBase(displayName, fluidFactory, rgba).setBlockName("fluidblock"+fluidName); - GameRegistry.registerBlock(blockFactory, ItemBlockFluid.class, blockFactory.getUnlocalizedName().substring(5)); - fluidFactory.setBlock(blockFactory); - + this.fluidFactory.setLuminosity(luminosity); + this.fluidFactory.setDensity(density); + this.fluidFactory.setTemperature(temperature); + this.fluidFactory.setViscosity(viscosity); + this.fluidFactory.setGaseous(isGas); + this.fluidFactory.setUnlocalizedName("fluid"+fluidName); + FluidRegistry.registerFluid(this.fluidFactory); + this.blockFactory = new BlockFluidBase(displayName, this.fluidFactory, rgba).setBlockName("fluidblock"+fluidName); + GameRegistry.registerBlock(this.blockFactory, ItemBlockFluid.class, this.blockFactory.getUnlocalizedName().substring(5)); + this.fluidFactory.setBlock(this.blockFactory); + //fluidFactory.setUnlocalizedName(blockFactory.getUnlocalizedName()); - + } - - public GenericFluid(Material fluidMaterial, int luminosity, int density, int temperature, int viscosity, boolean isGas) { - + + public GenericFluid(final Material fluidMaterial, final int luminosity, final int density, final int temperature, final int viscosity, final boolean isGas) { + super(fluidMaterial.getUnlocalizedName()); //IC2_ItemFluidCell fullFluidCell = emptyCell.fill(emptyCell, FluidUtils.getFluidStack(getUnlocalizedName(), 1), true); - - fluidFactory = this; + + this.fluidFactory = this; this.rgba = fluidMaterial.getRGBA(); this.fluidName = fluidMaterial.getUnlocalizedName(); - fluidFactory.setLuminosity(luminosity); - fluidFactory.setDensity(density); - fluidFactory.setTemperature(temperature); - fluidFactory.setViscosity(viscosity); - fluidFactory.setGaseous(isGas); - fluidFactory.setUnlocalizedName("fluid"+fluidName); - FluidRegistry.registerFluid(fluidFactory); - blockFactory = new BlockFluidBase(fluidFactory, fluidMaterial).setBlockName("fluidblock"+fluidName); - GameRegistry.registerBlock(blockFactory, ItemBlockFluid.class, blockFactory.getUnlocalizedName().substring(5)); - fluidFactory.setBlock(blockFactory); + this.fluidFactory.setLuminosity(luminosity); + this.fluidFactory.setDensity(density); + this.fluidFactory.setTemperature(temperature); + this.fluidFactory.setViscosity(viscosity); + this.fluidFactory.setGaseous(isGas); + this.fluidFactory.setUnlocalizedName("fluid"+this.fluidName); + FluidRegistry.registerFluid(this.fluidFactory); + this.blockFactory = new BlockFluidBase(this.fluidFactory, fluidMaterial).setBlockName("fluidblock"+this.fluidName); + GameRegistry.registerBlock(this.blockFactory, ItemBlockFluid.class, this.blockFactory.getUnlocalizedName().substring(5)); + this.fluidFactory.setBlock(this.blockFactory); //IC2_ItemFluidCell emptyCell = new IC2_ItemFluidCell(fluidName); /*if (aFullContainer != null && aEmptyContainer != null && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { GT_Values.RA.addFluidCannerRecipe(aFullContainer, container(aFullContainer, false), null, new FluidStack(rFluid, aFluidAmount)); }*/ //fluidFactory.setUnlocalizedName(blockFactory.getUnlocalizedName()); - + } - + @Override public int getColor() { - return Math.max(0, Math.min(255, this.rgba[0])) << 16 | Math.max(0, Math.min(255, this.rgba[1])) << 8 | Math.max(0, Math.min(255, this.rgba[2])); - } + return (Math.max(0, Math.min(255, this.rgba[0])) << 16) | (Math.max(0, Math.min(255, this.rgba[1])) << 8) | Math.max(0, Math.min(255, this.rgba[2])); + } } diff --git a/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java b/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java index af3c8a226e..cf1811781a 100644 --- a/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java +++ b/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java @@ -1,9 +1,9 @@ package gtPlusPlus.core.gui.beta; -import gtPlusPlus.core.interfaces.IGuiManagerMiscUtils; - import java.util.*; +import gtPlusPlus.core.interfaces.IGuiManagerMiscUtils; + public class Gui_ID_Registry { private static final Map<Class<? extends IGuiManagerMiscUtils>, MU_GuiId> classMap = new HashMap(); @@ -17,25 +17,25 @@ public class Gui_ID_Registry //registerGuiHandlers(MU_GuiType.Entity, Arrays.asList(new Class[] { EntityMinecartApiary.class, EntityMinecartBeehouse.class })); } - private static void registerGuiHandlers(Gui_Types MU_GuiType, List<Class<? extends IGuiManagerMiscUtils>> guiHandlerClasses) + private static void registerGuiHandlers(final Gui_Types MU_GuiType, final List<Class<? extends IGuiManagerMiscUtils>> guiHandlerClasses) { - for (Class<? extends IGuiManagerMiscUtils> tileGuiHandlerClass : guiHandlerClasses) + for (final Class<? extends IGuiManagerMiscUtils> tileGuiHandlerClass : guiHandlerClasses) { - MU_GuiId guiId = new MU_GuiId(nextId++, MU_GuiType, tileGuiHandlerClass); + final MU_GuiId guiId = new MU_GuiId(nextId++, MU_GuiType, tileGuiHandlerClass); classMap.put(tileGuiHandlerClass, guiId); idMap.put(Integer.valueOf(guiId.getId()), guiId); } } - public static MU_GuiId getGuiIdForGuiHandler(IGuiManagerMiscUtils guiHandler) + public static MU_GuiId getGuiIdForGuiHandler(final IGuiManagerMiscUtils guiHandler) { - Class<? extends IGuiManagerMiscUtils> guiHandlerClass = guiHandler.getClass(); - MU_GuiId guiId = (MU_GuiId)classMap.get(guiHandlerClass); + final Class<? extends IGuiManagerMiscUtils> guiHandlerClass = guiHandler.getClass(); + MU_GuiId guiId = classMap.get(guiHandlerClass); if (guiId == null) { - for (Map.Entry<Class<? extends IGuiManagerMiscUtils>, MU_GuiId> classGuiIdEntry : classMap.entrySet()) { + for (final Map.Entry<Class<? extends IGuiManagerMiscUtils>, MU_GuiId> classGuiIdEntry : classMap.entrySet()) { if (((Class)classGuiIdEntry.getKey()).isAssignableFrom(guiHandlerClass)) { - guiId = (MU_GuiId)classGuiIdEntry.getValue(); + guiId = classGuiIdEntry.getValue(); break; } } @@ -46,9 +46,9 @@ public class Gui_ID_Registry return guiId; } - public static MU_GuiId getGuiId(int id) + public static MU_GuiId getGuiId(final int id) { - return (MU_GuiId)idMap.get(Integer.valueOf(id)); + return idMap.get(Integer.valueOf(id)); } } diff --git a/src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java b/src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java index 428cae93d5..9348f40c9c 100644 --- a/src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java +++ b/src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java @@ -1,8 +1,8 @@ package gtPlusPlus.core.gui.beta; public enum Gui_Types - { - Item, Tile, Entity; - - private Gui_Types() {} - }
\ No newline at end of file +{ + Item, Tile, Entity; + + private Gui_Types() {} +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java b/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java index 7d17870743..116ad48480 100644 --- a/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java +++ b/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java @@ -2,31 +2,31 @@ package gtPlusPlus.core.gui.beta; import gtPlusPlus.core.interfaces.IGuiManagerMiscUtils; public class MU_GuiId - { - private final int id; - private final Gui_Types MU_GuiType; - private final Class<? extends IGuiManagerMiscUtils> guiHandlerClass; - - MU_GuiId(int id, Gui_Types MU_GuiType, Class<? extends IGuiManagerMiscUtils> guiHandlerClass) - { - this.id = id; - this.MU_GuiType = MU_GuiType; - this.guiHandlerClass = guiHandlerClass; - } - - public Gui_Types getGuiType() - { - return this.MU_GuiType; - } - - public Class<? extends IGuiManagerMiscUtils> getGuiHandlerClass() - { - return this.guiHandlerClass; - } - - public int getId() - { - return this.id; - } - } +{ + private final int id; + private final Gui_Types MU_GuiType; + private final Class<? extends IGuiManagerMiscUtils> guiHandlerClass; + + MU_GuiId(final int id, final Gui_Types MU_GuiType, final Class<? extends IGuiManagerMiscUtils> guiHandlerClass) + { + this.id = id; + this.MU_GuiType = MU_GuiType; + this.guiHandlerClass = guiHandlerClass; + } + + public Gui_Types getGuiType() + { + return this.MU_GuiType; + } + + public Class<? extends IGuiManagerMiscUtils> getGuiHandlerClass() + { + return this.guiHandlerClass; + } + + public int getId() + { + return this.id; + } +} diff --git a/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java b/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java index cd7b141bd4..fb42cd7cf5 100644 --- a/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java +++ b/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.gui.item; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + import gtPlusPlus.core.container.Container_BackpackBase; import gtPlusPlus.core.inventories.BaseInventoryBackpack; import gtPlusPlus.core.lib.CORE; @@ -11,22 +14,19 @@ import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - public class GuiBaseBackpack extends GuiContainer { /** x and y size of the inventory window in pixels. Defined as float, passed as int * These are used for drawing the player model. */ private float xSize_lo; private float ySize_lo; - - /** The FontRenderer used by GuiScreen */ - protected FontRenderer fontRenderer; + + /** The FontRenderer used by GuiScreen */ + protected FontRenderer fontRenderer; /** ResourceLocation takes 2 parameters: ModId, path to texture at the location: * "src/minecraft/assets/modid/" - * + * * I have provided a sample texture file that works with this tutorial. Download it * from Forge_Tutorials/textures/gui/ */ @@ -35,7 +35,7 @@ public class GuiBaseBackpack extends GuiContainer /** The inventory to render on screen */ private final BaseInventoryBackpack inventory; - public GuiBaseBackpack(Container_BackpackBase containerItem) + public GuiBaseBackpack(final Container_BackpackBase containerItem) { super(containerItem); this.inventory = containerItem.inventory; @@ -45,20 +45,20 @@ public class GuiBaseBackpack extends GuiContainer * Draws the screen and all the components in it. */ @Override - public void drawScreen(int par1, int par2, float par3) + public void drawScreen(final int par1, final int par2, final float par3) { super.drawScreen(par1, par2, par3); - this.xSize_lo = (float)par1; - this.ySize_lo = (float)par2; + this.xSize_lo = par1; + this.ySize_lo = par2; } /** * Draw the foreground layer for the GuiContainer (everything in front of the items) */ @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - String s = this.inventory.hasCustomInventoryName() ? this.inventory.getInventoryName() : this.inventory.getInventoryName(); + final String s = this.inventory.hasCustomInventoryName() ? this.inventory.getInventoryName() : this.inventory.getInventoryName(); //this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 0, 4210752); //this.fontRenderer.drawString(I18n.translate("container.inventory"), 26, this.ySize - 96 + 4, 4210752); } @@ -67,32 +67,32 @@ public class GuiBaseBackpack extends GuiContainer * Draw the background layer for the GuiContainer (everything behind the items) */ @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(iconLocation); - int k = (this.width - this.xSize) / 2; - int l = (this.height - this.ySize) / 2; + final int k = (this.width - this.xSize) / 2; + final int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - int i1; - drawPlayerModel(k + 51, l + 75, 30, (float)(k + 51) - this.xSize_lo, (float)(l + 75 - 50) - this.ySize_lo, this.mc.thePlayer); + final int i1; + drawPlayerModel(k + 51, l + 75, 30, k + 51 - this.xSize_lo, (l + 75) - 50 - this.ySize_lo, this.mc.thePlayer); } /** * This renders the player model in standard inventory position (in later versions of Minecraft / Forge, you can * simply call GuiInventory.drawEntityOnScreen directly instead of copying this code) */ - public static void drawPlayerModel(int x, int y, int scale, float yaw, float pitch, EntityLivingBase entity) { + public static void drawPlayerModel(final int x, final int y, final int scale, final float yaw, final float pitch, final EntityLivingBase entity) { GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glPushMatrix(); GL11.glTranslatef(x, y, 50.0F); GL11.glScalef(-scale, scale, scale); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - float f2 = entity.renderYawOffset; - float f3 = entity.rotationYaw; - float f4 = entity.rotationPitch; - float f5 = entity.prevRotationYawHead; - float f6 = entity.rotationYawHead; + final float f2 = entity.renderYawOffset; + final float f3 = entity.rotationYaw; + final float f4 = entity.rotationPitch; + final float f5 = entity.prevRotationYawHead; + final float f6 = entity.rotationYawHead; GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_FishTrap.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_FishTrap.java index 81a37d2751..ed2fc204f0 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_FishTrap.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_FishTrap.java @@ -1,5 +1,9 @@ package gtPlusPlus.core.gui.machine; +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.container.Container_FishTrap; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; @@ -7,23 +11,18 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) public class GUI_FishTrap extends GuiContainer { private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/FishTrap.png"); - public GUI_FishTrap(InventoryPlayer player_inventory, TileEntityFishTrap te){ + public GUI_FishTrap(final InventoryPlayer player_inventory, final TileEntityFishTrap te){ super(new Container_FishTrap(player_inventory, te)); } @Override - protected void drawGuiContainerForegroundLayer(int i, int j){ + protected void drawGuiContainerForegroundLayer(final int i, final int j){ //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752); //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); @@ -31,12 +30,12 @@ public class GUI_FishTrap extends GuiContainer { @Override - protected void drawGuiContainerBackgroundLayer(float f, int i, int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.mc.renderEngine.bindTexture(craftingTableGuiTextures); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); } diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java index 86388a2632..54ff675411 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java @@ -1,5 +1,9 @@ package gtPlusPlus.core.gui.machine; +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.container.Container_Workbench; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; @@ -8,26 +12,21 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) public class GUI_Workbench extends GuiContainer { private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/BronzeCraftingTable.png"); - + public boolean moveItemsToChest = false; public boolean moveItemsToCrafting = false; - public GUI_Workbench(InventoryPlayer player_inventory, TileEntityWorkbench tile){ + public GUI_Workbench(final InventoryPlayer player_inventory, final TileEntityWorkbench tile){ super(new Container_Workbench(player_inventory, tile)); } @Override - protected void drawGuiContainerForegroundLayer(int i, int j){ + protected void drawGuiContainerForegroundLayer(final int i, final int j){ //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752); //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); @@ -35,12 +34,12 @@ public class GUI_Workbench extends GuiContainer { @Override - protected void drawGuiContainerBackgroundLayer(float f, int i, int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.mc.renderEngine.bindTexture(craftingTableGuiTextures); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); } @@ -60,7 +59,7 @@ public class GUI_Workbench extends GuiContainer { } @Override - protected void actionPerformed(GuiButton B) + protected void actionPerformed(final GuiButton B) { //If the button id is different, or you have mrs buttons, create another if block for that too! if(B.id == 1){ diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java index 5c04acf13b..eec2fa4b35 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java @@ -1,5 +1,9 @@ package gtPlusPlus.core.gui.machine; +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.container.Container_WorkbenchAdvanced; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; @@ -7,35 +11,30 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) public class GUI_WorkbenchAdvanced extends GuiContainer { private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/AdvancedCraftingTable.png"); - public GUI_WorkbenchAdvanced(InventoryPlayer player_inventory, TileEntityWorkbenchAdvanced tile){ + public GUI_WorkbenchAdvanced(final InventoryPlayer player_inventory, final TileEntityWorkbenchAdvanced tile){ super(new Container_WorkbenchAdvanced(player_inventory, tile)); } @Override - protected void drawGuiContainerForegroundLayer(int i, int j){ + protected void drawGuiContainerForegroundLayer(final int i, final int j){ //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752); //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); } @Override - protected void drawGuiContainerBackgroundLayer(float f, int i, int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.mc.renderEngine.bindTexture(craftingTableGuiTextures); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index 1d0c9be34d..bcf8d73f86 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -1,6 +1,10 @@ package gtPlusPlus.core.handler; import static gtPlusPlus.core.lib.LoadedMods.Gregtech; + +import java.util.LinkedList; +import java.util.Queue; + import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.common.compat.*; import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler; @@ -13,19 +17,15 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.gregtech.registration.gregtech.*; - -import java.util.LinkedList; -import java.util.Queue; - import net.minecraft.item.ItemStack; public class COMPAT_HANDLER { - - public static Queue<Object> RemoveRecipeQueue = new LinkedList<Object>(); - public static Queue<ShapedRecipeObject> AddRecipeQueue = new LinkedList<ShapedRecipeObject>(); + + public static Queue<Object> RemoveRecipeQueue = new LinkedList<>(); + public static Queue<ShapedRecipeObject> AddRecipeQueue = new LinkedList<>(); public static Boolean areInitItemsLoaded = false; - - + + public static void registerMyModsOreDictEntries(){ Utils.LOG_INFO("Registering Materials with OreDict."); @@ -38,42 +38,42 @@ public class COMPAT_HANDLER { GT_OreDictUnificator.registerOre("bufferCore_"+CORE.VOLTAGES[i-1], new ItemStack(ItemUtils.getItem("miscutils:item.itemBufferCore"+i))); } } - + public static void registerGregtechMachines() { if (Gregtech) { - new RECIPES_LaserEngraver(); - GregtechEnergyBuffer.run(); - GregtechLFTR.run(); - GregtechSteamCondenser.run(); - GregtechSafeBlock.run(); - GregtechSuperConductionPoint.run(); - GregtechIronBlastFurnace.run(); - GregtechIndustrialCentrifuge.run(); - GregtechIndustrialCokeOven.run(); - GregtechIndustrialPlatePress.run(); - GregtechRocketFuelGenerator.run(); - GregtechIndustrialElectrolyzer.run(); - GregtechIndustrialMacerator.run(); - GregtechIndustrialWiremill.run(); - GregtechIndustrialMassFabricator.run(); - GregtechIndustrialBlastSmelter.run(); - GregtechSolarGenerators.run(); - GregtechPowerSubStation.run(); - GregtechDehydrator.run(); - GregtechTieredFluidTanks.run(); - GregtechIndustrialMultiTank.run(); - GregtechGeothermalThermalGenerator.run(); - Gregtech4Content.run(); - GregtechIndustrialFuelRefinery.run(); - GregtechTreeFarmerTE.run(); - GregtechIndustrialTreeFarm.run(); + new RECIPES_LaserEngraver(); + GregtechEnergyBuffer.run(); + GregtechLFTR.run(); + GregtechSteamCondenser.run(); + GregtechSafeBlock.run(); + GregtechSuperConductionPoint.run(); + GregtechIronBlastFurnace.run(); + GregtechIndustrialCentrifuge.run(); + GregtechIndustrialCokeOven.run(); + GregtechIndustrialPlatePress.run(); + GregtechRocketFuelGenerator.run(); + GregtechIndustrialElectrolyzer.run(); + GregtechIndustrialMacerator.run(); + GregtechIndustrialWiremill.run(); + GregtechIndustrialMassFabricator.run(); + GregtechIndustrialBlastSmelter.run(); + GregtechSolarGenerators.run(); + GregtechPowerSubStation.run(); + GregtechDehydrator.run(); + GregtechTieredFluidTanks.run(); + GregtechIndustrialMultiTank.run(); + GregtechGeothermalThermalGenerator.run(); + Gregtech4Content.run(); + GregtechIndustrialFuelRefinery.run(); + GregtechTreeFarmerTE.run(); + GregtechIndustrialTreeFarm.run(); } } - + //InterMod public static void intermodOreDictionarySupport(){ - + if (LoadedMods.Big_Reactors){ COMPAT_BigReactors.OreDict(); } @@ -103,23 +103,23 @@ public class COMPAT_HANDLER { } if (LoadedMods.IndustrialCraft2){ COMPAT_IC2.OreDict(); - } + } } - + public static void RemoveRecipesFromOtherMods(){ //Removal of Recipes - for(Object item : RemoveRecipeQueue){ + for(final Object item : RemoveRecipeQueue){ RecipeUtils.removeCraftingRecipe(item); - } + } } - + public static void InitialiseHandlerThenAddRecipes(){ RegistrationHandler.run(); } public static void InitialiseLateHandlerThenAddRecipes(){ LateRegistrationHandler.run(); } - + public static void startLoadingGregAPIBasedRecipes(){ RECIPES_GREGTECH.run(); } diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java index b30487c070..bf43c464e3 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java @@ -11,12 +11,12 @@ public class COMPAT_IntermodStaging { public static void preInit(){ HANDLER_GT.preInit(); - HANDLER_GC.preInit(); + HANDLER_GC.preInit(); HANDLER_TF.preInit(); HANDLER_FR.preInit(); HANDLER_IC2.preInit(); HANDLER_Computronics.preInit(); - + } public static void init(){ diff --git a/src/Java/gtPlusPlus/core/handler/CraftingManager.java b/src/Java/gtPlusPlus/core/handler/CraftingManager.java index bd0f114b1a..6fb580cc32 100644 --- a/src/Java/gtPlusPlus/core/handler/CraftingManager.java +++ b/src/Java/gtPlusPlus/core/handler/CraftingManager.java @@ -8,10 +8,10 @@ public class CraftingManager { } public static void addCraftingRecipies() { - + } public static void addSmeltingRecipies() { - + } } diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java index 5f2416413b..998547d17d 100644 --- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java +++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.handler; +import cpw.mods.fml.common.network.IGuiHandler; +import cpw.mods.fml.common.network.NetworkRegistry; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.container.*; import gtPlusPlus.core.gui.beta.Gui_ID_Registry; @@ -20,8 +22,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; -import cpw.mods.fml.common.network.IGuiHandler; -import cpw.mods.fml.common.network.NetworkRegistry; public class GuiHandler implements IGuiHandler { @@ -36,18 +36,18 @@ public class GuiHandler implements IGuiHandler { - public static void init(){ + public static void init(){ - Utils.LOG_INFO("Registering GUIs."); - NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new GuiHandler()); - //Register GuiHandler - //NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new GuiHandler()); + Utils.LOG_INFO("Registering GUIs."); + NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new GuiHandler()); + //Register GuiHandler + //NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new GuiHandler()); } @Override //ContainerModTileEntity - public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - TileEntity te = world.getTileEntity(x, y, z); + public Object getServerGuiElement(final int ID, final EntityPlayer player, final World world, final int x, final int y, final int z) { + final TileEntity te = world.getTileEntity(x, y, z); if (te != null){ if (ID == GUI1){ @@ -94,9 +94,9 @@ public class GuiHandler implements IGuiHandler { } @Override //GuiModTileEntity - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + public Object getClientGuiElement(final int ID, final EntityPlayer player, final World world, final int x, final int y, final int z) { Utils.LOG_WARNING("getClientGuiElement Called by: "+player+", in world: "+player.dimension+" at x:"+x+", y:"+y+", z:"+z+"."); - TileEntity te = world.getTileEntity(x, y, z); + final TileEntity te = world.getTileEntity(x, y, z); if (te != null){ if (ID == GUI1){ if (CORE.configSwitches.enableCustomAlvearyBlocks){ @@ -114,7 +114,7 @@ public class GuiHandler implements IGuiHandler { { // We have to cast the new container as our custom class // and pass in currently held item for the inventory - return new GuiBaseBackpack((Container_BackpackBase) new Container_BackpackBase(player, player.inventory, new BaseInventoryBackpack(player.getHeldItem()))); + return new GuiBaseBackpack(new Container_BackpackBase(player, player.inventory, new BaseInventoryBackpack(player.getHeldItem()))); } if (te != null){ @@ -136,31 +136,31 @@ public class GuiHandler implements IGuiHandler { //New Methods - public static void openGui(EntityPlayer entityplayer, IGuiManager guiHandler) + public static void openGui(final EntityPlayer entityplayer, final IGuiManager guiHandler) { openGui(entityplayer, guiHandler, (short)0); } - public static void openGui(EntityPlayer entityplayer, IGuiManager guiHandler, short data) + public static void openGui(final EntityPlayer entityplayer, final IGuiManager guiHandler, final short data) { - int guiData = encodeGuiData(guiHandler, data); - ChunkCoordinates coordinates = guiHandler.getCoordinates(); + final int guiData = encodeGuiData(guiHandler, data); + final ChunkCoordinates coordinates = guiHandler.getCoordinates(); entityplayer.openGui(GTplusplus.instance, guiData, entityplayer.worldObj, coordinates.posX, coordinates.posY, coordinates.posZ); } - private static int encodeGuiData(IGuiManager guiHandler, short data) + private static int encodeGuiData(final IGuiManager guiHandler, final short data) { - MU_GuiId guiId = Gui_ID_Registry.getGuiIdForGuiHandler(guiHandler); - return data << 16 | guiId.getId(); + final MU_GuiId guiId = Gui_ID_Registry.getGuiIdForGuiHandler(guiHandler); + return (data << 16) | guiId.getId(); } - private static MU_GuiId decodeGuiID(int guiData) + private static MU_GuiId decodeGuiID(final int guiData) { - int guiId = guiData & 0xFF; + final int guiId = guiData & 0xFF; return Gui_ID_Registry.getGuiId(guiId); } - private static short decodeGuiData(int guiId) + private static short decodeGuiData(final int guiId) { return (short)(guiId >> 16); } diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java b/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java index 7d739bdca3..a24b08d781 100644 --- a/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java +++ b/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java @@ -8,21 +8,21 @@ public class LateRegistrationHandler { public static int recipesSuccess = 0; public static int recipesFailed = 0; - + public static void run(){ - init(); + init(); } - + private final static void init(){ - for(ShapedRecipeObject item : COMPAT_HANDLER.AddRecipeQueue){ - item.buildRecipe(); - } + for(final ShapedRecipeObject item : COMPAT_HANDLER.AddRecipeQueue){ + item.buildRecipe(); + } try { Thread.sleep(10); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { Utils.LOG_INFO(e.toString()); } Utils.LOG_INFO("Late Recipes Loaded: "+recipesSuccess+" Failed: "+recipesFailed); } - + } diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java b/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java index 30e15668d9..e887607827 100644 --- a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java +++ b/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java @@ -8,11 +8,11 @@ public class RegistrationHandler { public static int recipesSuccess = 0; public static int recipesFailed = 0; - + public static void run(){ - init(); + init(); } - + private final static void init(){ RECIPES_Tools.RECIPES_LOAD(); RECIPES_Machines.RECIPES_LOAD(); @@ -20,10 +20,10 @@ public class RegistrationHandler { RECIPES_MachineComponents.RECIPES_LOAD(); RECIPE_Batteries.RECIPES_LOAD(); RECIPES_General.RECIPES_LOAD(); - //RECIPES_MTWRAPPER.run(); + //RECIPES_MTWRAPPER.run(); Utils.LOG_INFO("Loaded: "+recipesSuccess+" Failed: "+recipesFailed); COMPAT_HANDLER.areInitItemsLoaded = true; //Utils.LOG_INFO("MT Loaded: "+RECIPES_MTWRAPPER.MT_RECIPES_LOADED+" MT Failed: "+RECIPES_MTWRAPPER.MT_RECIPES_FAILED); } - + } diff --git a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java index ee334845cb..25ec4d98c7 100644 --- a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java @@ -2,16 +2,17 @@ package gtPlusPlus.core.handler.events; import static gtPlusPlus.core.lib.CORE.configSwitches.chanceToDropDrainedShard; import static gtPlusPlus.core.lib.CORE.configSwitches.chanceToDropFluoriteOre; + +import java.util.ArrayList; +import java.util.Random; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; - -import java.util.ArrayList; -import java.util.Random; - import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -19,13 +20,12 @@ import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.oredict.OreDictionary; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class BlockEventHandler { - private Random random = new Random(); + private final Random random = new Random(); @SubscribeEvent - public void onBlockLeftClicked(PlayerInteractEvent event) { + public void onBlockLeftClicked(final PlayerInteractEvent event) { /*if (event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) return; ItemStack heldItem = event.entityPlayer.getHeldItem(); @@ -44,7 +44,7 @@ public class BlockEventHandler { } @SubscribeEvent - public void onEntityDrop(LivingDropsEvent event) { + public void onEntityDrop(final LivingDropsEvent event) { /*if (event.entityLiving instanceof EntityPig && event.source instanceof EntityDamageSource) { // getEntity will return the Entity that caused the damage,even for indirect damage sources like arrows/fireballs // (where it will return the Entity that shot the projectile rather than the projectile itself) @@ -63,7 +63,7 @@ public class BlockEventHandler { @SubscribeEvent - public void onBlockBreak(BlockEvent.BreakEvent event) { + public void onBlockBreak(final BlockEvent.BreakEvent event) { } @@ -74,34 +74,34 @@ public class BlockEventHandler { //Used to handle Thaumcraft Shards when TC is not installed. @SubscribeEvent - public void harvestDrops(BlockEvent.HarvestDropsEvent event) { + public void harvestDrops(final BlockEvent.HarvestDropsEvent event) { //Spawn Dull Shards (Can spawn from Tree Logs, Grass or Stone. Stone going to be the most common source.) - if ((event.block == Blocks.stone || event.block == Blocks.sandstone || event.block == Blocks.log || event.block == Blocks.log2 || event.block == Blocks.grass) - && !LoadedMods.Thaumcraft && chanceToDropDrainedShard != 0) { + if (((event.block == Blocks.stone) || (event.block == Blocks.sandstone) || (event.block == Blocks.log) || (event.block == Blocks.log2) || (event.block == Blocks.grass)) + && !LoadedMods.Thaumcraft && (chanceToDropDrainedShard != 0)) { //small chance for one to spawn per stone mined. 1 per 3 stacks~ //TODO MAKE A CONFIG OPTION if (MathUtils.randInt(1, chanceToDropDrainedShard) == 1){ //Let's sort out a lucky charm for the player. - int FancyChance = MathUtils.randInt(1, 4); + final int FancyChance = MathUtils.randInt(1, 4); if (MathUtils.randInt(1, 100) < 90){ - event.drops.add(new ItemStack(ModItems.shardDull)); + event.drops.add(new ItemStack(ModItems.shardDull)); } //Make a Fire Shard else if (FancyChance == 1){ - event.drops.add(new ItemStack(ModItems.shardIgnis)); + event.drops.add(new ItemStack(ModItems.shardIgnis)); } //Make a Water Shard. else if (FancyChance == 2){ - event.drops.add(new ItemStack(ModItems.shardAqua)); + event.drops.add(new ItemStack(ModItems.shardAqua)); } //Make an Earth Shard. else if (FancyChance == 3){ - event.drops.add(new ItemStack(ModItems.shardTerra)); + event.drops.add(new ItemStack(ModItems.shardTerra)); } //Make an Air Shard. else if (FancyChance == 4){ - event.drops.add(new ItemStack(ModItems.shardAer)); - } - } + event.drops.add(new ItemStack(ModItems.shardAer)); + } + } else { Utils.LOG_WARNING("invalid chance"); } @@ -109,34 +109,36 @@ public class BlockEventHandler { //Spawns Fluorite from Lime Stone if (chanceToDropFluoriteOre != 0){ - if (!oreLimestone.isEmpty() || !blockLimestone.isEmpty()){ - if (!oreLimestone.isEmpty()) - for (ItemStack temp : oreLimestone){ + if (!this.oreLimestone.isEmpty() || !this.blockLimestone.isEmpty()){ + if (!this.oreLimestone.isEmpty()) { + for (final ItemStack temp : this.oreLimestone){ if (ItemUtils.getSimpleStack(Item.getItemFromBlock(event.block)) == temp) { if (MathUtils.randInt(1, chanceToDropFluoriteOre) == 1){ - event.drops.add(fluoriteOre.copy()); + event.drops.add(this.fluoriteOre.copy()); } } } - if (!blockLimestone.isEmpty()) - for (ItemStack temp : blockLimestone){ + } + if (!this.blockLimestone.isEmpty()) { + for (final ItemStack temp : this.blockLimestone){ if (ItemUtils.getSimpleStack(Item.getItemFromBlock(event.block)) == temp) { if (MathUtils.randInt(1, chanceToDropFluoriteOre) == 1){ - event.drops.add(fluoriteOre.copy()); + event.drops.add(this.fluoriteOre.copy()); } } } + } } if (event.block == Blocks.sandstone){ if (MathUtils.randInt(1, chanceToDropFluoriteOre*20) == 1){ - event.drops.add(fluoriteOre.copy()); + event.drops.add(this.fluoriteOre.copy()); } } } } @SubscribeEvent - public void logsHarvest(BlockEvent.HarvestDropsEvent event) { + public void logsHarvest(final BlockEvent.HarvestDropsEvent event) { /*if (event.block instanceof BlockLog) { // http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2444501-harvestdropevent-changing-drops-of-vanilla-blocks diff --git a/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java b/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java index 025d5fc8af..f1587fa82a 100644 --- a/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java @@ -10,7 +10,7 @@ import net.minecraft.util.MovementInputFromOptions; */ public class CustomMovementHandler { - + public boolean isDisabled; public boolean canDoubleTap; @@ -22,17 +22,17 @@ public class CustomMovementHandler { private long lastSprintPressed; private boolean handledSneakPress; private boolean handledSprintPress; - private boolean wasRiding; + private boolean wasRiding; /* * MovementInputFromOptions.updatePlayerMoveState() */ - public void update(Minecraft mc, MovementInputFromOptions options, EntityPlayerSP thisPlayer) + public void update(final Minecraft mc, final MovementInputFromOptions options, final EntityPlayerSP thisPlayer) { options.moveStrafe = 0.0F; options.moveForward = 0.0F; - GameSettings settings = mc.gameSettings; + final GameSettings settings = mc.gameSettings; if(settings.keyBindForward.getIsKeyPressed()) { @@ -61,7 +61,7 @@ public class CustomMovementHandler { // // Check to see if Enabled - Added 6/17/14 to provide option to disable Sneak Toggle - boolean isSneaking = SneakManager.Sneaking(); + final boolean isSneaking = SneakManager.Sneaking(); //Utils.LOG_INFO("Can sneak: "+isSneaking); //Utils.LOG_INFO("Can sprint: "+SneakManager.Sprinting()); if (isSneaking) @@ -94,7 +94,7 @@ public class CustomMovementHandler { this.wasRiding = false; } // If the key was held down for more than 300ms, stop sneaking upon release. - else if(System.currentTimeMillis() - this.lastPressed > 300L) + else if((System.currentTimeMillis() - this.lastPressed) > 300L) { options.sneak = false; } @@ -109,8 +109,8 @@ public class CustomMovementHandler { if(options.sneak || SneakManager.Sneaking()) { - options.moveStrafe = (float)((double)options.moveStrafe * 0.3D); - options.moveForward = (float)((double)options.moveForward * 0.3D); + options.moveStrafe = (float)(options.moveStrafe * 0.3D); + options.moveForward = (float)(options.moveForward * 0.3D); } // @@ -118,16 +118,16 @@ public class CustomMovementHandler { // // Establish conditions where we don't want to start a sprint - sneaking, riding, flying, hungry - boolean enoughHunger = (float)thisPlayer.getFoodStats().getFoodLevel() > 6.0F || thisPlayer.capabilities.isFlying; - boolean canSprint = !options.sneak && !thisPlayer.isRiding() && !thisPlayer.capabilities.isFlying && enoughHunger; + final boolean enoughHunger = (thisPlayer.getFoodStats().getFoodLevel() > 6.0F) || thisPlayer.capabilities.isFlying; + final boolean canSprint = !options.sneak && !thisPlayer.isRiding() && !thisPlayer.capabilities.isFlying && enoughHunger; - isDisabled = !SneakManager.Sprinting(); - canDoubleTap = SneakManager.optionDoubleTap; + this.isDisabled = !SneakManager.Sprinting(); + this.canDoubleTap = SneakManager.optionDoubleTap; // Key Pressed - if((canSprint || isDisabled) && settings.keyBindSprint.getIsKeyPressed() && !this.handledSprintPress) + if((canSprint || this.isDisabled) && settings.keyBindSprint.getIsKeyPressed() && !this.handledSprintPress) { - if(!isDisabled) + if(!this.isDisabled) { this.sprint = !this.sprint; this.lastSprintPressed = System.currentTimeMillis(); @@ -137,10 +137,10 @@ public class CustomMovementHandler { } // Key Released - if((canSprint || isDisabled) && !settings.keyBindSprint.getIsKeyPressed() && this.handledSprintPress) + if((canSprint || this.isDisabled) && !settings.keyBindSprint.getIsKeyPressed() && this.handledSprintPress) { // Was key held for longer than 300ms? If so, mark it so we can resume vanilla behavior - if(System.currentTimeMillis() - this.lastSprintPressed > 300L) + if((System.currentTimeMillis() - this.lastSprintPressed) > 300L) { this.sprintHeldAndReleased = true; } @@ -149,7 +149,7 @@ public class CustomMovementHandler { } - public void UpdateSprint(boolean newValue, boolean doubleTapped){ + public void UpdateSprint(final boolean newValue, final boolean doubleTapped){ if (!SneakManager.Sprinting()){ this.sprint = false; this.sprintDoubleTapped = doubleTapped; @@ -157,7 +157,7 @@ public class CustomMovementHandler { else{ this.sprint = newValue; this.sprintDoubleTapped = doubleTapped; - } + } } - + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java index 40a4b6e501..0666acc7fa 100644 --- a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java @@ -1,19 +1,16 @@ package gtPlusPlus.core.handler.events; +import java.util.UUID; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.proxy.ClientProxy; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.player.PlayerCache; import gtPlusPlus.core.util.player.PlayerUtils; - -import java.util.UUID; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class LoginEventHandler { @@ -22,7 +19,7 @@ public class LoginEventHandler { private EntityPlayer localPlayerRef; @SubscribeEvent - public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { + public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) { this.localPlayerRef = event.player; this.localPlayersName = event.player.getDisplayName(); @@ -36,21 +33,22 @@ public class LoginEventHandler { try { - if (localPlayerRef instanceof EntityPlayerMP){ + if (this.localPlayerRef instanceof EntityPlayerMP){ //Populates player cache - if (!localPlayerRef.worldObj.isRemote){ - PlayerCache.appendParamChanges(localPlayersName, localPlayersUUID.toString()); + if (!this.localPlayerRef.worldObj.isRemote){ + PlayerCache.appendParamChanges(this.localPlayersName, this.localPlayersUUID.toString()); if (!CORE.isModUpToDate){ Utils.LOG_INFO("You're not using the latest recommended version of GT++, consider updating."); - if (!CORE.MASTER_VERSION.toLowerCase().equals("offline")) + if (!CORE.MASTER_VERSION.toLowerCase().equals("offline")) { Utils.LOG_INFO("Latest version is: "+CORE.MASTER_VERSION); + } Utils.LOG_INFO("You currently have: "+CORE.VERSION); - PlayerUtils.messagePlayer(localPlayerRef, "You're not using the latest recommended version of GT++, consider updating."); + PlayerUtils.messagePlayer(this.localPlayerRef, "You're not using the latest recommended version of GT++, consider updating."); } else { - Utils.LOG_INFO("You're using the latest recommended version of GT++."); + Utils.LOG_INFO("You're using the latest recommended version of GT++."); } } @@ -90,14 +88,14 @@ public class LoginEventHandler { } }; - //t.start(); + //t.start(); }*/ - } - } catch (Throwable errr){ + } + } catch (final Throwable errr){ Utils.LOG_INFO("Login Handler encountered an error."); } diff --git a/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java index 7d7a40c356..dff8d3049e 100644 --- a/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java @@ -1,46 +1,45 @@ package gtPlusPlus.core.handler.events; +import java.util.UUID; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.metatileentity.*; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.player.PlayerUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines.GregtechMetaSafeBlockBase; - -import java.util.UUID; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.BlockEvent.BreakEvent; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class PickaxeBlockBreakEventHandler { @SubscribeEvent - public void onBreakBlock(BreakEvent event) { + public void onBreakBlock(final BreakEvent event) { try{ - TileEntity entity = event.world.getTileEntity(event.x, event.y, event.z); + final TileEntity entity = event.world.getTileEntity(event.x, event.y, event.z); if (entity != null){ - EntityPlayer playerInternal = event.getPlayer(); + final EntityPlayer playerInternal = event.getPlayer(); Utils.LOG_WARNING(entity.getClass().getSimpleName()); if (entity.getClass().getSimpleName().equals("")){ } - if (entity instanceof BaseTileEntity && !(entity instanceof BaseMetaPipeEntity)){ - IMetaTileEntity X = ((BaseMetaTileEntity)entity).getMetaTileEntity(); - Block ThisBlock = X.getBaseMetaTileEntity().getBlock(event.x, event.y, event.z); + if ((entity instanceof BaseTileEntity) && !(entity instanceof BaseMetaPipeEntity)){ + final IMetaTileEntity X = ((BaseMetaTileEntity)entity).getMetaTileEntity(); + final Block ThisBlock = X.getBaseMetaTileEntity().getBlock(event.x, event.y, event.z); if (X instanceof GregtechMetaSafeBlockBase){ - UUID ownerUUID = ((GregtechMetaSafeBlockBase)X).ownerUUID; - UUID accessorUUID = playerInternal.getUniqueID(); + final UUID ownerUUID = ((GregtechMetaSafeBlockBase)X).ownerUUID; + final UUID accessorUUID = playerInternal.getUniqueID(); Utils.LOG_WARNING("Owner UUID: "+ownerUUID); - Utils.LOG_WARNING("Accessor UUID: "+accessorUUID); + Utils.LOG_WARNING("Accessor UUID: "+accessorUUID); if (((GregtechMetaSafeBlockBase)X).bUnbreakable){ - + Utils.LOG_INFO("UUID info. Accessor: "+accessorUUID + " | Owner: "+ownerUUID); - - if (accessorUUID == ownerUUID){ + + if (accessorUUID == ownerUUID){ PlayerUtils.messagePlayer(playerInternal, "Since you own this block, it has been destroyed."); event.setCanceled(false); } @@ -55,16 +54,16 @@ public class PickaxeBlockBreakEventHandler { } } - catch (NullPointerException e) { + catch (final NullPointerException e) { System.out.print("Caught a NullPointerException involving Safe Blocks. Cause: "+e.getCause()); } } - - + + @SubscribeEvent - public void onPlayerInteraction(PlayerInteractEvent aEvent) { - if (aEvent.entityPlayer != null && aEvent.entityPlayer.worldObj != null && aEvent.action != null && aEvent.world.provider != null && !aEvent.entityPlayer.worldObj.isRemote && aEvent.action != null && aEvent.action != PlayerInteractEvent.Action.RIGHT_CLICK_AIR) { - //Utils.LOG_ERROR("Test"); - } - } + public void onPlayerInteraction(final PlayerInteractEvent aEvent) { + if ((aEvent.entityPlayer != null) && (aEvent.entityPlayer.worldObj != null) && (aEvent.action != null) && (aEvent.world.provider != null) && !aEvent.entityPlayer.worldObj.isRemote && (aEvent.action != null) && (aEvent.action != PlayerInteractEvent.Action.RIGHT_CLICK_AIR)) { + //Utils.LOG_ERROR("Test"); + } + } } diff --git a/src/Java/gtPlusPlus/core/handler/events/SneakManager.java b/src/Java/gtPlusPlus/core/handler/events/SneakManager.java index f330fea861..02072fe32f 100644 --- a/src/Java/gtPlusPlus/core/handler/events/SneakManager.java +++ b/src/Java/gtPlusPlus/core/handler/events/SneakManager.java @@ -40,11 +40,11 @@ public class SneakManager { toggleState(Sprinting); } - private static State toggleState(State state){ + private static State toggleState(final State state){ Utils.LOG_INFO("State Toggle"); if (state == State.ON) { return State.OFF; - } + } return State.ON; } @@ -68,14 +68,14 @@ public class SneakManager { ON(true), OFF(false); - private boolean STATE; + private final boolean STATE; private State (final boolean State) { this.STATE = State; } public boolean getState() { - return STATE; + return this.STATE; } } diff --git a/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java b/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java index 559301f4f0..0cd438c389 100644 --- a/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java +++ b/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java @@ -17,14 +17,14 @@ public class UnbreakableBlockManager{ } - public final void setmTileEntity(BaseMetaTileEntity mTileEntity/*, EntityPlayer aPlayer*/) { + public final void setmTileEntity(final BaseMetaTileEntity mTileEntity/*, EntityPlayer aPlayer*/) { UnbreakableBlockManager.mTileEntity = mTileEntity; if (!hasRun){ hasRun = true; - makeIndestructible(/*aPlayer*/); + this.makeIndestructible(/*aPlayer*/); } else { - Utils.LOG_WARNING("Why do you run twice?"); + Utils.LOG_WARNING("Why do you run twice?"); } } @@ -38,28 +38,28 @@ public class UnbreakableBlockManager{ Utils.LOG_WARNING("Initializing the code to set this TE to -1 hardness and make it indestructible."); - int X = ((BaseMetaTileEntity)mTileEntity).xCoord; //(GregtechMetaSafeBlock) this.mTileEntity.getXCoord(); - int Y = ((BaseMetaTileEntity)mTileEntity).yCoord; - int Z = ((BaseMetaTileEntity)mTileEntity).zCoord; + final int X = mTileEntity.xCoord; //(GregtechMetaSafeBlock) this.mTileEntity.getXCoord(); + final int Y = mTileEntity.yCoord; + final int Z = mTileEntity.zCoord; Utils.LOG_WARNING("Grabbing TileEntity @ [x,y,z] |"+X+"|"+Y+"|"+Z+"|"); - try{ - GregtechMetaSafeBlock MetaSafeBlock = ((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()); - TileEntity BaseMetaTileEntity = ((BaseMetaTileEntity)mTileEntity).getTileEntity(X, Y, Z); + try{ + final GregtechMetaSafeBlock MetaSafeBlock = ((GregtechMetaSafeBlock) UnbreakableBlockManager.mTileEntity.getMetaTileEntity()); + final TileEntity BaseMetaTileEntity = mTileEntity.getTileEntity(X, Y, Z); //MetaSafeBlockBase. - World TE_WORLD = MetaSafeBlock.getBaseMetaTileEntity().getWorld(); + final World TE_WORLD = MetaSafeBlock.getBaseMetaTileEntity().getWorld(); Utils.LOG_WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - TileEntity entity = BaseMetaTileEntity; - innerInvincible(MetaSafeBlock, entity, TE_WORLD, /*aPlayer,*/ X, Y, Z); + final TileEntity entity = BaseMetaTileEntity; + innerInvincible(MetaSafeBlock, entity, TE_WORLD, /*aPlayer,*/ X, Y, Z); } - catch (NullPointerException e) { + catch (final NullPointerException e) { System.out.print("Caught a NullPointerException involving Safe Blocks. Cause: "); e.printStackTrace(); } } - private static void innerInvincible(GregtechMetaSafeBlock MetaSafeBlock, TileEntity entity, World TE_WORLD, /*EntityPlayer aPlayer,*/ int X, int Y, int Z){ + private static void innerInvincible(final GregtechMetaSafeBlock MetaSafeBlock, final TileEntity entity, final World TE_WORLD, /*EntityPlayer aPlayer,*/ final int X, final int Y, final int Z){ if (entity != null){ Utils.LOG_WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); Utils.LOG_WARNING("Grabbed TE: "+entity.toString()); @@ -67,19 +67,19 @@ public class UnbreakableBlockManager{ - if (entity instanceof BaseTileEntity && !(entity instanceof BaseMetaPipeEntity)){ - IMetaTileEntity I = ((BaseMetaTileEntity)entity).getMetaTileEntity(); + if ((entity instanceof BaseTileEntity) && !(entity instanceof BaseMetaPipeEntity)){ + final IMetaTileEntity I = ((BaseMetaTileEntity)entity).getMetaTileEntity(); Utils.LOG_WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); Utils.LOG_WARNING("I Details: "+I.getMetaName()+" | "+I.getTileEntityBaseType()+" | "+I.toString()); - - if (I instanceof GregtechMetaSafeBlock){ + + if (I instanceof GregtechMetaSafeBlock){ Utils.LOG_WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - Block ThisBlock = I.getBaseMetaTileEntity().getBlock(X, Y, Z); + final Block ThisBlock = I.getBaseMetaTileEntity().getBlock(X, Y, Z); Utils.LOG_WARNING("Block Details: "+ThisBlock.toString()); diff --git a/src/Java/gtPlusPlus/core/handler/render/CapeHandler.java b/src/Java/gtPlusPlus/core/handler/render/CapeHandler.java index f5e87ff512..f86e1ff160 100644 --- a/src/Java/gtPlusPlus/core/handler/render/CapeHandler.java +++ b/src/Java/gtPlusPlus/core/handler/render/CapeHandler.java @@ -1,12 +1,13 @@ package gtPlusPlus.core.handler.render; +import java.util.Collection; + +import org.lwjgl.opengl.GL11; + import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; - -import java.util.Collection; - import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.RenderManager; @@ -16,105 +17,104 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderPlayerEvent; -import org.lwjgl.opengl.GL11; - public class CapeHandler extends RenderPlayer { - private final ResourceLocation[] mCapes = { - new ResourceLocation(CORE.MODID+":textures/TesterCape.png"), - new ResourceLocation(CORE.MODID+":textures/Draknyte1.png"), - new ResourceLocation("gregtech:textures/GregoriusCape.png") }; - private final Collection<String> mCapeList; + private final ResourceLocation[] mCapes = { + new ResourceLocation(CORE.MODID+":textures/TesterCape.png"), + new ResourceLocation(CORE.MODID+":textures/Draknyte1.png"), + new ResourceLocation("gregtech:textures/GregoriusCape.png") }; + private final Collection<String> mCapeList; - public CapeHandler(Collection<String> aCapeList) { - this.mCapeList = aCapeList; - setRenderManager(RenderManager.instance); - } + public CapeHandler(final Collection<String> aCapeList) { + this.mCapeList = aCapeList; + this.setRenderManager(RenderManager.instance); + } - public void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) { - AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer; - if (GT_Utility.getFullInvisibility(aPlayer)) { - aEvent.setCanceled(true); - return; + public void receiveRenderSpecialsEvent(final RenderPlayerEvent.Specials.Pre aEvent) { + final AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer; + if (GT_Utility.getFullInvisibility(aPlayer)) { + aEvent.setCanceled(true); + return; + } + final float aPartialTicks = aEvent.partialRenderTick; + if (aPlayer.isInvisible()) { + return; + } + if (GT_Utility.getPotion(aPlayer, + Integer.valueOf(Potion.invisibility.id).intValue())) { + return; + } + try { + ResourceLocation tResource = null; + if (aPlayer.getDisplayName().equalsIgnoreCase("XW3B")) { + tResource = this.mCapes[0]; } - float aPartialTicks = aEvent.partialRenderTick; - if (aPlayer.isInvisible()) { - return; + if (this.mCapeList.contains(aPlayer.getDisplayName().toLowerCase())) { + tResource = this.mCapes[0]; } - if (GT_Utility.getPotion(aPlayer, - Integer.valueOf(Potion.invisibility.id).intValue())) { - return; + if (aPlayer.getDisplayName().equalsIgnoreCase("Draknyte1")) { + tResource = this.mCapes[1]; } - try { - ResourceLocation tResource = null; - if (aPlayer.getDisplayName().equalsIgnoreCase("XW3B")) { - tResource = this.mCapes[0]; - } - if (this.mCapeList.contains(aPlayer.getDisplayName().toLowerCase())) { - tResource = this.mCapes[0]; + if (aPlayer.getDisplayName().equalsIgnoreCase("GregoriusT")) { + tResource = this.mCapes[2]; + } + if ((tResource != null) && (!(aPlayer.getHideCape()))) { + this.bindTexture(tResource); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 0.0F, 0.125F); + final double d0 = (aPlayer.field_71091_bM + + ((aPlayer.field_71094_bP - aPlayer.field_71091_bM) + * aPartialTicks)) + - (aPlayer.prevPosX + ((aPlayer.posX - aPlayer.prevPosX) + * aPartialTicks)); + final double d1 = (aPlayer.field_71096_bN + + ((aPlayer.field_71095_bQ - aPlayer.field_71096_bN) + * aPartialTicks)) + - (aPlayer.prevPosY + ((aPlayer.posY - aPlayer.prevPosY) + * aPartialTicks)); + final double d2 = (aPlayer.field_71097_bO + + ((aPlayer.field_71085_bR - aPlayer.field_71097_bO) + * aPartialTicks)) + - (aPlayer.prevPosZ + ((aPlayer.posZ - aPlayer.prevPosZ) + * aPartialTicks)); + final float f6 = aPlayer.prevRenderYawOffset + + ((aPlayer.renderYawOffset - aPlayer.prevRenderYawOffset) + * aPartialTicks); + final double d3 = MathHelper.sin((f6 * CORE.PI) / 180.0F); + final double d4 = -MathHelper.cos((f6 * CORE.PI) / 180.0F); + float f7 = (float) d1 * 10.0F; + float f8 = (float) ((d0 * d3) + (d2 * d4)) * 100.0F; + final float f9 = (float) ((d0 * d4) - (d2 * d3)) * 100.0F; + if (f7 < -6.0F) { + f7 = -6.0F; } - if (aPlayer.getDisplayName().equalsIgnoreCase("Draknyte1")) { - tResource = this.mCapes[1]; + if (f7 > 32.0F) { + f7 = 32.0F; } - if (aPlayer.getDisplayName().equalsIgnoreCase("GregoriusT")) { - tResource = this.mCapes[2]; + if (f8 < 0.0F) { + f8 = 0.0F; } - if ((tResource != null) && (!(aPlayer.getHideCape()))) { - bindTexture(tResource); - GL11.glPushMatrix(); - GL11.glTranslatef(0.0F, 0.0F, 0.125F); - double d0 = aPlayer.field_71091_bM - + (aPlayer.field_71094_bP - aPlayer.field_71091_bM) - * aPartialTicks - - (aPlayer.prevPosX + (aPlayer.posX - aPlayer.prevPosX) - * aPartialTicks); - double d1 = aPlayer.field_71096_bN - + (aPlayer.field_71095_bQ - aPlayer.field_71096_bN) - * aPartialTicks - - (aPlayer.prevPosY + (aPlayer.posY - aPlayer.prevPosY) - * aPartialTicks); - double d2 = aPlayer.field_71097_bO - + (aPlayer.field_71085_bR - aPlayer.field_71097_bO) - * aPartialTicks - - (aPlayer.prevPosZ + (aPlayer.posZ - aPlayer.prevPosZ) - * aPartialTicks); - float f6 = aPlayer.prevRenderYawOffset - + (aPlayer.renderYawOffset - aPlayer.prevRenderYawOffset) - * aPartialTicks; - double d3 = MathHelper.sin(f6 * CORE.PI / 180.0F); - double d4 = -MathHelper.cos(f6 * CORE.PI / 180.0F); - float f7 = (float) d1 * 10.0F; - float f8 = (float) (d0 * d3 + d2 * d4) * 100.0F; - float f9 = (float) (d0 * d4 - (d2 * d3)) * 100.0F; - if (f7 < -6.0F) { - f7 = -6.0F; - } - if (f7 > 32.0F) { - f7 = 32.0F; - } - if (f8 < 0.0F) { - f8 = 0.0F; - } - float f10 = aPlayer.prevCameraYaw - + (aPlayer.cameraYaw - aPlayer.prevCameraYaw) - * aPartialTicks; - f7 += MathHelper - .sin((aPlayer.prevDistanceWalkedModified + (aPlayer.distanceWalkedModified - aPlayer.prevDistanceWalkedModified) - * aPartialTicks) * 6.0F) - * 32.0F * f10; - if (aPlayer.isSneaking()) { - f7 += 25.0F; - } - GL11.glRotatef(6.0F + f8 / 2.0F + f7, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(f9 / 2.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(-f9 / 2.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); - ((ModelBiped) this.mainModel).renderCloak(0.0625F); - GL11.glPopMatrix(); + final float f10 = aPlayer.prevCameraYaw + + ((aPlayer.cameraYaw - aPlayer.prevCameraYaw) + * aPartialTicks); + f7 += MathHelper + .sin((aPlayer.prevDistanceWalkedModified + ((aPlayer.distanceWalkedModified - aPlayer.prevDistanceWalkedModified) + * aPartialTicks)) * 6.0F) + * 32.0F * f10; + if (aPlayer.isSneaking()) { + f7 += 25.0F; } - } catch (Throwable e) { - if (GT_Values.D1) - e.printStackTrace(GT_Log.err); + GL11.glRotatef(6.0F + (f8 / 2.0F) + f7, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(f9 / 2.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-f9 / 2.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + ((ModelBiped) this.mainModel).renderCloak(0.0625F); + GL11.glPopMatrix(); + } + } catch (final Throwable e) { + if (GT_Values.D1) { + e.printStackTrace(GT_Log.err); } } - + } + } diff --git a/src/Java/gtPlusPlus/core/handler/render/FirepitModel.java b/src/Java/gtPlusPlus/core/handler/render/FirepitModel.java index 9bad3d2f4e..845576e023 100644 --- a/src/Java/gtPlusPlus/core/handler/render/FirepitModel.java +++ b/src/Java/gtPlusPlus/core/handler/render/FirepitModel.java @@ -25,86 +25,86 @@ public class FirepitModel extends ModelBase public FirepitModel() { - textureWidth = 16; - textureHeight = 16; - - Side_A = new ModelRenderer(this, 0, 0); - Side_A.addBox(0F, 0F, 0F, 12, 6, 1); - Side_A.setRotationPoint(-6F, 18F, -6F); - Side_A.setTextureSize(16, 16); - Side_A.mirror = true; - setRotation(Side_A, -0.3148822F, 0F, 0F); + this.textureWidth = 16; + this.textureHeight = 16; + + this.Side_A = new ModelRenderer(this, 0, 0); + this.Side_A.addBox(0F, 0F, 0F, 12, 6, 1); + this.Side_A.setRotationPoint(-6F, 18F, -6F); + this.Side_A.setTextureSize(16, 16); + this.Side_A.mirror = true; + setRotation(this.Side_A, -0.3148822F, 0F, 0F); //Side_A.mirror = false; - Side_B = new ModelRenderer(this, 0, 0); - Side_B.addBox(0F, 0F, 0F, 12, 6, 1); - Side_B.setRotationPoint(-6F, 18F, 6F); - Side_B.setTextureSize(16, 16); - Side_B.mirror = true; - setRotation(Side_B, -0.3148822F, (CORE.PI/2), 0F); - - Side_C = new ModelRenderer(this, 0, 0); - Side_C.addBox(0F, 0F, 0F, 12, 6, 1); - Side_C.setRotationPoint(6F, 18F, 6F); - Side_C.setTextureSize(16, 16); - Side_C.mirror = true; - setRotation(Side_C, -0.3148822F, CORE.PI, 0F); + this.Side_B = new ModelRenderer(this, 0, 0); + this.Side_B.addBox(0F, 0F, 0F, 12, 6, 1); + this.Side_B.setRotationPoint(-6F, 18F, 6F); + this.Side_B.setTextureSize(16, 16); + this.Side_B.mirror = true; + setRotation(this.Side_B, -0.3148822F, (CORE.PI/2), 0F); + + this.Side_C = new ModelRenderer(this, 0, 0); + this.Side_C.addBox(0F, 0F, 0F, 12, 6, 1); + this.Side_C.setRotationPoint(6F, 18F, 6F); + this.Side_C.setTextureSize(16, 16); + this.Side_C.mirror = true; + setRotation(this.Side_C, -0.3148822F, CORE.PI, 0F); //Side_C.mirror = false; - Side_D = new ModelRenderer(this, 0, 0); - Side_D.addBox(0F, 0F, 0F, 12, 6, 1); - Side_D.setRotationPoint(6F, 18F, -6F); - Side_D.setTextureSize(16, 16); - Side_D.mirror = true; - setRotation(Side_D, -0.3148822F, 4.712389F, 0F); - - Log1 = new ModelRenderer(this, 0, 10); - Log1.addBox(0F, 0F, 0F, 14, 2, 2); - Log1.setRotationPoint(4F, 10F, -4F); - Log1.setTextureSize(16, 16); - Log1.mirror = true; - setRotation(Log1, 0F, 0F, (CORE.PI/2)); - - Log2 = new ModelRenderer(this, -2, 10); - Log2.addBox(0F, 0F, 0F, 14, 2, 2); - Log2.setRotationPoint(-4F, 10F, -4F); - Log2.setTextureSize(16, 16); - Log2.mirror = true; - setRotation(Log2, (CORE.PI/2), 0F, (CORE.PI/2)); + this.Side_D = new ModelRenderer(this, 0, 0); + this.Side_D.addBox(0F, 0F, 0F, 12, 6, 1); + this.Side_D.setRotationPoint(6F, 18F, -6F); + this.Side_D.setTextureSize(16, 16); + this.Side_D.mirror = true; + setRotation(this.Side_D, -0.3148822F, 4.712389F, 0F); + + this.Log1 = new ModelRenderer(this, 0, 10); + this.Log1.addBox(0F, 0F, 0F, 14, 2, 2); + this.Log1.setRotationPoint(4F, 10F, -4F); + this.Log1.setTextureSize(16, 16); + this.Log1.mirror = true; + setRotation(this.Log1, 0F, 0F, (CORE.PI/2)); + + this.Log2 = new ModelRenderer(this, -2, 10); + this.Log2.addBox(0F, 0F, 0F, 14, 2, 2); + this.Log2.setRotationPoint(-4F, 10F, -4F); + this.Log2.setTextureSize(16, 16); + this.Log2.mirror = true; + setRotation(this.Log2, (CORE.PI/2), 0F, (CORE.PI/2)); //Log2.mirror = false; - Log3 = new ModelRenderer(this, 0, 10); - Log3.addBox(0F, 0F, 0F, 14, 2, 2); - Log3.setRotationPoint(-4F, 10F, 4F); - Log3.setTextureSize(16, 16); - Log3.mirror = true; - setRotation(Log3, CORE.PI, 0F, (CORE.PI/2)); - - Log4 = new ModelRenderer(this, -2, 10); - Log4.addBox(0F, 0F, 0F, 14, 2, 2); - Log4.setRotationPoint(4F, 10F, 4F); - Log4.setTextureSize(16, 16); - Log4.mirror = true; - setRotation(Log4, 4.712389F, 0F, (CORE.PI/2)); + this.Log3 = new ModelRenderer(this, 0, 10); + this.Log3.addBox(0F, 0F, 0F, 14, 2, 2); + this.Log3.setRotationPoint(-4F, 10F, 4F); + this.Log3.setTextureSize(16, 16); + this.Log3.mirror = true; + setRotation(this.Log3, CORE.PI, 0F, (CORE.PI/2)); + + this.Log4 = new ModelRenderer(this, -2, 10); + this.Log4.addBox(0F, 0F, 0F, 14, 2, 2); + this.Log4.setRotationPoint(4F, 10F, 4F); + this.Log4.setTextureSize(16, 16); + this.Log4.mirror = true; + setRotation(this.Log4, 4.712389F, 0F, (CORE.PI/2)); //Log4.mirror = false; } @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + public void render(final Entity entity, final float f, final float f1, final float f2, final float f3, final float f4, final float f5) { super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - Side_A.render(f5); - Side_B.render(f5); - Side_C.render(f5); - Side_D.render(f5); - Log1.render(f5); - Log2.render(f5); - Log3.render(f5); - Log4.render(f5); + this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.Side_A.render(f5); + this.Side_B.render(f5); + this.Side_C.render(f5); + this.Side_D.render(f5); + this.Log1.render(f5); + this.Log2.render(f5); + this.Log3.render(f5); + this.Log4.render(f5); } - private static void setRotation(ModelRenderer model, float x, float y, float z) + private static void setRotation(final ModelRenderer model, final float x, final float y, final float z) { model.rotateAngleX = x; model.rotateAngleY = y; @@ -112,7 +112,7 @@ public class FirepitModel extends ModelBase } @Override - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) + public void setRotationAngles(final float f, final float f1, final float f2, final float f3, final float f4, final float f5, final Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } diff --git a/src/Java/gtPlusPlus/core/handler/render/FirepitRender.java b/src/Java/gtPlusPlus/core/handler/render/FirepitRender.java index 5a02de77b5..7b8d23e25b 100644 --- a/src/Java/gtPlusPlus/core/handler/render/FirepitRender.java +++ b/src/Java/gtPlusPlus/core/handler/render/FirepitRender.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.handler.render; +import org.lwjgl.opengl.GL11; + import net.minecraft.block.Block; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; @@ -8,31 +10,29 @@ import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; - -import org.lwjgl.opengl.GL11; public class FirepitRender extends TileEntitySpecialRenderer{ ResourceLocation texture = new ResourceLocation("miscutils" + ":"+ "textures/blocks/FirePit/mossyFirepit.png"); - private FirepitModel model; + private final FirepitModel model; public FirepitRender(){ this.model = new FirepitModel(); } - private void adjustRotatePivotViaMeta(World world, int x, int y, int z) { - int meta = world.getBlockMetadata(x, y, z); + private void adjustRotatePivotViaMeta(final World world, final int x, final int y, final int z) { + final int meta = world.getBlockMetadata(x, y, z); GL11.glPushMatrix(); GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F); GL11.glPopMatrix(); } @Override - public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float i) { + public void renderTileEntityAt(final TileEntity entity, final double x, final double y, final double z, final float i) { GL11.glPushMatrix(); GL11.glTranslatef((float)x + 0.1F, (float)y + 1.0F, (float)z + 0.5F); GL11.glRotatef(180, 0F, 0F, 1F); - this.bindTexture(texture); + this.bindTexture(this.texture); GL11.glPushMatrix(); this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glTranslatef(1.0f, 1.0f, 1.0f); @@ -40,16 +40,16 @@ public class FirepitRender extends TileEntitySpecialRenderer{ GL11.glPopMatrix(); } - //Set the lighting stuff, so it changes it's brightness properly. - private void adjustLightFixture(World world, int i, int j, int k, Block block) { - Tessellator tess = Tessellator.instance; + //Set the lighting stuff, so it changes it's brightness properly. + private void adjustLightFixture(final World world, final int i, final int j, final int k, final Block block) { + final Tessellator tess = Tessellator.instance; //float brightness = block.getBlockBrightness(world, i, j, k); //As of MC 1.7+ block.getBlockBrightness() has become block.getLightValue(): - float brightness = block.getLightValue(world, i, j, k); - int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0); - int modulousModifier = skyLight % 65536; - int divModifier = skyLight / 65536; + final float brightness = block.getLightValue(world, i, j, k); + final int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0); + final int modulousModifier = skyLight % 65536; + final int divModifier = skyLight / 65536; tess.setColorOpaque_F(brightness, brightness, brightness); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier); } } diff --git a/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java b/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java index f37886c6c0..289446eb07 100644 --- a/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java +++ b/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java @@ -14,29 +14,29 @@ import net.minecraft.world.World; public class Workbench_CraftingHandler { private static final Workbench_CraftingHandler instance = new Workbench_CraftingHandler(); - private List recipes = new ArrayList(); - + private final List recipes = new ArrayList(); + public static final Workbench_CraftingHandler getInstance() { - return instance; + return instance; } public Workbench_CraftingHandler() { - - //just a example recipe so you know how to add them - addRecipe(new ItemStack(Blocks.iron_block), new Object[] - { - "###", - "###", - "###", - Character.valueOf('#'), Items.iron_ingot - }); - - //another example Recipe, but shapeless - addShapelessRecipe(new ItemStack(Items.cake),new Object[]{Items.stick}); - - + + //just a example recipe so you know how to add them + this.addRecipe(new ItemStack(Blocks.iron_block), new Object[] + { + "###", + "###", + "###", + Character.valueOf('#'), Items.iron_ingot + }); + + //another example Recipe, but shapeless + this.addShapelessRecipe(new ItemStack(Items.cake),new Object[]{Items.stick}); + + } - - void addRecipe(ItemStack par1ItemStack, Object par2ArrayOfObj[]) + + void addRecipe(final ItemStack par1ItemStack, final Object par2ArrayOfObj[]) { String s = ""; int i = 0; @@ -45,11 +45,11 @@ public class Workbench_CraftingHandler { if (par2ArrayOfObj[i] instanceof String[]) { - String as[] = (String[])par2ArrayOfObj[i++]; + final String as[] = (String[])par2ArrayOfObj[i++]; for (int l = 0; l < as.length; l++) { - String s2 = as[l]; + final String s2 = as[l]; k++; j = s2.length(); s = (new StringBuilder()).append(s).append(s2).toString(); @@ -59,18 +59,18 @@ public class Workbench_CraftingHandler { { while (par2ArrayOfObj[i] instanceof String) { - String s1 = (String)par2ArrayOfObj[i++]; + final String s1 = (String)par2ArrayOfObj[i++]; k++; j = s1.length(); s = (new StringBuilder()).append(s).append(s1).toString(); } } - HashMap hashmap = new HashMap(); + final HashMap hashmap = new HashMap(); for (; i < par2ArrayOfObj.length; i += 2) { - Character character = (Character)par2ArrayOfObj[i]; + final Character character = (Character)par2ArrayOfObj[i]; ItemStack itemstack = null; if (par2ArrayOfObj[i + 1] instanceof Item) @@ -89,11 +89,11 @@ public class Workbench_CraftingHandler { hashmap.put(character, itemstack); } - ItemStack aitemstack[] = new ItemStack[j * k]; + final ItemStack aitemstack[] = new ItemStack[j * k]; - for (int i1 = 0; i1 < j * k; i1++) + for (int i1 = 0; i1 < (j * k); i1++) { - char c = s.charAt(i1); + final char c = s.charAt(i1); if (hashmap.containsKey(Character.valueOf(c))) { @@ -105,18 +105,18 @@ public class Workbench_CraftingHandler { } } - recipes.add(new ShapedRecipes(j, k, aitemstack, par1ItemStack)); + this.recipes.add(new ShapedRecipes(j, k, aitemstack, par1ItemStack)); } - public void addShapelessRecipe(ItemStack par1ItemStack, Object par2ArrayOfObj[]) + public void addShapelessRecipe(final ItemStack par1ItemStack, final Object par2ArrayOfObj[]) { - ArrayList arraylist = new ArrayList(); - Object aobj[] = par2ArrayOfObj; - int i = aobj.length; + final ArrayList arraylist = new ArrayList(); + final Object aobj[] = par2ArrayOfObj; + final int i = aobj.length; for (int j = 0; j < i; j++) { - Object obj = aobj[j]; + final Object obj = aobj[j]; if (obj instanceof ItemStack) { @@ -140,10 +140,10 @@ public class Workbench_CraftingHandler { } } - recipes.add(new ShapelessRecipes(par1ItemStack, arraylist)); + this.recipes.add(new ShapelessRecipes(par1ItemStack, arraylist)); } - public ItemStack findMatchingRecipe(InventoryCrafting par1InventoryCrafting, World par2World) + public ItemStack findMatchingRecipe(final InventoryCrafting par1InventoryCrafting, final World par2World) { int i = 0; ItemStack itemstack = null; @@ -151,7 +151,7 @@ public class Workbench_CraftingHandler { for (int j = 0; j < par1InventoryCrafting.getSizeInventory(); j++) { - ItemStack itemstack2 = par1InventoryCrafting.getStackInSlot(j); + final ItemStack itemstack2 = par1InventoryCrafting.getStackInSlot(j); if (itemstack2 == null) { @@ -188,9 +188,9 @@ public class Workbench_CraftingHandler { return new ItemStack(itemstack.itemID, 1, k1); }*/ - for (int k = 0; k < recipes.size(); k++) + for (int k = 0; k < this.recipes.size(); k++) { - IRecipe irecipe = (IRecipe)recipes.get(k); + final IRecipe irecipe = (IRecipe)this.recipes.get(k); if (irecipe.matches(par1InventoryCrafting, par2World)) { @@ -201,9 +201,9 @@ public class Workbench_CraftingHandler { return null; } - + public List getRecipeList() { - return recipes; + return this.recipes; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/workbench/Workbench_RecipeSorter.java b/src/Java/gtPlusPlus/core/handler/workbench/Workbench_RecipeSorter.java index 97ea2365c0..b68ae89e5c 100644 --- a/src/Java/gtPlusPlus/core/handler/workbench/Workbench_RecipeSorter.java +++ b/src/Java/gtPlusPlus/core/handler/workbench/Workbench_RecipeSorter.java @@ -8,34 +8,35 @@ public class Workbench_RecipeSorter implements Comparator { final Workbench_CraftingHandler CraftingManagerCrafter; - Workbench_RecipeSorter(Workbench_CraftingHandler par1CraftingManager) + Workbench_RecipeSorter(final Workbench_CraftingHandler par1CraftingManager) { - CraftingManagerCrafter = par1CraftingManager; + this.CraftingManagerCrafter = par1CraftingManager; } - public int compareRecipes(IRecipe par1IRecipe, IRecipe par2IRecipe) + public int compareRecipes(final IRecipe par1IRecipe, final IRecipe par2IRecipe) { - if ((par1IRecipe instanceof ShapelessRecipes) && (par2IRecipe instanceof ShapedRecipes)) - { - return 1; - } - - if ((par2IRecipe instanceof ShapelessRecipes) && (par1IRecipe instanceof ShapedRecipes)) - { - return -1; - } - - if (par2IRecipe.getRecipeSize() < par1IRecipe.getRecipeSize()) - { - return -1; - } - - return par2IRecipe.getRecipeSize() <= par1IRecipe.getRecipeSize() ? 0 : 1; + if ((par1IRecipe instanceof ShapelessRecipes) && (par2IRecipe instanceof ShapedRecipes)) + { + return 1; + } + + if ((par2IRecipe instanceof ShapelessRecipes) && (par1IRecipe instanceof ShapedRecipes)) + { + return -1; + } + + if (par2IRecipe.getRecipeSize() < par1IRecipe.getRecipeSize()) + { + return -1; + } + + return par2IRecipe.getRecipeSize() <= par1IRecipe.getRecipeSize() ? 0 : 1; } - public int compare(Object par1Obj, Object par2Obj) + @Override + public int compare(final Object par1Obj, final Object par2Obj) { - return compareRecipes((IRecipe)par1Obj, (IRecipe)par2Obj); + return this.compareRecipes((IRecipe)par1Obj, (IRecipe)par2Obj); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java b/src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java index 90126b1e82..473aa827b6 100644 --- a/src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java +++ b/src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java @@ -4,45 +4,45 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; public interface IItemBlueprint { - + /** - * The inventory size for the blueprint~ - */ + * The inventory size for the blueprint~ + */ public int INV_SIZE = 9; - + /** - * Meta Compatible function to allow meta items to be blueprints - * @param stack yourMetaItem - * @return true if it is a Blueprint - */ + * Meta Compatible function to allow meta items to be blueprints + * @param stack yourMetaItem + * @return true if it is a Blueprint + */ public boolean isBlueprint(ItemStack stack); - + /** - * Sets the blueprint for this itemstack. - * @param stack yourMetaItem - * @return true if blueprint is set successfully - */ + * Sets the blueprint for this itemstack. + * @param stack yourMetaItem + * @return true if blueprint is set successfully + */ public boolean setBlueprint(ItemStack stack, IInventory craftingTable, ItemStack output); - + /** - * Sets the name of the recipe/blueprint - * @param String Blueprint Name - * @return N/A - */ + * Sets the name of the recipe/blueprint + * @param String Blueprint Name + * @return N/A + */ public void setBlueprintName(ItemStack stack, String name); - + /** - * Does this itemstack hold a blueprint? - * @param stack yourMetaItem - * @return true if is holding a Blueprint - */ + * Does this itemstack hold a blueprint? + * @param stack yourMetaItem + * @return true if is holding a Blueprint + */ public boolean hasBlueprint(ItemStack stack); - + /** - * Gets the recipe held by the item - * @param stack yourMetaItem - * @return the blueprints contents - */ + * Gets the recipe held by the item + * @param stack yourMetaItem + * @return the blueprints contents + */ public ItemStack[] getBlueprint(ItemStack stack); } diff --git a/src/Java/gtPlusPlus/core/inventories/BaseInventoryBackpack.java b/src/Java/gtPlusPlus/core/inventories/BaseInventoryBackpack.java index 59fe8aa4fa..9d0f75acba 100644 --- a/src/Java/gtPlusPlus/core/inventories/BaseInventoryBackpack.java +++ b/src/Java/gtPlusPlus/core/inventories/BaseInventoryBackpack.java @@ -1,9 +1,8 @@ package gtPlusPlus.core.inventories; -import gtPlusPlus.core.item.base.BaseItemBackpack; - import java.util.UUID; +import gtPlusPlus.core.item.base.BaseItemBackpack; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -13,7 +12,7 @@ import net.minecraftforge.common.util.Constants; public class BaseInventoryBackpack implements IInventory{ - private String name = "Inventory Item"; + private final String name = "Inventory Item"; /** Provides NBT Tag Compound to reference */ private final ItemStack invItem; @@ -22,28 +21,28 @@ public class BaseInventoryBackpack implements IInventory{ public static final int INV_SIZE = 8; /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; + private final ItemStack[] inventory = new ItemStack[INV_SIZE]; // declaration of variable: - protected String uniqueID; + protected String uniqueID; /** * @param itemstack - the ItemStack to which this inventory belongs */ - public BaseInventoryBackpack(ItemStack stack) + public BaseInventoryBackpack(final ItemStack stack) { - invItem = stack; + this.invItem = stack; /** initialize variable within the constructor: */ - uniqueID = ""; + this.uniqueID = ""; if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); // no tag compound means the itemstack does not yet have a UUID, so assign one: - uniqueID = UUID.randomUUID().toString(); - } - + this.uniqueID = UUID.randomUUID().toString(); + } + // Create a new NBT Tag Compound if one doesn't already exist, or you will crash if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); @@ -53,75 +52,75 @@ public class BaseInventoryBackpack implements IInventory{ // either reference will change in the other // Read the inventory contents from NBT - readFromNBT(stack.getTagCompound()); + this.readFromNBT(stack.getTagCompound()); } @Override public int getSizeInventory() { - return inventory.length; + return this.inventory.length; } @Override - public ItemStack getStackInSlot(int slot) + public ItemStack getStackInSlot(final int slot) { - return inventory[slot]; + return this.inventory[slot]; } @Override - public ItemStack decrStackSize(int slot, int amount) + public ItemStack decrStackSize(final int slot, final int amount) { - ItemStack stack = getStackInSlot(slot); + ItemStack stack = this.getStackInSlot(slot); if(stack != null) { if(stack.stackSize > amount) { stack = stack.splitStack(amount); // Don't forget this line or your inventory will not be saved! - markDirty(); + this.markDirty(); } else { // this method also calls markDirty, so we don't need to call it again - setInventorySlotContents(slot, null); + this.setInventorySlotContents(slot, null); } } return stack; } @Override - public ItemStack getStackInSlotOnClosing(int slot) + public ItemStack getStackInSlotOnClosing(final int slot) { - ItemStack stack = getStackInSlot(slot); - setInventorySlotContents(slot, null); + final ItemStack stack = this.getStackInSlot(slot); + this.setInventorySlotContents(slot, null); return stack; } @Override - public void setInventorySlotContents(int slot, ItemStack stack) + public void setInventorySlotContents(final int slot, final ItemStack stack) { - inventory[slot] = stack; + this.inventory[slot] = stack; - if (stack != null && stack.stackSize > getInventoryStackLimit()) + if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) { - stack.stackSize = getInventoryStackLimit(); + stack.stackSize = this.getInventoryStackLimit(); } // Don't forget this line or your inventory will not be saved! - markDirty(); + this.markDirty(); } // 1.7.2+ renamed to getInventoryName @Override public String getInventoryName() { - return name; + return this.name; } // 1.7.2+ renamed to hasCustomInventoryName @Override public boolean hasCustomInventoryName() { - return name.length() > 0; + return this.name.length() > 0; } @Override @@ -139,19 +138,19 @@ public class BaseInventoryBackpack implements IInventory{ @Override public void markDirty() { - for (int i = 0; i < getSizeInventory(); ++i) + for (int i = 0; i < this.getSizeInventory(); ++i) { - if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) { - inventory[i] = null; + if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) { + this.inventory[i] = null; } } - // This line here does the work: - writeToNBT(invItem.getTagCompound()); + // This line here does the work: + this.writeToNBT(this.invItem.getTagCompound()); } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { return true; } @@ -170,7 +169,7 @@ public class BaseInventoryBackpack implements IInventory{ * even when this returns false */ @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { // Don't want to be able to store the inventory item within itself // Bad things will happen, like losing your inventory @@ -181,32 +180,32 @@ public class BaseInventoryBackpack implements IInventory{ /** * A custom method to read our inventory from an ItemStack's NBT compound */ - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(final NBTTagCompound compound) { // Gets the custom taglist we wrote to this compound, if any // 1.7.2+ change to compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND); - NBTTagList items = compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND); - - if ("".equals(uniqueID)) + final NBTTagList items = compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND); + + if ("".equals(this.uniqueID)) { // try to read unique ID from NBT - uniqueID = compound.getString("uniqueID"); + this.uniqueID = compound.getString("uniqueID"); // if it's still "", assign a new one: - if ("".equals(uniqueID)) + if ("".equals(this.uniqueID)) { - uniqueID = UUID.randomUUID().toString(); + this.uniqueID = UUID.randomUUID().toString(); } } for (int i = 0; i < items.tagCount(); ++i) { // 1.7.2+ change to items.getCompoundTagAt(i) - NBTTagCompound item = (NBTTagCompound) items.getCompoundTagAt(i); - int slot = item.getInteger("Slot"); + final NBTTagCompound item = items.getCompoundTagAt(i); + final int slot = item.getInteger("Slot"); // Just double-checking that the saved slot index is within our inventory array bounds - if (slot >= 0 && slot < getSizeInventory()) { - inventory[slot] = ItemStack.loadItemStackFromNBT(item); + if ((slot >= 0) && (slot < this.getSizeInventory())) { + this.inventory[slot] = ItemStack.loadItemStackFromNBT(item); } } } @@ -214,21 +213,21 @@ public class BaseInventoryBackpack implements IInventory{ /** * A custom method to write our inventory to an ItemStack's NBT compound */ - public void writeToNBT(NBTTagCompound tagcompound) + public void writeToNBT(final NBTTagCompound tagcompound) { // Create a new NBT Tag List to store itemstacks as NBT Tags - NBTTagList items = new NBTTagList(); + final NBTTagList items = new NBTTagList(); - for (int i = 0; i < getSizeInventory(); ++i) + for (int i = 0; i < this.getSizeInventory(); ++i) { // Only write stacks that contain items - if (getStackInSlot(i) != null) + if (this.getStackInSlot(i) != null) { // Make a new NBT Tag Compound to write the itemstack and slot index to - NBTTagCompound item = new NBTTagCompound(); + final NBTTagCompound item = new NBTTagCompound(); item.setInteger("Slot", i); // Writes the itemstack in slot(i) to the Tag Compound we just made - getStackInSlot(i).writeToNBT(item); + this.getStackInSlot(i).writeToNBT(item); // add the tag compound to our tag list items.appendTag(item); diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryFishTrap.java b/src/Java/gtPlusPlus/core/inventories/InventoryFishTrap.java index d3e2de8b99..429ff517c1 100644 --- a/src/Java/gtPlusPlus/core/inventories/InventoryFishTrap.java +++ b/src/Java/gtPlusPlus/core/inventories/InventoryFishTrap.java @@ -1,6 +1,5 @@ package gtPlusPlus.core.inventories; -import gtPlusPlus.core.util.Utils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -9,113 +8,113 @@ import net.minecraft.nbt.NBTTagList; public class InventoryFishTrap implements IInventory{ - private String name = "Fishtrap"; + private final String name = "Fishtrap"; /** Defining your inventory size this way is handy */ public static final int INV_SIZE = 15; /** Inventory's size must be same as number of slots you add to the Container class */ private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - public void readFromNBT(NBTTagCompound nbt){ - NBTTagList list = nbt.getTagList("Items", 10); - inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++){ - NBTTagCompound data = list.getCompoundTagAt(i); - int slot = data.getInteger("Slot"); - if(slot >= 0 && slot < INV_SIZE){ - //Utils.LOG_INFO("Trying to read NBT data from inventory."); - inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(NBTTagCompound nbt){ - NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++){ - ItemStack stack = inventory[i]; - if(stack != null){ - //Utils.LOG_INFO("Trying to write NBT data to inventory."); - NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - + + public void readFromNBT(final NBTTagCompound nbt){ + final NBTTagList list = nbt.getTagList("Items", 10); + this.inventory = new ItemStack[INV_SIZE]; + for(int i = 0;i<list.tagCount();i++){ + final NBTTagCompound data = list.getCompoundTagAt(i); + final int slot = data.getInteger("Slot"); + if((slot >= 0) && (slot < INV_SIZE)){ + //Utils.LOG_INFO("Trying to read NBT data from inventory."); + this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); + } + } + } + + public void writeToNBT(final NBTTagCompound nbt){ + final NBTTagList list = new NBTTagList(); + for(int i = 0;i<INV_SIZE;i++){ + final ItemStack stack = this.inventory[i]; + if(stack != null){ + //Utils.LOG_INFO("Trying to write NBT data to inventory."); + final NBTTagCompound data = new NBTTagCompound(); + stack.writeToNBT(data); + data.setInteger("Slot", i); + list.appendTag(data); + } + } + nbt.setTag("Items", list); + } + @Override public int getSizeInventory() { - return inventory.length; + return this.inventory.length; } - + public ItemStack[] getInventory(){ - return inventory; + return this.inventory; } @Override - public ItemStack getStackInSlot(int slot) + public ItemStack getStackInSlot(final int slot) { - return inventory[slot]; + return this.inventory[slot]; } @Override - public ItemStack decrStackSize(int slot, int amount) + public ItemStack decrStackSize(final int slot, final int amount) { - ItemStack stack = getStackInSlot(slot); + ItemStack stack = this.getStackInSlot(slot); if(stack != null) { if(stack.stackSize > amount) { stack = stack.splitStack(amount); // Don't forget this line or your inventory will not be saved! - markDirty(); + this.markDirty(); } else { // this method also calls markDirty, so we don't need to call it again - setInventorySlotContents(slot, null); + this.setInventorySlotContents(slot, null); } } return stack; } @Override - public ItemStack getStackInSlotOnClosing(int slot) + public ItemStack getStackInSlotOnClosing(final int slot) { - ItemStack stack = getStackInSlot(slot); - setInventorySlotContents(slot, null); + final ItemStack stack = this.getStackInSlot(slot); + this.setInventorySlotContents(slot, null); return stack; } @Override - public void setInventorySlotContents(int slot, ItemStack stack) + public void setInventorySlotContents(final int slot, final ItemStack stack) { - inventory[slot] = stack; + this.inventory[slot] = stack; - if (stack != null && stack.stackSize > getInventoryStackLimit()) + if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) { - stack.stackSize = getInventoryStackLimit(); + stack.stackSize = this.getInventoryStackLimit(); } // Don't forget this line or your inventory will not be saved! - markDirty(); + this.markDirty(); } // 1.7.2+ renamed to getInventoryName @Override public String getInventoryName() { - return name; + return this.name; } // 1.7.2+ renamed to hasCustomInventoryName @Override public boolean hasCustomInventoryName() { - return name.length() > 0; + return this.name.length() > 0; } @Override @@ -133,21 +132,21 @@ public class InventoryFishTrap implements IInventory{ @Override public void markDirty() { - for (int i = 0; i < getSizeInventory(); ++i) + for (int i = 0; i < this.getSizeInventory(); ++i) { - ItemStack temp = getStackInSlot(i); + final ItemStack temp = this.getStackInSlot(i); if (temp != null){ //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); } - - if (temp != null && temp.stackSize == 0) { - inventory[i] = null; + + if ((temp != null) && (temp.stackSize == 0)) { + this.inventory[i] = null; } } } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { return true; } @@ -166,7 +165,7 @@ public class InventoryFishTrap implements IInventory{ * even when this returns false */ @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { // Don't want to be able to store the inventory item within itself // Bad things will happen, like losing your inventory diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java index 8d147ad21c..3ea5675ba2 100644 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java @@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagList; public class InventoryWorkbenchChest implements IInventory{ - private String name = "Inventory Chest"; + private final String name = "Inventory Chest"; /** Defining your inventory size this way is handy */ public static final int INV_SIZE = 16; @@ -20,113 +20,113 @@ public class InventoryWorkbenchChest implements IInventory{ * @param itemstack - the ItemStack to which this inventory belongs */ public InventoryWorkbenchChest() - { - + { + + } + + public void readFromNBT(final NBTTagCompound nbt) + { + final NBTTagList list = nbt.getTagList("Items", 10); + this.inventory = new ItemStack[INV_SIZE]; + for(int i = 0;i<list.tagCount();i++) + { + final NBTTagCompound data = list.getCompoundTagAt(i); + final int slot = data.getInteger("Slot"); + if((slot >= 0) && (slot < INV_SIZE)) + { + this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); + } + } } - - public void readFromNBT(NBTTagCompound nbt) - { - NBTTagList list = nbt.getTagList("Items", 10); - inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - NBTTagCompound data = list.getCompoundTagAt(i); - int slot = data.getInteger("Slot"); - if(slot >= 0 && slot < INV_SIZE) - { - inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(NBTTagCompound nbt) - { - NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - ItemStack stack = inventory[i]; - if(stack != null) - { - NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - + + public void writeToNBT(final NBTTagCompound nbt) + { + final NBTTagList list = new NBTTagList(); + for(int i = 0;i<INV_SIZE;i++) + { + final ItemStack stack = this.inventory[i]; + if(stack != null) + { + final NBTTagCompound data = new NBTTagCompound(); + stack.writeToNBT(data); + data.setInteger("Slot", i); + list.appendTag(data); + } + } + nbt.setTag("Items", list); + } + @Override public int getSizeInventory() { - return inventory.length; + return this.inventory.length; } - + public ItemStack[] getInventory(){ - return inventory; + return this.inventory; } @Override - public ItemStack getStackInSlot(int slot) + public ItemStack getStackInSlot(final int slot) { - return inventory[slot]; + return this.inventory[slot]; } @Override - public ItemStack decrStackSize(int slot, int amount) + public ItemStack decrStackSize(final int slot, final int amount) { - ItemStack stack = getStackInSlot(slot); + ItemStack stack = this.getStackInSlot(slot); if(stack != null) { if(stack.stackSize > amount) { stack = stack.splitStack(amount); // Don't forget this line or your inventory will not be saved! - markDirty(); + this.markDirty(); } else { // this method also calls markDirty, so we don't need to call it again - setInventorySlotContents(slot, null); + this.setInventorySlotContents(slot, null); } } return stack; } @Override - public ItemStack getStackInSlotOnClosing(int slot) + public ItemStack getStackInSlotOnClosing(final int slot) { - ItemStack stack = getStackInSlot(slot); - setInventorySlotContents(slot, null); + final ItemStack stack = this.getStackInSlot(slot); + this.setInventorySlotContents(slot, null); return stack; } @Override - public void setInventorySlotContents(int slot, ItemStack stack) + public void setInventorySlotContents(final int slot, final ItemStack stack) { - inventory[slot] = stack; + this.inventory[slot] = stack; - if (stack != null && stack.stackSize > getInventoryStackLimit()) + if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) { - stack.stackSize = getInventoryStackLimit(); + stack.stackSize = this.getInventoryStackLimit(); } // Don't forget this line or your inventory will not be saved! - markDirty(); + this.markDirty(); } // 1.7.2+ renamed to getInventoryName @Override public String getInventoryName() { - return name; + return this.name; } // 1.7.2+ renamed to hasCustomInventoryName @Override public boolean hasCustomInventoryName() { - return name.length() > 0; + return this.name.length() > 0; } @Override @@ -144,21 +144,21 @@ public class InventoryWorkbenchChest implements IInventory{ @Override public void markDirty() { - for (int i = 0; i < getSizeInventory(); ++i) + for (int i = 0; i < this.getSizeInventory(); ++i) { - ItemStack temp = getStackInSlot(i); + final ItemStack temp = this.getStackInSlot(i); if (temp != null){ //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); } - - if (temp != null && temp.stackSize == 0) { - inventory[i] = null; + + if ((temp != null) && (temp.stackSize == 0)) { + this.inventory[i] = null; } } } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { return true; } @@ -177,7 +177,7 @@ public class InventoryWorkbenchChest implements IInventory{ * even when this returns false */ @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { // Don't want to be able to store the inventory item within itself // Bad things will happen, like losing your inventory diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java index 8c0738cab9..e86f21c559 100644 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java @@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagList; public class InventoryWorkbenchCrafting implements IInventory{ - private String name = "Inventory Crafting"; + private final String name = "Inventory Crafting"; /** Defining your inventory size this way is handy */ public static final int INV_SIZE = 9; @@ -17,133 +17,133 @@ public class InventoryWorkbenchCrafting implements IInventory{ private ItemStack[] inventory = new ItemStack[INV_SIZE]; public final InventoryCrafting craftMatrix; public final Container parentContainer; - + public InventoryCrafting getCrafting(){ - return craftMatrix; + return this.craftMatrix; } /** * @param itemstack - the ItemStack to which this inventory belongs */ - public InventoryWorkbenchCrafting(Container containerR) + public InventoryWorkbenchCrafting(final Container containerR) { this.parentContainer = containerR; - this.craftMatrix = new InventoryCrafting(parentContainer, 3, 3); + this.craftMatrix = new InventoryCrafting(this.parentContainer, 3, 3); } - + private ItemStack[] getArrayOfCraftingItems(){ - ItemStack[] array = new ItemStack[9]; - for (int i=0; i<craftMatrix.getSizeInventory();i++){ - if(craftMatrix.getStackInSlot(i) != null){ - array[i] = craftMatrix.getStackInSlot(i); - } - } + final ItemStack[] array = new ItemStack[9]; + for (int i=0; i<this.craftMatrix.getSizeInventory();i++){ + if(this.craftMatrix.getStackInSlot(i) != null){ + array[i] = this.craftMatrix.getStackInSlot(i); + } + } return array; } - - public void readFromNBT(NBTTagCompound nbt) - { - NBTTagList list = nbt.getTagList("Items", 10); - inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - NBTTagCompound data = list.getCompoundTagAt(i); - int slot = data.getInteger("Slot"); - if(slot >= 0 && slot < INV_SIZE) - { - getInventory()[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(NBTTagCompound nbt) - { - NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - ItemStack stack = getInventory()[i]; - if(stack != null) - { - NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - + + public void readFromNBT(final NBTTagCompound nbt) + { + final NBTTagList list = nbt.getTagList("Items", 10); + this.inventory = new ItemStack[INV_SIZE]; + for(int i = 0;i<list.tagCount();i++) + { + final NBTTagCompound data = list.getCompoundTagAt(i); + final int slot = data.getInteger("Slot"); + if((slot >= 0) && (slot < INV_SIZE)) + { + this.getInventory()[slot] = ItemStack.loadItemStackFromNBT(data); + } + } + } + + public void writeToNBT(final NBTTagCompound nbt) + { + final NBTTagList list = new NBTTagList(); + for(int i = 0;i<INV_SIZE;i++) + { + final ItemStack stack = this.getInventory()[i]; + if(stack != null) + { + final NBTTagCompound data = new NBTTagCompound(); + stack.writeToNBT(data); + data.setInteger("Slot", i); + list.appendTag(data); + } + } + nbt.setTag("Items", list); + } + @Override public int getSizeInventory() { - return getInventory().length; + return this.getInventory().length; } - + public ItemStack[] getInventory(){ - return getArrayOfCraftingItems(); + return this.getArrayOfCraftingItems(); } @Override - public ItemStack getStackInSlot(int slot) + public ItemStack getStackInSlot(final int slot) { - return getInventory()[slot]; + return this.getInventory()[slot]; } @Override - public ItemStack decrStackSize(int slot, int amount) + public ItemStack decrStackSize(final int slot, final int amount) { - ItemStack stack = getStackInSlot(slot); + ItemStack stack = this.getStackInSlot(slot); if(stack != null) { if(stack.stackSize > amount) { stack = stack.splitStack(amount); // Don't forget this line or your inventory will not be saved! - markDirty(); + this.markDirty(); } else { // this method also calls markDirty, so we don't need to call it again - setInventorySlotContents(slot, null); + this.setInventorySlotContents(slot, null); } } return stack; } @Override - public ItemStack getStackInSlotOnClosing(int slot) + public ItemStack getStackInSlotOnClosing(final int slot) { - ItemStack stack = getStackInSlot(slot); - setInventorySlotContents(slot, null); + final ItemStack stack = this.getStackInSlot(slot); + this.setInventorySlotContents(slot, null); return stack; } @Override - public void setInventorySlotContents(int slot, ItemStack stack) + public void setInventorySlotContents(final int slot, final ItemStack stack) { - getInventory()[slot] = stack; + this.getInventory()[slot] = stack; - if (stack != null && stack.stackSize > getInventoryStackLimit()) + if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) { - stack.stackSize = getInventoryStackLimit(); + stack.stackSize = this.getInventoryStackLimit(); } // Don't forget this line or your inventory will not be saved! - markDirty(); + this.markDirty(); } // 1.7.2+ renamed to getInventoryName @Override public String getInventoryName() { - return name; + return this.name; } // 1.7.2+ renamed to hasCustomInventoryName @Override public boolean hasCustomInventoryName() { - return name.length() > 0; + return this.name.length() > 0; } @Override @@ -161,16 +161,16 @@ public class InventoryWorkbenchCrafting implements IInventory{ @Override public void markDirty() { - for (int i = 0; i < getSizeInventory(); ++i) + for (int i = 0; i < this.getSizeInventory(); ++i) { - if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) { - getInventory()[i] = null; + if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) { + this.getInventory()[i] = null; } } } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { return true; } @@ -189,7 +189,7 @@ public class InventoryWorkbenchCrafting implements IInventory{ * even when this returns false */ @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { // Don't want to be able to store the inventory item within itself // Bad things will happen, like losing your inventory diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java index f4fe78d458..432a425a9b 100644 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java @@ -6,19 +6,19 @@ import net.minecraft.item.ItemStack; public class InventoryWorkbenchHoloCrafting implements IInventory{ - private String name = "Inventory Crafting"; + private final String name = "Inventory Crafting"; /** Defining your inventory size this way is handy */ public static final int INV_SIZE = 9; /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; + private final ItemStack[] inventory = new ItemStack[INV_SIZE]; /** * @param itemstack - the ItemStack to which this inventory belongs */ public InventoryWorkbenchHoloCrafting() - { + { } @@ -57,67 +57,67 @@ public class InventoryWorkbenchHoloCrafting implements IInventory{ @Override public int getSizeInventory() { - return inventory.length; + return this.inventory.length; } public ItemStack[] getInventory(){ - return inventory; + return this.inventory; } @Override - public ItemStack getStackInSlot(int slot) + public ItemStack getStackInSlot(final int slot) { - return inventory[slot]; + return this.inventory[slot]; } @Override - public ItemStack decrStackSize(int slot, int amount) + public ItemStack decrStackSize(final int slot, final int amount) { - ItemStack stack = getStackInSlot(slot); + ItemStack stack = this.getStackInSlot(slot); if(stack != null) { if(stack.stackSize > amount) { stack = stack.splitStack(amount); - markDirty(); + this.markDirty(); } else { - setInventorySlotContents(slot, null); + this.setInventorySlotContents(slot, null); } } return stack; } @Override - public ItemStack getStackInSlotOnClosing(int slot) + public ItemStack getStackInSlotOnClosing(final int slot) { - ItemStack stack = getStackInSlot(slot); - setInventorySlotContents(slot, null); + final ItemStack stack = this.getStackInSlot(slot); + this.setInventorySlotContents(slot, null); return stack; } @Override - public void setInventorySlotContents(int slot, ItemStack stack) + public void setInventorySlotContents(final int slot, final ItemStack stack) { - inventory[slot] = stack; - if (stack != null && stack.stackSize > getInventoryStackLimit()) + this.inventory[slot] = stack; + if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) { - stack.stackSize = getInventoryStackLimit(); + stack.stackSize = this.getInventoryStackLimit(); } - markDirty(); + this.markDirty(); } @Override public String getInventoryName() { - return name; + return this.name; } @Override public boolean hasCustomInventoryName() { - return name.length() > 0; + return this.name.length() > 0; } @Override @@ -129,21 +129,21 @@ public class InventoryWorkbenchHoloCrafting implements IInventory{ @Override public void markDirty() { - for (int i = 0; i < getSizeInventory(); ++i) + for (int i = 0; i < this.getSizeInventory(); ++i) { - ItemStack temp = getStackInSlot(i); + final ItemStack temp = this.getStackInSlot(i); if (temp != null){ //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); } - if (temp != null && temp.stackSize == 0) { - inventory[i] = null; + if ((temp != null) && (temp.stackSize == 0)) { + this.inventory[i] = null; } } } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { return true; } @@ -156,7 +156,7 @@ public class InventoryWorkbenchHoloCrafting implements IInventory{ @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { return true; } diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java index c5da273a11..acec3f35ea 100644 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java @@ -10,11 +10,11 @@ import net.minecraft.nbt.NBTTagList; public class InventoryWorkbenchHoloSlots implements IInventory{ - private String name = "Inventory Holo"; + private final String name = "Inventory Holo"; //Output Slot public IInventory craftResult = new InventoryCraftResult(); - + /** Defining your inventory size this way is handy */ public static final int INV_SIZE = 6; @@ -29,30 +29,30 @@ public class InventoryWorkbenchHoloSlots implements IInventory{ } - public void readFromNBT(NBTTagCompound nbt) + public void readFromNBT(final NBTTagCompound nbt) { - NBTTagList list = nbt.getTagList("Items", 10); - inventory = new ItemStack[INV_SIZE]; + final NBTTagList list = nbt.getTagList("Items", 10); + this.inventory = new ItemStack[INV_SIZE]; for(int i = 0;i<list.tagCount();i++) { - NBTTagCompound data = list.getCompoundTagAt(i); - int slot = data.getInteger("Slot"); - if(slot >= 1 && slot < INV_SIZE) + final NBTTagCompound data = list.getCompoundTagAt(i); + final int slot = data.getInteger("Slot"); + if((slot >= 1) && (slot < INV_SIZE)) { - inventory[slot] = ItemStack.loadItemStackFromNBT(data); + this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); } } } - public void writeToNBT(NBTTagCompound nbt) + public void writeToNBT(final NBTTagCompound nbt) { - NBTTagList list = new NBTTagList(); + final NBTTagList list = new NBTTagList(); for(int i = 0;i<INV_SIZE;i++) { - ItemStack stack = inventory[i]; - if(stack != null && i != 0) + final ItemStack stack = this.inventory[i]; + if((stack != null) && (i != 0)) { - NBTTagCompound data = new NBTTagCompound(); + final NBTTagCompound data = new NBTTagCompound(); stack.writeToNBT(data); data.setInteger("Slot", i); list.appendTag(data); @@ -64,45 +64,45 @@ public class InventoryWorkbenchHoloSlots implements IInventory{ @Override public int getSizeInventory() { - return inventory.length; + return this.inventory.length; } public ItemStack[] getInventory(){ - return inventory; + return this.inventory; } @Override - public ItemStack getStackInSlot(int slot) + public ItemStack getStackInSlot(final int slot) { - return inventory[slot]; + return this.inventory[slot]; } @Override - public void setInventorySlotContents(int slot, ItemStack stack) + public void setInventorySlotContents(final int slot, final ItemStack stack) { - inventory[slot] = stack; + this.inventory[slot] = stack; - if (stack != null && stack.stackSize > getInventoryStackLimit()) + if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) { - stack.stackSize = getInventoryStackLimit(); + stack.stackSize = this.getInventoryStackLimit(); } // Don't forget this line or your inventory will not be saved! - markDirty(); + this.markDirty(); } // 1.7.2+ renamed to getInventoryName @Override public String getInventoryName() { - return name; + return this.name; } // 1.7.2+ renamed to hasCustomInventoryName @Override public boolean hasCustomInventoryName() { - return name.length() > 0; + return this.name.length() > 0; } @Override @@ -120,16 +120,16 @@ public class InventoryWorkbenchHoloSlots implements IInventory{ @Override public void markDirty() { - for (int i = 0; i < getSizeInventory(); ++i) + for (int i = 0; i < this.getSizeInventory(); ++i) { - if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) { - inventory[i] = null; + if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) { + this.inventory[i] = null; } } } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { return true; } @@ -148,13 +148,13 @@ public class InventoryWorkbenchHoloSlots implements IInventory{ * even when this returns false */ @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) - { + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) + { return false; } /** A list of one item containing the result of the crafting formula */ - private ItemStack[] stackResult = new ItemStack[1]; + private final ItemStack[] stackResult = new ItemStack[1]; /** * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a @@ -187,17 +187,17 @@ public class InventoryWorkbenchHoloSlots implements IInventory{ return stack; }*/ @Override - public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) - { - if (getStackInSlot(0) != null){ - Utils.LOG_INFO("getStackInSlot(0) contains "+getStackInSlot(0).getDisplayName()); + public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) + { + if (this.getStackInSlot(0) != null){ + Utils.LOG_INFO("getStackInSlot(0) contains "+this.getStackInSlot(0).getDisplayName()); if (this.stackResult[0] == null){ Utils.LOG_INFO("this.stackResult[0] == null"); - this.stackResult[0] = getStackInSlot(0); + this.stackResult[0] = this.getStackInSlot(0); } else if (this.stackResult[0] != null){ Utils.LOG_INFO("this.stackResult[0] != null"); - if (this.stackResult[0].getDisplayName().toLowerCase().equals(getStackInSlot(0).getDisplayName().toLowerCase())){ + if (this.stackResult[0].getDisplayName().toLowerCase().equals(this.getStackInSlot(0).getDisplayName().toLowerCase())){ Utils.LOG_INFO("Items are the same?"); } else { @@ -205,27 +205,27 @@ public class InventoryWorkbenchHoloSlots implements IInventory{ } } } - - if (this.stackResult[0] != null) - { + + if (this.stackResult[0] != null) + { Utils.LOG_INFO("this.stackResult[0] != null - Really never should be though. - Returning "+this.stackResult[0].getDisplayName()); - ItemStack itemstack = this.stackResult[0]; - this.stackResult[0] = null; - return itemstack; - } + final ItemStack itemstack = this.stackResult[0]; + this.stackResult[0] = null; + return itemstack; + } return null; - } + } /** * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - * like when you close a workbench GUI. */ @Override - public ItemStack getStackInSlotOnClosing(int p_70304_1_) + public ItemStack getStackInSlotOnClosing(final int p_70304_1_) { if (this.stackResult[0] != null) { - ItemStack itemstack = this.stackResult[0]; + final ItemStack itemstack = this.stackResult[0]; this.stackResult[0] = null; return itemstack; } diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java index 7e3e7c3aef..c7ff680cbc 100644 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java @@ -9,7 +9,7 @@ import net.minecraft.nbt.NBTTagList; public class InventoryWorkbenchTools implements IInventory{ - private String name = "Inventory Tools"; + private final String name = "Inventory Tools"; /** Defining your inventory size this way is handy */ public static final int INV_SIZE = 5; @@ -22,112 +22,112 @@ public class InventoryWorkbenchTools implements IInventory{ */ public InventoryWorkbenchTools() { - + + } + + public void readFromNBT(final NBTTagCompound nbt) + { + final NBTTagList list = nbt.getTagList("Items", 10); + this.inventory = new ItemStack[INV_SIZE]; + for(int i = 0;i<list.tagCount();i++) + { + final NBTTagCompound data = list.getCompoundTagAt(i); + final int slot = data.getInteger("Slot"); + if((slot >= 0) && (slot < INV_SIZE)) + { + this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); + } + } } - - public void readFromNBT(NBTTagCompound nbt) - { - NBTTagList list = nbt.getTagList("Items", 10); - inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - NBTTagCompound data = list.getCompoundTagAt(i); - int slot = data.getInteger("Slot"); - if(slot >= 0 && slot < INV_SIZE) - { - inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(NBTTagCompound nbt) - { - NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - ItemStack stack = inventory[i]; - if(stack != null) - { - NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - + + public void writeToNBT(final NBTTagCompound nbt) + { + final NBTTagList list = new NBTTagList(); + for(int i = 0;i<INV_SIZE;i++) + { + final ItemStack stack = this.inventory[i]; + if(stack != null) + { + final NBTTagCompound data = new NBTTagCompound(); + stack.writeToNBT(data); + data.setInteger("Slot", i); + list.appendTag(data); + } + } + nbt.setTag("Items", list); + } + @Override public int getSizeInventory() { - return inventory.length; + return this.inventory.length; } - + public ItemStack[] getInventory(){ - return inventory; + return this.inventory; } @Override - public ItemStack getStackInSlot(int slot) + public ItemStack getStackInSlot(final int slot) { - return inventory[slot]; + return this.inventory[slot]; } @Override - public ItemStack decrStackSize(int slot, int amount) + public ItemStack decrStackSize(final int slot, final int amount) { - ItemStack stack = getStackInSlot(slot); + ItemStack stack = this.getStackInSlot(slot); if(stack != null) { if(stack.stackSize > amount) { stack = stack.splitStack(amount); // Don't forget this line or your inventory will not be saved! - markDirty(); + this.markDirty(); } else { // this method also calls markDirty, so we don't need to call it again - setInventorySlotContents(slot, null); + this.setInventorySlotContents(slot, null); } } return stack; } @Override - public ItemStack getStackInSlotOnClosing(int slot) + public ItemStack getStackInSlotOnClosing(final int slot) { - ItemStack stack = getStackInSlot(slot); - setInventorySlotContents(slot, null); + final ItemStack stack = this.getStackInSlot(slot); + this.setInventorySlotContents(slot, null); return stack; } @Override - public void setInventorySlotContents(int slot, ItemStack stack) + public void setInventorySlotContents(final int slot, final ItemStack stack) { - inventory[slot] = stack; + this.inventory[slot] = stack; - if (stack != null && stack.stackSize > getInventoryStackLimit()) + if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) { - stack.stackSize = getInventoryStackLimit(); + stack.stackSize = this.getInventoryStackLimit(); } // Don't forget this line or your inventory will not be saved! - markDirty(); + this.markDirty(); } // 1.7.2+ renamed to getInventoryName @Override public String getInventoryName() { - return name; + return this.name; } // 1.7.2+ renamed to hasCustomInventoryName @Override public boolean hasCustomInventoryName() { - return name.length() > 0; + return this.name.length() > 0; } @Override @@ -145,16 +145,16 @@ public class InventoryWorkbenchTools implements IInventory{ @Override public void markDirty() { - for (int i = 0; i < getSizeInventory(); ++i) + for (int i = 0; i < this.getSizeInventory(); ++i) { - if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) { - inventory[i] = null; + if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) { + this.inventory[i] = null; } } } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { return true; } @@ -173,15 +173,15 @@ public class InventoryWorkbenchTools implements IInventory{ * even when this returns false */ @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { // Don't want to be able to store the inventory item within itself // Bad things will happen, like losing your inventory // Actually, this needs a custom Slot to work if (itemstack.getItem() instanceof GT_MetaGenerated_Tool){ return true; - } + } return false; } - + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java index 77f3351e59..1cc3f45844 100644 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java @@ -12,126 +12,126 @@ import net.minecraft.nbt.NBTTagList; public class InventoryWorkbenchToolsElectric implements IInventory{ - private String name = "Inventory Tools"; + private final String name = "Inventory Tools"; /** Defining your inventory size this way is handy */ public static final int INV_SIZE = 5; /** Inventory's size must be same as number of slots you add to the Container class */ private ItemStack[] inventory = new ItemStack[INV_SIZE]; - private Slot[] toolSlots = new SlotGtToolElectric[INV_SIZE]; //TODO + private final Slot[] toolSlots = new SlotGtToolElectric[INV_SIZE]; //TODO /** * @param itemstack - the ItemStack to which this inventory belongs */ public InventoryWorkbenchToolsElectric() { - + + } + + public void readFromNBT(final NBTTagCompound nbt) + { + final NBTTagList list = nbt.getTagList("Items", 10); + this.inventory = new ItemStack[INV_SIZE]; + for(int i = 0;i<list.tagCount();i++) + { + final NBTTagCompound data = list.getCompoundTagAt(i); + final int slot = data.getInteger("Slot"); + if((slot >= 0) && (slot < INV_SIZE)) + { + this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); + } + } } - - public void readFromNBT(NBTTagCompound nbt) - { - NBTTagList list = nbt.getTagList("Items", 10); - inventory = new ItemStack[INV_SIZE]; - for(int i = 0;i<list.tagCount();i++) - { - NBTTagCompound data = list.getCompoundTagAt(i); - int slot = data.getInteger("Slot"); - if(slot >= 0 && slot < INV_SIZE) - { - inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(NBTTagCompound nbt) - { - NBTTagList list = new NBTTagList(); - for(int i = 0;i<INV_SIZE;i++) - { - ItemStack stack = inventory[i]; - if(stack != null) - { - NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - + + public void writeToNBT(final NBTTagCompound nbt) + { + final NBTTagList list = new NBTTagList(); + for(int i = 0;i<INV_SIZE;i++) + { + final ItemStack stack = this.inventory[i]; + if(stack != null) + { + final NBTTagCompound data = new NBTTagCompound(); + stack.writeToNBT(data); + data.setInteger("Slot", i); + list.appendTag(data); + } + } + nbt.setTag("Items", list); + } + @Override public int getSizeInventory() { - return inventory.length; + return this.inventory.length; } - + public ItemStack[] getInventory(){ - return inventory; + return this.inventory; } @Override - public ItemStack getStackInSlot(int slot) + public ItemStack getStackInSlot(final int slot) { - return inventory[slot]; + return this.inventory[slot]; } @Override - public ItemStack decrStackSize(int slot, int amount) + public ItemStack decrStackSize(final int slot, final int amount) { - ItemStack stack = getStackInSlot(slot); + ItemStack stack = this.getStackInSlot(slot); if(stack != null) { if(stack.stackSize > amount) { stack = stack.splitStack(amount); // Don't forget this line or your inventory will not be saved! - markDirty(); + this.markDirty(); } else { // this method also calls markDirty, so we don't need to call it again - setInventorySlotContents(slot, null); + this.setInventorySlotContents(slot, null); } } return stack; } @Override - public ItemStack getStackInSlotOnClosing(int slot) + public ItemStack getStackInSlotOnClosing(final int slot) { - ItemStack stack = getStackInSlot(slot); - setInventorySlotContents(slot, null); + final ItemStack stack = this.getStackInSlot(slot); + this.setInventorySlotContents(slot, null); return stack; } @Override - public void setInventorySlotContents(int slot, ItemStack stack) + public void setInventorySlotContents(final int slot, final ItemStack stack) { - inventory[slot] = stack; + this.inventory[slot] = stack; - if (stack != null && stack.stackSize > getInventoryStackLimit()) + if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) { - stack.stackSize = getInventoryStackLimit(); + stack.stackSize = this.getInventoryStackLimit(); } // Don't forget this line or your inventory will not be saved! - markDirty(); + this.markDirty(); } // 1.7.2+ renamed to getInventoryName @Override public String getInventoryName() { - return name; + return this.name; } // 1.7.2+ renamed to hasCustomInventoryName @Override public boolean hasCustomInventoryName() { - return name.length() > 0; + return this.name.length() > 0; } @Override @@ -149,16 +149,16 @@ public class InventoryWorkbenchToolsElectric implements IInventory{ @Override public void markDirty() { - for (int i = 0; i < getSizeInventory(); ++i) + for (int i = 0; i < this.getSizeInventory(); ++i) { - if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) { - inventory[i] = null; + if ((this.getStackInSlot(i) != null) && (this.getStackInSlot(i).stackSize == 0)) { + this.inventory[i] = null; } } } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { return true; } @@ -177,15 +177,15 @@ public class InventoryWorkbenchToolsElectric implements IInventory{ * even when this returns false */ @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { // Don't want to be able to store the inventory item within itself // Bad things will happen, like losing your inventory // Actually, this needs a custom Slot to work - if (itemstack.getItem() instanceof GT_MetaGenerated_Tool || itemstack.getItem() instanceof IElectricItem){ + if ((itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof IElectricItem)){ return true; - } + } return false; } - + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 6a9ded65b9..d042fac201 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -2,6 +2,8 @@ package gtPlusPlus.core.item; import static gtPlusPlus.core.creative.AddToCreativeTab.tabMachines; import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; import static gtPlusPlus.core.lib.CORE.LOAD_ALL_CONTENT; + +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.Materials; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.common.compat.COMPAT_Baubles; @@ -11,17 +13,19 @@ import gtPlusPlus.core.item.base.dusts.decimal.BaseItemCentidust; import gtPlusPlus.core.item.base.dusts.decimal.BaseItemDecidust; import gtPlusPlus.core.item.base.foods.BaseItemFood; import gtPlusPlus.core.item.base.foods.BaseItemHotFood; -import gtPlusPlus.core.item.base.ingots.BaseItemIngotOLD; +import gtPlusPlus.core.item.base.ingots.BaseItemIngot_OLD; import gtPlusPlus.core.item.base.plates.BaseItemPlate; import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble; +import gtPlusPlus.core.item.effects.RarityRare; import gtPlusPlus.core.item.effects.RarityUncommon; import gtPlusPlus.core.item.general.*; import gtPlusPlus.core.item.init.ItemsFoods; import gtPlusPlus.core.item.init.ItemsMultiTools; import gtPlusPlus.core.item.tool.misc.SandstoneHammer; import gtPlusPlus.core.item.tool.staballoy.*; -import gtPlusPlus.core.lib.*; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.CORE.configSwitches; +import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.*; import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.material.nuclear.NUCLIDE; @@ -36,12 +40,12 @@ import net.minecraft.item.Item.ToolMaterial; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fluids.Fluid; -import cpw.mods.fml.common.registry.GameRegistry; public final class ModItems { public static ToolMaterial STABALLOY = EnumHelper.addToolMaterial("Staballoy", 3, 2500, 7, 1.0F, 18); public static Item AAA_Broken; + public static Item itemAlkalusDisk; public static Item itemDebugShapeSpawner; @@ -189,7 +193,7 @@ public final class ModItems { public static BaseItemPlate itemPlateClay; public static BaseItemPlateDouble itemDoublePlateClay; - + public static Item dustFertUN18; public static Item dustFertUN32; @@ -200,12 +204,13 @@ public final class ModItems { public static final void init(){ //Default item used when recipes fail, handy for debugging. - AAA_Broken = new BaseItemIngotOLD("AAA_Broken", "Errors - Tell Alkalus", Utils.rgbtoHexValue(128, 128, 128), 0); + AAA_Broken = new BaseItemIngot_OLD("AAA_Broken", "Errors - Tell Alkalus", Utils.rgbtoHexValue(128, 128, 128), 0); + itemAlkalusDisk = new CoreItem("itemAlkalusDisk", AddToCreativeTab.tabMisc, 1, 0, "Unknown Use", EnumRarity.rare, EnumChatFormatting.AQUA, false, null); //Debug Loading if (CORE.DEBUG){ DEBUG_INIT.registerItems(); - } + } //Some Simple forms of materials @@ -225,7 +230,7 @@ public final class ModItems { itemHeliumBlob = new CoreItem("itemHeliumBlob", tabMisc, ItemUtils.getSimpleStack(itemHydrogenBlob)).setTextureName(CORE.MODID + ":itemHeliumBlob"); //Register this neato device, for making some fires. - itemBasicFireMaker = new ItemBasicFirestarter(); + itemBasicFireMaker = new ItemBasicFirestarter(); //Make some backpacks //Primary colours @@ -271,7 +276,7 @@ public final class ModItems { MaterialGenerator.generate(ELEMENT.getInstance().RHODIUM); MaterialGenerator.generate(ELEMENT.getInstance().RHENIUM); MaterialGenerator.generate(ELEMENT.getInstance().THALLIUM); - + //RADIOACTIVE ELEMENTS MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().TECHNETIUM, false); //LFTR byproduct MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().POLONIUM, false); @@ -279,7 +284,7 @@ public final class ModItems { MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().RADON, false); MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().FRANCIUM, false); MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().RADIUM, false); - MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().PROMETHIUM, false); + //MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().PROMETHIUM, false); MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().ACTINIUM, false); MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().PROTACTINIUM, false); MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().NEPTUNIUM, false); //LFTR byproduct @@ -288,14 +293,14 @@ public final class ModItems { MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().CALIFORNIUM, false); MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().EINSTEINIUM, false); MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().FERMIUM, false); - - - + + + //Nuclear Isotopes - - //Lithium-7 is used as a part of the molten lithium fluoride in molten salt reactors: liquid-fluoride nuclear reactors. - //The large neutron-absorption cross-section of lithium-6 (about 940 barns[5]) as compared with the very small - //neutron cross-section of lithium-7 (about 45 millibarns) makes high separation of lithium-7 from natural lithium a + + //Lithium-7 is used as a part of the molten lithium fluoride in molten salt reactors: liquid-fluoride nuclear reactors. + //The large neutron-absorption cross-section of lithium-6 (about 940 barns[5]) as compared with the very small + //neutron cross-section of lithium-7 (about 45 millibarns) makes high separation of lithium-7 from natural lithium a //strong requirement for the possible use in lithium fluoride reactors. MaterialGenerator.generate(NUCLIDE.getInstance().LITHIUM7, false); //Thorium-232 is the most stable isotope of Thorium, purified for nuclear fuel use in this case. @@ -304,11 +309,11 @@ public final class ModItems { //because of parasitic (n,2n) reactions on uranium-233 itself, or on protactinium-233, or on thorium-232: MaterialGenerator.generate(NUCLIDE.getInstance().URANIUM232); //Uranium-233 is a fissile isotope of uranium that is bred from thorium-232 as part of the thorium fuel cycle. - MaterialGenerator.generate(NUCLIDE.getInstance().URANIUM233); - //Plutonium-238 is a very powerful alpha emitter. This makes the plutonium-238 isotope suitable for usage in radioisotope thermoelectric generators (RTGs) + MaterialGenerator.generate(NUCLIDE.getInstance().URANIUM233); + //Plutonium-238 is a very powerful alpha emitter. This makes the plutonium-238 isotope suitable for usage in radioisotope thermoelectric generators (RTGs) //and radioisotope heater units - one gram of plutonium-238 generates approximately 0.5 W of thermal power. MaterialGenerator.generateNuclearMaterial(NUCLIDE.getInstance().PLUTONIUM238, false); - + //Carbides - Tungsten Carbide exists in .09 so don't generate it. - Should still come before alloys though @@ -318,7 +323,7 @@ public final class ModItems { MaterialGenerator.generate(ALLOY.SILICON_CARBIDE); MaterialGenerator.generate(ALLOY.ZIRCONIUM_CARBIDE); MaterialGenerator.generate(ALLOY.TANTALUM_CARBIDE); - MaterialGenerator.generate(ALLOY.NIOBIUM_CARBIDE); + MaterialGenerator.generate(ALLOY.NIOBIUM_CARBIDE); //Generate Fluorides @@ -334,12 +339,12 @@ public final class ModItems { MaterialGenerator.generateNuclearMaterial(FLUORIDES.NEPTUNIUM_HEXAFLUORIDE); MaterialGenerator.generateNuclearMaterial(FLUORIDES.TECHNETIUM_HEXAFLUORIDE); MaterialGenerator.generateNuclearMaterial(FLUORIDES.SELENIUM_HEXAFLUORIDE); - + //Generate Reactor Fuel Salts MaterialGenerator.generateNuclearMaterial(NUCLIDE.LiFBeF2ZrF4U235); MaterialGenerator.generateNuclearMaterial(NUCLIDE.LiFBeF2ZrF4UF4); MaterialGenerator.generateNuclearMaterial(NUCLIDE.LiFBeF2ThF4UF4); - + //Generate some Alloys @@ -348,7 +353,7 @@ public final class ModItems { MaterialGenerator.generate(ALLOY.BLOODSTEEL); MaterialGenerator.generate(ALLOY.ZERON_100); - //Tumbaga was the name given by Spaniards to a non-specific alloy of gold and copper + //Tumbaga was the name given by Spaniards to a non-specific alloy of gold and copper MaterialGenerator.generate(ALLOY.TUMBAGA); //Potin is traditionally an alloy of bronze, tin and lead, with varying quantities of each possible MaterialGenerator.generate(ALLOY.POTIN); @@ -371,7 +376,7 @@ public final class ModItems { //Composite Alloys MaterialGenerator.generate(ALLOY.STELLITE); - MaterialGenerator.generate(ALLOY.TALONITE); + MaterialGenerator.generate(ALLOY.TALONITE); //Hastelloy MaterialGenerator.generate(ALLOY.HASTELLOY_W); @@ -385,13 +390,13 @@ public final class ModItems { MaterialGenerator.generate(ALLOY.INCOLOY_MA956); //Leagrisium - MaterialGenerator.generate(ALLOY.LEAGRISIUM); + MaterialGenerator.generate(ALLOY.LEAGRISIUM); //Must be the final Alloy to Generate - MaterialGenerator.generate(ALLOY.QUANTUM); + MaterialGenerator.generate(ALLOY.QUANTUM); - } catch (Throwable r){ + } catch (final Throwable r){ Utils.LOG_INFO("Failed to Generated a Material. "+r.getMessage()); //Utils.LOG_INFO("Failed to Generated a Material. "+r.getCause().getMessage()); //Utils.LOG_INFO("Failed to Generated a Material. "+r.getStackTrace()[0].getMethodName()); @@ -403,7 +408,7 @@ public final class ModItems { //TC Style Shards, for use in making energy crystal mix. //A dull shard, able to be infused with an element. shardDull = new BaseItemTCShard("Drained", Utils.rgbtoHexValue(75, 75, 75), "Can be infused to create a magical shard.", "Obtained from Mining Stone/SandStone, Chopping Logs or Shovelling Dirt."); - + //Generates four elemental shards when TC is not installed. if (!LoadedMods.Thaumcraft){ shardAer = new BaseItemTCShard("Aer", Utils.rgbtoHexValue(225, 225, 5)); @@ -425,20 +430,20 @@ public final class ModItems { - //Nuclear Fuel Dusts + //Nuclear Fuel Dusts dustLithiumCarbonate = ItemUtils.generateSpecialUseDusts("LithiumCarbonate", "Lithium Carbonate", Utils.rgbtoHexValue(240, 240, 240))[0]; //https://en.wikipedia.org/wiki/Lithium_carbonate dustLithiumPeroxide = ItemUtils.generateSpecialUseDusts("LithiumPeroxide", "Lithium Peroxide", Utils.rgbtoHexValue(250, 250, 250))[0]; //https://en.wikipedia.org/wiki/Lithium_peroxide dustLithiumHydroxide = ItemUtils.generateSpecialUseDusts("LithiumHydroxide", "Lithium Hydroxide", Utils.rgbtoHexValue(250, 250, 250))[0]; //https://en.wikipedia.org/wiki/Lithium_hydroxide - if (ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1).getItem() == ModItems.AAA_Broken || !LoadedMods.IHL){ + if ((ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1).getItem() == ModItems.AAA_Broken) || !LoadedMods.IHL){ dustQuicklime = ItemUtils.generateSpecialUseDusts("Quicklime", "Quicklime", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_oxide } dustCalciumHydroxide = ItemUtils.generateSpecialUseDusts("CalciumHydroxide", "Hydrated Lime", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_hydroxide dustCalciumCarbonate = ItemUtils.generateSpecialUseDusts("CalciumCarbonate", "Calcium Carbonate", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_carbonate - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGypsum", 1) == null || ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustCalciumSulfate", 1) == null){ + if ((ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGypsum", 1) == null) || (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustCalciumSulfate", 1) == null)){ dustCalciumSulfate = ItemUtils.generateSpecialUseDusts("Gypsum", "Calcium Sulfate (Gypsum)", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_sulfate GT_OreDictUnificator.registerOre("dustCalciumSulfate", ItemUtils.getSimpleStack(dustCalciumSulfate)); - } + } else { GT_OreDictUnificator.registerOre("dustCalciumSulfate", ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGypsum", 1)); } @@ -446,7 +451,7 @@ public final class ModItems { //FLiBe Fuel Compounds dustLi2BeF4 = ItemUtils.generateSpecialUseDusts("Li2BeF4", "Li2BeF4 Fuel Compound", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/FLiBe - fluidFLiBeSalt = FluidUtils.generateFluid("Li2BeF4", "Li2BeF4", 7430, new short[]{255, 255, 255, 100}); + fluidFLiBeSalt = FluidUtils.generateFluid("Li2BeF4", "Li2BeF4", 7430, new short[]{255, 255, 255, 100}); //Zirconium //Cinter Pellet. @@ -459,47 +464,47 @@ public final class ModItems { GT_OreDictUnificator.registerOre("cellZrF4", ItemUtils.getItemStackOfAmountFromOreDict("cellZirconiumTetrafluoride", 1)); GT_OreDictUnificator.registerOre("dustZrF4", ItemUtils.getItemStackOfAmountFromOreDict("dustZirconiumTetrafluoride", 1)); FluidUtils.generateFluid("ZirconiumTetrafluoride", "Zirconium Tetrafluoride [ZrF4]", 500, new short[]{170, 170, 140, 100}); //https://en.wikipedia.org/wiki/Zirconium_tetrafluoride - + //Coolant Salt //NaBF4 - NaF - 621C //dustNaBF4NaF = ItemUtils.generateSpecialUseDusts("NaBF4NaF", "NaBF4NaF", Utils.rgbtoHexValue(45, 45, 90))[0]; //https://en.wikipedia.org/wiki/Zirconium_tetrafluoride - - + + //Load Tree Farmer if (CORE.configSwitches.enableMultiblock_TreeFarmer){ //https://en.wikipedia.org/wiki/UAN dustFertUN18 = ItemUtils.generateSpecialUseDusts("UN18Fertiliser", "UN-18 Fertiliser", Utils.rgbtoHexValue(60, 155, 60))[0]; dustFertUN32 = ItemUtils.generateSpecialUseDusts("UN32Fertiliser", "UN-32 Fertiliser", Utils.rgbtoHexValue(55, 190, 55))[0]; - + ItemStack temp1 = null; ItemStack temp2 = null; - + if (LoadedMods.IndustrialCraft2){ temp1 = ItemUtils.getCorrectStacktype("IC2:itemFertilizer", 1); } if (LoadedMods.Forestry){ - temp2 = ItemUtils.getCorrectStacktype("Forestry:fertilizerCompound", 1); + temp2 = ItemUtils.getCorrectStacktype("Forestry:fertilizerCompound", 1); } if (temp1 != null){ FluidUtils.generateFluidNonMolten("Fertiliser", "Fertiliser", 32, new short[]{45, 170, 45, 100}, temp1, temp2); } FluidUtils.generateFluidNonMolten("UN32Fertiliser", "UN-32 Fertiliser", 24, new short[]{55, 190, 55, 100}, null, null); FluidUtils.generateFluidNonMolten("UN18Fertiliser", "UN-18 Fertiliser", 22, new short[]{60, 155, 60, 100}, null, null); - + /*GT_Values.RA.addMixerRecipe( arg0, //Item In arg1, arg2, - arg3, + arg3, arg4, //Fluid in arg5, //Fluid Out arg6, //Item out - arg7, //Eu + arg7, //Eu arg8); //Time */ - + } - - + + //Test items metaItem2 = new BaseEuItem(); metaItem2.registerItem(0, EnumChatFormatting.BLACK+"Test Item 0", 0, 0, "I am 0."); @@ -511,7 +516,7 @@ public final class ModItems { //Create Multi-tools ItemsMultiTools.load(); - + //Just an unusual plate needed for some black magic. itemPlateClay = new BaseItemPlate(MaterialUtils.generateMaterialFromGtENUM(Materials.Clay)); itemDoublePlateClay = new BaseItemPlateDouble(MaterialUtils.generateMaterialFromGtENUM(Materials.Clay)); @@ -529,13 +534,13 @@ public final class ModItems { itemDustConductiveIron = ItemUtils.generateSpecialUseDusts("ConductiveIron", "Conductive Iron", Utils.rgbtoHexValue(164,109,100))[0]; //EnderIO Plates - itemPlateSoularium = new BaseItemPlate("itemPlate"+"Soularium", "Soularium", MaterialState.SOLID, new short[]{95, 90, 54}, 2, 0); - itemPlateRedstoneAlloy = new BaseItemPlate("itemPlate"+"RedstoneAlloy", "Redstone Alloy", MaterialState.SOLID, new short[]{178,34,34}, 2, 0); - itemPlateElectricalSteel =new BaseItemPlate("itemPlate"+"ElectricalSteel", "Electrical Steel", MaterialState.SOLID, new short[]{194, 194, 194}, 2, 0); - itemPlatePulsatingIron = new BaseItemPlate("itemPlate"+"PhasedIron", "Phased Iron", MaterialState.SOLID, new short[]{50, 91, 21}, 2, 0); - itemPlateEnergeticAlloy = new BaseItemPlate("itemPlate"+"EnergeticAlloy", "Energetic Alloy", MaterialState.SOLID, new short[]{252, 152, 45}, 2, 0); - itemPlateVibrantAlloy = new BaseItemPlate("itemPlate"+"VibrantAlloy", "Vibrant Alloy", MaterialState.SOLID, new short[]{204, 242, 142}, 2, 0); - itemPlateConductiveIron = new BaseItemPlate("itemPlate"+"ConductiveIron", "Conductive Iron", MaterialState.SOLID, new short[]{164, 109, 100}, 2, 0); + itemPlateSoularium = ItemUtils.generateSpecialUsePlate("itemPlate"+"Soularium", "Soularium", new short[]{95, 90, 54}, 0); + itemPlateRedstoneAlloy = ItemUtils.generateSpecialUsePlate("itemPlate"+"RedstoneAlloy", "Redstone Alloy", new short[]{178,34,34}, 0); + itemPlateElectricalSteel = ItemUtils.generateSpecialUsePlate("itemPlate"+"ElectricalSteel", "Electrical Steel", new short[]{194, 194, 194}, 0); + itemPlatePulsatingIron = ItemUtils.generateSpecialUsePlate("itemPlate"+"PhasedIron", "Phased Iron", new short[]{50, 91, 21}, 0); + itemPlateEnergeticAlloy = ItemUtils.generateSpecialUsePlate("itemPlate"+"EnergeticAlloy", "Energetic Alloy", new short[]{252, 152, 45}, 0); + itemPlateVibrantAlloy = ItemUtils.generateSpecialUsePlate("itemPlate"+"VibrantAlloy", "Vibrant Alloy", new short[]{204, 242, 142}, 0); + itemPlateConductiveIron = ItemUtils.generateSpecialUsePlate("itemPlate"+"ConductiveIron", "Conductive Iron", new short[]{164, 109, 100}, 0); //Register dumb naming conventions - Who chose fucking phased Iron/Gold? GT_OreDictUnificator.registerOre("dustPhasedGold", ItemUtils.getSimpleStack(itemDustVibrantAlloy)); @@ -550,11 +555,10 @@ public final class ModItems { //Big Reactors if (LoadedMods.Big_Reactors|| LOAD_ALL_CONTENT){ Utils.LOG_INFO("BigReactors Found - Loading Resources."); - //Item Init - itemPlateBlutonium = new BaseItemPlate("itemPlate"+"Blutonium", "Blutonium", MaterialState.SOLID, new short[]{0, 0, 255}, 2, 0); - itemPlateCyanite = new BaseItemPlate("itemPlate"+"Cyanite", "Cyanite", MaterialState.SOLID, new short[]{0, 191, 255}, 2, 0); - itemPlateLudicrite = new BaseItemPlate("itemPlate"+"Ludicrite", "Ludicrite", MaterialState.SOLID, new short[]{167, 5, 179}, 2, 0); - + //Item Init + itemPlateBlutonium = ItemUtils.generateSpecialUsePlate("itemPlate"+"Blutonium", "Blutonium", new short[]{0, 0, 255}, 0); + itemPlateBlutonium = ItemUtils.generateSpecialUsePlate("itemPlate"+"Cyanite", "Cyanite", new short[]{0, 191, 255}, 0); + itemPlateLudicrite = ItemUtils.generateSpecialUsePlate("itemPlate"+"Ludicrite", "Ludicrite", new short[]{167, 5, 179}, 0); } else { Utils.LOG_WARNING("BigReactors not Found - Skipping Resources."); @@ -565,11 +569,10 @@ public final class ModItems { Utils.LOG_INFO("Thaumcraft Found - Loading Resources."); //Item Init try { - - ItemUtils.getItemForOreDict("Thaumcraft:ItemResource", "ingotVoidMetal", "Void Metal Ingot", 16); - itemPlateVoidMetal = new BaseItemPlate("itemPlate"+"Void", "Void", MaterialState.SOLID, new short[]{82, 17, 82}, 2, 0); + ItemUtils.getItemForOreDict("Thaumcraft:ItemResource", "ingotVoidMetal", "Void Metal Ingot", 16); + itemPlateVoidMetal = ItemUtils.generateSpecialUsePlate("itemPlate"+"Void", "Void", new short[]{82, 17, 82}, 0); GT_OreDictUnificator.registerOre("plateVoidMetal", new ItemStack(ModItems.itemPlateVoidMetal)); - } catch (NullPointerException e){ + } catch (final NullPointerException e){ e.getClass(); } @@ -583,7 +586,7 @@ public final class ModItems { Utils.LOG_INFO("ExtraUtilities Found - Loading Resources."); try { //MaterialGenerator.generate(ALLOY.BEDROCKIUM); - } catch (NullPointerException e){ + } catch (final NullPointerException e){ e.getClass(); } } @@ -595,7 +598,7 @@ public final class ModItems { if (LoadedMods.PneumaticCraft|| LOAD_ALL_CONTENT){ Utils.LOG_INFO("PneumaticCraft Found - Loading Resources."); //Item Init - itemPlateCompressedIron = new BaseItemPlate("itemPlate"+"CompressedIron", "Compressed Iron", MaterialState.SOLID, new short[]{128, 128, 128}, 2, 0); + itemPlateCompressedIron = ItemUtils.generateSpecialUsePlate("itemPlate"+"CompressedIron", "Compressed Iron", new short[]{128, 128, 128}, 0); } else { Utils.LOG_WARNING("PneumaticCraft not Found - Skipping Resources."); @@ -617,7 +620,7 @@ public final class ModItems { if (LoadedMods.RFTools|| LOAD_ALL_CONTENT){ Utils.LOG_INFO("rfTools Found - Loading Resources."); //Item Init - itemPlateDimensionShard = new BaseItemPlate("itemPlate"+"DimensionShard", "Dimensional Shard", MaterialState.SOLID, new short[]{170, 230, 230}, 2, 0); + itemPlateDimensionShard = ItemUtils.generateSpecialUsePlate("itemPlate"+"DimensionShard", "Dimensional Shard", new short[]{170, 230, 230}, 0); } else { Utils.LOG_WARNING("rfTools not Found - Skipping Resources."); @@ -629,15 +632,15 @@ public final class ModItems { RfEuBattery = new RF2EU_Battery(); //Baubles Mod Test - try {Class baublesTest = Class.forName("baubles.api.IBauble"); - if (baublesTest != null){ + try {final Class baublesTest = Class.forName("baubles.api.IBauble"); + if (baublesTest != null){ COMPAT_Baubles.run(); } else { - Utils.LOG_INFO("Baubles Not Found - Skipping Resources."); + Utils.LOG_INFO("Baubles Not Found - Skipping Resources."); } - } catch(Throwable T){ - Utils.LOG_INFO("Baubles Not Found - Skipping Resources."); + } catch(final Throwable T){ + Utils.LOG_INFO("Baubles Not Found - Skipping Resources."); } } else { @@ -648,7 +651,8 @@ public final class ModItems { //Special Item Handling Case if (configSwitches.enableAlternativeBatteryAlloy) { //ModItems.itemIngotBatteryAlloy = new BaseItemIngot("itemIngotBatteryAlloy", "Battery Alloy", new short[]{35, 228, 141}, 0); TODO - ModItems.itemPlateBatteryAlloy = new BaseItemPlate("itemPlateBatteryAlloy", "Battery Alloy", MaterialState.SOLID, new short[]{35, 228, 141}, 2, 0); + ModItems.itemPlateBatteryAlloy = ItemUtils.generateSpecialUsePlate("itemPlateBatteryAlloy", "Battery Alloy", new short[]{35, 228, 141}, 0); + } @@ -683,6 +687,6 @@ public final class ModItems { GameRegistry.registerItem(itemPLACEHOLDER_Circuit, "itemPLACEHOLDER_Circuit"); //ItemBlockGtFrameBox = new ItemBlockGtFrameBox(ModBlocks.blockGtFrameSet1); - //GameRegistry.registerItem(ItemBlockGtFrameBox, "itemGtFrameBoxSet1"); + //GameRegistry.registerItem(ItemBlockGtFrameBox, "itemGtFrameBoxSet1"); } } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java b/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java index 21e09d2d19..8f8d0eed72 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java @@ -2,8 +2,15 @@ package gtPlusPlus.core.item.base; import static gregtech.api.enums.GT_Values.D1; import static gregtech.api.enums.GT_Values.V; + +import java.util.*; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.SubTag; import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.interfaces.IItemBehaviour; import gregtech.api.interfaces.IItemContainer; @@ -13,9 +20,6 @@ import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.array.Pair; import ic2.api.item.*; - -import java.util.*; - import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; @@ -25,272 +29,318 @@ import net.minecraft.item.*; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricItemManager { /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - private final HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>> mItemBehaviors = new HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>>(); + private final HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>> mItemBehaviors = new HashMap<>(); public final short mOffset, mItemAmount; public final BitSet mEnabledItems; public final BitSet mVisibleItems; public final IIcon[][] mIconList; - /** The unlocalized name of this item. */ - private String unlocalizedName; - - private ArrayList<Pair<Integer, EnumRarity>> rarity = new ArrayList<Pair<Integer, EnumRarity>>(); - private ArrayList<Pair<Integer, EnumChatFormatting>> descColour = new ArrayList<Pair<Integer, EnumChatFormatting>>(); - private ArrayList<Pair<Integer, String>> itemName = new ArrayList<Pair<Integer, String>>(); - private ArrayList<Pair<Integer, String>> itemDescription = new ArrayList<Pair<Integer, String>>(); - private ArrayList<Pair<Integer, Boolean>> hasEffect = new ArrayList<Pair<Integer, Boolean>>(); - - public final HashMap<Short, Long[]> mElectricStats = new HashMap<Short, Long[]>(); - public final HashMap<Short, Short> mBurnValues = new HashMap<Short, Short>(); + /** The unlocalized name of this item. */ + private String unlocalizedName; + + private final ArrayList<Pair<Integer, EnumRarity>> rarity = new ArrayList<>(); + private final ArrayList<Pair<Integer, EnumChatFormatting>> descColour = new ArrayList<>(); + private final ArrayList<Pair<Integer, String>> itemName = new ArrayList<>(); + private final ArrayList<Pair<Integer, String>> itemDescription = new ArrayList<>(); + private final ArrayList<Pair<Integer, Boolean>> hasEffect = new ArrayList<>(); + + public final HashMap<Short, Long[]> mElectricStats = new HashMap<>(); + public final HashMap<Short, Short> mBurnValues = new HashMap<>(); public BaseEuItem() { - this("MU-metaitem.02", AddToCreativeTab.tabOther, (short) 1000, (short) 31766); - } - - public BaseEuItem(String unlocalizedName, CreativeTabs creativeTab, short aOffset, short aItemAmount) { - mEnabledItems = new BitSet(aItemAmount); - mVisibleItems = new BitSet(aItemAmount); - mOffset = (short) Math.min(32766, aOffset); - mItemAmount = (short) Math.min(aItemAmount, 32766 - mOffset); - mIconList = new IIcon[aItemAmount][1]; - setHasSubtypes(true); - setMaxDamage(0); - setUnlocalizedName(unlocalizedName); - setCreativeTab(creativeTab); - setMaxStackSize(1); + this("MU-metaitem.02", AddToCreativeTab.tabOther, (short) 1000, (short) 31766); + } + + public BaseEuItem(final String unlocalizedName, final CreativeTabs creativeTab, final short aOffset, final short aItemAmount) { + this.mEnabledItems = new BitSet(aItemAmount); + this.mVisibleItems = new BitSet(aItemAmount); + this.mOffset = (short) Math.min(32766, aOffset); + this.mItemAmount = (short) Math.min(aItemAmount, 32766 - this.mOffset); + this.mIconList = new IIcon[aItemAmount][1]; + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setUnlocalizedName(unlocalizedName); + this.setCreativeTab(creativeTab); + this.setMaxStackSize(1); GameRegistry.registerItem(this, unlocalizedName); - } - - - public void registerItem(int id, String localizedName, long euStorage, int tier, String description) { - registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, EnumChatFormatting.GRAY, false); - } - - public void registerItem(int id, String localizedName, long euStorage, int tier, String description, int burnTime) { - registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, EnumChatFormatting.GRAY, false); - setBurnValue(id, burnTime); - } - - - public void registerItem(int id, String localizedName, long euStorage, short tier, String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect) { - addItem(id, localizedName, EnumChatFormatting.YELLOW+"Electric", new Object[]{}); - setElectricStats(mOffset + id, euStorage, GT_Values.V[tier], tier, -3L, true); - this.rarity.add(new Pair<Integer, EnumRarity>(id, regRarity)); - this.itemName.add(new Pair<Integer, String>(id, localizedName)); - this.itemDescription.add(new Pair<Integer, String>(id, description)); - this.descColour.add(new Pair<Integer, EnumChatFormatting>(id, colour)); - this.hasEffect.add(new Pair<Integer, Boolean>(id, Effect)); - } + } + + + public void registerItem(final int id, final String localizedName, final long euStorage, final int tier, final String description) { + this.registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, EnumChatFormatting.GRAY, false); + } + + public void registerItem(final int id, final String localizedName, final long euStorage, final int tier, final String description, final int burnTime) { + this.registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, EnumChatFormatting.GRAY, false); + this.setBurnValue(id, burnTime); + } + + + public void registerItem(final int id, final String localizedName, final long euStorage, final short tier, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect) { + this.addItem(id, localizedName, EnumChatFormatting.YELLOW+"Electric", new Object[]{}); + this.setElectricStats(this.mOffset + id, euStorage, GT_Values.V[tier], tier, -3L, true); + this.rarity.add(new Pair<>(id, regRarity)); + this.itemName.add(new Pair<>(id, localizedName)); + this.itemDescription.add(new Pair<>(id, description)); + this.descColour.add(new Pair<>(id, colour)); + this.hasEffect.add(new Pair<>(id, Effect)); + } @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ - if (rarity.get(par1ItemStack.getItemDamage()-mOffset) != null) - return rarity.get(par1ItemStack.getItemDamage()-mOffset).getValue(); + public EnumRarity getRarity(final ItemStack par1ItemStack){ + if (this.rarity.get(par1ItemStack.getItemDamage()-this.mOffset) != null) { + return this.rarity.get(par1ItemStack.getItemDamage()-this.mOffset).getValue(); + } return EnumRarity.common; } @Override - public boolean hasEffect(ItemStack par1ItemStack){ - if (hasEffect.get(par1ItemStack.getItemDamage()-mOffset) != null) - return hasEffect.get(par1ItemStack.getItemDamage()-mOffset).getValue(); + public boolean hasEffect(final ItemStack par1ItemStack){ + if (this.hasEffect.get(par1ItemStack.getItemDamage()-this.mOffset) != null) { + return this.hasEffect.get(par1ItemStack.getItemDamage()-this.mOffset).getValue(); + } return false; } - + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public final void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + public final void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, List aList, final boolean aF3_H) { //aList.add("Meta: "+(aStack.getItemDamage()-mOffset)); - if (descColour.get(aStack.getItemDamage()-mOffset) != null && itemDescription.get(aStack.getItemDamage()-mOffset) != null) - aList.add(descColour.get(aStack.getItemDamage()-mOffset).getValue()+itemDescription.get(aStack.getItemDamage()-mOffset).getValue()); - String tKey = getUnlocalizedName(aStack) + ".tooltip", tString = GT_LanguageManager.getTranslation(tKey); - if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) aList.add(tString); - Long[] tStats = getElectricStats(aStack); - if (tStats != null) { - if (tStats[3] > 0) { - aList.add(EnumChatFormatting.AQUA + "Contains " + GT_Utility.formatNumbers(tStats[3]) + " EU Tier: " + (tStats[2] >= 0 ? tStats[2] : 0) + EnumChatFormatting.GRAY); - } else { - long tCharge = getRealCharge(aStack); - if (tStats[3] == -2 && tCharge <= 0) { - aList.add(EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + EnumChatFormatting.GRAY); - } else { - aList.add(EnumChatFormatting.AQUA + "" + GT_Utility.formatNumbers(tCharge) + " / " + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + EnumChatFormatting.GRAY); - } - } - } - ArrayList<IItemBehaviour<BaseEuItem>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour<BaseEuItem> tBehavior : tList) - aList = tBehavior.getAdditionalToolTips(this, aList, aStack); - } - - + if ((this.descColour.get(aStack.getItemDamage()-this.mOffset) != null) && (this.itemDescription.get(aStack.getItemDamage()-this.mOffset) != null)) { + aList.add(this.descColour.get(aStack.getItemDamage()-this.mOffset).getValue()+this.itemDescription.get(aStack.getItemDamage()-this.mOffset).getValue()); + } + final String tKey = this.getUnlocalizedName(aStack) + ".tooltip", tString = GT_LanguageManager.getTranslation(tKey); + if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) { + aList.add(tString); + } + final Long[] tStats = this.getElectricStats(aStack); + if (tStats != null) { + if (tStats[3] > 0) { + aList.add(EnumChatFormatting.AQUA + "Contains " + GT_Utility.formatNumbers(tStats[3]) + " EU Tier: " + (tStats[2] >= 0 ? tStats[2] : 0) + EnumChatFormatting.GRAY); + } else { + final long tCharge = this.getRealCharge(aStack); + if ((tStats[3] == -2) && (tCharge <= 0)) { + aList.add(EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + EnumChatFormatting.GRAY); + } else { + aList.add(EnumChatFormatting.AQUA + "" + GT_Utility.formatNumbers(tCharge) + " / " + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + EnumChatFormatting.GRAY); + } + } + } + final ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final IItemBehaviour<BaseEuItem> tBehavior : tList) { + aList = tBehavior.getAdditionalToolTips(this, aList, aStack); + } + } + } + + @Override - public final Item getChargedItem(ItemStack itemStack) { + public final Item getChargedItem(final ItemStack itemStack) { return this; } @Override - public final Item getEmptyItem(ItemStack itemStack) { + public final Item getEmptyItem(final ItemStack itemStack) { return this; } @Override - public final double getMaxCharge(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return 0; + public final double getMaxCharge(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return 0; + } return Math.abs(tStats[0]); } @Override - public final double getTransferLimit(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return 0; + public final double getTransferLimit(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return 0; + } return Math.max(tStats[1], tStats[3]); } @Override - public final int getTier(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); + public final int getTier(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]); } @Override - public final double charge(ItemStack aStack, double aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aSimulate) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null || tStats[2] > aTier || !(tStats[3] == -1 || tStats[3] == -3 || (tStats[3] < 0 && aCharge == Integer.MAX_VALUE)) || aStack.stackSize != 1) + public final double charge(final ItemStack aStack, final double aCharge, final int aTier, final boolean aIgnoreTransferLimit, final boolean aSimulate) { + final Long[] tStats = this.getElectricStats(aStack); + if ((tStats == null) || (tStats[2] > aTier) || !((tStats[3] == -1) || (tStats[3] == -3) || ((tStats[3] < 0) && (aCharge == Integer.MAX_VALUE))) || (aStack.stackSize != 1)) { return 0; - long tChargeBefore = getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE ? Long.MAX_VALUE : Math.min(Math.abs(tStats[0]), tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); - if (!aSimulate) setCharge(aStack, tNewCharge); + } + final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE ? Long.MAX_VALUE : Math.min(Math.abs(tStats[0]), tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); + if (!aSimulate) { + this.setCharge(aStack, tNewCharge); + } return tNewCharge - tChargeBefore; } @Override - public final double discharge(ItemStack aStack, double aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aBatteryAlike, boolean aSimulate) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null || tStats[2] > aTier) return 0; - if (aBatteryAlike && !canProvideEnergy(aStack)) return 0; + public final double discharge(final ItemStack aStack, final double aCharge, final int aTier, final boolean aIgnoreTransferLimit, final boolean aBatteryAlike, final boolean aSimulate) { + final Long[] tStats = this.getElectricStats(aStack); + if ((tStats == null) || (tStats[2] > aTier)) { + return 0; + } + if (aBatteryAlike && !this.canProvideEnergy(aStack)) { + return 0; + } if (tStats[3] > 0) { - if (aCharge < tStats[3] || aStack.stackSize < 1) return 0; - if (!aSimulate) aStack.stackSize--; + if ((aCharge < tStats[3]) || (aStack.stackSize < 1)) { + return 0; + } + if (!aSimulate) { + aStack.stackSize--; + } return tStats[3]; } - long tChargeBefore = getRealCharge(aStack), tNewCharge = Math.max(0, tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); - if (!aSimulate) setCharge(aStack, tNewCharge); + final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = Math.max(0, tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); + if (!aSimulate) { + this.setCharge(aStack, tNewCharge); + } return tChargeBefore - tNewCharge; } @Override - public final double getCharge(ItemStack aStack) { - return getRealCharge(aStack); + public final double getCharge(final ItemStack aStack) { + return this.getRealCharge(aStack); } @Override - public final boolean canUse(ItemStack aStack, double aAmount) { - return getRealCharge(aStack) >= aAmount; + public final boolean canUse(final ItemStack aStack, final double aAmount) { + return this.getRealCharge(aStack) >= aAmount; } @Override - public final boolean use(ItemStack aStack, double aAmount, EntityLivingBase aPlayer) { - chargeFromArmor(aStack, aPlayer); - if (aPlayer instanceof EntityPlayer && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) return true; - double tTransfer = discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, true); + public final boolean use(final ItemStack aStack, final double aAmount, final EntityLivingBase aPlayer) { + this.chargeFromArmor(aStack, aPlayer); + if ((aPlayer instanceof EntityPlayer) && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) { + return true; + } + final double tTransfer = this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, true); if (tTransfer == aAmount) { - discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); - chargeFromArmor(aStack, aPlayer); + this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); + this.chargeFromArmor(aStack, aPlayer); return true; } - discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); - chargeFromArmor(aStack, aPlayer); + this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); + this.chargeFromArmor(aStack, aPlayer); return false; } @Override - public final boolean canProvideEnergy(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return false; - return tStats[3] > 0 || (aStack.stackSize == 1 && (tStats[3] == -2 || tStats[3] == -3)); + public final boolean canProvideEnergy(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return false; + } + return (tStats[3] > 0) || ((aStack.stackSize == 1) && ((tStats[3] == -2) || (tStats[3] == -3))); } @Override - public final void chargeFromArmor(ItemStack aStack, EntityLivingBase aPlayer) { - if (aPlayer == null || aPlayer.worldObj.isRemote) return; + public final void chargeFromArmor(final ItemStack aStack, final EntityLivingBase aPlayer) { + if ((aPlayer == null) || aPlayer.worldObj.isRemote) { + return; + } for (int i = 1; i < 5; i++) { - ItemStack tArmor = aPlayer.getEquipmentInSlot(i); + final ItemStack tArmor = aPlayer.getEquipmentInSlot(i); if (GT_ModHandler.isElectricItem(tArmor)) { - IElectricItem tArmorItem = (IElectricItem) tArmor.getItem(); - if (tArmorItem.canProvideEnergy(tArmor) && tArmorItem.getTier(tArmor) >= getTier(aStack)) { - double tCharge = ElectricItem.manager.discharge(tArmor, charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true), Integer.MAX_VALUE, true, true, false); + final IElectricItem tArmorItem = (IElectricItem) tArmor.getItem(); + if (tArmorItem.canProvideEnergy(tArmor) && (tArmorItem.getTier(tArmor) >= this.getTier(aStack))) { + final double tCharge = ElectricItem.manager.discharge(tArmor, this.charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true), Integer.MAX_VALUE, true, true, false); if (tCharge > 0) { - charge(aStack, tCharge, Integer.MAX_VALUE, true, false); + this.charge(aStack, tCharge, Integer.MAX_VALUE, true, false); if (aPlayer instanceof EntityPlayer) { - Container tContainer = ((EntityPlayer) aPlayer).openContainer; - if (tContainer != null) tContainer.detectAndSendChanges(); + final Container tContainer = ((EntityPlayer) aPlayer).openContainer; + if (tContainer != null) { + tContainer.detectAndSendChanges(); + } } } } } } - } + } - public final long getRealCharge(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return 0; - if (tStats[3] > 0) return (int) (long) tStats[3]; - NBTTagCompound tNBT = aStack.getTagCompound(); + public final long getRealCharge(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return 0; + } + if (tStats[3] > 0) { + return (int) (long) tStats[3]; + } + final NBTTagCompound tNBT = aStack.getTagCompound(); return tNBT == null ? 0 : tNBT.getLong("GT.ItemCharge"); - } + } - public final boolean setCharge(ItemStack aStack, long aCharge) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null || tStats[3] > 0) return false; + public final boolean setCharge(final ItemStack aStack, long aCharge) { + final Long[] tStats = this.getElectricStats(aStack); + if ((tStats == null) || (tStats[3] > 0)) { + return false; + } NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT == null) tNBT = new NBTTagCompound(); + if (tNBT == null) { + tNBT = new NBTTagCompound(); + } tNBT.removeTag("GT.ItemCharge"); aCharge = Math.min(tStats[0] < 0 ? Math.abs(tStats[0] / 2) : aCharge, Math.abs(tStats[0])); if (aCharge > 0) { - aStack.setItemDamage(getChargedMetaData(aStack)); + aStack.setItemDamage(this.getChargedMetaData(aStack)); tNBT.setLong("GT.ItemCharge", aCharge); } else { - aStack.setItemDamage(getEmptyMetaData(aStack)); + aStack.setItemDamage(this.getEmptyMetaData(aStack)); + } + if (tNBT.hasNoTags()) { + aStack.setTagCompound(null); + } else { + aStack.setTagCompound(tNBT); } - if (tNBT.hasNoTags()) aStack.setTagCompound(null); - else aStack.setTagCompound(tNBT); - isItemStackUsable(aStack); + this.isItemStackUsable(aStack); return true; } @SuppressWarnings("static-method") - public short getChargedMetaData(ItemStack aStack) { + public short getChargedMetaData(final ItemStack aStack) { return (short) aStack.getItemDamage(); } @SuppressWarnings("static-method") - public short getEmptyMetaData(ItemStack aStack) { + public short getEmptyMetaData(final ItemStack aStack) { return (short) aStack.getItemDamage(); } - public boolean isItemStackUsable(ItemStack aStack) { - ArrayList<IItemBehaviour<BaseEuItem>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour<BaseEuItem> tBehavior : tList) - if (!tBehavior.isItemStackUsable(this, aStack)) return false; + public boolean isItemStackUsable(final ItemStack aStack) { + final ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final IItemBehaviour<BaseEuItem> tBehavior : tList) { + if (!tBehavior.isItemStackUsable(this, aStack)) { + return false; + } + } + } return true; } @Override - public final String getToolTip(ItemStack aStack) { + public final String getToolTip(final ItemStack aStack) { return null; } // This has its own ToolTip Handler, no need to let the IC2 Handler screw us up at this Point @Override - public final IElectricItemManager getManager(ItemStack aStack) { + public final IElectricItemManager getManager(final ItemStack aStack) { return this; } // We are our own Manager @@ -301,10 +351,15 @@ public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricI * @param aValue 200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 EU) * @return the Item itself for convenience in constructing. */ - public final BaseEuItem setBurnValue(int aMetaValue, int aValue) { - if (aMetaValue < 0 || aValue < 0) return this; - if (aValue == 0) mBurnValues.remove((short) aMetaValue); - else mBurnValues.put((short) aMetaValue, aValue > Short.MAX_VALUE ? Short.MAX_VALUE : (short) aValue); + public final BaseEuItem setBurnValue(final int aMetaValue, final int aValue) { + if ((aMetaValue < 0) || (aValue < 0)) { + return this; + } + if (aValue == 0) { + this.mBurnValues.remove((short) aMetaValue); + } else { + this.mBurnValues.put((short) aMetaValue, aValue > Short.MAX_VALUE ? Short.MAX_VALUE : (short) aValue); + } return this; } @@ -319,11 +374,14 @@ public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricI * Use -3 if you want to make this Battery charge/discharge-able. * @return the Item itself for convenience in constructing. */ - public final BaseEuItem setElectricStats(int aMetaValue, long aMaxCharge, long aTransferLimit, long aTier, long aSpecialData, boolean aUseAnimations) { - if (aMetaValue < 0) return this; - if (aMaxCharge == 0) mElectricStats.remove((short) aMetaValue); - else { - mElectricStats.put((short) aMetaValue, new Long[]{aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData}); + public final BaseEuItem setElectricStats(final int aMetaValue, final long aMaxCharge, final long aTransferLimit, final long aTier, final long aSpecialData, final boolean aUseAnimations) { + if (aMetaValue < 0) { + return this; + } + if (aMaxCharge == 0) { + this.mElectricStats.remove((short) aMetaValue); + } else { + this.mElectricStats.put((short) aMetaValue, new Long[]{aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData}); } return this; } @@ -332,174 +390,187 @@ public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricI @SuppressWarnings({ "rawtypes", "unchecked" }) @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) { - for (int i = 0, j = mEnabledItems.length(); i < j; i++) - if (mVisibleItems.get(i) || (D1 && mEnabledItems.get(i))) { - Long[] tStats = mElectricStats.get((short) (mOffset + i)); - if (tStats != null && tStats[3] < 0) { - ItemStack tStack = new ItemStack(this, 1, mOffset + i); - setCharge(tStack, Math.abs(tStats[0])); - isItemStackUsable(tStack); + public void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) { + for (int i = 0, j = this.mEnabledItems.length(); i < j; i++) { + if (this.mVisibleItems.get(i) || (D1 && this.mEnabledItems.get(i))) { + final Long[] tStats = this.mElectricStats.get((short) (this.mOffset + i)); + if ((tStats != null) && (tStats[3] < 0)) { + final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); + this.setCharge(tStack, Math.abs(tStats[0])); + this.isItemStackUsable(tStack); aList.add(tStack); } - if (tStats == null || tStats[3] != -2) { - ItemStack tStack = new ItemStack(this, 1, mOffset + i); - isItemStackUsable(tStack); + if ((tStats == null) || (tStats[3] != -2)) { + final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); + this.isItemStackUsable(tStack); aList.add(tStack); } } + } } @Override @SideOnly(Side.CLIENT) - public final void registerIcons(IIconRegister aIconRegister) { - for (short i = 0, j = (short) mEnabledItems.length(); i < j; i++) - if (mEnabledItems.get(i)) { - for (byte k = 1; k < mIconList[i].length; k++) { - mIconList[i][k] = aIconRegister.registerIcon(CORE.MODID+":" + (getUnlocalizedName() + "/" + i + "/" + k)); + public final void registerIcons(final IIconRegister aIconRegister) { + for (short i = 0, j = (short) this.mEnabledItems.length(); i < j; i++) { + if (this.mEnabledItems.get(i)) { + for (byte k = 1; k < this.mIconList[i].length; k++) { + this.mIconList[i][k] = aIconRegister.registerIcon(CORE.MODID+":" + (this.getUnlocalizedName() + "/" + i + "/" + k)); } - mIconList[i][0] = aIconRegister.registerIcon(CORE.MODID+":" + (getUnlocalizedName() + "/" + i)); + this.mIconList[i][0] = aIconRegister.registerIcon(CORE.MODID+":" + (this.getUnlocalizedName() + "/" + i)); } + } + } + + + @Override + public final IIcon getIconFromDamage(final int aMetaData) { + if (aMetaData < 0) { + return null; + } + return (aMetaData - this.mOffset) < this.mIconList.length ? this.mIconList[aMetaData - this.mOffset][0] : null; } - - - @Override - public final IIcon getIconFromDamage(int aMetaData) { - if (aMetaData < 0) return null; - return aMetaData - mOffset < mIconList.length ? mIconList[aMetaData - mOffset][0] : null; - } - + /** - * Sets the unlocalized name of this item to the string passed as the parameter" - */ - @Override - public Item setUnlocalizedName(String p_77655_1_){ - this.unlocalizedName = p_77655_1_; - super.setUnlocalizedName(p_77655_1_); - return this; - } - + * Sets the unlocalized name of this item to the string passed as the parameter" + */ + @Override + public Item setUnlocalizedName(final String p_77655_1_){ + this.unlocalizedName = p_77655_1_; + super.setUnlocalizedName(p_77655_1_); + return this; + } + /** - * Returns the unlocalized name of this item. - */ - @Override + * Returns the unlocalized name of this item. + */ + @Override public String getUnlocalizedName() - { - return this.unlocalizedName; - } + { + return this.unlocalizedName; + } + + public final Long[] getElectricStats(final ItemStack aStack) { + return this.mElectricStats.get((short) aStack.getItemDamage()); + } + + @Override + public int getItemEnchantability() { + return 0; + } - public final Long[] getElectricStats(ItemStack aStack) { - return mElectricStats.get((short) aStack.getItemDamage()); + @Override + public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) { + return false; } - + @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public boolean isBookEnchantable(ItemStack aStack, ItemStack aBook) { - return false; - } - - @Override - public boolean getIsRepairable(ItemStack aStack, ItemStack aMaterial) { - return false; - } - - - /** - * Adds a special Item Behaviour to the Item. - * <p/> - * Note: the boolean Behaviours sometimes won't be executed if another boolean Behaviour returned true before. - * - * @param aMetaValue the Meta Value of the Item you want to add it to. [0 - 32765] - * @param aBehavior the Click Behavior you want to add. - * @return the Item itself for convenience in constructing. - */ - public final BaseEuItem addItemBehavior(int aMetaValue, IItemBehaviour<BaseEuItem> aBehavior) { - if (aMetaValue < 0 || aMetaValue >= 32766 || aBehavior == null) return this; - ArrayList<IItemBehaviour<BaseEuItem>> tList = mItemBehaviors.get((short) aMetaValue); - if (tList == null) { - tList = new ArrayList<IItemBehaviour<BaseEuItem>>(1); - mItemBehaviors.put((short) aMetaValue, tList); - } - tList.add(aBehavior); - return this; - } - - /** - * This adds a Custom Item to the ending Range. - * - * @param aID The Id of the assigned Item [0 - mItemAmount] (The MetaData gets auto-shifted by +mOffset) - * @param aEnglish The Default Localized Name of the created Item - * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip - * @param aFoodBehavior The Food Value of this Item. Can be null aswell. Just a convenience thing. - * @param aRandomData The OreDict Names you want to give the Item. Also used for TC Aspects and some other things. - * @return An ItemStack containing the newly created Item. - */ - @SuppressWarnings("unchecked") - public final ItemStack addItem(int aID, String aEnglish, String aToolTip, Object... aRandomData) { - if (aToolTip == null) aToolTip = ""; - if (aID >= 0 && aID < mItemAmount) { - ItemStack rStack = new ItemStack(this, 1, mOffset + aID); - mEnabledItems.set(aID); - mVisibleItems.set(aID); - GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".name", aEnglish); - GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".tooltip", aToolTip); - List<TC_AspectStack> tAspects = new ArrayList<TC_AspectStack>(); - // Important Stuff to do first - for (Object tRandomData : aRandomData) - if (tRandomData instanceof SubTag) { - if (tRandomData == SubTag.INVISIBLE) { - mVisibleItems.set(aID, false); - continue; - } - if (tRandomData == SubTag.NO_UNIFICATION) { - GT_OreDictUnificator.addToBlacklist(rStack); - continue; - } - } - // now check for the rest - for (Object tRandomData : aRandomData) - if (tRandomData != null) { - boolean tUseOreDict = true; - if (tRandomData instanceof IItemBehaviour) { - addItemBehavior(mOffset + aID, (IItemBehaviour<BaseEuItem>) tRandomData); - tUseOreDict = false; - } - if (tRandomData instanceof IItemContainer) { - ((IItemContainer) tRandomData).set(rStack); - tUseOreDict = false; - } - if (tRandomData instanceof SubTag) { - continue; - } - if (tRandomData instanceof TC_AspectStack) { - ((TC_AspectStack) tRandomData).addToAspectList(tAspects); - continue; - } - if (tRandomData instanceof ItemData) { - if (GT_Utility.isStringValid(tRandomData)) - GT_OreDictUnificator.registerOre(tRandomData, rStack); - else GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData); - continue; - } - if (tUseOreDict) { - GT_OreDictUnificator.registerOre(tRandomData, rStack); - continue; - } - } - if (GregTech_API.sThaumcraftCompat != null) - GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); - return rStack; - } - return null; - } + public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) { + return false; + } + + + /** + * Adds a special Item Behaviour to the Item. + * <p/> + * Note: the boolean Behaviours sometimes won't be executed if another boolean Behaviour returned true before. + * + * @param aMetaValue the Meta Value of the Item you want to add it to. [0 - 32765] + * @param aBehavior the Click Behavior you want to add. + * @return the Item itself for convenience in constructing. + */ + public final BaseEuItem addItemBehavior(final int aMetaValue, final IItemBehaviour<BaseEuItem> aBehavior) { + if ((aMetaValue < 0) || (aMetaValue >= 32766) || (aBehavior == null)) { + return this; + } + ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) aMetaValue); + if (tList == null) { + tList = new ArrayList<>(1); + this.mItemBehaviors.put((short) aMetaValue, tList); + } + tList.add(aBehavior); + return this; + } + + /** + * This adds a Custom Item to the ending Range. + * + * @param aID The Id of the assigned Item [0 - mItemAmount] (The MetaData gets auto-shifted by +mOffset) + * @param aEnglish The Default Localized Name of the created Item + * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip + * @param aFoodBehavior The Food Value of this Item. Can be null aswell. Just a convenience thing. + * @param aRandomData The OreDict Names you want to give the Item. Also used for TC Aspects and some other things. + * @return An ItemStack containing the newly created Item. + */ + @SuppressWarnings("unchecked") + public final ItemStack addItem(final int aID, final String aEnglish, String aToolTip, final Object... aRandomData) { + if (aToolTip == null) { + aToolTip = ""; + } + if ((aID >= 0) && (aID < this.mItemAmount)) { + final ItemStack rStack = new ItemStack(this, 1, this.mOffset + aID); + this.mEnabledItems.set(aID); + this.mVisibleItems.set(aID); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".name", aEnglish); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".tooltip", aToolTip); + final List<TC_AspectStack> tAspects = new ArrayList<>(); + // Important Stuff to do first + for (final Object tRandomData : aRandomData) { + if (tRandomData instanceof SubTag) { + if (tRandomData == SubTag.INVISIBLE) { + this.mVisibleItems.set(aID, false); + continue; + } + if (tRandomData == SubTag.NO_UNIFICATION) { + GT_OreDictUnificator.addToBlacklist(rStack); + continue; + } + } + } + // now check for the rest + for (final Object tRandomData : aRandomData) { + if (tRandomData != null) { + boolean tUseOreDict = true; + if (tRandomData instanceof IItemBehaviour) { + this.addItemBehavior(this.mOffset + aID, (IItemBehaviour<BaseEuItem>) tRandomData); + tUseOreDict = false; + } + if (tRandomData instanceof IItemContainer) { + ((IItemContainer) tRandomData).set(rStack); + tUseOreDict = false; + } + if (tRandomData instanceof SubTag) { + continue; + } + if (tRandomData instanceof TC_AspectStack) { + ((TC_AspectStack) tRandomData).addToAspectList(tAspects); + continue; + } + if (tRandomData instanceof ItemData) { + if (GT_Utility.isStringValid(tRandomData)) { + GT_OreDictUnificator.registerOre(tRandomData, rStack); + } else { + GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData); + } + continue; + } + if (tUseOreDict) { + GT_OreDictUnificator.registerOre(tRandomData, rStack); + continue; + } + } + } + if (GregTech_API.sThaumcraftCompat != null) { + GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); + } + return rStack; + } + return null; + } @Override - public String getItemStackDisplayName(ItemStack par1ItemStack) { - return itemName.get(par1ItemStack.getItemDamage()-mOffset).getValue(); + public String getItemStackDisplayName(final ItemStack par1ItemStack) { + return this.itemName.get(par1ItemStack.getItemDamage()-this.mOffset).getValue(); } } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java b/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java index 391f7bb986..a878ab5254 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.item.base; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.creative.AddToCreativeTab; @@ -12,35 +15,32 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class BaseItemBackpack extends Item{ - + protected final int colourValue; protected final String unlocalName; - - - public BaseItemBackpack(String unlocalizedName, int colour){ - this.unlocalName = unlocalizedName; - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + "itemBackpack"); - this.colourValue = colour; - GameRegistry.registerItem(this, unlocalizedName); - GT_OreDictUnificator.registerOre("storageBackpack", ItemUtils.getSimpleStack(this)); - setMaxStackSize(1); - setCreativeTab(AddToCreativeTab.tabOther); + + + public BaseItemBackpack(final String unlocalizedName, final int colour){ + this.unlocalName = unlocalizedName; + this.setUnlocalizedName(unlocalizedName); + this.setTextureName(CORE.MODID + ":" + "itemBackpack"); + this.colourValue = colour; + GameRegistry.registerItem(this, unlocalizedName); + GT_OreDictUnificator.registerOre("storageBackpack", ItemUtils.getSimpleStack(this)); + this.setMaxStackSize(1); + this.setCreativeTab(AddToCreativeTab.tabOther); } // Without this method, your inventory will NOT work!!! @Override - public int getMaxItemUseDuration(ItemStack stack) { + public int getMaxItemUseDuration(final ItemStack stack) { return 1; // return any value greater than zero } - - @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) + + @Override + public ItemStack onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer player) { if (!world.isRemote) { @@ -48,41 +48,41 @@ public class BaseItemBackpack extends Item{ if (!player.isSneaking()) { player.openGui(GTplusplus.instance, GuiHandler.GUI3, world, 0, 0, 0); } - + // Otherwise, stealthily place some diamonds in there for a nice surprise next time you open it up :) else { - // Utils.LOG_INFO("Player is Sneaking, giving them sneaky diamonds."); - // new BaseInventoryBackpack(player.getHeldItem()).setInventorySlotContents(0, new ItemStack(Items.diamond,4)); + // Utils.LOG_INFO("Player is Sneaking, giving them sneaky diamonds."); + // new BaseInventoryBackpack(player.getHeldItem()).setInventorySlotContents(0, new ItemStack(Items.diamond,4)); } } - + return itemstack; } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colourValue == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return colourValue; - } - - @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - //Name Formatting. - String temp = unlocalName.replace("backpack", ""); - //Lets find the colour. - if (temp.toLowerCase().contains("dark")){ - temp = unlocalName.substring(12, unlocalName.length()); - temp = "Dark "+ temp; - } - return (temp+" Backpack"); - } + @Override + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.colourValue == 0){ + return MathUtils.generateSingularRandomHexValue(); + } + return this.colourValue; + + } + + @Override + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + //Name Formatting. + String temp = this.unlocalName.replace("backpack", ""); + //Lets find the colour. + if (temp.toLowerCase().contains("dark")){ + temp = this.unlocalName.substring(12, this.unlocalName.length()); + temp = "Dark "+ temp; + } + return (temp+" Backpack"); + } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) + public void registerIcons(final IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(CORE.MODID + ":" + "itemBackpack"); } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java b/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java index 86cd1c8046..2521671223 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java @@ -2,18 +2,18 @@ package gtPlusPlus.core.item.base; import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; /* - * - * + * + * Key Point: You can access the NBT compound data from the Item class (in those methods that pass an ItemStack), but the NBT compound can only be set on an ItemStack. The steps to add NBT data to an ItemStack: @@ -21,25 +21,25 @@ import cpw.mods.fml.relauncher.SideOnly; Create an NBTTagCompound and fill it with the appropriate data Call ItemStack#setTagCompound() method to set it. - * + * */ public class BaseItemBrain extends Item{ // This is an array of all the types I am going to be adding. String[] brainTypes = { "dead", "preserved", "fresh", "tasty" }; - // This method allows us to have different language translation keys for + // This method allows us to have different language translation keys for // each item we add. @Override - public String getUnlocalizedName(ItemStack stack) + public String getUnlocalizedName(final ItemStack stack) { - // This makes sure that the stack has a tag compound. This is how data + // This makes sure that the stack has a tag compound. This is how data // is stored on items. - if (stack.hasTagCompound()) + if (stack.hasTagCompound()) { // This is the object holding all of the item data. - NBTTagCompound itemData = stack.getTagCompound(); - // This checks to see if the item has data stored under the + final NBTTagCompound itemData = stack.getTagCompound(); + // This checks to see if the item has data stored under the // brainType key. if (itemData.hasKey("brainType")) { @@ -54,48 +54,48 @@ public class BaseItemBrain extends Item{ // This is a fun method which allows us to run some code when our item is - // shown in a creative tab. I am going to use it to add all the brain + // shown in a creative tab. I am going to use it to add all the brain // types. @SuppressWarnings("unchecked") @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tab, List itemList) + public void getSubItems(final Item item, final CreativeTabs tab, final List itemList) { // This creates a loop with a counter. It will go through once for - // every listing in brainTypes, and gives us a number associated + // every listing in brainTypes, and gives us a number associated // with each listing. - for (int pos = 0; pos < brainTypes.length; pos++) + for (int pos = 0; pos < this.brainTypes.length; pos++) { - // This creates a new ItemStack instance. The item parameter + // This creates a new ItemStack instance. The item parameter // supplied is this item. - ItemStack brainStack = new ItemStack(item); - // By default, a new ItemStack does not have any nbt compound data. + final ItemStack brainStack = new ItemStack(item); + // By default, a new ItemStack does not have any nbt compound data. // We need to give it some. brainStack.setTagCompound(new NBTTagCompound()); - // Now we set the type of the item, brainType is the key, and + // Now we set the type of the item, brainType is the key, and // brainTypes[pos] is grabbing a // entry from the brainTypes array. - brainStack.getTagCompound().setString("brainType", - brainTypes[pos]); + brainStack.getTagCompound().setString("brainType", + this.brainTypes[pos]); // And this adds it to the itemList, which is a list of all items // in the creative tab. itemList.add(brainStack); } } - // This code will allow us to tell the items apart in game. You can change + // This code will allow us to tell the items apart in game. You can change @SuppressWarnings("unchecked") // texture based on nbt data, but I won't be covering that. @Override @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean isAdvanced){ - if ( stack.hasTagCompound() + public void addInformation(final ItemStack stack, final EntityPlayer player, final List tooltip, final boolean isAdvanced){ + if ( stack.hasTagCompound() && stack.getTagCompound().hasKey("brainType")) { // StatCollector is a class which allows us to handle string // language translation. This requires that you fill out the // translation in you language class. - tooltip.add(StatCollector.translateToLocal("tooltip.yourmod." + tooltip.add(StatCollector.translateToLocal("tooltip.yourmod." + stack.getTagCompound().getString("brainType") + ".desc")); } else // If the brain does not have valid tag data, a default message diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index 8903360943..8c6dc9a0c9 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.item.base; +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; @@ -8,16 +11,12 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.entity.EntityUtils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; - -import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; public class BaseItemComponent extends Item{ @@ -28,22 +27,22 @@ public class BaseItemComponent extends Item{ public final int componentColour; public Object extraData; - public BaseItemComponent(Material material, ComponentTypes componentType) { + public BaseItemComponent(final Material material, final ComponentTypes componentType) { this.componentMaterial = material; this.unlocalName = "item"+componentType.COMPONENT_NAME+material.getUnlocalizedName(); this.materialName = material.getLocalizedName(); this.componentType = componentType; this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalName); + this.setUnlocalizedName(this.unlocalName); this.setMaxStackSize(64); - this.setTextureName(getCorrectTextures()); + this.setTextureName(this.getCorrectTextures()); this.componentColour = material.getRgbAsHex(); - GameRegistry.registerItem(this, unlocalName); + GameRegistry.registerItem(this, this.unlocalName); GT_OreDictUnificator.registerOre(componentType.getOreDictName()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this)); } //For Cell Generation - public BaseItemComponent(String unlocalName, String localName, short[] RGBA) { + public BaseItemComponent(final String unlocalName, final String localName, final short[] RGBA) { this.componentMaterial = null; this.unlocalName = "itemCell"+unlocalName; this.materialName = localName; @@ -60,90 +59,90 @@ public class BaseItemComponent extends Item{ public String getCorrectTextures(){ if (!CORE.configSwitches.useGregtechTextures){ - return CORE.MODID + ":" + "item"+componentType.COMPONENT_NAME; + return CORE.MODID + ":" + "item"+this.componentType.COMPONENT_NAME; } - if (componentType == ComponentTypes.GEAR){ + if (this.componentType == ComponentTypes.GEAR){ return "gregtech" + ":" + "materialicons/METALLIC/" + "gearGt"; } - else if (componentType == ComponentTypes.ROD){ + else if (this.componentType == ComponentTypes.ROD){ return "gregtech" + ":" + "materialicons/METALLIC/" + "stick"; } - else if (componentType == ComponentTypes.RODLONG){ + else if (this.componentType == ComponentTypes.RODLONG){ return "gregtech" + ":" + "materialicons/METALLIC/" + "stickLong"; } - else if (componentType == ComponentTypes.PLATEDOUBLE){ + else if (this.componentType == ComponentTypes.PLATEDOUBLE){ return "gregtech" + ":" + "materialicons/METALLIC/" + "plateDouble"; } - return "gregtech" + ":" + "materialicons/METALLIC/" + componentType.COMPONENT_NAME.toLowerCase(); + return "gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME.toLowerCase(); } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { - if (componentMaterial != null) { - return (componentMaterial.getLocalizedName()+componentType.DISPLAY_NAME); + if (this.componentMaterial != null) { + return (this.componentMaterial.getLocalizedName()+this.componentType.DISPLAY_NAME); } - return materialName+" Cell"; + return this.materialName+" Cell"; } public final String getMaterialName() { - return materialName; + return this.materialName; } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public final void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public final void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("") && componentMaterial != null){ + if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("") && (this.componentMaterial != null)){ - if (componentType == ComponentTypes.DUST){ + if (this.componentType == ComponentTypes.DUST){ //list.add(EnumChatFormatting.GRAY+"A pile of " + materialName + " dust."); } - if (componentType == ComponentTypes.INGOT){ - //list.add(EnumChatFormatting.GRAY+"A solid ingot of " + materialName + "."); - if (materialName != null && materialName != "" && !materialName.equals("") && unlocalName.toLowerCase().contains("ingothot")){ - list.add(EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.RED+"Very hot! "+EnumChatFormatting.GRAY+" Avoid direct handling.."); + if (this.componentType == ComponentTypes.INGOT){ + //list.add(EnumChatFormatting.GRAY+"A solid ingot of " + materialName + "."); + if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("") && this.unlocalName.toLowerCase().contains("ingothot")){ + list.add(EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.RED+"Very hot! "+EnumChatFormatting.GRAY+" Avoid direct handling.."); } } - if (componentType == ComponentTypes.PLATE){ - //list.add(EnumChatFormatting.GRAY+"A flat plate of " + materialName + "."); + if (this.componentType == ComponentTypes.PLATE){ + //list.add(EnumChatFormatting.GRAY+"A flat plate of " + materialName + "."); } - if (componentType == ComponentTypes.PLATEDOUBLE){ - //list.add(EnumChatFormatting.GRAY+"A double plate of " + materialName + "."); + if (this.componentType == ComponentTypes.PLATEDOUBLE){ + //list.add(EnumChatFormatting.GRAY+"A double plate of " + materialName + "."); } - if (componentType == ComponentTypes.ROD){ - //list.add(EnumChatFormatting.GRAY+"A 40cm Rod of " + materialName + "."); + if (this.componentType == ComponentTypes.ROD){ + //list.add(EnumChatFormatting.GRAY+"A 40cm Rod of " + materialName + "."); } - if (componentType == ComponentTypes.RODLONG){ + if (this.componentType == ComponentTypes.RODLONG){ //list.add(EnumChatFormatting.GRAY+"A 80cm Rod of " + materialName + "."); } - if (componentType == ComponentTypes.ROTOR){ - //list.add(EnumChatFormatting.GRAY+"A Rotor made out of " + materialName + ". "); + if (this.componentType == ComponentTypes.ROTOR){ + //list.add(EnumChatFormatting.GRAY+"A Rotor made out of " + materialName + ". "); } - if (componentType == ComponentTypes.BOLT){ - //list.add(EnumChatFormatting.GRAY+"A small Bolt, constructed from " + materialName + "."); + if (this.componentType == ComponentTypes.BOLT){ + //list.add(EnumChatFormatting.GRAY+"A small Bolt, constructed from " + materialName + "."); } - if (componentType == ComponentTypes.SCREW){ - //list.add(EnumChatFormatting.GRAY+"A 8mm Screw, fabricated out of some " + materialName + "."); + if (this.componentType == ComponentTypes.SCREW){ + //list.add(EnumChatFormatting.GRAY+"A 8mm Screw, fabricated out of some " + materialName + "."); } - if (componentType == ComponentTypes.GEAR){ + if (this.componentType == ComponentTypes.GEAR){ //list.add(EnumChatFormatting.GRAY+"A large Gear, constructed from " + materialName + "."); } - if (componentType == ComponentTypes.RING){ + if (this.componentType == ComponentTypes.RING){ //list.add(EnumChatFormatting.GRAY+"A " + materialName + " Ring."); - } - if (componentMaterial != null){ - if (!componentMaterial.vChemicalFormula.equals("??") && !componentMaterial.vChemicalFormula.equals("?")) { - if (componentType != ComponentTypes.CELL || componentType != ComponentTypes.PLASMACELL){ - list.add(Utils.sanitizeString(componentMaterial.vChemicalFormula)); + } + if (this.componentMaterial != null){ + if (!this.componentMaterial.vChemicalFormula.equals("??") && !this.componentMaterial.vChemicalFormula.equals("?")) { + if ((this.componentType != ComponentTypes.CELL) || (this.componentType != ComponentTypes.PLASMACELL)){ + list.add(Utils.sanitizeString(this.componentMaterial.vChemicalFormula)); } else { - list.add(Utils.sanitizeString(componentMaterial.vChemicalFormula)); + list.add(Utils.sanitizeString(this.componentMaterial.vChemicalFormula)); } } - if (componentMaterial.isRadioactive){ + if (this.componentMaterial.isRadioactive){ list.add(CORE.GT_Tooltip_Radioactive); } } @@ -155,14 +154,14 @@ public class BaseItemComponent extends Item{ @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - return componentColour; + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + return this.componentColour; } @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - if (componentMaterial != null){ - EntityUtils.applyRadiationDamageToEntity(componentMaterial.vRadioationLevel, world, entityHolding); + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { + if (this.componentMaterial != null){ + EntityUtils.applyRadiationDamageToEntity(this.componentMaterial.vRadioationLevel, world, entityHolding); } } @@ -185,30 +184,30 @@ public class BaseItemComponent extends Item{ SCREW("Screw", " Screw", "screw"), BOLT("Bolt", " Bolt", "bolt"), ROTOR("Rotor", " Rotor", "rotor"), - RING("Ring", " Ring", "ring"), - PLASMACELL("CellPlasma", " Plasma Cell", "cellPlasma"), - CELL("Cell", " Cell", "cell"), - NUGGET("Nugget", " Nugget", "nugget"); + RING("Ring", " Ring", "ring"), + PLASMACELL("CellPlasma", " Plasma Cell", "cellPlasma"), + CELL("Cell", " Cell", "cell"), + NUGGET("Nugget", " Nugget", "nugget"); private String COMPONENT_NAME; private String DISPLAY_NAME; private String OREDICT_NAME; - private ComponentTypes (final String LocalName, String DisplayName, String OreDictName){ + private ComponentTypes (final String LocalName, final String DisplayName, final String OreDictName){ this.COMPONENT_NAME = LocalName; this.DISPLAY_NAME = DisplayName; this.OREDICT_NAME = OreDictName; } public String getComponent(){ - return COMPONENT_NAME; - } + return this.COMPONENT_NAME; + } public String getName(){ - return DISPLAY_NAME; + return this.DISPLAY_NAME; } public String getOreDictName(){ - return OREDICT_NAME; + return this.OREDICT_NAME; } } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java b/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java index 431f93b3e6..3c55f066da 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java @@ -1,9 +1,8 @@ package gtPlusPlus.core.item.base; -import gtPlusPlus.core.lib.CORE; - import java.util.List; +import gtPlusPlus.core.lib.CORE; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -11,18 +10,18 @@ import net.minecraft.item.ItemStack; public class BaseItemGeneric extends Item { - public BaseItemGeneric(String unlocalizedName, CreativeTabs c, int stackSize, int maxDmg) + public BaseItemGeneric(final String unlocalizedName, final CreativeTabs c, final int stackSize, final int maxDmg) { - setUnlocalizedName(CORE.MODID + "_" + unlocalizedName); - setTextureName(CORE.MODID + ":" + unlocalizedName); - setCreativeTab(c); - setMaxStackSize(stackSize); - setMaxDamage(maxDmg); + this.setUnlocalizedName(CORE.MODID + "_" + unlocalizedName); + this.setTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(c); + this.setMaxStackSize(stackSize); + this.setMaxDamage(maxDmg); } - + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { super.addInformation(stack, aPlayer, list, bool); - } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java b/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java index ed87677970..1c92fd8455 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java @@ -1,13 +1,12 @@ package gtPlusPlus.core.item.base; +import java.util.List; + import gregtech.api.enums.Materials; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Quality; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; - -import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -22,51 +21,51 @@ public class BaseItemLoot extends Item{ private Quality lootQuality; private final Materials lootMaterial; - public BaseItemLoot(LootTypes lootType, Materials material) { + public BaseItemLoot(final LootTypes lootType, final Materials material) { this.lootTypes = lootType; this.lootMaterial = material; - this.materialName = material.mDefaultLocalName; - this.unlocalName = "item"+lootType.LOOT_TYPE+this.materialName; - this.setUnlocalizedName(unlocalName); + this.materialName = material.mDefaultLocalName; + this.unlocalName = "item"+lootType.LOOT_TYPE+this.materialName; + this.setUnlocalizedName(this.unlocalName); this.setMaxStackSize(1); this.setTextureName(CORE.MODID + ":" + "item"+lootType.LOOT_TYPE); } - + public ItemStack generateLootStack(){ - lootQuality = Quality.getRandomQuality(); + this.lootQuality = Quality.getRandomQuality(); return ItemUtils.getSimpleStack(this, 1); } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - return (materialName+lootTypes.DISPLAY_SUFFIX); + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + return (this.materialName+this.lootTypes.DISPLAY_SUFFIX); } public final String getMaterialName() { - return materialName; + return this.materialName; } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add(lootQuality.getQuality()); - + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(this.lootQuality.getQuality()); + /*if (componentMaterial.isRadioactive){ list.add(CORE.GT_Tooltip_Radioactive); - }*/ + }*/ super.addInformation(stack, aPlayer, list, bool); } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - short[] temp = lootMaterial.mRGBa; + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + final short[] temp = this.lootMaterial.mRGBa; return Utils.rgbtoHexValue(temp[0], temp[1], temp[2]); } @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { //EntityUtils.applyRadiationDamageToEntity(lootQuality.vRadioationLevel, world, entityHolding); } @@ -83,7 +82,7 @@ public class BaseItemLoot extends Item{ Helmet("Helmet", " Medium Helm", "helmet"), Chestplate("Platebody", " Chestplate", "platebody"), Leggings("Platelegs", " Platelegs", "platelegs"), - Boots("Boots", " Boots", "boots"); + Boots("Boots", " Boots", "boots"); private String LOOT_TYPE; private String DISPLAY_SUFFIX; private String OREDICT_NAME; @@ -93,13 +92,13 @@ public class BaseItemLoot extends Item{ this.OREDICT_NAME = OreDictName; } public String getLootType(){ - return LOOT_TYPE; - } + return this.LOOT_TYPE; + } public String getName(){ - return DISPLAY_SUFFIX; + return this.DISPLAY_SUFFIX; } public String getOreDictName(){ - return OREDICT_NAME; + return this.OREDICT_NAME; } } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemTCShard.java b/src/Java/gtPlusPlus/core/item/base/BaseItemTCShard.java index a8c51df7c4..7eff231e86 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemTCShard.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemTCShard.java @@ -1,20 +1,19 @@ package gtPlusPlus.core.item.base; +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; - -import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; public class BaseItemTCShard extends Item{ @@ -23,54 +22,54 @@ public class BaseItemTCShard extends Item{ public final String descriptionString; public final String descriptionString2; public final int itemColour; - - public BaseItemTCShard(String DisplayName, int colour) { + + public BaseItemTCShard(final String DisplayName, final int colour) { this(DisplayName, colour, ""); } - - public BaseItemTCShard(String DisplayName, int colour, String Description) { + + public BaseItemTCShard(final String DisplayName, final int colour, final String Description) { this(DisplayName, colour, "", Description); } - public BaseItemTCShard(String DisplayName, int colour, String Description, String Description2) { + public BaseItemTCShard(final String DisplayName, final int colour, final String Description, final String Description2) { this.unlocalName = "item"+Utils.sanitizeString(DisplayName); this.displayName = DisplayName; this.itemColour = colour; this.descriptionString = Description; this.descriptionString2 = Description2; this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalName); + this.setUnlocalizedName(this.unlocalName); this.setMaxStackSize(64); this.setTextureName(CORE.MODID + ":" + "itemShard"); - GameRegistry.registerItem(this, unlocalName); + GameRegistry.registerItem(this, this.unlocalName); GT_OreDictUnificator.registerOre("shard"+DisplayName, ItemUtils.getSimpleStack(this)); GT_OreDictUnificator.registerOre("gemInfused"+DisplayName, ItemUtils.getSimpleStack(this)); } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { return (this.displayName+" Shard"); } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (descriptionString != "" || !descriptionString.equals("")){ - list.add(EnumChatFormatting.GRAY+descriptionString); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if ((this.descriptionString != "") || !this.descriptionString.equals("")){ + list.add(EnumChatFormatting.GRAY+this.descriptionString); } - if (descriptionString2 != "" || !descriptionString2.equals("")){ - list.add(EnumChatFormatting.GRAY+descriptionString2); + if ((this.descriptionString2 != "") || !this.descriptionString2.equals("")){ + list.add(EnumChatFormatting.GRAY+this.descriptionString2); } } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - return itemColour; + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + return this.itemColour; } @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java b/src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java index c793776e37..38c0ee567f 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java @@ -1,10 +1,9 @@ package gtPlusPlus.core.item.base; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; - import java.util.List; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -17,55 +16,55 @@ public class BaseItemWithCharge extends Item{ public int int_Charge = 0; public int int_Max_Charge = 0; - - public BaseItemWithCharge(String unlocalizedName, int constructor_Charge, int constructor_Max_Charge) { + + public BaseItemWithCharge(final String unlocalizedName, final int constructor_Charge, final int constructor_Max_Charge) { this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); + this.setMaxStackSize(1); this.setCreativeTab(AddToCreativeTab.tabMachines); this.int_Charge = constructor_Charge; this.int_Max_Charge = constructor_Max_Charge; } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - int NBT_Charge = int_Charge; - int NBT_Max_Charge = int_Max_Charge; + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + int NBT_Charge = this.int_Charge; + int NBT_Max_Charge = this.int_Max_Charge; if (stack.stackTagCompound != null) { NBT_Charge = stack.stackTagCompound.getInteger("charge_Current"); NBT_Max_Charge = stack.stackTagCompound.getInteger("charge_Max"); - String tempX = String.valueOf(NBT_Charge); - String tempY = String.valueOf(NBT_Max_Charge); - String formattedX = EnumChatFormatting.RED+tempX+EnumChatFormatting.GRAY; - String formattedY = EnumChatFormatting.DARK_RED+tempY+EnumChatFormatting.GRAY; - list.add(EnumChatFormatting.GRAY+"Charge:"+formattedX+"/"+formattedY+"."); - super.addInformation(stack, aPlayer, list, bool); - } + final String tempX = String.valueOf(NBT_Charge); + final String tempY = String.valueOf(NBT_Max_Charge); + final String formattedX = EnumChatFormatting.RED+tempX+EnumChatFormatting.GRAY; + final String formattedY = EnumChatFormatting.DARK_RED+tempY+EnumChatFormatting.GRAY; + list.add(EnumChatFormatting.GRAY+"Charge:"+formattedX+"/"+formattedY+"."); + super.addInformation(stack, aPlayer, list, bool); + } } //Ticking and NBT Handling /* Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and * update it's contents. - * + * * public int fuelRemaining = 0; public int maximumFuel = 0; public String fuelType = ""; public float heat = 0; public float maxHeat = 5000; - * + * */ @Override - public void onCreated(ItemStack itemStack, World world, EntityPlayer player) { + public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) { } @Override - public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) { - + public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) { + } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) { + public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer par3Entity) { itemStack.stackTagCompound = new NBTTagCompound(); return super.onItemRightClick(itemStack, world, par3Entity); } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java b/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java index ec052ef1f9..4c9ad1e486 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java @@ -1,29 +1,28 @@ package gtPlusPlus.core.item.base; -import gtPlusPlus.core.lib.CORE; - import java.util.List; +import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; public class BaseItemWithDamageValue extends Item{ - public BaseItemWithDamageValue(String unlocalizedName) { + public BaseItemWithDamageValue(final String unlocalizedName) { this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); this.setMaxStackSize(1); this.setMaxDamage(100); } @Override - public void setDamage(ItemStack stack, int damage) { + public void setDamage(final ItemStack stack, final int damage) { super.setDamage(stack, damage); - } + } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { list.add(EnumChatFormatting.GOLD+""); super.addInformation(stack, aPlayer, list, bool); - } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java b/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java index a782e8da00..f856185cdb 100644 --- a/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java +++ b/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java @@ -1,11 +1,12 @@ package gtPlusPlus.core.item.base; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.util.Utils; - import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.util.Utils; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; import net.minecraft.client.renderer.texture.IIconRegister; @@ -15,236 +16,234 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.*; import net.minecraft.util.*; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class BasicSpawnEgg extends ItemMonsterPlacer { - @SideOnly(Side.CLIENT) - private IIcon theIcon; - protected int colorBase = 0x000000; - protected int colorSpots = 0xFFFFFF; - protected String entityMODID = ""; - protected String entityToSpawnName = ""; - protected String entityToSpawnNameFull = ""; - protected EntityLiving entityToSpawn = null; - - public BasicSpawnEgg(){ - super(); - } - - public BasicSpawnEgg(String MODID, String parEntityToSpawnName, int parPrimaryColor, int parSecondaryColor){ - setHasSubtypes(false); - maxStackSize = 64; - setCreativeTab(AddToCreativeTab.tabOther); - setEntityToSpawnName(parEntityToSpawnName); - colorBase = parPrimaryColor; - colorSpots = parSecondaryColor; - entityMODID = MODID; - - // DEBUG - Utils.LOG_WARNING("Spawn egg constructor for "+entityToSpawnName); - } - - /** - * Callback for item usage. If the item does something special on right clicking, - - * he will have one of those. Return - * True if something happen and false if it don't. This is for ITEMS, not BLOCKS - */ - @Override - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10){ - if (par3World.isRemote) - { - return true; - } - Block block = par3World.getBlock(par4, par5, par6); + @SideOnly(Side.CLIENT) + private IIcon theIcon; + protected int colorBase = 0x000000; + protected int colorSpots = 0xFFFFFF; + protected String entityMODID = ""; + protected String entityToSpawnName = ""; + protected String entityToSpawnNameFull = ""; + protected EntityLiving entityToSpawn = null; + + public BasicSpawnEgg(){ + super(); + } + + public BasicSpawnEgg(final String MODID, final String parEntityToSpawnName, final int parPrimaryColor, final int parSecondaryColor){ + this.setHasSubtypes(false); + this.maxStackSize = 64; + this.setCreativeTab(AddToCreativeTab.tabOther); + this.setEntityToSpawnName(parEntityToSpawnName); + this.colorBase = parPrimaryColor; + this.colorSpots = parSecondaryColor; + this.entityMODID = MODID; + + // DEBUG + Utils.LOG_WARNING("Spawn egg constructor for "+this.entityToSpawnName); + } + + /** + * Callback for item usage. If the item does something special on right clicking, + + * he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + @Override + public boolean onItemUse(final ItemStack par1ItemStack, final EntityPlayer par2EntityPlayer, final World par3World, int par4, int par5, int par6, final int par7, final float par8, final float par9, final float par10){ + if (par3World.isRemote) + { + return true; + } + final Block block = par3World.getBlock(par4, par5, par6); par4 += Facing.offsetsXForSide[par7]; par5 += Facing.offsetsYForSide[par7]; par6 += Facing.offsetsZForSide[par7]; double d0 = 0.0D; - if (par7 == 1 && block.getRenderType() == 11) + if ((par7 == 1) && (block.getRenderType() == 11)) { - d0 = 0.5D; + d0 = 0.5D; } - Entity entity = spawnEntity(par3World, par4 + 0.5D, par5 + d0, par6 + 0.5D); + final Entity entity = this.spawnEntity(par3World, par4 + 0.5D, par5 + d0, par6 + 0.5D); if (entity != null) { - if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) - { - ((EntityLiving)entity).setCustomNameTag(par1ItemStack.getDisplayName()); - } - - if (!par2EntityPlayer.capabilities.isCreativeMode) - { - --par1ItemStack.stackSize; - } + if ((entity instanceof EntityLivingBase) && par1ItemStack.hasDisplayName()) + { + ((EntityLiving)entity).setCustomNameTag(par1ItemStack.getDisplayName()); + } + + if (!par2EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } } return true; - } + } - /** - * Called whenever this item is equipped and the right mouse button is pressed. + /** + * Called whenever this item is equipped and the right mouse button is pressed. - *Args: itemStack, world, entityPlayer - */ - @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){ - if (par2World.isRemote) - { - return par1ItemStack; - } - MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true); + *Args: itemStack, world, entityPlayer + */ + @Override + public ItemStack onItemRightClick(final ItemStack par1ItemStack, final World par2World, final EntityPlayer par3EntityPlayer){ + if (par2World.isRemote) + { + return par1ItemStack; + } + final MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true); if (movingobjectposition == null) { - return par1ItemStack; + return par1ItemStack; } if (movingobjectposition.typeOfHit == MovingObjectPosition - .MovingObjectType.BLOCK) + .MovingObjectType.BLOCK) { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - - if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) - { - return par1ItemStack; - } - - if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack)) - { - return par1ItemStack; - } - - if (par2World.getBlock(i, j, k) instanceof BlockLiquid) - { - Entity entity = spawnEntity(par2World, i, j, k); - - if (entity != null) - { - if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) - { - ((EntityLiving)entity).setCustomNameTag(par1ItemStack.getDisplayName()); - } - - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - --par1ItemStack.stackSize; - } - } - } + final int i = movingobjectposition.blockX; + final int j = movingobjectposition.blockY; + final int k = movingobjectposition.blockZ; + + if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) + { + return par1ItemStack; + } + + if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack)) + { + return par1ItemStack; + } + + if (par2World.getBlock(i, j, k) instanceof BlockLiquid) + { + final Entity entity = this.spawnEntity(par2World, i, j, k); + + if (entity != null) + { + if ((entity instanceof EntityLivingBase) && par1ItemStack.hasDisplayName()) + { + ((EntityLiving)entity).setCustomNameTag(par1ItemStack.getDisplayName()); + } + + if (!par3EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + } + } } return par1ItemStack; - } - - /** - * Spawns the creature specified by the egg's type in the location specified by - - * the last three parameters. - * Parameters: world, entityID, x, y, z. - */ - public Entity spawnEntity(World parWorld, double parX, double parY, double parZ){ - - if (!parWorld.isRemote) // never spawn entity on client side - { - entityToSpawnNameFull = entityMODID+"."+entityToSpawnName; - if (EntityList.stringToClassMapping.containsKey(entityToSpawnNameFull)) - { - entityToSpawn = (EntityLiving) EntityList - - .createEntityByName(entityToSpawnNameFull, parWorld); - entityToSpawn.setLocationAndAngles(parX, parY, parZ, - - MathHelper.wrapAngleTo180_float(parWorld.rand.nextFloat() - - * 360.0F), 0.0F); - parWorld.spawnEntityInWorld(entityToSpawn); - entityToSpawn.onSpawnWithEgg((IEntityLivingData)null); - entityToSpawn.playLivingSound(); - } - else - { - //DEBUG - Utils.LOG_WARNING("Entity not found "+entityToSpawnName); - } - } - - return entityToSpawn; - } - - - /** - * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) - */ - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item parItem, CreativeTabs parTab, List parList){ - parList.add(new ItemStack(parItem, 1, 0)); - } - - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack par1ItemStack, int parColorType){ - return (parColorType == 0) ? colorBase : colorSpots; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses(){ - return true; - } - - @Override - // Doing this override means that there is no localization for language - // unless you specifically check for localization here and convert - public String getItemStackDisplayName(ItemStack par1ItemStack){ - return "Spawn "+entityToSpawnName; - } - - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister){ - super.registerIcons(par1IconRegister); - theIcon = par1IconRegister.registerIcon(getIconString() + "_overlay"); - } - - /** - * Gets an icon index based on an item's damage value and the given render pass - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamageForRenderPass(int parDamageVal, int parRenderPass){ - return parRenderPass > 0 ? theIcon : super.getIconFromDamageForRenderPass(parDamageVal, parRenderPass); - } - - public void setColors(int parColorBase, int parColorSpots){ - colorBase = parColorBase; - colorSpots = parColorSpots; - } - - public int getColorBase(){ - return colorBase; - } - - public int getColorSpots(){ - return colorSpots; - } - - public void setEntityToSpawnName(String parEntityToSpawnName){ - entityToSpawnName = parEntityToSpawnName; - entityToSpawnNameFull = entityMODID+"."+entityToSpawnName; - } + } + + /** + * Spawns the creature specified by the egg's type in the location specified by + + * the last three parameters. + * Parameters: world, entityID, x, y, z. + */ + public Entity spawnEntity(final World parWorld, final double parX, final double parY, final double parZ){ + + if (!parWorld.isRemote) // never spawn entity on client side + { + this.entityToSpawnNameFull = this.entityMODID+"."+this.entityToSpawnName; + if (EntityList.stringToClassMapping.containsKey(this.entityToSpawnNameFull)) + { + this.entityToSpawn = (EntityLiving) EntityList + + .createEntityByName(this.entityToSpawnNameFull, parWorld); + this.entityToSpawn.setLocationAndAngles(parX, parY, parZ, + + MathHelper.wrapAngleTo180_float(parWorld.rand.nextFloat() + + * 360.0F), 0.0F); + parWorld.spawnEntityInWorld(this.entityToSpawn); + this.entityToSpawn.onSpawnWithEgg((IEntityLivingData)null); + this.entityToSpawn.playLivingSound(); + } + else + { + //DEBUG + Utils.LOG_WARNING("Entity not found "+this.entityToSpawnName); + } + } + + return this.entityToSpawn; + } + + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(final Item parItem, final CreativeTabs parTab, final List parList){ + parList.add(new ItemStack(parItem, 1, 0)); + } + + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(final ItemStack par1ItemStack, final int parColorType){ + return (parColorType == 0) ? this.colorBase : this.colorSpots; + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses(){ + return true; + } + + @Override + // Doing this override means that there is no localization for language + // unless you specifically check for localization here and convert + public String getItemStackDisplayName(final ItemStack par1ItemStack){ + return "Spawn "+this.entityToSpawnName; + } + + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(final IIconRegister par1IconRegister){ + super.registerIcons(par1IconRegister); + this.theIcon = par1IconRegister.registerIcon(this.getIconString() + "_overlay"); + } + + /** + * Gets an icon index based on an item's damage value and the given render pass + */ + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(final int parDamageVal, final int parRenderPass){ + return parRenderPass > 0 ? this.theIcon : super.getIconFromDamageForRenderPass(parDamageVal, parRenderPass); + } + + public void setColors(final int parColorBase, final int parColorSpots){ + this.colorBase = parColorBase; + this.colorSpots = parColorSpots; + } + + public int getColorBase(){ + return this.colorBase; + } + + public int getColorSpots(){ + return this.colorSpots; + } + + public void setEntityToSpawnName(final String parEntityToSpawnName){ + this.entityToSpawnName = parEntityToSpawnName; + this.entityToSpawnNameFull = this.entityMODID+"."+this.entityToSpawnName; + } } diff --git a/src/Java/gtPlusPlus/core/item/base/CoreItem.java b/src/Java/gtPlusPlus/core/item/base/CoreItem.java index 9c7b14f648..a5f1f7f705 100644 --- a/src/Java/gtPlusPlus/core/item/base/CoreItem.java +++ b/src/Java/gtPlusPlus/core/item/base/CoreItem.java @@ -1,19 +1,18 @@ package gtPlusPlus.core.item.base; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; - import java.util.List; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.*; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class CoreItem extends Item { @@ -31,7 +30,7 @@ public class CoreItem extends Item /* * Name, Tab - 64 Stack, 0 Dmg */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab) + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab) { this(unlocalizedName, creativeTab, 64, 0); //Calls 3 } @@ -40,35 +39,35 @@ public class CoreItem extends Item /* * Name, Tab - 64 Stack, 0 Dmg */ - public CoreItem(String unlocalizedName, String displayName, CreativeTabs creativeTab) + public CoreItem(final String unlocalizedName, final String displayName, final CreativeTabs creativeTab) { this(unlocalizedName, creativeTab, 64, 0); //Calls 3 - itemName = displayName; + this.itemName = displayName; } //0.1 - /* - * Name, Tab - 64 Stack, 0 Dmg - */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, ItemStack OverrideItem) - { - this(unlocalizedName, creativeTab, 64, 0, "This item will be replaced by another when helf by a player, it is old and should not be used in recipes.", EnumRarity.uncommon, EnumChatFormatting.UNDERLINE, false, OverrideItem); //Calls 5 - } + /* + * Name, Tab - 64 Stack, 0 Dmg + */ + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final ItemStack OverrideItem) + { + this(unlocalizedName, creativeTab, 64, 0, "This item will be replaced by another when helf by a player, it is old and should not be used in recipes.", EnumRarity.uncommon, EnumChatFormatting.UNDERLINE, false, OverrideItem); //Calls 5 + } //0.1 /* * Name, Tab - 64 Stack, 0 Dmg */ - public CoreItem(String unlocalizedName, String displayName, CreativeTabs creativeTab, ItemStack OverrideItem) + public CoreItem(final String unlocalizedName, final String displayName, final CreativeTabs creativeTab, final ItemStack OverrideItem) { this(unlocalizedName, creativeTab, 64, 0, "This item will be replaced by another when helf by a player, it is old and should not be used in recipes.", EnumRarity.uncommon, EnumChatFormatting.UNDERLINE, false, OverrideItem); //Calls 5 - itemName = displayName; + this.itemName = displayName; } //1 /* * Name, Tab, Stack - 0 Dmg */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize) + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize) { this(unlocalizedName, creativeTab, stackSize, 0); //Calls 3 } @@ -76,15 +75,15 @@ public class CoreItem extends Item /* * Name, Tab, Stack, Description - 0 Dmg */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, String description) + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final String description) { this(unlocalizedName, creativeTab, stackSize, 0, description); //Calls 4 - } + } //3 /* * Name, Tab, Stack, Dmg - Description */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg) + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg) { this(unlocalizedName, creativeTab, stackSize, maxDmg, ""); //Calls 4 } @@ -92,7 +91,7 @@ public class CoreItem extends Item /* * Name, Tab, Stack, Dmg, Description */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description) + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String description) { this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, EnumChatFormatting.GRAY, false, null); //Calls 4.5 } @@ -100,7 +99,7 @@ public class CoreItem extends Item /* * Name, Tab, Stack, Dmg, Description, Text Colour - Common */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description, EnumChatFormatting colour) + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String description, final EnumChatFormatting colour) { this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, colour, false, null); //Calls 5 } @@ -109,22 +108,22 @@ public class CoreItem extends Item /* * Name, Tab, Stack, Dmg, Description, Rarity - Gray text */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description, EnumRarity rarity) + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String description, final EnumRarity rarity) { this(unlocalizedName, creativeTab, stackSize, maxDmg, description, rarity, EnumChatFormatting.GRAY, false, null); //Calls 5 } - //5 + //5 /* * Name, Tab, Stack, Dmg, Description, Rarity, Text Colour, Effect */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect, ItemStack OverrideItem) + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, final ItemStack OverrideItem) { - setUnlocalizedName(unlocalizedName); - setTextureName(CORE.MODID + ":" + unlocalizedName); - setCreativeTab(creativeTab); - setMaxStackSize(stackSize); - setMaxDamage(maxDmg); + this.setUnlocalizedName(unlocalizedName); + this.setTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(creativeTab); + this.setMaxStackSize(stackSize); + this.setMaxDamage(maxDmg); this.rarity = regRarity; this.itemDescription = description; this.descColour = colour; @@ -135,29 +134,29 @@ public class CoreItem extends Item @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add(descColour+itemDescription); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(this.descColour+this.itemDescription); //super.addInformation(stack, aPlayer, list, bool); - } + } @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ - return rarity; + public EnumRarity getRarity(final ItemStack par1ItemStack){ + return this.rarity; } @Override - public boolean hasEffect(ItemStack par1ItemStack){ - return hasEffect; + public boolean hasEffect(final ItemStack par1ItemStack){ + return this.hasEffect; } @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - if (turnsInto != null){ + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { + if (this.turnsInto != null){ if (entityHolding instanceof EntityPlayer){ - Utils.LOG_INFO("Replacing "+iStack.getDisplayName()+" with "+turnsInto.getDisplayName()+"."); - ItemStack tempTransform = turnsInto; + Utils.LOG_INFO("Replacing "+iStack.getDisplayName()+" with "+this.turnsInto.getDisplayName()+"."); + final ItemStack tempTransform = this.turnsInto; if (iStack.stackSize == 64){ tempTransform.stackSize=64; ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform)); @@ -176,9 +175,10 @@ public class CoreItem extends Item } @Override - public String getItemStackDisplayName(ItemStack tItem) { - if (itemName == null || itemName.equals("")) - return super.getItemStackDisplayName(tItem); - return itemName; + public String getItemStackDisplayName(final ItemStack tItem) { + if ((this.itemName == null) || this.itemName.equals("")) { + return super.getItemStackDisplayName(tItem); + } + return this.itemName; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java index 6292c5cde6..0420809253 100644 --- a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java +++ b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java @@ -5,7 +5,7 @@ import gtPlusPlus.core.material.Material; public class BaseItemBolt extends BaseItemComponent{ - public BaseItemBolt(Material material) { + public BaseItemBolt(final Material material) { super(material, BaseItemComponent.ComponentTypes.BOLT); } } diff --git a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java index 17af462a0f..2345c1ee8d 100644 --- a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java +++ b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.item.base.cell; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; @@ -7,8 +9,6 @@ import gtPlusPlus.core.util.Utils; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class BaseItemCell extends BaseItemComponent{ @@ -16,9 +16,9 @@ public class BaseItemCell extends BaseItemComponent{ private IIcon overlay; ComponentTypes Cell = ComponentTypes.CELL; - public BaseItemCell(Material material) { - super(material, BaseItemComponent.ComponentTypes.CELL); - fluidColour = (short[]) ((material == null) ? extraData : material.getRGBA()); + public BaseItemCell(final Material material) { + super(material, BaseItemComponent.ComponentTypes.CELL); + this.fluidColour = (short[]) ((material == null) ? this.extraData : material.getRGBA()); } @Override @@ -27,22 +27,22 @@ public class BaseItemCell extends BaseItemComponent{ return true; } - @Override - public void registerIcons(IIconRegister i) { - this.base = i.registerIcon(CORE.MODID + ":" + "item"+Cell.getComponent()); - this.overlay = i.registerIcon(CORE.MODID + ":" + "item"+Cell.getComponent()+"_Overlay"); + @Override + public void registerIcons(final IIconRegister i) { + this.base = i.registerIcon(CORE.MODID + ":" + "item"+this.Cell.getComponent()); + this.overlay = i.registerIcon(CORE.MODID + ":" + "item"+this.Cell.getComponent()+"_Overlay"); //this.overlay = cellMaterial.getFluid(1000).getFluid().get } - private short[] fluidColour; + private final short[] fluidColour; boolean upwards = true; @Override - public int getColorFromItemStack(ItemStack stack, int renderPass) { + public int getColorFromItemStack(final ItemStack stack, final int renderPass) { if (renderPass == 0){ - return Utils.rgbtoHexValue(230, 230, 230); - } - + return Utils.rgbtoHexValue(230, 230, 230); + } + /*if (tickValue == 20){ if (upwards){ @@ -56,7 +56,7 @@ public class BaseItemCell extends BaseItemComponent{ if (fluidBright >= 20) upwards = false; } } - + if (tickValue > 20){ tickValue=0; } @@ -65,12 +65,12 @@ public class BaseItemCell extends BaseItemComponent{ } return Utils.rgbtoHexValue(fluidColour[0]+fluidBright, fluidColour[1]+fluidBright, fluidColour[2]+fluidBright);*/ - return componentColour; + return this.componentColour; } @Override - public IIcon getIconFromDamageForRenderPass(int damage, int pass) { + public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { if(pass == 0) { return this.base; } diff --git a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java index ba32be9b53..fc9ebc67be 100644 --- a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java +++ b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.item.base.cell; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; @@ -10,8 +12,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class BaseItemPlasmaCell extends BaseItemComponent{ @@ -19,12 +19,12 @@ public class BaseItemPlasmaCell extends BaseItemComponent{ private IIcon overlay; ComponentTypes PlasmaCell = ComponentTypes.PLASMACELL; private int tickCounter = 0; - private int tickCounterMax = 200; - private short[] fluidColour; + private final int tickCounterMax = 200; + private final short[] fluidColour; - public BaseItemPlasmaCell(Material material) { - super(material, ComponentTypes.PLASMACELL); - fluidColour = (short[]) ((material == null) ? extraData : material.getRGBA()); + public BaseItemPlasmaCell(final Material material) { + super(material, ComponentTypes.PLASMACELL); + this.fluidColour = (short[]) ((material == null) ? this.extraData : material.getRGBA()); } @Override @@ -33,45 +33,45 @@ public class BaseItemPlasmaCell extends BaseItemComponent{ return true; } - @Override - public void registerIcons(IIconRegister i) { - this.base = i.registerIcon(CORE.MODID + ":" + "item"+PlasmaCell.getComponent()); - this.overlay = i.registerIcon(CORE.MODID + ":" + "item"+PlasmaCell.getComponent()+"_Overlay"); + @Override + public void registerIcons(final IIconRegister i) { + this.base = i.registerIcon(CORE.MODID + ":" + "item"+this.PlasmaCell.getComponent()); + this.overlay = i.registerIcon(CORE.MODID + ":" + "item"+this.PlasmaCell.getComponent()+"_Overlay"); //this.overlay = cellMaterial.getFluid(1000).getFluid().get } @Override - public int getColorFromItemStack(ItemStack stack, int renderPass) { + public int getColorFromItemStack(final ItemStack stack, final int renderPass) { if (renderPass == 0){ - return Utils.rgbtoHexValue(230, 230, 230); - } - return componentColour; + return Utils.rgbtoHexValue(230, 230, 230); + } + return this.componentColour; } @Override - public IIcon getIconFromDamageForRenderPass(int damage, int pass) { + public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { if(pass == 0) { return this.base; } return this.overlay; } - + @Override - public String getItemStackDisplayName(ItemStack cell) { - return materialName+" Plasma Cell"; + public String getItemStackDisplayName(final ItemStack cell) { + return this.materialName+" Plasma Cell"; } @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - if (componentMaterial != null){ + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { + if (this.componentMaterial != null){ if (!world.isRemote){ - if(tickCounter < tickCounterMax ){ - tickCounter++; - } - else if(tickCounter >= tickCounterMax){ + if(this.tickCounter < this.tickCounterMax ){ + this.tickCounter++; + } + else if(this.tickCounter >= this.tickCounterMax){ entityHolding.attackEntityFrom(DamageSource.onFire, 2); - tickCounter = 0; + this.tickCounter = 0; } } } diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index 42a610641e..f28f2871a8 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -1,6 +1,10 @@ package gtPlusPlus.core.item.base.dusts; import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; @@ -10,15 +14,11 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.entity.EntityUtils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; - -import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; public class BaseItemDust extends Item{ @@ -26,14 +26,14 @@ public class BaseItemDust extends Item{ protected String materialName; protected String pileType; String name = ""; - private int mTier; - private Material dustInfo; + private final int mTier; + private final Material dustInfo; - public BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, int sRadioactivity) { - setUnlocalizedName(unlocalizedName); + public BaseItemDust(final String unlocalizedName, final String materialName, final Material matInfo, final int colour, final String pileSize, final int tier, final int sRadioactivity) { + this.setUnlocalizedName(unlocalizedName); this.setUnlocalizedName(unlocalizedName); this.setMaxStackSize(64); - this.setTextureName(getCorrectTexture(pileSize)); + this.setTextureName(this.getCorrectTexture(pileSize)); this.setCreativeTab(tabMisc); this.colour = colour; @@ -44,13 +44,13 @@ public class BaseItemDust extends Item{ GameRegistry.registerItem(this, unlocalizedName); String temp = ""; - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName()); - if (getUnlocalizedName().contains("item.")){ - temp = getUnlocalizedName().replace("item.", ""); + Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); + if (this.getUnlocalizedName().contains("item.")){ + temp = this.getUnlocalizedName().replace("item.", ""); Utils.LOG_WARNING("Generating OreDict Name: "+temp); } else { - temp = getUnlocalizedName(); + temp = this.getUnlocalizedName(); } if (temp.contains("DustTiny")){ temp = temp.replace("itemD", "d"); @@ -63,73 +63,73 @@ public class BaseItemDust extends Item{ else { temp = temp.replace("itemD", "d"); Utils.LOG_WARNING("Generating OreDict Name: "+temp); - } - if (temp != null && !temp.equals("")){ + } + if ((temp != null) && !temp.equals("")){ GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); } - addFurnaceRecipe(); - addMacerationRecipe(); + this.addFurnaceRecipe(); + this.addMacerationRecipe(); } - private String getCorrectTexture(String pileSize){ + private String getCorrectTexture(final String pileSize){ if (!CORE.configSwitches.useGregtechTextures){ - if (pileSize == "dust" || pileSize == "Dust"){ + if ((pileSize == "dust") || (pileSize == "Dust")){ this.setTextureName(CORE.MODID + ":" + "dust");} else{ this.setTextureName(CORE.MODID + ":" + "dust"+pileSize); } - } + } if (pileSize.toLowerCase().contains("small")){ - return "gregtech" + ":" + "materialicons/METALLIC/dustSmall"; + return "gregtech" + ":" + "materialicons/METALLIC/dustSmall"; } else if (pileSize.toLowerCase().contains("tiny")){ - return "gregtech" + ":" + "materialicons/METALLIC/dustTiny"; - } - return "gregtech" + ":" + "materialicons/METALLIC/dust"; + return "gregtech" + ":" + "materialicons/METALLIC/dustTiny"; + } + return "gregtech" + ":" + "materialicons/METALLIC/dust"; } @Override - public String getItemStackDisplayName(ItemStack iStack) { + public String getItemStackDisplayName(final ItemStack iStack) { - if (getUnlocalizedName().contains("DustTiny")){ - name = "Tiny Pile of "+materialName + " Dust"; + if (this.getUnlocalizedName().contains("DustTiny")){ + this.name = "Tiny Pile of "+this.materialName + " Dust"; } - else if (getUnlocalizedName().contains("DustSmall")){ - name = "Small Pile of "+materialName + " Dust"; + else if (this.getUnlocalizedName().contains("DustSmall")){ + this.name = "Small Pile of "+this.materialName + " Dust"; } else { - name = materialName + " Dust"; + this.name = this.materialName + " Dust"; } - return name; + return this.name; } protected final int sRadiation; @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { + EntityUtils.applyRadiationDamageToEntity(this.sRadiation, world, entityHolding); } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { //if (pileType != null && materialName != null && pileType != "" && materialName != "" && !pileType.equals("") && !materialName.equals("")){ /*if (getUnlocalizedName().contains("DustTiny")){ - list.add(EnumChatFormatting.GRAY+"A tiny pile of " + materialName + " dust."); + list.add(EnumChatFormatting.GRAY+"A tiny pile of " + materialName + " dust."); } else if (getUnlocalizedName().contains("DustSmall")){ - list.add(EnumChatFormatting.GRAY+"A small pile of " + materialName + " dust."); + list.add(EnumChatFormatting.GRAY+"A small pile of " + materialName + " dust."); } else { list.add(EnumChatFormatting.GRAY+"A pile of " + materialName + " dust."); }*/ if (stack.getDisplayName().equalsIgnoreCase("fluorite")){ - list.add("Mined from Sandstone and Limestone."); + list.add("Mined from Sandstone and Limestone."); } - if (sRadiation > 0){ + if (this.sRadiation > 0){ list.add(CORE.GT_Tooltip_Radioactive); } - if (dustInfo != null){ - list.add(dustInfo.vChemicalFormula); + if (this.dustInfo != null){ + list.add(this.dustInfo.vChemicalFormula); } @@ -138,47 +138,47 @@ public class BaseItemDust extends Item{ } public final String getMaterialName() { - return materialName; + return this.materialName; } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colour == 0){ + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.colour == 0){ return MathUtils.generateSingularRandomHexValue(); } - return colour; + return this.colour; } private void addMacerationRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Dusts"); + Utils.LOG_WARNING("Adding recipe for "+this.materialName+" Dusts"); - String tempIngot = getUnlocalizedName().replace("item.itemDust", "ingot"); - String tempDust = getUnlocalizedName().replace("item.itemDust", "dust"); + String tempIngot = this.getUnlocalizedName().replace("item.itemDust", "ingot"); + final String tempDust = this.getUnlocalizedName().replace("item.itemDust", "dust"); ItemStack tempInputStack; ItemStack tempOutputStack; - if (getUnlocalizedName().contains("DustSmall") || getUnlocalizedName().contains("DustTiny")){ + if (this.getUnlocalizedName().contains("DustSmall") || this.getUnlocalizedName().contains("DustTiny")){ return; } - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName()); - if (getUnlocalizedName().contains("item.")){ - tempIngot = getUnlocalizedName().replace("item.", ""); + Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); + if (this.getUnlocalizedName().contains("item.")){ + tempIngot = this.getUnlocalizedName().replace("item.", ""); Utils.LOG_WARNING("Generating OreDict Name: "+tempIngot); } else { - tempIngot = getUnlocalizedName(); + tempIngot = this.getUnlocalizedName(); } tempIngot = tempIngot.replace("itemDust", "ingot"); Utils.LOG_WARNING("Generating OreDict Name: "+tempIngot); - ItemStack[] outputStacks = {dustInfo.getDust(1)}; - if (tempIngot != null && !tempIngot.equals("")){ + final ItemStack[] outputStacks = {this.dustInfo.getDust(1)}; + if ((tempIngot != null) && !tempIngot.equals("")){ tempInputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1); tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempDust, 1); ItemStack tempStackOutput2 = null; - int chance = mTier*10/MathUtils.randInt(10, 20); + final int chance = (this.mTier*10)/MathUtils.randInt(10, 20); if (outputStacks.length != 0){ if (outputStacks.length == 1){ tempStackOutput2 = null; @@ -191,68 +191,68 @@ public class BaseItemDust extends Item{ else { tempStackOutput2 = null; } - } + } } else { tempStackOutput2 = null; } - if (null != tempOutputStack && null != tempInputStack){ + if ((null != tempOutputStack) && (null != tempInputStack)){ GT_ModHandler.addPulverisationRecipe(tempInputStack, tempOutputStack.splitStack(1), tempStackOutput2, chance); } } } - private void addFurnaceRecipe(){ + private void addFurnaceRecipe(){ String temp = ""; - if (getUnlocalizedName().contains("item.")){ - temp = getUnlocalizedName().replace("item.", ""); + if (this.getUnlocalizedName().contains("item.")){ + temp = this.getUnlocalizedName().replace("item.", ""); } else { - temp = getUnlocalizedName(); + temp = this.getUnlocalizedName(); } if (temp.contains("DustTiny") || temp.contains("DustSmall")){ return; } - temp = temp.replace("itemDust", "ingot"); - if (temp != null && !temp.equals("")){ + temp = temp.replace("itemDust", "ingot"); + if ((temp != null) && !temp.equals("")){ - if (dustInfo.requiresBlastFurnace()){ - Utils.LOG_WARNING("Adding recipe for Hot "+materialName+" Ingots in a Blast furnace."); - String tempIngot = temp.replace("ingot", "ingotHot"); - ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1); + if (this.dustInfo.requiresBlastFurnace()){ + Utils.LOG_WARNING("Adding recipe for Hot "+this.materialName+" Ingots in a Blast furnace."); + final String tempIngot = temp.replace("ingot", "ingotHot"); + final ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1); if (null != tempOutputStack){ Utils.LOG_WARNING("This will produce "+tempOutputStack.getDisplayName() + " Debug: "+tempIngot); - addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*mTier); - } + this.addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*this.mTier); + } return; } - Utils.LOG_WARNING("Adding recipe for "+materialName+" Ingots in a furnace."); - ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); + Utils.LOG_WARNING("Adding recipe for "+this.materialName+" Ingots in a furnace."); + final ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); //Utils.LOG_WARNING("This will produce an ingot of "+tempOutputStack.getDisplayName() + " Debug: "+temp); if (null != tempOutputStack){ - if (mTier < 5 || !dustInfo.requiresBlastFurnace()){ + if ((this.mTier < 5) || !this.dustInfo.requiresBlastFurnace()){ if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(ItemUtils.getSimpleStack(this), tempOutputStack)){ - Utils.LOG_WARNING("Successfully added a furnace recipe for "+materialName); + Utils.LOG_WARNING("Successfully added a furnace recipe for "+this.materialName); } else { - Utils.LOG_WARNING("Failed to add a furnace recipe for "+materialName); + Utils.LOG_WARNING("Failed to add a furnace recipe for "+this.materialName); } - } - else if (mTier >= 5 || dustInfo.requiresBlastFurnace()){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Ingots in a Blast furnace."); + } + else if ((this.mTier >= 5) || this.dustInfo.requiresBlastFurnace()){ + Utils.LOG_WARNING("Adding recipe for "+this.materialName+" Ingots in a Blast furnace."); Utils.LOG_WARNING("This will produce "+tempOutputStack.getDisplayName()); if (null != tempOutputStack){ - addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*mTier); - } - return; + this.addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*this.mTier); + } + return; } } - } + } } - private void addBlastFurnaceRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, int tempRequired){ + private void addBlastFurnaceRecipe(final ItemStack input1, final ItemStack input2, final ItemStack output1, final ItemStack output2, final int tempRequired){ //Special Cases /*if (input1.getUnlocalizedName().toLowerCase().contains("tantalloy61")){ Utils.LOG_INFO("Adding Special handler for Staballoy-61 in the Blast Furnace"); @@ -270,8 +270,8 @@ public class BaseItemDust extends Item{ GT_Values.NF, GT_Values.NF, output1, output2, - 250*mTier*20, - mTier*64, + 250*this.mTier*20, + this.mTier*64, tempRequired); diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java index 3eab83f812..2062094159 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java @@ -1,33 +1,32 @@ package gtPlusPlus.core.item.base.dusts; -import gtPlusPlus.core.lib.CORE; - import java.util.List; +import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; public abstract class BaseItemDustAbstract extends Item{ - + protected int colour = 0; protected String materialName; protected String pileType; - - public BaseItemDustAbstract(String unlocalizedName, String materialName, int colour, String pileSize) { + + public BaseItemDustAbstract(final String unlocalizedName, final String materialName, final int colour, final String pileSize) { this.setUnlocalizedName(unlocalizedName); - this.setMaxStackSize(64); + this.setMaxStackSize(64); if (pileSize.toLowerCase().equals("dust")){ - this.setTextureName(CORE.MODID + ":" + "dust"); + this.setTextureName(CORE.MODID + ":" + "dust"); } else{ - this.setTextureName(CORE.MODID + ":" + "dust"+pileSize); + this.setTextureName(CORE.MODID + ":" + "dust"+pileSize); } this.setMaxStackSize(64); this.colour = colour; - this.materialName = materialName; - setUnlocalizedName(unlocalizedName); + this.materialName = materialName; + this.setUnlocalizedName(unlocalizedName); GameRegistry.registerItem(this, unlocalizedName); } @@ -39,5 +38,5 @@ public abstract class BaseItemDustAbstract extends Item{ @Override public abstract int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF); - + } diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java index a4e8c1cadc..8dc9eb8c3c 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java @@ -1,6 +1,10 @@ package gtPlusPlus.core.item.base.dusts; import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; @@ -8,15 +12,11 @@ import gtPlusPlus.core.util.entity.EntityUtils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.materials.MaterialUtils; import gtPlusPlus.core.util.math.MathUtils; - -import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; public class BaseItemDustUnique extends Item{ @@ -26,11 +26,11 @@ public class BaseItemDustUnique extends Item{ String name = ""; String chemicalNotation = ""; - public BaseItemDustUnique(String unlocalizedName, String materialName, int colour, String pileSize) { - setUnlocalizedName(unlocalizedName); + public BaseItemDustUnique(final String unlocalizedName, final String materialName, final int colour, final String pileSize) { + this.setUnlocalizedName(unlocalizedName); this.setUnlocalizedName(unlocalizedName); this.setMaxStackSize(64); - this.setTextureName(getCorrectTexture(pileSize)); + this.setTextureName(this.getCorrectTexture(pileSize)); this.setCreativeTab(tabMisc); this.colour = colour; this.materialName = materialName; @@ -39,13 +39,13 @@ public class BaseItemDustUnique extends Item{ GameRegistry.registerItem(this, unlocalizedName); String temp = ""; - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName()); - if (getUnlocalizedName().contains("item.")){ - temp = getUnlocalizedName().replace("item.", ""); + Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); + if (this.getUnlocalizedName().contains("item.")){ + temp = this.getUnlocalizedName().replace("item.", ""); Utils.LOG_WARNING("Generating OreDict Name: "+temp); } else { - temp = getUnlocalizedName(); + temp = this.getUnlocalizedName(); } if (temp.contains("DustTiny")){ temp = temp.replace("itemD", "d"); @@ -58,103 +58,157 @@ public class BaseItemDustUnique extends Item{ else { temp = temp.replace("itemD", "d"); Utils.LOG_WARNING("Generating OreDict Name: "+temp); - } - if (temp != null && !temp.equals("")){ + } + if ((temp != null) && !temp.equals("")){ GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); } } @Override - public String getItemStackDisplayName(ItemStack iStack) { + public String getItemStackDisplayName(final ItemStack iStack) { - if (getUnlocalizedName().contains("DustTiny")){ - name = "Tiny Pile of "+materialName+ " Dust"; + if (this.getUnlocalizedName().contains("DustTiny")){ + this.name = "Tiny Pile of "+this.materialName+ " Dust"; } - else if (getUnlocalizedName().contains("DustSmall")){ - name = "Small Pile of "+materialName+ " Dust"; + else if (this.getUnlocalizedName().contains("DustSmall")){ + this.name = "Small Pile of "+this.materialName+ " Dust"; } else { - name = materialName+ " Dust"; + this.name = this.materialName+ " Dust"; } - return name; + return this.name; } - private String getCorrectTexture(String pileSize){ + private String getCorrectTexture(final String pileSize){ if (!CORE.configSwitches.useGregtechTextures){ - if (pileSize == "dust" || pileSize == "Dust"){ + if ((pileSize == "dust") || (pileSize == "Dust")){ this.setTextureName(CORE.MODID + ":" + "dust");} else{ this.setTextureName(CORE.MODID + ":" + "dust"+pileSize); } - } + } if (pileSize.toLowerCase().contains("small")){ - return "gregtech" + ":" + "materialicons/SHINY/dustSmall"; + return "gregtech" + ":" + "materialicons/SHINY/dustSmall"; } else if (pileSize.toLowerCase().contains("tiny")){ - return "gregtech" + ":" + "materialicons/SHINY/dustTiny"; - } - return "gregtech" + ":" + "materialicons/SHINY/dust"; + return "gregtech" + ":" + "materialicons/SHINY/dustTiny"; + } + return "gregtech" + ":" + "materialicons/SHINY/dust"; } protected final int sRadiation; @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { + EntityUtils.applyRadiationDamageToEntity(this.sRadiation, world, entityHolding); } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (sRadiation > 0){ + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if (this.sRadiation > 0){ list.add(CORE.GT_Tooltip_Radioactive); } - if (containsSubScript(chemicalNotation)){ - list.add(chemicalNotation); + if (containsSubScript(this.chemicalNotation)){ + list.add(this.chemicalNotation); } super.addInformation(stack, aPlayer, list, bool); } - static boolean containsSubScript(String s){ - if (s.contains(MaterialUtils.superscript("1"))) return true; - if (s.contains(MaterialUtils.superscript("2"))) return true; - if (s.contains(MaterialUtils.superscript("3"))) return true; - if (s.contains(MaterialUtils.superscript("4"))) return true; - if (s.contains(MaterialUtils.superscript("5"))) return true; - if (s.contains(MaterialUtils.superscript("6"))) return true; - if (s.contains(MaterialUtils.superscript("7"))) return true; - if (s.contains(MaterialUtils.superscript("8"))) return true; - if (s.contains(MaterialUtils.superscript("9"))) return true; - if (s.contains(MaterialUtils.subscript("1"))) return true; - if (s.contains(MaterialUtils.subscript("2"))) return true; - if (s.contains(MaterialUtils.subscript("3"))) return true; - if (s.contains(MaterialUtils.subscript("4"))) return true; - if (s.contains(MaterialUtils.subscript("5"))) return true; - if (s.contains(MaterialUtils.subscript("6"))) return true; - if (s.contains(MaterialUtils.subscript("7"))) return true; - if (s.contains(MaterialUtils.subscript("8"))) return true; - if (s.contains(MaterialUtils.subscript("9"))) return true; - String r = MaterialUtils.subscript(s); - if (r.contains(("1"))) return false; - if (r.contains(("2"))) return false; - if (r.contains(("3"))) return false; - if (r.contains(("4"))) return false; - if (r.contains(("5"))) return false; - if (r.contains(("6"))) return false; - if (r.contains(("7"))) return false; - if (r.contains(("8"))) return false; - if (r.contains(("9"))) return false; + static boolean containsSubScript(final String s){ + if (s.contains(MaterialUtils.superscript("1"))) { + return true; + } + if (s.contains(MaterialUtils.superscript("2"))) { + return true; + } + if (s.contains(MaterialUtils.superscript("3"))) { + return true; + } + if (s.contains(MaterialUtils.superscript("4"))) { + return true; + } + if (s.contains(MaterialUtils.superscript("5"))) { + return true; + } + if (s.contains(MaterialUtils.superscript("6"))) { + return true; + } + if (s.contains(MaterialUtils.superscript("7"))) { + return true; + } + if (s.contains(MaterialUtils.superscript("8"))) { + return true; + } + if (s.contains(MaterialUtils.superscript("9"))) { + return true; + } + if (s.contains(MaterialUtils.subscript("1"))) { + return true; + } + if (s.contains(MaterialUtils.subscript("2"))) { + return true; + } + if (s.contains(MaterialUtils.subscript("3"))) { + return true; + } + if (s.contains(MaterialUtils.subscript("4"))) { + return true; + } + if (s.contains(MaterialUtils.subscript("5"))) { + return true; + } + if (s.contains(MaterialUtils.subscript("6"))) { + return true; + } + if (s.contains(MaterialUtils.subscript("7"))) { + return true; + } + if (s.contains(MaterialUtils.subscript("8"))) { + return true; + } + if (s.contains(MaterialUtils.subscript("9"))) { + return true; + } + final String r = MaterialUtils.subscript(s); + if (r.contains(("1"))) { + return false; + } + if (r.contains(("2"))) { + return false; + } + if (r.contains(("3"))) { + return false; + } + if (r.contains(("4"))) { + return false; + } + if (r.contains(("5"))) { + return false; + } + if (r.contains(("6"))) { + return false; + } + if (r.contains(("7"))) { + return false; + } + if (r.contains(("8"))) { + return false; + } + if (r.contains(("9"))) { + return false; + } return false; } public final String getMaterialName() { - return MaterialUtils.subscript(materialName); + return MaterialUtils.subscript(this.materialName); } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colour == 0){ + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.colour == 0){ return MathUtils.generateSingularRandomHexValue(); } - return colour; + return this.colour; } diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java index 0faa781fd9..981e78a563 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java @@ -1,16 +1,15 @@ package gtPlusPlus.core.item.base.dusts.decimal; +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; - -import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import cpw.mods.fml.common.registry.GameRegistry; public class BaseItemCentidust extends Item{ @@ -18,39 +17,39 @@ public class BaseItemCentidust extends Item{ final String materialName; final String unlocalName; - public BaseItemCentidust(Material material) { + public BaseItemCentidust(final Material material) { this.dustMaterial = material; this.unlocalName = "itemCentidust"+material.getUnlocalizedName(); this.materialName = material.getLocalizedName(); this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalName); + this.setUnlocalizedName(this.unlocalName); this.setMaxStackSize(10); this.setTextureName(CORE.MODID + ":" + "itemCentidust"); //TODO - GameRegistry.registerItem(this, unlocalName); + GameRegistry.registerItem(this, this.unlocalName); //GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this)); //TODO } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return (materialName+ " Centidust"); + return (this.materialName+ " Centidust"); } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"1% of a " + materialName + " dust pile."); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("")){ + list.add(EnumChatFormatting.GRAY+"1% of a " + this.materialName + " dust pile."); } super.addInformation(stack, aPlayer, list, bool); } public final String getMaterialName() { - return materialName; + return this.materialName; } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - return dustMaterial.getRgbAsHex(); + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + return this.dustMaterial.getRgbAsHex(); } } diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java index afb9eef473..1db3520136 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java @@ -1,16 +1,15 @@ package gtPlusPlus.core.item.base.dusts.decimal; +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; - -import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import cpw.mods.fml.common.registry.GameRegistry; public class BaseItemDecidust extends Item{ @@ -18,39 +17,39 @@ public class BaseItemDecidust extends Item{ final String materialName; final String unlocalName; - public BaseItemDecidust(Material material) { + public BaseItemDecidust(final Material material) { this.dustMaterial = material; this.unlocalName = "itemDecidust"+material.getUnlocalizedName(); this.materialName = material.getLocalizedName(); this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalName); + this.setUnlocalizedName(this.unlocalName); this.setMaxStackSize(10); this.setTextureName(CORE.MODID + ":" + "itemDecidust"); //TODO - GameRegistry.registerItem(this, unlocalName); + GameRegistry.registerItem(this, this.unlocalName); //GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this)); //TODO } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return (materialName+ " Decidust"); + return (this.materialName+ " Decidust"); } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"10% of a " + materialName + " dust pile."); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("")){ + list.add(EnumChatFormatting.GRAY+"10% of a " + this.materialName + " dust pile."); } super.addInformation(stack, aPlayer, list, bool); } public final String getMaterialName() { - return materialName; + return this.materialName; } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - return dustMaterial.getRgbAsHex(); + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + return this.dustMaterial.getRgbAsHex(); } } diff --git a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java index 7b0663d9cf..2ea6afb166 100644 --- a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java +++ b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.item.base.foods; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.player.EntityPlayer; @@ -7,14 +8,13 @@ import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; public class BaseItemFood extends ItemFood { - private PotionEffect[] effects; + private final PotionEffect[] effects; protected String localName; - public BaseItemFood(String unlocalizedName, String localizedName, int healAmount, float saturationModifier, boolean wolvesFavorite, PotionEffect... effects) { + public BaseItemFood(final String unlocalizedName, final String localizedName, final int healAmount, final float saturationModifier, final boolean wolvesFavorite, final PotionEffect... effects) { super(healAmount, saturationModifier, wolvesFavorite); this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName.replace("Hot", "")); @@ -25,23 +25,24 @@ public class BaseItemFood extends ItemFood { } @Override - protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { + protected void onFoodEaten(final ItemStack stack, final World world, final EntityPlayer player) { super.onFoodEaten(stack, world, player); - for (int i = 0; i < effects.length; i ++) { - if (!world.isRemote && effects[i] != null && effects[i].getPotionID() > 0) + for (int i = 0; i < this.effects.length; i ++) { + if (!world.isRemote && (this.effects[i] != null) && (this.effects[i].getPotionID() > 0)) { player.addPotionEffect(new PotionEffect(this.effects[i].getPotionID(), this.effects[i].getDuration(), this.effects[i].getAmplifier(), this.effects[i].getIsAmbient() ) ); + } } } - + @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return ("A Serving of "+localName); + return ("A Serving of "+this.localName); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java index 92b8c8c224..69be546843 100644 --- a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java +++ b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java @@ -1,11 +1,10 @@ package gtPlusPlus.core.item.base.foods; +import java.util.List; + import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; - -import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -21,7 +20,7 @@ public class BaseItemHotFood extends BaseItemFood{ protected int cooldownTime; protected Item output; - public BaseItemHotFood(String unlocalizedName, int healAmount, float healSaturation, String foodName, int timeToCoolInSeconds, Item cooledFood) { + public BaseItemHotFood(final String unlocalizedName, final int healAmount, final float healSaturation, final String foodName, final int timeToCoolInSeconds, final Item cooledFood) { super(unlocalizedName, "Hot "+foodName, healAmount, healSaturation, false); this.unlocalName = unlocalizedName; this.cooldownTime = timeToCoolInSeconds * 20; @@ -31,47 +30,47 @@ public class BaseItemHotFood extends BaseItemFood{ } @Override - public ItemStack onEaten(ItemStack iStack, World world, EntityPlayer player) { + public ItemStack onEaten(final ItemStack iStack, final World world, final EntityPlayer player) { return super.onEaten(iStack, world, player); } @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { //Utils.LOG_INFO("Item Damage: "+iStack.getItemDamage()+" Max Damage: "+iStack.getMaxDamage()); if (!world.isRemote){ - if(iStack.getItemDamage() == cooldownTime) { - if (entityHolding instanceof EntityPlayer){ - Utils.LOG_INFO("Foods Done."); - ((EntityPlayer) entityHolding).inventory.addItemStackToInventory(ItemUtils.getSimpleStack(output)); - ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); + if(iStack.getItemDamage() == this.cooldownTime) { + if (entityHolding instanceof EntityPlayer){ + Utils.LOG_INFO("Foods Done."); + ((EntityPlayer) entityHolding).inventory.addItemStackToInventory(ItemUtils.getSimpleStack(this.output)); + ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); + } + }else if(iStack.getItemDamage() < this.cooldownTime){ + iStack.setItemDamage(iStack.getItemDamage() + 1); + } + if(MathUtils.divideXintoY(iStack.getItemDamage(), 150)){ + entityHolding.attackEntityFrom(DamageSource.onFire, 1); } - }else if(iStack.getItemDamage() < cooldownTime){ - iStack.setItemDamage(iStack.getItemDamage() + 1); - } - if(MathUtils.divideXintoY(iStack.getItemDamage(), 150)){ - entityHolding.attackEntityFrom(DamageSource.onFire, 1); - } - + } super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_); } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.RED+"Very hot!"+EnumChatFormatting.GRAY+" Avoid direct handling.."); - list.add(EnumChatFormatting.GRAY+"This food has "+((cooldownTime-(int) stack.getItemDamage())/20)+" seconds left, until it is cool."); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("")){ + list.add(EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.RED+"Very hot!"+EnumChatFormatting.GRAY+" Avoid direct handling.."); + list.add(EnumChatFormatting.GRAY+"This food has "+((this.cooldownTime-stack.getItemDamage())/20)+" seconds left, until it is cool."); } super.addInformation(stack, aPlayer, list, bool); } public final String getMaterialName() { - return materialName; + return this.materialName; } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { return Utils.rgbtoHexValue(230, 96, 96); } diff --git a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java index 7c4fe89568..b72ea5db15 100644 --- a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java +++ b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java @@ -5,7 +5,7 @@ import gtPlusPlus.core.material.Material; public class BaseItemGear extends BaseItemComponent{ - public BaseItemGear(Material material) { - super(material, BaseItemComponent.ComponentTypes.GEAR); + public BaseItemGear(final Material material) { + super(material, BaseItemComponent.ComponentTypes.GEAR); } } diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java index 3f6ff6e358..0933790de1 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java @@ -12,42 +12,42 @@ public class BaseItemIngot extends BaseItemComponent{ protected final String materialName; protected final String unlocalName; - public BaseItemIngot(Material material) { + public BaseItemIngot(final Material material) { this(material, ComponentTypes.INGOT); } - - public BaseItemIngot(Material material, ComponentTypes type) { + + public BaseItemIngot(final Material material, final ComponentTypes type) { super(material, type); this.materialName = material.getLocalizedName(); this.unlocalName = material.getUnlocalizedName(); - generateCompressorRecipe(); + this.generateCompressorRecipe(); } private void generateCompressorRecipe(){ - if (unlocalName.contains("itemIngot")){ - ItemStack tempStack = ItemUtils.getSimpleStack(this, 9); + if (this.unlocalName.contains("itemIngot")){ + final ItemStack tempStack = ItemUtils.getSimpleStack(this, 9); ItemStack tempOutput = null; - String temp = getUnlocalizedName().replace("item.itemIngot", "block"); - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName()); - if (getUnlocalizedName().contains("item.")){ - temp = getUnlocalizedName().replace("item.", ""); + String temp = this.getUnlocalizedName().replace("item.itemIngot", "block"); + Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); + if (this.getUnlocalizedName().contains("item.")){ + temp = this.getUnlocalizedName().replace("item.", ""); Utils.LOG_WARNING("Generating OreDict Name: "+temp); } temp = temp.replace("itemIngot", "block"); Utils.LOG_WARNING("Generating OreDict Name: "+temp); - if (temp != null && !temp.equals("")){ + if ((temp != null) && !temp.equals("")){ tempOutput = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); if (tempOutput != null){ GT_ModHandler.addCompressionRecipe(tempStack, tempOutput); } - + } } - else if (unlocalName.contains("itemHotIngot")){ + else if (this.unlocalName.contains("itemHotIngot")){ return; } - + } - + } diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java index a122589c9d..a06cfc2a30 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java @@ -12,43 +12,43 @@ import net.minecraft.world.World; public class BaseItemIngotHot extends BaseItemIngot{ - private ItemStack outputIngot; + private final ItemStack outputIngot; private int tickCounter = 0; - private int tickCounterMax = 200; - private int mTier; + private final int tickCounterMax = 200; + private final int mTier; - public BaseItemIngotHot(Material material) { + public BaseItemIngotHot(final Material material) { super(material, ComponentTypes.HOTINGOT); this.setTextureName(CORE.MODID + ":" + "itemIngotHot"); this.outputIngot = material.getIngot(1); this.mTier = material.vTier; - generateRecipe(); + this.generateRecipe(); } - + @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - return ("Hot "+materialName+ " Ingot"); + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + return ("Hot "+this.materialName+ " Ingot"); } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { return Utils.rgbtoHexValue(225, 225, 225); } private void generateRecipe(){ - Utils.LOG_WARNING("Adding Vacuum Freezer recipe for a Hot Ingot of "+materialName+"."); - GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getSimpleStack(this), outputIngot.copy(), 60*mTier); - } + Utils.LOG_WARNING("Adding Vacuum Freezer recipe for a Hot Ingot of "+this.materialName+"."); + GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getSimpleStack(this), this.outputIngot.copy(), 60*this.mTier); + } @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { if (!world.isRemote){ - if(tickCounter < tickCounterMax){ - tickCounter++; - } - else if(tickCounter == tickCounterMax){ + if(this.tickCounter < this.tickCounterMax){ + this.tickCounter++; + } + else if(this.tickCounter == this.tickCounterMax){ entityHolding.attackEntityFrom(DamageSource.onFire, 1); - tickCounter = 0; + this.tickCounter = 0; } } super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_); diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotOLD.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot_OLD.java index 15b1e48200..5d14660190 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotOLD.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot_OLD.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.item.base.ingots; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.creative.AddToCreativeTab; @@ -12,16 +13,15 @@ import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -public class BaseItemIngotOLD extends Item{ +public class BaseItemIngot_OLD extends Item{ protected int colour; protected String materialName; protected String unlocalName; - public BaseItemIngotOLD(String unlocalizedName, String materialName, int colour, int sRadioactivity) { - setUnlocalizedName(unlocalizedName); + public BaseItemIngot_OLD(final String unlocalizedName, final String materialName, final int colour, final int sRadioactivity) { + this.setUnlocalizedName(unlocalizedName); this.setCreativeTab(AddToCreativeTab.tabMisc); this.setUnlocalizedName(unlocalizedName); this.unlocalName = unlocalizedName; @@ -33,68 +33,68 @@ public class BaseItemIngotOLD extends Item{ this.sRadiation = sRadioactivity; GameRegistry.registerItem(this, unlocalizedName); String temp = ""; - if (unlocalName.contains("itemIngot")){ - temp = unlocalName.replace("itemI", "i"); + if (this.unlocalName.contains("itemIngot")){ + temp = this.unlocalName.replace("itemI", "i"); } - else if (unlocalName.contains("itemHotIngot")){ - temp = unlocalName.replace("itemHotIngot", "ingotHot"); + else if (this.unlocalName.contains("itemHotIngot")){ + temp = this.unlocalName.replace("itemHotIngot", "ingotHot"); } - if (temp != null && !temp.equals("")){ + if ((temp != null) && !temp.equals("")){ GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); - } - generateCompressorRecipe(); + } + this.generateCompressorRecipe(); } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return (materialName+ " Ingot"); + return (this.materialName+ " Ingot"); } public final String getMaterialName() { - return materialName; + return this.materialName; } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colour == 0){ + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.colour == 0){ return MathUtils.generateSingularRandomHexValue(); } - return colour; + return this.colour; } private void generateCompressorRecipe(){ - if (unlocalName.contains("itemIngot")){ - ItemStack tempStack = ItemUtils.getSimpleStack(this, 9); + if (this.unlocalName.contains("itemIngot")){ + final ItemStack tempStack = ItemUtils.getSimpleStack(this, 9); ItemStack tempOutput = null; - String temp = getUnlocalizedName().replace("item.itemIngot", "block"); - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName()); - if (getUnlocalizedName().contains("item.")){ - temp = getUnlocalizedName().replace("item.", ""); + String temp = this.getUnlocalizedName().replace("item.itemIngot", "block"); + Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); + if (this.getUnlocalizedName().contains("item.")){ + temp = this.getUnlocalizedName().replace("item.", ""); Utils.LOG_WARNING("Generating OreDict Name: "+temp); } temp = temp.replace("itemIngot", "block"); Utils.LOG_WARNING("Generating OreDict Name: "+temp); - if (temp != null && !temp.equals("")){ + if ((temp != null) && !temp.equals("")){ tempOutput = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); if (tempOutput != null){ GT_ModHandler.addCompressionRecipe(tempStack, tempOutput); } - + } } - else if (unlocalName.contains("itemHotIngot")){ + else if (this.unlocalName.contains("itemHotIngot")){ return; } - + } - + protected final int sRadiation; - @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); - } + @Override + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { + EntityUtils.applyRadiationDamageToEntity(this.sRadiation, world, entityHolding); + } } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBase.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBase.java index 488f9a6f60..bccfeaebab 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBase.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBase.java @@ -7,16 +7,16 @@ import net.minecraft.item.ItemStack; public class ItemBlockBase extends ItemBlock { - public ItemBlockBase(Block block) { - super(block); - this.setCreativeTab(AddToCreativeTab.tabBlock); - } + public ItemBlockBase(final Block block) { + super(block); + this.setCreativeTab(AddToCreativeTab.tabBlock); + } + + @Override + public int getColorFromItemStack(final ItemStack p_82790_1_, final int p_82790_2_) { + + return super.getColorFromItemStack(p_82790_1_, p_82790_2_); + } + - @Override - public int getColorFromItemStack(ItemStack p_82790_1_, int p_82790_2_) { - - return super.getColorFromItemStack(p_82790_1_, p_82790_2_); - } - - }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java index 2e39a47f81..f7da55cc2c 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java @@ -1,13 +1,12 @@ package gtPlusPlus.core.item.base.itemblock; +import java.util.List; + import gtPlusPlus.core.fluids.BlockFluidBase; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; - -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -21,56 +20,56 @@ public class ItemBlockFluid extends ItemBlock{ final BlockFluidBase baseBlock; String name; - public ItemBlockFluid(Block block) { + public ItemBlockFluid(final Block block) { super(block); this.baseBlock = (BlockFluidBase) block; - this.blockColour = baseBlock.getRenderColor(1); - this.thisFluid = baseBlock.getFluidMaterial(); - this.sRadiation=ItemUtils.getRadioactivityLevel(baseBlock.getUnlocalizedName()); - this.name = baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", ""); + this.blockColour = this.baseBlock.getRenderColor(1); + this.thisFluid = this.baseBlock.getFluidMaterial(); + this.sRadiation=ItemUtils.getRadioactivityLevel(this.baseBlock.getUnlocalizedName()); + this.name = this.baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", ""); //GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), UtilsItems.getSimpleStack(this)); } - - public final Material setFluidMaterial(Material M){ - return thisFluid=M; + + public final Material setFluidMaterial(final Material M){ + return this.thisFluid=M; } - public int getRenderColor(int aMeta) { - return blockColour; + public int getRenderColor(final int aMeta) { + return this.blockColour; } - + @Override - public String getItemStackDisplayName(ItemStack iStack) { - if (thisFluid != null){ - this.name = "Molten "+thisFluid.getLocalizedName(); - return name; + public String getItemStackDisplayName(final ItemStack iStack) { + if (this.thisFluid != null){ + this.name = "Molten "+this.thisFluid.getLocalizedName(); + return this.name; } - this.name = "Molten "+baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", ""); - return name; + this.name = "Molten "+this.baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", ""); + return this.name; } - + @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (blockColour == 0){ + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.blockColour == 0){ return MathUtils.generateSingularRandomHexValue(); } - return blockColour; + return this.blockColour; } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add("Temperature: "+MathUtils.celsiusToKelvin(thisFluid.getMeltingPointC())+"K"); - if (sRadiation > 0){ + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add("Temperature: "+MathUtils.celsiusToKelvin(this.thisFluid.getMeltingPointC())+"K"); + if (this.sRadiation > 0){ list.add(CORE.GT_Tooltip_Radioactive); } super.addInformation(stack, aPlayer, list, bool); } public String GetProperName() { - String tempIngot; + String tempIngot; - tempIngot = "Molten "+baseBlock.getLocalizedName(); + tempIngot = "Molten "+this.baseBlock.getLocalizedName(); return tempIngot; } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java index 1e34a22098..d7de10141f 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java @@ -1,14 +1,13 @@ package gtPlusPlus.core.item.base.itemblock; +import java.util.List; + import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.block.base.BlockBaseModular; import gtPlusPlus.core.block.base.BlockBaseOre; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.entity.EntityUtils; import gtPlusPlus.core.util.item.ItemUtils; - -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -20,51 +19,51 @@ public class ItemBlockGtBlock extends ItemBlock{ protected final int blockColour; protected final int sRadiation; - - private final Block thisBlock; + + private final Block thisBlock; private boolean isOre = false; - - public ItemBlockGtBlock(Block block) { + + public ItemBlockGtBlock(final Block block) { super(block); - thisBlock = block; + this.thisBlock = block; if (block instanceof BlockBaseOre){ - isOre = true; - } - BlockBaseModular baseBlock = (BlockBaseModular) block; + this.isOre = true; + } + final BlockBaseModular baseBlock = (BlockBaseModular) block; this.blockColour = baseBlock.getRenderColor(0); if (block.getLocalizedName().toLowerCase().contains("uranium") || block.getLocalizedName().toLowerCase().contains("plutonium") || block.getLocalizedName().toLowerCase().contains("thorium")){ - sRadiation = 2; + this.sRadiation = 2; } else { - sRadiation = 0; + this.sRadiation = 0; } GT_OreDictUnificator.registerOre("block"+block.getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), ItemUtils.getSimpleStack(this)); } - public int getRenderColor(int aMeta) { - return blockColour; - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (sRadiation > 0){ - list.add(CORE.GT_Tooltip_Radioactive); - } - if (isOre){ - if (thisBlock != null){ - if (thisBlock.getLocalizedName().equalsIgnoreCase("fluorite ore")){ - list.add("Mined from Sandstone and Limestone."); - } - } - } - else { + public int getRenderColor(final int aMeta) { + return this.blockColour; + } + + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if (this.sRadiation > 0){ + list.add(CORE.GT_Tooltip_Radioactive); + } + if (this.isOre){ + if (this.thisBlock != null){ + if (this.thisBlock.getLocalizedName().equalsIgnoreCase("fluorite ore")){ + list.add("Mined from Sandstone and Limestone."); + } } + } + else { + } super.addInformation(stack, aPlayer, list, bool); } - - @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); - } + + @Override + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { + EntityUtils.applyRadiationDamageToEntity(this.sRadiation, world, entityHolding); + } } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java index 9d442e3102..9d9fbc1972 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java @@ -9,16 +9,16 @@ import net.minecraft.item.ItemBlock; public class ItemBlockGtFrameBox extends ItemBlock{ protected int blockColour; - - public ItemBlockGtFrameBox(Block block) { + + public ItemBlockGtFrameBox(final Block block) { super(block); - BlockBaseModular baseBlock = (BlockBaseModular) block; + final BlockBaseModular baseBlock = (BlockBaseModular) block; this.blockColour = baseBlock.getRenderColor(1); GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), ItemUtils.getSimpleStack(this)); } - public int getRenderColor(int aMeta) { - return blockColour; - } + public int getRenderColor(final int aMeta) { + return this.blockColour; + } } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java index 73fcbc2ab6..7a5f20833f 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java @@ -12,32 +12,32 @@ import net.minecraft.world.World; public class ItemBlockTileEntity extends ItemBlock{ String[] description; - - public ItemBlockTileEntity(Block block) { + + public ItemBlockTileEntity(final Block block) { super(block); } - - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - for (int i =0; i< this.description.length; i++){ - if (!this.description[i].equals("")){ - list.add(this.description[i]); - } - } - - + + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + for (int i =0; i< this.description.length; i++){ + if (!this.description[i].equals("")){ + list.add(this.description[i]); + } + } + + super.addInformation(stack, aPlayer, list, bool); } - - @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - + + @Override + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { + + } + + public void setDecription(final String[] description){ + for (int i =0; i< description.length; i++){ + this.description[i] = description[i]; } - - public void setDecription(String[] description){ - for (int i =0; i< description.length; i++){ - this.description[i] = description[i]; - } - } + } } diff --git a/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java b/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java index d4f7ac02a6..a6eb598622 100644 --- a/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java +++ b/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java @@ -5,7 +5,7 @@ import gtPlusPlus.core.material.Material; public class BaseItemNugget extends BaseItemComponent{ - public BaseItemNugget(Material material) { - super(material, BaseItemComponent.ComponentTypes.NUGGET); + public BaseItemNugget(final Material material) { + super(material, BaseItemComponent.ComponentTypes.NUGGET); } } diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java index a905e75186..231b593356 100644 --- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java +++ b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java @@ -7,14 +7,14 @@ import gtPlusPlus.core.util.materials.MaterialUtils; public class BaseItemPlate extends BaseItemComponent{ - public BaseItemPlate(Material material) { + public BaseItemPlate(final Material material) { super(material, BaseItemComponent.ComponentTypes.PLATE); } - - public BaseItemPlate(String unlocalizedName, String materialName, MaterialState state, short[] colour, int tier, int sRadioactivity) { + + public BaseItemPlate(final String unlocalizedName, final String materialName, final MaterialState state, final short[] colour, final int tier, final int sRadioactivity) { this(MaterialUtils.generateQuickMaterial(materialName, state, new short[]{colour[0], colour[1], colour[2], 0}, sRadioactivity)); } - + } diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java index ce8bbe8191..c56889a5dd 100644 --- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java +++ b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java @@ -6,13 +6,13 @@ import net.minecraft.item.ItemStack; public class BaseItemPlateDouble extends BaseItemComponent{ - public BaseItemPlateDouble(Material material) { - super(material, BaseItemComponent.ComponentTypes.PLATEDOUBLE); + public BaseItemPlateDouble(final Material material) { + super(material, BaseItemComponent.ComponentTypes.PLATEDOUBLE); this.setMaxStackSize(32); } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - return ("Double "+materialName+ " Plate"); + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + return ("Double "+this.materialName+ " Plate"); } } diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java new file mode 100644 index 0000000000..0300a63848 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java @@ -0,0 +1,68 @@ +package gtPlusPlus.core.item.base.plates; + +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.entity.EntityUtils; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.math.MathUtils; +import net.minecraft.entity.Entity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class BaseItemPlate_OLD extends Item{ + + protected int colour; + protected String materialName; + protected String unlocalName; + + public BaseItemPlate_OLD(final String unlocalizedName, final String materialName, final int colour, final int sRadioactivity) { + this.setUnlocalizedName(unlocalizedName); + this.setCreativeTab(AddToCreativeTab.tabMisc); + this.setUnlocalizedName(unlocalizedName); + this.unlocalName = unlocalizedName; + this.setMaxStackSize(64); + this.setTextureName(CORE.MODID + ":" + "itemPlate"); + this.setMaxStackSize(64); + this.colour = colour; + this.materialName = materialName; + this.sRadiation = sRadioactivity; + GameRegistry.registerItem(this, unlocalizedName); + String temp = ""; + if (this.unlocalName.toLowerCase().contains("itemplate")){ + temp = this.unlocalName.replace("itemP", "p"); + } + if ((temp != null) && !temp.equals("")){ + GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); + } + } + + @Override + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + + return (this.materialName+ " plate"); + } + + public final String getMaterialName() { + return this.materialName; + } + + @Override + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.colour == 0){ + return MathUtils.generateSingularRandomHexValue(); + } + return this.colour; + + } + + 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_) { + EntityUtils.applyRadiationDamageToEntity(this.sRadiation, world, entityHolding); + } +} diff --git a/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java b/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java index 6ad3509876..62777cc9f5 100644 --- a/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java +++ b/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java @@ -5,7 +5,7 @@ import gtPlusPlus.core.material.Material; public class BaseItemRing extends BaseItemComponent{ - public BaseItemRing(Material material) { + public BaseItemRing(final Material material) { super(material, BaseItemComponent.ComponentTypes.RING); } } diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java index 2e4acd6ccb..5fe7ca6424 100644 --- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java +++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java @@ -8,24 +8,24 @@ import net.minecraft.item.ItemStack; public class BaseItemRod extends BaseItemComponent{ - public BaseItemRod(Material material) { - super(material, BaseItemComponent.ComponentTypes.ROD); - addExtruderRecipe(); + public BaseItemRod(final Material material) { + super(material, BaseItemComponent.ComponentTypes.ROD); + this.addExtruderRecipe(); } private void addExtruderRecipe(){ - Utils.LOG_WARNING("Adding cutter recipe for "+materialName+" Rods"); + Utils.LOG_WARNING("Adding cutter recipe for "+this.materialName+" Rods"); - ItemStack stackStick = componentMaterial.getRod(1); - ItemStack stackBolt = componentMaterial.getBolt(4); + final ItemStack stackStick = this.componentMaterial.getRod(1); + final ItemStack stackBolt = this.componentMaterial.getBolt(4); GT_Values.RA.addCutterRecipe( stackStick, stackBolt, null, - (int) Math.max(componentMaterial.getMass() * 2L, 1L), - 4); + (int) Math.max(this.componentMaterial.getMass() * 2L, 1L), + 4); } } diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java index 882dc8b2bf..84d7d00472 100644 --- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java +++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java @@ -9,39 +9,39 @@ import net.minecraft.item.ItemStack; public class BaseItemRodLong extends BaseItemComponent{ - public BaseItemRodLong(Material material) { + public BaseItemRodLong(final Material material) { super(material, BaseItemComponent.ComponentTypes.RODLONG); - addExtruderRecipe(); + this.addExtruderRecipe(); } - + @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - return ("Long "+materialName+ " Rod"); + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + return ("Long "+this.materialName+ " Rod"); } private void addExtruderRecipe(){ - Utils.LOG_WARNING("Adding recipe for Long "+materialName+" Rods"); + Utils.LOG_WARNING("Adding recipe for Long "+this.materialName+" Rods"); - String tempStick = unlocalName.replace("itemRodLong", "stick"); - String tempStickLong = unlocalName.replace("itemRodLong", "stickLong"); - ItemStack stackStick = ItemUtils.getItemStackOfAmountFromOreDict(tempStick, 1); - ItemStack stackLong = ItemUtils.getItemStackOfAmountFromOreDict(tempStickLong, 1); + final String tempStick = this.unlocalName.replace("itemRodLong", "stick"); + final String tempStickLong = this.unlocalName.replace("itemRodLong", "stickLong"); + final ItemStack stackStick = ItemUtils.getItemStackOfAmountFromOreDict(tempStick, 1); + final ItemStack stackLong = ItemUtils.getItemStackOfAmountFromOreDict(tempStickLong, 1); - ItemStack temp = stackStick; + final ItemStack temp = stackStick; temp.stackSize = 2; GT_Values.RA.addForgeHammerRecipe( temp, stackLong, - (int) Math.max(componentMaterial.getMass(), 1L), + (int) Math.max(this.componentMaterial.getMass(), 1L), 16); GT_Values.RA.addCutterRecipe( stackLong, temp, null, - (int) Math.max(componentMaterial.getMass(), 1L), - 4); + (int) Math.max(this.componentMaterial.getMass(), 1L), + 4); } } diff --git a/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java b/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java index f993cc64b2..6960e89e89 100644 --- a/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java +++ b/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java @@ -5,7 +5,7 @@ import gtPlusPlus.core.material.Material; public class BaseItemRotor extends BaseItemComponent{ - public BaseItemRotor(Material material) { + public BaseItemRotor(final Material material) { super(material, BaseItemComponent.ComponentTypes.ROTOR); } } diff --git a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java index 93aa5b7526..f35e4834cc 100644 --- a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java +++ b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java @@ -9,22 +9,22 @@ import net.minecraft.item.ItemStack; public class BaseItemScrew extends BaseItemComponent{ - public BaseItemScrew(Material material) { + public BaseItemScrew(final Material material) { super(material, BaseItemComponent.ComponentTypes.SCREW); - addLatheRecipe(); + this.addLatheRecipe(); } private void addLatheRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Screws"); - ItemStack boltStack = ItemUtils.getItemStackOfAmountFromOreDict(unlocalName.replace("itemScrew", "bolt"), 1); - if (null != boltStack){ - GT_Values.RA.addLatheRecipe( - boltStack, - ItemUtils.getSimpleStack(this), - null, - (int) Math.max(componentMaterial.getMass() / 8L, 1L), - 4); - } + Utils.LOG_WARNING("Adding recipe for "+this.materialName+" Screws"); + final ItemStack boltStack = ItemUtils.getItemStackOfAmountFromOreDict(this.unlocalName.replace("itemScrew", "bolt"), 1); + if (null != boltStack){ + GT_Values.RA.addLatheRecipe( + boltStack, + ItemUtils.getSimpleStack(this), + null, + (int) Math.max(this.componentMaterial.getMass() / 8L, 1L), + 4); + } } } diff --git a/src/Java/gtPlusPlus/core/item/effects/RarityEffect.java b/src/Java/gtPlusPlus/core/item/effects/RarityEffect.java index 6bd7f009bb..b30f956b53 100644 --- a/src/Java/gtPlusPlus/core/item/effects/RarityEffect.java +++ b/src/Java/gtPlusPlus/core/item/effects/RarityEffect.java @@ -1,12 +1,12 @@ package gtPlusPlus.core.item.effects; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.*; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.*; /* - * + * This determines the name colour. EnumRarity can be: EnumRarity.common - the standard white colour. EnumRarity.uncommon - a yellow colour. @@ -15,25 +15,25 @@ EnumRarity.epic - the purple colour used on the Golden Apple. @SideOnly is an FML annotation. It marks the method below it for existing only on one side. Possible values are: Side.CLIENT is probably the most common one. This marks the method as existing only on the client side. Side.SERVER marks the method as existing only on the server side. - * + * */ public class RarityEffect extends Item { - public RarityEffect(int par1){ + public RarityEffect(final int par1){ super(); this.setCreativeTab(CreativeTabs.tabMaterials); } - + @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ + public EnumRarity getRarity(final ItemStack par1ItemStack){ return EnumRarity.common; } - + @Override - public boolean hasEffect(ItemStack par1ItemStack){ + public boolean hasEffect(final ItemStack par1ItemStack){ return true; } - + } diff --git a/src/Java/gtPlusPlus/core/item/effects/RarityEpic.java b/src/Java/gtPlusPlus/core/item/effects/RarityEpic.java index 952bcfc9d3..25bdc71349 100644 --- a/src/Java/gtPlusPlus/core/item/effects/RarityEpic.java +++ b/src/Java/gtPlusPlus/core/item/effects/RarityEpic.java @@ -1,26 +1,26 @@ package gtPlusPlus.core.item.effects; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.*; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.*; public class RarityEpic extends Item { - public RarityEpic(int par1){ + public RarityEpic(final int par1){ super(); this.setCreativeTab(CreativeTabs.tabMaterials); } - + @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ + public EnumRarity getRarity(final ItemStack par1ItemStack){ return EnumRarity.epic; } - + @Override - public boolean hasEffect(ItemStack par1ItemStack){ + public boolean hasEffect(final ItemStack par1ItemStack){ return true; } - + } diff --git a/src/Java/gtPlusPlus/core/item/effects/RarityRare.java b/src/Java/gtPlusPlus/core/item/effects/RarityRare.java index cc313f5e77..7b5ba69efc 100644 --- a/src/Java/gtPlusPlus/core/item/effects/RarityRare.java +++ b/src/Java/gtPlusPlus/core/item/effects/RarityRare.java @@ -1,26 +1,26 @@ package gtPlusPlus.core.item.effects; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.*; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.*; public class RarityRare extends Item { - public RarityRare(int par1){ + public RarityRare(){ super(); this.setCreativeTab(CreativeTabs.tabMaterials); } - + @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ + public EnumRarity getRarity(final ItemStack par1ItemStack){ return EnumRarity.rare; } - + @Override - public boolean hasEffect(ItemStack par1ItemStack){ + public boolean hasEffect(final ItemStack par1ItemStack){ return true; } - + } diff --git a/src/Java/gtPlusPlus/core/item/effects/RarityUncommon.java b/src/Java/gtPlusPlus/core/item/effects/RarityUncommon.java index 26e2429f6a..82c5c55fff 100644 --- a/src/Java/gtPlusPlus/core/item/effects/RarityUncommon.java +++ b/src/Java/gtPlusPlus/core/item/effects/RarityUncommon.java @@ -1,20 +1,20 @@ package gtPlusPlus.core.item.effects; -import net.minecraft.item.*; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.item.*; public class RarityUncommon extends Item { - + @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ + public EnumRarity getRarity(final ItemStack par1ItemStack){ return EnumRarity.uncommon; } - + @Override - public boolean hasEffect(ItemStack par1ItemStack){ + public boolean hasEffect(final ItemStack par1ItemStack){ return true; } - + } diff --git a/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java b/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java index 5a05ac7655..55efc50c4e 100644 --- a/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java +++ b/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java @@ -1,10 +1,9 @@ package gtPlusPlus.core.item.general; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; - import java.util.List; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -18,87 +17,87 @@ public class BedLocator_Base extends Item{ public int bed_X = 0; public int bed_Y = 0; public int bed_Z = 0; - - public BedLocator_Base(String unlocalizedName) { + + public BedLocator_Base(final String unlocalizedName) { this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); + this.setMaxStackSize(1); this.setCreativeTab(AddToCreativeTab.tabMachines); } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + + + int NBT_X = this.bed_X; + int NBT_Y = this.bed_Y; + int NBT_Z = this.bed_Z; - - int NBT_X = bed_X; - int NBT_Y = bed_Y; - int NBT_Z = bed_Z; - if (stack.stackTagCompound != null) { NBT_X = stack.stackTagCompound.getInteger("pos_x"); NBT_Y = stack.stackTagCompound.getInteger("pos_y"); NBT_Z = stack.stackTagCompound.getInteger("pos_z"); - String tempX = String.valueOf(NBT_X); - String tempY = String.valueOf(NBT_Y); - String tempZ = String.valueOf(NBT_Z); - String formattedX = EnumChatFormatting.DARK_RED+tempX+EnumChatFormatting.GRAY; - String formattedY = EnumChatFormatting.RED+tempY+EnumChatFormatting.GRAY; - String formattedZ = EnumChatFormatting.RED+tempZ+EnumChatFormatting.GRAY; - - list.add(EnumChatFormatting.GRAY+"X: "+formattedX+"."); - list.add(EnumChatFormatting.GRAY+"Y: "+formattedY+"."); - list.add(EnumChatFormatting.GRAY+"Z: "+formattedZ+"."); - super.addInformation(stack, aPlayer, list, bool); - } + final String tempX = String.valueOf(NBT_X); + final String tempY = String.valueOf(NBT_Y); + final String tempZ = String.valueOf(NBT_Z); + final String formattedX = EnumChatFormatting.DARK_RED+tempX+EnumChatFormatting.GRAY; + final String formattedY = EnumChatFormatting.RED+tempY+EnumChatFormatting.GRAY; + final String formattedZ = EnumChatFormatting.RED+tempZ+EnumChatFormatting.GRAY; + + list.add(EnumChatFormatting.GRAY+"X: "+formattedX+"."); + list.add(EnumChatFormatting.GRAY+"Y: "+formattedY+"."); + list.add(EnumChatFormatting.GRAY+"Z: "+formattedZ+"."); + super.addInformation(stack, aPlayer, list, bool); + } } //Ticking and NBT Handling /* Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and * update it's contents. - * + * * public int fuelRemaining = 0; public int maximumFuel = 0; public String fuelType = ""; public float heat = 0; public float maxHeat = 5000; - * + * */ @Override - public void onCreated(ItemStack itemStack, World world, EntityPlayer player) { + public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) { itemStack.stackTagCompound = new NBTTagCompound(); this.bed_X = 0; this.bed_Y = 0; this.bed_Z = 0; - itemStack.stackTagCompound.setInteger("pos_x", bed_X); - itemStack.stackTagCompound.setInteger("pos_y", bed_Y); - itemStack.stackTagCompound.setInteger("pos_z", bed_Z); + itemStack.stackTagCompound.setInteger("pos_x", this.bed_X); + itemStack.stackTagCompound.setInteger("pos_y", this.bed_Y); + itemStack.stackTagCompound.setInteger("pos_z", this.bed_Z); } @Override - public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) { - + public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) { + } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) { + public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer par3Entity) { itemStack.stackTagCompound = new NBTTagCompound(); if (par3Entity.getBedLocation() != null){ - this.bed_X = par3Entity.getBedLocation().posX; - this.bed_Y = par3Entity.getBedLocation().posY; - this.bed_Z = par3Entity.getBedLocation().posZ; + this.bed_X = par3Entity.getBedLocation().posX; + this.bed_Y = par3Entity.getBedLocation().posY; + this.bed_Z = par3Entity.getBedLocation().posZ; } else { this.bed_X = 0; this.bed_Y = 0; this.bed_Z = 0; } - itemStack.stackTagCompound.setInteger("pos_x", bed_X); - itemStack.stackTagCompound.setInteger("pos_y", bed_Y); - itemStack.stackTagCompound.setInteger("pos_z", bed_Z); + itemStack.stackTagCompound.setInteger("pos_x", this.bed_X); + itemStack.stackTagCompound.setInteger("pos_y", this.bed_Y); + itemStack.stackTagCompound.setInteger("pos_z", this.bed_Z); return super.onItemRightClick(itemStack, world, par3Entity); } diff --git a/src/Java/gtPlusPlus/core/item/general/BufferCore.java b/src/Java/gtPlusPlus/core/item/general/BufferCore.java index 42f8c99c70..40136d7409 100644 --- a/src/Java/gtPlusPlus/core/item/general/BufferCore.java +++ b/src/Java/gtPlusPlus/core/item/general/BufferCore.java @@ -1,23 +1,22 @@ package gtPlusPlus.core.item.general; +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.item.base.BaseItemWithDamageValue; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; - -import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class BufferCore extends BaseItemWithDamageValue{ - + public int coreTier = 0; - - public BufferCore(String unlocalizedName, int i) { + + public BufferCore(final String unlocalizedName, final int i) { super(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); this.setMaxStackSize(2); @@ -25,74 +24,74 @@ public class BufferCore extends BaseItemWithDamageValue{ } @Override - public String getItemStackDisplayName(ItemStack stack) { + public String getItemStackDisplayName(final ItemStack stack) { return super.getItemStackDisplayName(stack)+" ["+CORE.VOLTAGES[this.coreTier-1]+"]."; } - + @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses() - { - return true; - } + public boolean requiresMultipleRenderPasses() + { + return true; + } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { list.add(EnumChatFormatting.GRAY+"A key crafting component for making energy buffers."); super.addInformation(stack, aPlayer, list, bool); } public final int getCoreTier() { - return coreTier; + return this.coreTier; } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { //Figure Out Damage - String s = String.format("%X", HEX_OxFFFFFF); + final String s = String.format("%X", HEX_OxFFFFFF); //Utils.LOG_INFO(s); //String rgb = Utils.hex2Rgb(s); //Utils.LOG_INFO(rgb); - if (coreTier == 1){ + if (this.coreTier == 1){ HEX_OxFFFFFF = 0x4d4d4d; } - else if (coreTier == 2){ + else if (this.coreTier == 2){ HEX_OxFFFFFF = 0x666666; } - else if (coreTier == 3){ + else if (this.coreTier == 3){ HEX_OxFFFFFF = 0x8c8c8c; } - else if (coreTier == 4){ + else if (this.coreTier == 4){ HEX_OxFFFFFF = 0xa6a6a6; } - else if (coreTier == 5){ + else if (this.coreTier == 5){ HEX_OxFFFFFF = 0xcccccc; } - else if (coreTier == 6){ + else if (this.coreTier == 6){ HEX_OxFFFFFF = 0xe6e6e6; } - else if (coreTier == 7){ + else if (this.coreTier == 7){ HEX_OxFFFFFF = 0xffffcc; } - else if (coreTier == 8){ + else if (this.coreTier == 8){ HEX_OxFFFFFF = 0xace600; } - else if (coreTier == 9){ + else if (this.coreTier == 9){ HEX_OxFFFFFF = 0xffff00; } /*else if (coreTier == 10){ HEX_OxFFFFFF = 0xff0000; }*/ - else if (coreTier == 10){ + else if (this.coreTier == 10){ HEX_OxFFFFFF = Utils.rgbtoHexValue(MathUtils.randInt(220, 250), MathUtils.randInt(221, 251), MathUtils.randInt(220, 250)); } else { HEX_OxFFFFFF = 0xffffff; } - + return HEX_OxFFFFFF; } - + } diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java b/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java index a7a1526277..6bb1e8d7bc 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java @@ -14,15 +14,15 @@ import net.minecraft.world.World; public class ItemBasicFirestarter extends CoreItem { public ItemBasicFirestarter() { - super("itemSimpleFiremaker", AddToCreativeTab.tabTools, 1, 5, "Can probably make you a fire"); + super("itemSimpleFiremaker", AddToCreativeTab.tabTools, 1, 5, "Can probably make you a fire"); this.setTextureName(CORE.MODID+":"+"itemFireStarter"); } @Override public boolean onItemUse( - ItemStack thisItem, EntityPlayer thisPlayer, World thisWorld, + final ItemStack thisItem, final EntityPlayer thisPlayer, final World thisWorld, int blockX, int blockY, int blockZ, - int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { + final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) { if (p_77648_7_ == 0) { --blockY; } @@ -47,23 +47,23 @@ public class ItemBasicFirestarter extends CoreItem { if (thisWorld.getBlock(blockX, blockY, blockZ) instanceof FirePit){ thisWorld.setBlockMetadataWithNotify(blockX, blockY, blockZ, 2, 4); PlayerUtils.messagePlayer(thisPlayer, "You light the fire pit. "); - } + } if (thisWorld.isAirBlock(blockX, blockY, blockZ)) { - int random = MathUtils.randInt(0, 3); + final int random = MathUtils.randInt(0, 3); //Explode, lol. if (random == 0){ PlayerUtils.messagePlayer(thisPlayer, "You somehow managed to set yourself on fire... "); - thisWorld.playSoundEffect((double)thisPlayer.posX + 0.5D, (double)thisPlayer.posY + 0.5D, (double)thisPlayer.posZ + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - thisPlayer.setFire(4); + thisWorld.playSoundEffect(thisPlayer.posX + 0.5D, thisPlayer.posY + 0.5D, thisPlayer.posZ + 0.5D, "fire.ignite", 1.0F, (itemRand.nextFloat() * 0.4F) + 0.8F); + thisPlayer.setFire(4); thisItem.damageItem(thisItem.getMaxDamage(), thisPlayer); } //Create a fire else if (random == 2){ PlayerUtils.messagePlayer(thisPlayer, "You created a fire!"); - thisWorld.playSoundEffect((double)blockX + 0.5D, (double)blockY + 0.5D, (double)blockZ + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - thisWorld.setBlock(blockX, blockY, blockZ, Blocks.fire); + thisWorld.playSoundEffect(blockX + 0.5D, blockY + 0.5D, blockZ + 0.5D, "fire.ignite", 1.0F, (itemRand.nextFloat() * 0.4F) + 0.8F); + thisWorld.setBlock(blockX, blockY, blockZ, Blocks.fire); } //Do nothing @@ -78,7 +78,7 @@ public class ItemBasicFirestarter extends CoreItem { } @Override - public String getItemStackDisplayName(ItemStack thisItem) { + public String getItemStackDisplayName(final ItemStack thisItem) { return "Basic Firemaker"; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java index 0458a38110..65aa618cb3 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.item.general; +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.interfaces.IItemBlueprint; import gtPlusPlus.core.lib.CORE; @@ -7,9 +10,6 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.player.PlayerUtils; - -import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -19,14 +19,13 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; public class ItemBlueprint extends Item implements IItemBlueprint{ - public ItemBlueprint(String unlocalizedName) { + public ItemBlueprint(final String unlocalizedName) { this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); + this.setMaxStackSize(1); this.setCreativeTab(AddToCreativeTab.tabMachines); //this.bpID = MathUtils.randInt(0, 1000); GameRegistry.registerItem(this, unlocalizedName); @@ -34,10 +33,10 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack itemStack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack itemStack, final EntityPlayer aPlayer, final List list, final boolean bool) { //Create some NBT if it's not there, otherwise this does nothing. if (!itemStack.hasTagCompound()){ - createNBT(itemStack); + this.createNBT(itemStack); } //Set up some default variables. int id = -1; @@ -46,14 +45,14 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ //Get proper display vars from NBT if it's there if (itemStack.hasTagCompound()){ //Utils.LOG_WARNING("Found TagCompound"); - id = (int) getNBT(itemStack, "mID"); - name = (String) getNBT(itemStack, "mName"); - blueprint = (boolean) getNBT(itemStack, "mBlueprint"); + id = (int) this.getNBT(itemStack, "mID"); + name = (String) this.getNBT(itemStack, "mName"); + blueprint = (boolean) this.getNBT(itemStack, "mBlueprint"); } //Write to tooltip list for each viable setting. if (itemStack.hasTagCompound()) { if (id != -1){ - list.add(EnumChatFormatting.GRAY+"Technical Document No. "+id); + list.add(EnumChatFormatting.GRAY+"Technical Document No. "+id); } if(blueprint){ list.add(EnumChatFormatting.BLUE+"Currently holding a blueprint for "+name); @@ -61,7 +60,7 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ else { list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything."); } - } + } else { list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything."); } @@ -69,46 +68,46 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { return "Blueprint [I am useless]"; } @Override - public void onCreated(ItemStack itemStack, World world, EntityPlayer player) { - createNBT(itemStack); + public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) { + this.createNBT(itemStack); } @Override - public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) { } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) { + public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer par3Entity) { //Let the player know what blueprint is held if (itemStack.hasTagCompound()) { - PlayerUtils.messagePlayer(par3Entity, "This Blueprint holds NBT data. "+"|"+getNBT(itemStack, "mID")+"|"+getNBT(itemStack, "mBlueprint")+"|"+getNBT(itemStack, "mName")+"|"+ItemUtils.getArrayStackNames(readItemsFromNBT(itemStack))); + PlayerUtils.messagePlayer(par3Entity, "This Blueprint holds NBT data. "+"|"+this.getNBT(itemStack, "mID")+"|"+this.getNBT(itemStack, "mBlueprint")+"|"+this.getNBT(itemStack, "mName")+"|"+ItemUtils.getArrayStackNames(this.readItemsFromNBT(itemStack))); } else { - createNBT(itemStack); - PlayerUtils.messagePlayer(par3Entity, "This is a placeholder. "+getNBT(itemStack, "mID")); + this.createNBT(itemStack); + PlayerUtils.messagePlayer(par3Entity, "This is a placeholder. "+this.getNBT(itemStack, "mID")); } return super.onItemRightClick(itemStack, world, par3Entity); } - public ItemStack[] readItemsFromNBT(ItemStack itemStack){ + public ItemStack[] readItemsFromNBT(final ItemStack itemStack){ ItemStack[] blueprint = new ItemStack[9]; if (itemStack.hasTagCompound()){ - NBTTagCompound nbt = itemStack.getTagCompound(); - NBTTagList list = nbt.getTagList("Items", 10); + final NBTTagCompound nbt = itemStack.getTagCompound(); + final NBTTagList list = nbt.getTagList("Items", 10); blueprint = new ItemStack[INV_SIZE]; for(int i = 0;i<list.tagCount();i++) { - NBTTagCompound data = list.getCompoundTagAt(i); - int slot = data.getInteger("Slot"); - if(slot >= 0 && slot < INV_SIZE) + final NBTTagCompound data = list.getCompoundTagAt(i); + final int slot = data.getInteger("Slot"); + if((slot >= 0) && (slot < INV_SIZE)) { blueprint[slot] = ItemStack.loadItemStackFromNBT(data); } @@ -118,17 +117,17 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ return null; } - public ItemStack writeItemsToNBT(ItemStack itemStack, ItemStack[] craftingGrid){ - ItemStack[] blueprint = craftingGrid; + public ItemStack writeItemsToNBT(final ItemStack itemStack, final ItemStack[] craftingGrid){ + final ItemStack[] blueprint = craftingGrid; if (itemStack.hasTagCompound()){ - NBTTagCompound nbt = itemStack.getTagCompound(); - NBTTagList list = new NBTTagList(); + final NBTTagCompound nbt = itemStack.getTagCompound(); + final NBTTagList list = new NBTTagList(); for(int i = 0;i<INV_SIZE;i++) { - ItemStack stack = blueprint[i]; + final ItemStack stack = blueprint[i]; if(stack != null) { - NBTTagCompound data = new NBTTagCompound(); + final NBTTagCompound data = new NBTTagCompound(); stack.writeToNBT(data); data.setInteger("Slot", i); list.appendTag(data); @@ -142,18 +141,18 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ } @Override - public boolean isBlueprint(ItemStack stack) { + public boolean isBlueprint(final ItemStack stack) { return true; } @Override - public boolean setBlueprint(ItemStack stack, IInventory craftingTable, ItemStack output) { + public boolean setBlueprint(final ItemStack stack, final IInventory craftingTable, final ItemStack output) { boolean hasBP = false; ItemStack[] blueprint = new ItemStack[9]; if (stack.hasTagCompound()){ - hasBP = (boolean) getNBT(stack, "mBlueprint"); - blueprint = readItemsFromNBT(stack); + hasBP = (boolean) this.getNBT(stack, "mBlueprint"); + blueprint = this.readItemsFromNBT(stack); } if (!hasBP){ @@ -164,7 +163,7 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ blueprint[0].stackSize = 0; } } - writeItemsToNBT(stack, blueprint); + this.writeItemsToNBT(stack, blueprint); if (stack.hasTagCompound()){ if(stack.getTagCompound().getCompoundTag("Items") != null){ stack.stackTagCompound.setBoolean("mBlueprint", true); @@ -172,43 +171,43 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ else { //Invalid BP saved? } - hasBP = (boolean) getNBT(stack, "mBlueprint"); + hasBP = (boolean) this.getNBT(stack, "mBlueprint"); } - + if (output != null){ - setBlueprintName(stack, output.getDisplayName()); + this.setBlueprintName(stack, output.getDisplayName()); hasBP = true; return true; } return false; - } catch (Throwable t){ - return false; + } catch (final Throwable t){ + return false; } } return false; } @Override - public void setBlueprintName(ItemStack stack, String name) { + public void setBlueprintName(final ItemStack stack, final String name) { stack.stackTagCompound.setString("mName", name); } @Override - public boolean hasBlueprint(ItemStack stack) { + public boolean hasBlueprint(final ItemStack stack) { if (stack.hasTagCompound()){ - return (boolean) getNBT(stack, "mBlueprint"); + return (boolean) this.getNBT(stack, "mBlueprint"); } return false; } @Override - public ItemStack[] getBlueprint(ItemStack stack) { + public ItemStack[] getBlueprint(final ItemStack stack) { ItemStack[] blueprint = new ItemStack[9]; if (stack.hasTagCompound()){ - blueprint = readItemsFromNBT(stack); - } + blueprint = this.readItemsFromNBT(stack); + } try { - ItemStack[] returnStack = new ItemStack[9]; + final ItemStack[] returnStack = new ItemStack[9]; for (int o=0; o<blueprint.length; o++){ returnStack[o] = blueprint[o]; if (returnStack[0] != null){ @@ -216,12 +215,12 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ } } return returnStack; - } catch (Throwable t){ - return null; + } catch (final Throwable t){ + return null; } } - public boolean createNBT(ItemStack itemStack){ + public boolean createNBT(final ItemStack itemStack){ if (itemStack.hasTagCompound()){ if (!itemStack.stackTagCompound.getBoolean("mBlueprint") && !itemStack.stackTagCompound.getString("mName").equals("")){ //No Blueprint and no name Set @@ -245,9 +244,9 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ return false; } else if(!itemStack.hasTagCompound()){ - int bpID = MathUtils.randInt(0, 1000); - boolean hasRecipe = false; - String recipeName = ""; + final int bpID = MathUtils.randInt(0, 1000); + final boolean hasRecipe = false; + final String recipeName = ""; Utils.LOG_WARNING("Creating Blueprint, setting up it's NBT data. "+bpID); itemStack.stackTagCompound = new NBTTagCompound(); itemStack.stackTagCompound.setInteger("mID", bpID); @@ -256,19 +255,19 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ return true; } else { - int bpID = MathUtils.randInt(0, 1000); - boolean hasRecipe = false; - String recipeName = ""; + final int bpID = MathUtils.randInt(0, 1000); + final boolean hasRecipe = false; + final String recipeName = ""; Utils.LOG_WARNING("Creating a Blueprint, setting up it's NBT data. "+bpID); itemStack.stackTagCompound = new NBTTagCompound(); itemStack.stackTagCompound.setInteger("mID", bpID); itemStack.stackTagCompound.setBoolean("mBlueprint", hasRecipe); itemStack.stackTagCompound.setString("mName", recipeName); return true; - } + } } - public Object getNBT(ItemStack itemStack, String tagNBT){ + public Object getNBT(final ItemStack itemStack, final String tagNBT){ if (!itemStack.hasTagCompound()){ return null; } @@ -286,8 +285,9 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ //For More Tag Support //o = itemStack.stackTagCompound.getInteger(tagNBT); } - if (o != null) + if (o != null) { return o; + } return null; } } diff --git a/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java index 77aa6ce078..ad98df9c78 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java @@ -1,13 +1,16 @@ package gtPlusPlus.core.item.general; +import java.util.List; + +import baubles.api.BaubleType; +import baubles.api.IBauble; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import ic2.api.item.*; - -import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -17,10 +20,6 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import baubles.api.BaubleType; -import baubles.api.IBauble; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; @Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) public class ItemCloakingDevice extends Item implements IElectricItem, IElectricItemManager, IBauble{ @@ -30,35 +29,35 @@ public class ItemCloakingDevice extends Item implements IElectricItem, IElectric private final static int maxValueEU = 10000*20*500; protected double chargeEU = 0; - public ItemCloakingDevice(double charge){ + public ItemCloakingDevice(final double charge){ this.chargeEU = charge; this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setUnlocalizedName(unlocalizedName); + this.setUnlocalizedName(this.unlocalizedName); this.setMaxStackSize(1); this.setTextureName(CORE.MODID + ":" + "personalCloakingDevice"); this.thisStack = ItemUtils.getSimpleStack(this); - this.charge(thisStack, charge, 3, true, false); - if (charge == 10000*20*500){ - this.setDamage(thisStack, 13); + this.charge(this.thisStack, charge, 3, true, false); + if (charge == (10000*20*500)){ + this.setDamage(this.thisStack, 13); } - GameRegistry.registerItem(this, unlocalizedName+"-"+charge); + GameRegistry.registerItem(this, this.unlocalizedName+"-"+charge); } @Override - public void onUpdate(ItemStack itemStack, World worldObj, Entity player, int p_77663_4_, boolean p_77663_5_) { + public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, final boolean p_77663_5_) { if (worldObj.isRemote) { return; } if (player instanceof EntityPlayer){ - for (ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { + for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { if (is == itemStack) { continue; } if (is != null) { if (is.getItem() instanceof IElectricItem) { - IElectricItem electricItem = (IElectricItem) is.getItem(); - chargeEU = ElectricItem.manager.getCharge(is); + final IElectricItem electricItem = (IElectricItem) is.getItem(); + this.chargeEU = ElectricItem.manager.getCharge(is); } } @@ -70,74 +69,74 @@ public class ItemCloakingDevice extends Item implements IElectricItem, IElectric } @Override - public boolean canProvideEnergy(ItemStack itemStack) { + public boolean canProvideEnergy(final ItemStack itemStack) { return true; } @Override - public Item getChargedItem(ItemStack itemStack) { - ItemStack x = itemStack.copy(); + public Item getChargedItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); x.setItemDamage(maxValueEU); return x.getItem(); } @Override - public Item getEmptyItem(ItemStack itemStack) { - ItemStack x = itemStack.copy(); + public Item getEmptyItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); x.setItemDamage(0); return x.getItem(); } @Override - public double getMaxCharge(ItemStack itemStack) { + public double getMaxCharge(final ItemStack itemStack) { return maxValueEU; } @Override - public int getTier(ItemStack itemStack) { + public int getTier(final ItemStack itemStack) { return 5; } @Override - public double getTransferLimit(ItemStack itemStack) { + public double getTransferLimit(final ItemStack itemStack) { return 8196; } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { return (EnumChatFormatting.BLUE+"Personal Cloaking Device"+EnumChatFormatting.GRAY); } @Override - public double getDurabilityForDisplay(ItemStack stack) + public double getDurabilityForDisplay(final ItemStack stack) { //return 1.0D - getEnergyStored(stack) / this.capacity; - return 1.0D - (double)getCharge(stack) / (double)getMaxCharge(stack); + return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack)); } @Override - public boolean showDurabilityBar(ItemStack stack) + public boolean showDurabilityBar(final ItemStack stack) { return true; } - - public int secondsLeft(ItemStack stack){ + + public int secondsLeft(final ItemStack stack){ double r = 0; - r = getCharge(stack)/(10000*20); + r = this.getCharge(stack)/(10000*20); return (int) MathUtils.decimalRounding(r); } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add(""); - list.add(EnumChatFormatting.GREEN+"Worn as a Belt within Baubles."+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN+"Drains 10,000EU/t to provide invisibility."+EnumChatFormatting.GRAY); - list.add(""); - list.add(EnumChatFormatting.GOLD+"IC2/EU Information"+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+getTier(thisStack)+EnumChatFormatting.GRAY+"] Input Limit: ["+EnumChatFormatting.YELLOW+getTransferLimit(thisStack)+EnumChatFormatting.GRAY +"EU/t]"); - list.add(EnumChatFormatting.GRAY+"Current Power: ["+EnumChatFormatting.YELLOW+(long) getCharge(stack)+EnumChatFormatting.GRAY+"EU] ["+EnumChatFormatting.YELLOW+MathUtils.findPercentage(getCharge(stack), getMaxCharge(stack))+EnumChatFormatting.GRAY +"%]"); - list.add(EnumChatFormatting.GRAY+"Time Remaining: ["+EnumChatFormatting.YELLOW+secondsLeft(stack)+ EnumChatFormatting.GRAY +" seconds]"); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(""); + list.add(EnumChatFormatting.GREEN+"Worn as a Belt within Baubles."+EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GREEN+"Drains 10,000EU/t to provide invisibility."+EnumChatFormatting.GRAY); + list.add(""); + list.add(EnumChatFormatting.GOLD+"IC2/EU Information"+EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+this.getTier(this.thisStack)+EnumChatFormatting.GRAY+"] Input Limit: ["+EnumChatFormatting.YELLOW+this.getTransferLimit(this.thisStack)+EnumChatFormatting.GRAY +"EU/t]"); + list.add(EnumChatFormatting.GRAY+"Current Power: ["+EnumChatFormatting.YELLOW+(long) this.getCharge(stack)+EnumChatFormatting.GRAY+"EU] ["+EnumChatFormatting.YELLOW+MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack))+EnumChatFormatting.GRAY +"%]"); + list.add(EnumChatFormatting.GRAY+"Time Remaining: ["+EnumChatFormatting.YELLOW+this.secondsLeft(stack)+ EnumChatFormatting.GRAY +" seconds]"); super.addInformation(stack, aPlayer, list, bool); } @@ -165,8 +164,8 @@ public class ItemCloakingDevice extends Item implements IElectricItem, IElectric }*/ @Override - public double charge(ItemStack stack, double amount, int tier, - boolean ignoreTransferLimit, boolean simulate) { + public double charge(final ItemStack stack, final double amount, final int tier, + final boolean ignoreTransferLimit, final boolean simulate) { if (!simulate) { @@ -177,8 +176,8 @@ public class ItemCloakingDevice extends Item implements IElectricItem, IElectric } @Override - public double discharge(ItemStack stack, double amount, int tier, - boolean ignoreTransferLimit, boolean externally, boolean simulate) { + public double discharge(final ItemStack stack, final double amount, final int tier, + final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) { if (!simulate) { ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); @@ -188,62 +187,62 @@ public class ItemCloakingDevice extends Item implements IElectricItem, IElectric } @Override - public double getCharge(ItemStack stack) { + public double getCharge(final ItemStack stack) { return ElectricItem.manager.getCharge(stack); } @Override - public boolean canUse(ItemStack stack, double amount) { + public boolean canUse(final ItemStack stack, final double amount) { return ElectricItem.manager.canUse(stack, amount); } @Override - public boolean use(ItemStack stack, double amount, EntityLivingBase entity) { + public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) { return ElectricItem.manager.use(stack, amount, entity); } @Override - public void chargeFromArmor(ItemStack stack, EntityLivingBase entity) { + public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) { ElectricItem.manager.chargeFromArmor(stack, entity); } @Override - public String getToolTip(ItemStack stack) { + public String getToolTip(final ItemStack stack) { return ElectricItem.manager.getToolTip(stack); } @Override - public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) { + public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) { return true; } @Override - public boolean canUnequip(ItemStack arg0, EntityLivingBase arg1) { + public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) { return true; } @Override - public BaubleType getBaubleType(ItemStack arg0) { + public BaubleType getBaubleType(final ItemStack arg0) { return BaubleType.BELT; } @Override //TODO - public void onEquipped(ItemStack arg0, EntityLivingBase arg1) { + public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { } @Override //TODO - public void onUnequipped(ItemStack arg0, EntityLivingBase arg1) { + public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) { } @Override //TODO - public void onWornTick(ItemStack arg0, EntityLivingBase arg1) { + public void onWornTick(final ItemStack arg0, final EntityLivingBase arg1) { //Utils.LOG_INFO("Trying to Tick Belt. 1"); if (!arg1.worldObj.isRemote){ - if (getCharge(arg0) >= 10000){ + if (this.getCharge(arg0) >= 10000){ arg1.addPotionEffect(new PotionEffect(Potion.invisibility.id, 10, 2)); - discharge(arg0, 10000, 5, true, true, false); + this.discharge(arg0, 10000, 5, true, true, false); } else { if (arg1.isPotionActive((Potion.invisibility))){ diff --git a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java index d922c243c3..63e0abb238 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java @@ -1,5 +1,11 @@ package gtPlusPlus.core.item.general; +import java.util.List; + +import baubles.api.BaubleType; +import baubles.api.IBauble; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; @@ -7,9 +13,6 @@ import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.player.PlayerUtils; import ic2.api.item.*; - -import java.util.List; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -17,10 +20,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import baubles.api.BaubleType; -import baubles.api.IBauble; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; @Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) public class ItemHealingDevice extends Item implements IElectricItem, IElectricItemManager, IBauble{ @@ -32,28 +31,28 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI public ItemHealingDevice(){ this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setUnlocalizedName(unlocalizedName); + this.setUnlocalizedName(this.unlocalizedName); this.setMaxStackSize(1); this.setTextureName(CORE.MODID + ":" + "personalCloakingDevice"); this.thisStack = ItemUtils.getSimpleStack(this); - GameRegistry.registerItem(this, unlocalizedName); + GameRegistry.registerItem(this, this.unlocalizedName); } @Override - public void onUpdate(ItemStack itemStack, World worldObj, Entity player, int p_77663_4_, boolean p_77663_5_) { + public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, final boolean p_77663_5_) { if (worldObj.isRemote) { return; } if (player instanceof EntityPlayer){ - for (ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { + for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { if (is == itemStack) { continue; } if (is != null) { if (is.getItem() instanceof IElectricItem) { - IElectricItem electricItem = (IElectricItem) is.getItem(); - chargeEU = ElectricItem.manager.getCharge(is); + final IElectricItem electricItem = (IElectricItem) is.getItem(); + this.chargeEU = ElectricItem.manager.getCharge(is); } } @@ -65,81 +64,81 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI } @Override - public boolean canProvideEnergy(ItemStack itemStack) { + public boolean canProvideEnergy(final ItemStack itemStack) { return true; } @Override - public Item getChargedItem(ItemStack itemStack) { - ItemStack x = itemStack.copy(); + public Item getChargedItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); x.setItemDamage(maxValueEU); return x.getItem(); } @Override - public Item getEmptyItem(ItemStack itemStack) { - ItemStack x = itemStack.copy(); + public Item getEmptyItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); x.setItemDamage(0); return x.getItem(); } @Override - public double getMaxCharge(ItemStack itemStack) { + public double getMaxCharge(final ItemStack itemStack) { return maxValueEU; } @Override - public int getTier(ItemStack itemStack) { + public int getTier(final ItemStack itemStack) { return 5; } @Override - public double getTransferLimit(ItemStack itemStack) { + public double getTransferLimit(final ItemStack itemStack) { return 32784; } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { return (EnumChatFormatting.BLUE+"Personal Healing NanoBooster"+EnumChatFormatting.RESET); } @Override - public double getDurabilityForDisplay(ItemStack stack) + public double getDurabilityForDisplay(final ItemStack stack) { //return 1.0D - getEnergyStored(stack) / this.capacity; - return 1.0D - (double)getCharge(stack) / (double)getMaxCharge(stack); + return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack)); } @Override - public boolean showDurabilityBar(ItemStack stack) + public boolean showDurabilityBar(final ItemStack stack) { return true; } - - public double secondsLeft(ItemStack stack){ - + + public double secondsLeft(final ItemStack stack){ + double r = 0; - r = getCharge(stack)/(1638400/4); + r = this.getCharge(stack)/(1638400/4); return (int) r; } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add(""); - list.add(EnumChatFormatting.GREEN+"Worn as a Necklace within Baubles."+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN+"Drains 1638400eu to restore hunger."+EnumChatFormatting.GRAY); - list.add(""); - list.add(EnumChatFormatting.GOLD+"IC2/EU Information"+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+getTier(thisStack)+EnumChatFormatting.GRAY+"] Transfer Limit: ["+EnumChatFormatting.YELLOW+getTransferLimit(thisStack)+EnumChatFormatting.GRAY +"Eu/t]"); - list.add(EnumChatFormatting.GRAY+"Current Power: ["+EnumChatFormatting.YELLOW+(long) getCharge(stack)+EnumChatFormatting.GRAY+"Eu] ["+EnumChatFormatting.YELLOW+MathUtils.findPercentage(getCharge(stack), getMaxCharge(stack))+EnumChatFormatting.GRAY +"%]"); - list.add(EnumChatFormatting.GRAY+"Uses Remaining: ["+EnumChatFormatting.YELLOW+secondsLeft(stack)+ EnumChatFormatting.GRAY +"]"); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(""); + list.add(EnumChatFormatting.GREEN+"Worn as a Necklace within Baubles."+EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GREEN+"Drains 1638400eu to restore hunger."+EnumChatFormatting.GRAY); + list.add(""); + list.add(EnumChatFormatting.GOLD+"IC2/EU Information"+EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+this.getTier(this.thisStack)+EnumChatFormatting.GRAY+"] Transfer Limit: ["+EnumChatFormatting.YELLOW+this.getTransferLimit(this.thisStack)+EnumChatFormatting.GRAY +"Eu/t]"); + list.add(EnumChatFormatting.GRAY+"Current Power: ["+EnumChatFormatting.YELLOW+(long) this.getCharge(stack)+EnumChatFormatting.GRAY+"Eu] ["+EnumChatFormatting.YELLOW+MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack))+EnumChatFormatting.GRAY +"%]"); + list.add(EnumChatFormatting.GRAY+"Uses Remaining: ["+EnumChatFormatting.YELLOW+this.secondsLeft(stack)+ EnumChatFormatting.GRAY +"]"); super.addInformation(stack, aPlayer, list, bool); } @Override - public double charge(ItemStack stack, double amount, int tier, - boolean ignoreTransferLimit, boolean simulate) { + public double charge(final ItemStack stack, final double amount, final int tier, + final boolean ignoreTransferLimit, final boolean simulate) { if (!simulate) { @@ -150,8 +149,8 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI } @Override - public double discharge(ItemStack stack, double amount, int tier, - boolean ignoreTransferLimit, boolean externally, boolean simulate) { + public double discharge(final ItemStack stack, final double amount, final int tier, + final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) { if (!simulate) { ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); @@ -161,66 +160,66 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI } @Override - public double getCharge(ItemStack stack) { + public double getCharge(final ItemStack stack) { return ElectricItem.manager.getCharge(stack); } @Override - public boolean canUse(ItemStack stack, double amount) { + public boolean canUse(final ItemStack stack, final double amount) { return ElectricItem.manager.canUse(stack, amount); } @Override - public boolean use(ItemStack stack, double amount, EntityLivingBase entity) { + public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) { return ElectricItem.manager.use(stack, amount, entity); } @Override - public void chargeFromArmor(ItemStack stack, EntityLivingBase entity) { + public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) { ElectricItem.manager.chargeFromArmor(stack, entity); } @Override - public String getToolTip(ItemStack stack) { + public String getToolTip(final ItemStack stack) { return ElectricItem.manager.getToolTip(stack); } @Override - public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) { + public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) { return true; } @Override - public boolean canUnequip(ItemStack arg0, EntityLivingBase arg1) { + public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) { return true; } @Override - public BaubleType getBaubleType(ItemStack arg0) { + public BaubleType getBaubleType(final ItemStack arg0) { return BaubleType.AMULET; } @Override //TODO - public void onEquipped(ItemStack arg0, EntityLivingBase arg1) { + public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { } @Override //TODO - public void onUnequipped(ItemStack arg0, EntityLivingBase arg1) { + public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) { } @Override //TODO - public void onWornTick(ItemStack arg0, EntityLivingBase arg1) { + public void onWornTick(final ItemStack arg0, final EntityLivingBase arg1) { if (!arg1.worldObj.isRemote){ - if (getCharge(arg0) >= 1638400/4){ + if (this.getCharge(arg0) >= (1638400/4)){ if (arg1.getHealth() < arg1.getMaxHealth()){ - float rx = arg1.getMaxHealth()-arg1.getHealth(); + final float rx = arg1.getMaxHealth()-arg1.getHealth(); Utils.LOG_INFO("rx:"+rx); - arg1.heal(rx*2); - discharge(arg0, (1638400/4)*rx, 6, true, true, false); - PlayerUtils.messagePlayer((EntityPlayer) arg1, "Your NanoBooster Whirs! Leaving you feeling stronger. It Healed "+rx+" hp."); - PlayerUtils.messagePlayer((EntityPlayer) arg1, "You check it's remaining uses, it has "+secondsLeft(arg0)+"."); + arg1.heal(rx*2); + this.discharge(arg0, (1638400/4)*rx, 6, true, true, false); + PlayerUtils.messagePlayer((EntityPlayer) arg1, "Your NanoBooster Whirs! Leaving you feeling stronger. It Healed "+rx+" hp."); + PlayerUtils.messagePlayer((EntityPlayer) arg1, "You check it's remaining uses, it has "+this.secondsLeft(arg0)+"."); } } } diff --git a/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java b/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java index 70ab4d38f5..e20271d4b6 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java @@ -1,13 +1,16 @@ package gtPlusPlus.core.item.general; +import java.util.List; + +import baubles.api.BaubleType; +import baubles.api.IBauble; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.handler.events.CustomMovementHandler; import gtPlusPlus.core.handler.events.SneakManager; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.item.ItemUtils; - -import java.util.List; - import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -16,38 +19,34 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import baubles.api.BaubleType; -import baubles.api.IBauble; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; @Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) public class ItemSlowBuildingRing extends Item implements IBauble{ private final String unlocalizedName = "SlowBuildingRing"; CustomMovementHandler x; - + public ItemSlowBuildingRing(){ this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setUnlocalizedName(unlocalizedName); + this.setUnlocalizedName(this.unlocalizedName); this.setMaxStackSize(1); - this.setTextureName(CORE.MODID + ":" + "personalCloakingDevice"); + this.setTextureName(CORE.MODID + ":" + "itemSlowBuildersRing"); ItemUtils.getSimpleStack(this); - GameRegistry.registerItem(this, unlocalizedName); + GameRegistry.registerItem(this, this.unlocalizedName); } @Override - public void onUpdate(ItemStack itemStack, World worldObj, Entity player, int p_77663_4_, boolean p_77663_5_) { + public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, final boolean p_77663_5_) { if (worldObj.isRemote) { return; } if (player instanceof EntityPlayer){ - for (ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { + for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { if (is == itemStack) { continue; } if (is != null) { - + } } @@ -56,59 +55,59 @@ public class ItemSlowBuildingRing extends Item implements IBauble{ } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { return (EnumChatFormatting.YELLOW+"Slow Building Ring"+EnumChatFormatting.GRAY); } - + @Override - public boolean showDurabilityBar(ItemStack stack) + public boolean showDurabilityBar(final ItemStack stack) { return false; } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add(""); - list.add(EnumChatFormatting.GREEN+"Worn as a Ring within Baubles. Prevents you from sprinting."+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN+"Movement speed reduced to crouch speed."+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GREEN+"Press shift while worn to toggle crouch on/off."+EnumChatFormatting.GRAY); - list.add(""); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(""); + list.add(EnumChatFormatting.GREEN+"Worn as a Ring within Baubles. Prevents you from sprinting."+EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GREEN+"Movement speed reduced to crouch speed."+EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GREEN+"Press shift while worn to toggle crouch on/off."+EnumChatFormatting.GRAY); + list.add(""); super.addInformation(stack, aPlayer, list, bool); } @Override - public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) { + public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) { return true; } @Override - public boolean canUnequip(ItemStack arg0, EntityLivingBase arg1) { + public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) { return true; } @Override - public BaubleType getBaubleType(ItemStack arg0) { + public BaubleType getBaubleType(final ItemStack arg0) { return BaubleType.RING; } @Override //TODO - public void onEquipped(ItemStack arg0, EntityLivingBase arg1) { + public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { doEffect(arg1); } @Override //TODO - public void onUnequipped(ItemStack arg0, EntityLivingBase arg1) { + public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) { SneakManager.setSprintingStateON(); SneakManager.setCrouchingStateOFF(); } @Override //TODO - public void onWornTick(ItemStack arg0, EntityLivingBase arg1) { + public void onWornTick(final ItemStack arg0, final EntityLivingBase arg1) { doEffect(arg1); } - - private static void doEffect(EntityLivingBase arg1){ + + private static void doEffect(final EntityLivingBase arg1){ if (arg1.worldObj.isRemote){ if (!arg1.isSneaking()){ arg1.setSneaking(true); diff --git a/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java b/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java index f452b83a73..f4ad191f11 100644 --- a/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java +++ b/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.item.general; +import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; @@ -12,199 +13,198 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.FillBucketEvent; -import cpw.mods.fml.common.eventhandler.Event; public class NuclearFuelRodBase extends Item { - /** field for checking if the bucket has been filled. */ - private Block isFull; - public NuclearFuelRodBase(Block p_i45331_1_) - { - this.maxStackSize = 1; - this.isFull = p_i45331_1_; - this.setCreativeTab(CreativeTabs.tabMisc); - } - - /** - * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer - */ - @Override - public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) - { - boolean flag = this.isFull == Blocks.air; - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(p_77659_2_, p_77659_3_, flag); - - if (movingobjectposition == null) - { - return p_77659_1_; - } - FillBucketEvent event = new FillBucketEvent(p_77659_3_, p_77659_1_, p_77659_2_, movingobjectposition); + /** field for checking if the bucket has been filled. */ + private final Block isFull; + public NuclearFuelRodBase(final Block p_i45331_1_) + { + this.maxStackSize = 1; + this.isFull = p_i45331_1_; + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + @Override + public ItemStack onItemRightClick(final ItemStack p_77659_1_, final World p_77659_2_, final EntityPlayer p_77659_3_) + { + final boolean flag = this.isFull == Blocks.air; + final MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(p_77659_2_, p_77659_3_, flag); + + if (movingobjectposition == null) + { + return p_77659_1_; + } + final FillBucketEvent event = new FillBucketEvent(p_77659_3_, p_77659_1_, p_77659_2_, movingobjectposition); if (MinecraftForge.EVENT_BUS.post(event)) { - return p_77659_1_; + return p_77659_1_; } if (event.getResult() == Event.Result.ALLOW) { - if (p_77659_3_.capabilities.isCreativeMode) - { - return p_77659_1_; - } - - if (--p_77659_1_.stackSize <= 0) - { - return event.result; - } - - if (!p_77659_3_.inventory.addItemStackToInventory(event.result)) - { - p_77659_3_.dropPlayerItemWithRandomChoice(event.result, false); - } - - return p_77659_1_; + if (p_77659_3_.capabilities.isCreativeMode) + { + return p_77659_1_; + } + + if (--p_77659_1_.stackSize <= 0) + { + return event.result; + } + + if (!p_77659_3_.inventory.addItemStackToInventory(event.result)) + { + p_77659_3_.dropPlayerItemWithRandomChoice(event.result, false); + } + + return p_77659_1_; } if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - - if (!p_77659_2_.canMineBlock(p_77659_3_, i, j, k)) - { - return p_77659_1_; - } - - if (flag) - { - if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_)) - { - return p_77659_1_; - } - - Material material = p_77659_2_.getBlock(i, j, k).getMaterial(); - int l = p_77659_2_.getBlockMetadata(i, j, k); - - if (material == Material.water && l == 0) - { - p_77659_2_.setBlockToAir(i, j, k); - return this.func_150910_a(p_77659_1_, p_77659_3_, Items.water_bucket); - } - - if (material == Material.lava && l == 0) - { - p_77659_2_.setBlockToAir(i, j, k); - return this.func_150910_a(p_77659_1_, p_77659_3_, Items.lava_bucket); - } - } - else - { - if (this.isFull == Blocks.air) - { - return new ItemStack(Items.bucket); - } - - if (movingobjectposition.sideHit == 0) - { - --j; - } - - if (movingobjectposition.sideHit == 1) - { - ++j; - } - - if (movingobjectposition.sideHit == 2) - { - --k; - } - - if (movingobjectposition.sideHit == 3) - { - ++k; - } - - if (movingobjectposition.sideHit == 4) - { - --i; - } - - if (movingobjectposition.sideHit == 5) - { - ++i; - } - - if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_)) - { - return p_77659_1_; - } - - if (this.tryPlaceContainedLiquid(p_77659_2_, i, j, k) && !p_77659_3_.capabilities.isCreativeMode) - { - return new ItemStack(Items.bucket); - } - } + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; + + if (!p_77659_2_.canMineBlock(p_77659_3_, i, j, k)) + { + return p_77659_1_; + } + + if (flag) + { + if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_)) + { + return p_77659_1_; + } + + final Material material = p_77659_2_.getBlock(i, j, k).getMaterial(); + final int l = p_77659_2_.getBlockMetadata(i, j, k); + + if ((material == Material.water) && (l == 0)) + { + p_77659_2_.setBlockToAir(i, j, k); + return this.func_150910_a(p_77659_1_, p_77659_3_, Items.water_bucket); + } + + if ((material == Material.lava) && (l == 0)) + { + p_77659_2_.setBlockToAir(i, j, k); + return this.func_150910_a(p_77659_1_, p_77659_3_, Items.lava_bucket); + } + } + else + { + if (this.isFull == Blocks.air) + { + return new ItemStack(Items.bucket); + } + + if (movingobjectposition.sideHit == 0) + { + --j; + } + + if (movingobjectposition.sideHit == 1) + { + ++j; + } + + if (movingobjectposition.sideHit == 2) + { + --k; + } + + if (movingobjectposition.sideHit == 3) + { + ++k; + } + + if (movingobjectposition.sideHit == 4) + { + --i; + } + + if (movingobjectposition.sideHit == 5) + { + ++i; + } + + if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_)) + { + return p_77659_1_; + } + + if (this.tryPlaceContainedLiquid(p_77659_2_, i, j, k) && !p_77659_3_.capabilities.isCreativeMode) + { + return new ItemStack(Items.bucket); + } + } } return p_77659_1_; - } - - @SuppressWarnings("static-method") - private ItemStack func_150910_a(ItemStack p_150910_1_, EntityPlayer p_150910_2_, Item p_150910_3_) - { - if (p_150910_2_.capabilities.isCreativeMode) - { - return p_150910_1_; - } - else if (--p_150910_1_.stackSize <= 0) - { - return new ItemStack(p_150910_3_); - } - else - { - if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_))) - { - p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false); - } - - return p_150910_1_; - } - } - - /** - * Attempts to place the liquid contained inside the bucket. - */ - public boolean tryPlaceContainedLiquid(World p_77875_1_, int p_77875_2_, int p_77875_3_, int p_77875_4_) - { - if (this.isFull == Blocks.air) - { - return false; - } - Material material = p_77875_1_.getBlock(p_77875_2_, p_77875_3_, p_77875_4_).getMaterial(); - boolean flag = !material.isSolid(); + } + + @SuppressWarnings("static-method") + private ItemStack func_150910_a(final ItemStack p_150910_1_, final EntityPlayer p_150910_2_, final Item p_150910_3_) + { + if (p_150910_2_.capabilities.isCreativeMode) + { + return p_150910_1_; + } + else if (--p_150910_1_.stackSize <= 0) + { + return new ItemStack(p_150910_3_); + } + else + { + if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_))) + { + p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false); + } + + return p_150910_1_; + } + } + + /** + * Attempts to place the liquid contained inside the bucket. + */ + public boolean tryPlaceContainedLiquid(final World p_77875_1_, final int p_77875_2_, final int p_77875_3_, final int p_77875_4_) + { + if (this.isFull == Blocks.air) + { + return false; + } + final Material material = p_77875_1_.getBlock(p_77875_2_, p_77875_3_, p_77875_4_).getMaterial(); + final boolean flag = !material.isSolid(); if (!p_77875_1_.isAirBlock(p_77875_2_, p_77875_3_, p_77875_4_) && !flag) { - return false; + return false; } - if (p_77875_1_.provider.isHellWorld && this.isFull == Blocks.flowing_water) + if (p_77875_1_.provider.isHellWorld && (this.isFull == Blocks.flowing_water)) { - p_77875_1_.playSoundEffect((double)((float)p_77875_2_ + 0.5F), (double)((float)p_77875_3_ + 0.5F), (double)((float)p_77875_4_ + 0.5F), "random.fizz", 0.5F, 2.6F + (p_77875_1_.rand.nextFloat() - p_77875_1_.rand.nextFloat()) * 0.8F); + p_77875_1_.playSoundEffect(p_77875_2_ + 0.5F, p_77875_3_ + 0.5F, p_77875_4_ + 0.5F, "random.fizz", 0.5F, 2.6F + ((p_77875_1_.rand.nextFloat() - p_77875_1_.rand.nextFloat()) * 0.8F)); - for (int l = 0; l < 8; ++l) - { - p_77875_1_.spawnParticle("largesmoke", (double)p_77875_2_ + Math.random(), (double)p_77875_3_ + Math.random(), (double)p_77875_4_ + Math.random(), 0.0D, 0.0D, 0.0D); - } + for (int l = 0; l < 8; ++l) + { + p_77875_1_.spawnParticle("largesmoke", p_77875_2_ + Math.random(), p_77875_3_ + Math.random(), p_77875_4_ + Math.random(), 0.0D, 0.0D, 0.0D); + } } else { - if (!p_77875_1_.isRemote && flag && !material.isLiquid()) - { - p_77875_1_.func_147480_a(p_77875_2_, p_77875_3_, p_77875_4_, true); - } + if (!p_77875_1_.isRemote && flag && !material.isLiquid()) + { + p_77875_1_.func_147480_a(p_77875_2_, p_77875_3_, p_77875_4_, true); + } - p_77875_1_.setBlock(p_77875_2_, p_77875_3_, p_77875_4_, this.isFull, 0, 3); + p_77875_1_.setBlock(p_77875_2_, p_77875_3_, p_77875_4_, this.isFull, 0, 3); } return true; - } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java b/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java index 3f51db7047..9c1fdd29f5 100644 --- a/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java +++ b/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java @@ -1,13 +1,17 @@ package gtPlusPlus.core.item.general; +import java.util.List; + +import cofh.energy.ItemEnergyContainer; +import cpw.mods.fml.common.IFuelHandler; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import ic2.api.item.*; - -import java.util.List; - import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -18,11 +22,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import cofh.energy.ItemEnergyContainer; -import cpw.mods.fml.common.IFuelHandler; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, IElectricItemManager, IFuelHandler{ @@ -39,29 +38,29 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, //this.setMaxDamage(Integer.MAX_VALUE); //this.setDamage(UtilsItems.getSimpleStack(this), 0); this.setCreativeTab(AddToCreativeTab.tabMachines); - this.setUnlocalizedName(unlocalizedName); + this.setUnlocalizedName(this.unlocalizedName); this.setMaxStackSize(1); this.setTextureName(CORE.MODID + ":" + "itemIngot"); this.thisStack = ItemUtils.getSimpleStack(this); - GameRegistry.registerItem(this, unlocalizedName); + GameRegistry.registerItem(this, this.unlocalizedName); } @Override - public void onUpdate(ItemStack itemStack, World worldObj, Entity player, int p_77663_4_, boolean p_77663_5_) { - getEnergyStored(itemStack); + public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, final boolean p_77663_5_) { + this.getEnergyStored(itemStack); if (worldObj.isRemote) { return; } if (player instanceof EntityPlayer){ - for (ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { + for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { if (is == itemStack) { continue; } if (is != null) { if (is.getItem() instanceof IElectricItem) { - IElectricItem electricItem = (IElectricItem) is.getItem(); - chargeEU = ElectricItem.manager.getCharge(is); + final IElectricItem electricItem = (IElectricItem) is.getItem(); + this.chargeEU = ElectricItem.manager.getCharge(is); } } @@ -73,145 +72,145 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, } @Override - public boolean canProvideEnergy(ItemStack itemStack) { + public boolean canProvideEnergy(final ItemStack itemStack) { return true; } @Override - public Item getChargedItem(ItemStack itemStack) { - ItemStack x = itemStack.copy(); + public Item getChargedItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); x.setItemDamage(maxValueEU); return x.getItem(); } @Override - public Item getEmptyItem(ItemStack itemStack) { - ItemStack x = itemStack.copy(); + public Item getEmptyItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); x.setItemDamage(0); return x.getItem(); } @Override - public double getMaxCharge(ItemStack itemStack) { + public double getMaxCharge(final ItemStack itemStack) { return maxValueEU; } @Override - public int getTier(ItemStack itemStack) { + public int getTier(final ItemStack itemStack) { return 3; } @Override - public double getTransferLimit(ItemStack itemStack) { + public double getTransferLimit(final ItemStack itemStack) { return 8196; } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + public String getItemStackDisplayName(final ItemStack p_77653_1_) { return ("Universally Chargeable Battery"); } @Override - public double getDurabilityForDisplay(ItemStack stack) + public double getDurabilityForDisplay(final ItemStack stack) { //return 1.0D - getEnergyStored(stack) / this.capacity; - return MathUtils.findPercentage(getEnergyStored(stack), getMaxEnergyStored(stack)); + return MathUtils.findPercentage(this.getEnergyStored(stack), this.getMaxEnergyStored(stack)); } @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack par1ItemStack, int par2) + public int getColorFromItemStack(final ItemStack par1ItemStack, final int par2) { - int i = 30; + final int i = 30; - float f13 = ((float)(Minecraft.getSystemTime() % 6000L) / 3000.0F * CORE.PI * 2.0F); + final float f13 = (((Minecraft.getSystemTime() % 6000L) / 3000.0F) * CORE.PI * 2.0F); - float t = 0.9F + 0.1F * MathHelper.cos(f13); + final float t = 0.9F + (0.1F * MathHelper.cos(f13)); - double v = 1.0D - getDurabilityForDisplay(par1ItemStack); + final double v = 1.0D - this.getDurabilityForDisplay(par1ItemStack); int r = i + (int)(v * (255 - i) * t); if (r > 255) { r = 255; } - int g = i + (int)(v * (64 - i) * t); + final int g = i + (int)(v * (64 - i) * t); - return r << 16 | g << 8 | i; + return (r << 16) | (g << 8) | i; } @Override - public boolean showDurabilityBar(ItemStack stack) + public boolean showDurabilityBar(final ItemStack stack) { return false; } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add(EnumChatFormatting.YELLOW+"IC2/EU Information"+EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+getTier(thisStack)+EnumChatFormatting.GRAY+"] Current Power: ["+EnumChatFormatting.YELLOW+(long) getCharge(stack)+EnumChatFormatting.GRAY+"/EU]"); - list.add(EnumChatFormatting.GRAY+"Transfer Limit: ["+EnumChatFormatting.YELLOW+getTransferLimit(thisStack)+ EnumChatFormatting.GRAY +"Eu/t]" +"Burn Time: ["+EnumChatFormatting.YELLOW+getBurnTime(stack)/20+EnumChatFormatting.GRAY+"s]"); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(EnumChatFormatting.YELLOW+"IC2/EU Information"+EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+this.getTier(this.thisStack)+EnumChatFormatting.GRAY+"] Current Power: ["+EnumChatFormatting.YELLOW+(long) this.getCharge(stack)+EnumChatFormatting.GRAY+"/EU]"); + list.add(EnumChatFormatting.GRAY+"Transfer Limit: ["+EnumChatFormatting.YELLOW+this.getTransferLimit(this.thisStack)+ EnumChatFormatting.GRAY +"Eu/t]" +"Burn Time: ["+EnumChatFormatting.YELLOW+(this.getBurnTime(stack)/20)+EnumChatFormatting.GRAY+"s]"); list.add(""); list.add(EnumChatFormatting.RED+"RF Information"); list.add(EnumChatFormatting.GRAY+"Extraction Rate: [" +EnumChatFormatting.RED+ this.maxExtract + EnumChatFormatting.GRAY + "Rf/t]" + " Insert Rate: [" +EnumChatFormatting.RED+ this.maxReceive+EnumChatFormatting.GRAY+"Rf/t]"); - list.add(EnumChatFormatting.GRAY+"Current Charge: ["+EnumChatFormatting.RED+getEnergyStored(stack) + EnumChatFormatting.GRAY + "Rf / " + getMaxEnergyStored(stack)+"Rf] "+EnumChatFormatting.RED+MathUtils.findPercentage(getEnergyStored(stack), getMaxEnergyStored(stack))+EnumChatFormatting.GRAY+"%"); + list.add(EnumChatFormatting.GRAY+"Current Charge: ["+EnumChatFormatting.RED+this.getEnergyStored(stack) + EnumChatFormatting.GRAY + "Rf / " + this.getMaxEnergyStored(stack)+"Rf] "+EnumChatFormatting.RED+MathUtils.findPercentage(this.getEnergyStored(stack), this.getMaxEnergyStored(stack))+EnumChatFormatting.GRAY+"%"); super.addInformation(stack, aPlayer, list, bool); } @Override - public ItemStack getContainerItem(ItemStack itemStack) + public ItemStack getContainerItem(final ItemStack itemStack) { - ItemStack newItem = itemStack.copy(); + final ItemStack newItem = itemStack.copy(); newItem.stackSize = 1; - extractEnergy(newItem, 150000, false); + this.extractEnergy(newItem, 150000, false); return newItem; } @Override - public boolean hasContainerItem(ItemStack stack) + public boolean hasContainerItem(final ItemStack stack) { return true; } @Override - public int getBurnTime(ItemStack fuel) { + public int getBurnTime(final ItemStack fuel) { if ((fuel == null) || (fuel.getItem() != this)) { return 0; } - return extractEnergy(fuel, 150000, true) / 50 / 100; + return this.extractEnergy(fuel, 150000, true) / 50 / 100; } @Override - public double charge(ItemStack stack, double amount, int tier, - boolean ignoreTransferLimit, boolean simulate) { + public double charge(final ItemStack stack, final double amount, final int tier, + final boolean ignoreTransferLimit, final boolean simulate) { if (stack.stackTagCompound == null) { stack.stackTagCompound = new NBTTagCompound(); } int energy = stack.stackTagCompound.getInteger("Energy"); - int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, maxReceive)); + final int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, this.maxReceive)); if (!simulate) { energy += energyReceived; stack.stackTagCompound.setInteger("Energy", energy); ElectricItem.manager.discharge(stack, ElectricItem.manager.getCharge(stack), 3, true, true, false); ElectricItem.manager.charge(stack, energy/rfPerEU, 3, true, false); - + } return ElectricItem.manager.charge(stack, amount, tier, ignoreTransferLimit, simulate); } @Override - public double discharge(ItemStack stack, double amount, int tier, - boolean ignoreTransferLimit, boolean externally, boolean simulate) { + public double discharge(final ItemStack stack, final double amount, final int tier, + final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) { if ((stack.stackTagCompound == null) || (!stack.stackTagCompound.hasKey("Energy"))) { - double euCharge = getCharge(ItemUtils.getSimpleStack(this)); - if (euCharge != 0 && euCharge >= 1){ + final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this)); + if ((euCharge != 0) && (euCharge >= 1)){ return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); } return 0; } int energy = stack.stackTagCompound.getInteger("Energy"); - int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); + final int energyExtracted = Math.min(energy, Math.min(this.maxExtract, this.maxExtract)); if (!simulate) { energy -= energyExtracted; @@ -219,70 +218,70 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, ElectricItem.manager.discharge(stack, ElectricItem.manager.getCharge(stack), 3, true, true, false); ElectricItem.manager.charge(stack, energy/rfPerEU, 3, true, false); } - + return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); } @Override - public double getCharge(ItemStack stack) { + public double getCharge(final ItemStack stack) { return ElectricItem.manager.getCharge(stack); } @Override - public boolean canUse(ItemStack stack, double amount) { + public boolean canUse(final ItemStack stack, final double amount) { return ElectricItem.manager.canUse(stack, amount); } @Override - public boolean use(ItemStack stack, double amount, EntityLivingBase entity) { + public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) { return ElectricItem.manager.use(stack, amount, entity); } @Override - public void chargeFromArmor(ItemStack stack, EntityLivingBase entity) { + public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) { ElectricItem.manager.chargeFromArmor(stack, entity); } @Override - public String getToolTip(ItemStack stack) { + public String getToolTip(final ItemStack stack) { return ElectricItem.manager.getToolTip(stack); } @Override - public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) + public int receiveEnergy(final ItemStack container, final int maxReceive, final boolean simulate) { if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) { - double euCharge = getCharge(ItemUtils.getSimpleStack(this)); - if (euCharge != 0 && euCharge >= 1){ + final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this)); + if ((euCharge != 0) && (euCharge >= 1)){ return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); } return 0; } int energy = container.stackTagCompound.getInteger("Energy"); - int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, maxReceive)); + final int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, maxReceive)); if (!simulate) { energy += energyReceived; container.stackTagCompound.setInteger("Energy", energy); ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false); ElectricItem.manager.charge(container, energy/rfPerEU, 3, true, false); - + } return energyReceived; } @Override - public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) + public int extractEnergy(final ItemStack container, final int maxExtract, final boolean simulate) { if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) { - double euCharge = getCharge(ItemUtils.getSimpleStack(this)); - if (euCharge != 0 && euCharge >= 1){ + final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this)); + if ((euCharge != 0) && (euCharge >= 1)){ return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); } return 0; } int energy = container.stackTagCompound.getInteger("Energy"); - int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); + final int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); if (!simulate) { energy -= energyExtracted; @@ -294,16 +293,16 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, } @Override - public int getEnergyStored(ItemStack container) + public int getEnergyStored(final ItemStack container) { if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) { - double euCharge = getCharge(ItemUtils.getSimpleStack(this)); - if (euCharge != 0 && euCharge >= 1){ + final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this)); + if ((euCharge != 0) && (euCharge >= 1)){ return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); } return 0; } - int energy = container.stackTagCompound.getInteger("Energy"); + final int energy = container.stackTagCompound.getInteger("Energy"); ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false); ElectricItem.manager.charge(container, energy/rfPerEU, 3, true, false); return energy; diff --git a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java b/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java index 2a94456c2a..5678058818 100644 --- a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java +++ b/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java @@ -1,10 +1,9 @@ package gtPlusPlus.core.item.general.fuelrods; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; - import java.util.List; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -19,8 +18,8 @@ public class FuelRod_Base extends Item{ public int maximumFuel = 0; public String fuelType = ""; public float heat = 0; - public float maxHeat = getMaxHeat(); - public FuelRod_Base(String unlocalizedName, String type, int fuelLeft, int maxFuel) { + public float maxHeat = this.getMaxHeat(); + public FuelRod_Base(final String unlocalizedName, final String type, final int fuelLeft, final int maxFuel) { this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); this.setMaxStackSize(1); @@ -30,88 +29,88 @@ public class FuelRod_Base extends Item{ this.fuelType = type; this.setCreativeTab(AddToCreativeTab.tabMachines); } - + private float getMaxHeat(){ float tempvar; - if (fuelType == "Thorium"){ + if (this.fuelType == "Thorium"){ tempvar = 2500; } - - else if (fuelType == "Uranium"){ + + else if (this.fuelType == "Uranium"){ tempvar = 5000; } - - else if (fuelType == "Plutonium"){ + + else if (this.fuelType == "Plutonium"){ tempvar = 10000; } - + else { tempvar = 5000; } return tempvar; - + } - - private void updateVars(ItemStack stack){ + + private void updateVars(final ItemStack stack){ if (stack.stackTagCompound != null) { - heat = stack.stackTagCompound.getFloat("heat"); - fuelRemaining = stack.stackTagCompound.getInteger("fuelRemaining"); - } + this.heat = stack.stackTagCompound.getFloat("heat"); + this.fuelRemaining = stack.stackTagCompound.getInteger("fuelRemaining"); + } } - + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - Float NBT_Heat = heat; - Float NBT_MaxHeat = maxHeat; - int NBT_Fuel = fuelRemaining; - String NBT_Type= fuelType; + Float NBT_Heat = this.heat; + Float NBT_MaxHeat = this.maxHeat; + int NBT_Fuel = this.fuelRemaining; + String NBT_Type= this.fuelType; if (stack.stackTagCompound != null) { NBT_Heat = stack.stackTagCompound.getFloat("heat"); NBT_MaxHeat = stack.stackTagCompound.getFloat("maxHeat"); NBT_Fuel = stack.stackTagCompound.getInteger("fuelRemaining"); NBT_Type = stack.stackTagCompound.getString("fuelType"); - } + } - String tempHeat = String.valueOf(NBT_Heat); - String tempMaxHeat = String.valueOf(NBT_MaxHeat); - String tempFuel = String.valueOf(NBT_Fuel); - String formattedType = EnumChatFormatting.DARK_RED+NBT_Type+EnumChatFormatting.GRAY; + final String tempHeat = String.valueOf(NBT_Heat); + final String tempMaxHeat = String.valueOf(NBT_MaxHeat); + final String tempFuel = String.valueOf(NBT_Fuel); + final String formattedType = EnumChatFormatting.DARK_RED+NBT_Type+EnumChatFormatting.GRAY; String formattedHeat = EnumChatFormatting.RED+tempHeat+EnumChatFormatting.GRAY; - String formattedMaxHeat = EnumChatFormatting.RED+tempMaxHeat+EnumChatFormatting.GRAY; + final String formattedMaxHeat = EnumChatFormatting.RED+tempMaxHeat+EnumChatFormatting.GRAY; String formattedFuelLeft = tempFuel+EnumChatFormatting.GRAY; - int tempMax = maximumFuel; - float tempCurrentHeat = heat; - int tempFuelLeft = fuelRemaining; - + final int tempMax = this.maximumFuel; + final float tempCurrentHeat = this.heat; + final int tempFuelLeft = this.fuelRemaining; + //Fuel Usage Formatting - if (tempFuelLeft <= maximumFuel/3){ + if (tempFuelLeft <= (this.maximumFuel/3)){ formattedFuelLeft = EnumChatFormatting.RED+tempFuel+EnumChatFormatting.GRAY; } - else if (tempFuelLeft >= maximumFuel/3 && tempFuelLeft <= (maximumFuel/3)*2){ + else if ((tempFuelLeft >= (this.maximumFuel/3)) && (tempFuelLeft <= ((this.maximumFuel/3)*2))){ formattedFuelLeft = EnumChatFormatting.YELLOW+tempFuel+EnumChatFormatting.GRAY; } - else if (tempFuelLeft >= (maximumFuel/3)*2 && tempFuelLeft <= maximumFuel){ + else if ((tempFuelLeft >= ((this.maximumFuel/3)*2)) && (tempFuelLeft <= this.maximumFuel)){ formattedFuelLeft = EnumChatFormatting.GREEN+tempFuel+EnumChatFormatting.GRAY; } else { formattedFuelLeft = EnumChatFormatting.GRAY+tempFuel+EnumChatFormatting.GRAY; } - + //Heat Formatting - if (tempCurrentHeat <= 200 && tempCurrentHeat >= 0){ + if ((tempCurrentHeat <= 200) && (tempCurrentHeat >= 0)){ formattedHeat = EnumChatFormatting.GRAY+tempHeat+EnumChatFormatting.GRAY; } - else if (tempCurrentHeat <= maxHeat/3 && tempCurrentHeat > 200){ + else if ((tempCurrentHeat <= (this.maxHeat/3)) && (tempCurrentHeat > 200)){ formattedHeat = EnumChatFormatting.YELLOW+tempHeat+EnumChatFormatting.GRAY; } - else if (tempCurrentHeat >= maxHeat/3 && tempMax < (maxHeat/3)*2 && tempCurrentHeat != 0){ + else if ((tempCurrentHeat >= (this.maxHeat/3)) && (tempMax < ((this.maxHeat/3)*2)) && (tempCurrentHeat != 0)){ formattedHeat = EnumChatFormatting.GOLD+tempHeat+EnumChatFormatting.GRAY; } - else if (tempCurrentHeat >= ((maxHeat/3)*2) && tempMax <= maxHeat && tempCurrentHeat != 0){ + else if ((tempCurrentHeat >= ((this.maxHeat/3)*2)) && (tempMax <= this.maxHeat) && (tempCurrentHeat != 0)){ formattedHeat = EnumChatFormatting.RED+tempHeat+EnumChatFormatting.GRAY; } else { @@ -123,64 +122,64 @@ public class FuelRod_Base extends Item{ super.addInformation(stack, aPlayer, list, bool); } - public String getType(ItemStack stack){ + public String getType(final ItemStack stack){ if (stack.stackTagCompound != null){ return stack.stackTagCompound.getString("fuelType"); - } - return fuelType; + } + return this.fuelType; } - public int getFuelRemaining(ItemStack stack){ + public int getFuelRemaining(final ItemStack stack){ if (stack.stackTagCompound != null){ return stack.stackTagCompound.getInteger("fuelRemaining"); - } - return 0; + } + return 0; } public int getMaxFuel(){ - return maximumFuel; + return this.maximumFuel; } - public int getFuel(ItemStack stack){ + public int getFuel(final ItemStack stack){ if (stack != null){ - int i = stack.getItemDamage(); - int r = maximumFuel - i; + final int i = stack.getItemDamage(); + final int r = this.maximumFuel - i; return r; } return 0; } - public boolean setFuelRemainingExplicitly(int i){ - int tempFuel = fuelRemaining; - fuelRemaining = i; + public boolean setFuelRemainingExplicitly(final int i){ + final int tempFuel = this.fuelRemaining; + this.fuelRemaining = i; if (i != tempFuel){ return true; - } + } return false; } - public boolean addFuel(int i){ - int tempFuel = fuelRemaining; - fuelRemaining = tempFuel+i; - if (fuelRemaining != tempFuel){ + public boolean addFuel(final int i){ + final int tempFuel = this.fuelRemaining; + this.fuelRemaining = tempFuel+i; + if (this.fuelRemaining != tempFuel){ return true; - } + } return false; } - public float getHeat(ItemStack value){ + public float getHeat(final ItemStack value){ if (value.stackTagCompound != null){ - return value.stackTagCompound.getFloat("heat"); + return value.stackTagCompound.getFloat("heat"); } return 0f; } - public boolean addHeat(float i){ - float tempFuel = heat; - heat = tempFuel+i; - if (heat != tempFuel){ + public boolean addHeat(final float i){ + final float tempFuel = this.heat; + this.heat = tempFuel+i; + if (this.heat != tempFuel){ return true; - } + } return false; } @@ -188,36 +187,36 @@ public class FuelRod_Base extends Item{ //Ticking and NBT Handling /* Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and * update it's contents. - * + * * public int fuelRemaining = 0; public int maximumFuel = 0; public String fuelType = ""; public float heat = 0; public float maxHeat = 5000; - * + * */ @Override - public void onCreated(ItemStack itemStack, World world, EntityPlayer player) { + public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) { itemStack.stackTagCompound = new NBTTagCompound(); - itemStack.stackTagCompound.setInteger("fuelRemaining", getFuelRemaining(itemStack)); - itemStack.stackTagCompound.setInteger("maximumFuel", maximumFuel); - itemStack.stackTagCompound.setFloat("heat", getHeat(itemStack)); - itemStack.stackTagCompound.setFloat("maxHeat", getMaxHeat()); - itemStack.stackTagCompound.setString("fuelType", getType(itemStack)); - updateVars(itemStack); + itemStack.stackTagCompound.setInteger("fuelRemaining", this.getFuelRemaining(itemStack)); + itemStack.stackTagCompound.setInteger("maximumFuel", this.maximumFuel); + itemStack.stackTagCompound.setFloat("heat", this.getHeat(itemStack)); + itemStack.stackTagCompound.setFloat("maxHeat", this.getMaxHeat()); + itemStack.stackTagCompound.setString("fuelType", this.getType(itemStack)); + this.updateVars(itemStack); } @Override - public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) { itemStack.stackTagCompound = new NBTTagCompound(); - itemStack.stackTagCompound.setInteger("fuelRemaining", getFuelRemaining(itemStack)); - itemStack.stackTagCompound.setInteger("maximumFuel", maximumFuel); - itemStack.stackTagCompound.setFloat("heat", getHeat(itemStack)); - itemStack.stackTagCompound.setFloat("maxHeat", getMaxHeat()); - itemStack.stackTagCompound.setString("fuelType", getType(itemStack)); - updateVars(itemStack); + itemStack.stackTagCompound.setInteger("fuelRemaining", this.getFuelRemaining(itemStack)); + itemStack.stackTagCompound.setInteger("maximumFuel", this.maximumFuel); + itemStack.stackTagCompound.setFloat("heat", this.getHeat(itemStack)); + itemStack.stackTagCompound.setFloat("maxHeat", this.getMaxHeat()); + itemStack.stackTagCompound.setString("fuelType", this.getType(itemStack)); + this.updateVars(itemStack); } - - + + } diff --git a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java b/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java index 9b852cb1ea..dbf1209b50 100644 --- a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java +++ b/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.item.general.fuelrods; public class FuelRod_Thorium extends FuelRod_Base{ - public FuelRod_Thorium(String unlocalizedName, String type, int fuelLeft, int maxFuel) { + public FuelRod_Thorium(final String unlocalizedName, final String type, final int fuelLeft, final int maxFuel) { super(unlocalizedName, type, fuelLeft, maxFuel); this.setMaxDamage(maxFuel); this.maximumFuel = maxFuel; diff --git a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java index 7fbfca0ac8..bc9fc1167e 100644 --- a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java +++ b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java @@ -14,30 +14,30 @@ public class ItemsFoods { public static void load(){ run(); } - + private static void run(){ - - //Raisin Bread + + //Raisin Bread ModItems.itemIngotRaisinBread = new BaseItemFood("itemIngotRaisinBread", "Raisin Bread", 3, 1.5f, false, new PotionEffect(Potion.weakness.id, 40, 1)).setAlwaysEdible(); GT_OreDictUnificator.registerOre("foodRaisinBread", ItemUtils.getItemStack(CORE.MODID+":itemIngotRaisinBread", 1)); - //Hot Raisin Bread + //Hot Raisin Bread ModItems.itemHotIngotRaisinBread = new BaseItemHotFood("itemHotIngotRaisinBread", 1, 0.5f, "Raisin Bread", 120, ModItems.itemIngotRaisinBread); GT_OreDictUnificator.registerOre("foodHotRaisinBread", ItemUtils.getItemStack(CORE.MODID+":itemHotIngotRaisinBread", 1)); - //Raisin Bread + //Raisin Bread ModItems.itemFoodRaisinToast = new BaseItemFood("itemFoodRaisinToast", "Raisin Toast", 1, 0.5f, false).setAlwaysEdible(); GT_OreDictUnificator.registerOre("foodRaisinToast", ItemUtils.getItemStack(CORE.MODID+":itemFoodRaisinToast", 1)); - //Hot Raisin Bread + //Hot Raisin Bread ModItems.itemHotFoodRaisinToast = new BaseItemHotFood("itemHotFoodRaisinToast", 1, 0.5f, "Raisin Toast", 20, ModItems.itemFoodRaisinToast); GT_OreDictUnificator.registerOre("foodHotRaisinToast", ItemUtils.getItemStack(CORE.MODID+":itemHotFoodRaisinToast", 1)); - //Raisin Bread + //Raisin Bread ModItems.itemFoodCurriedSausages = new BaseItemFood("itemFoodCurriedSausages", "Curried Sausages", 5, 2f, false); GT_OreDictUnificator.registerOre("foodCurriedSausages", ItemUtils.getItemStack(CORE.MODID+":itemFoodCurriedSausages", 1)); - //Hot Raisin Bread + //Hot Raisin Bread ModItems.itemHotFoodCurriedSausages = new BaseItemHotFood("itemHotFoodCurriedSausages", 1, 0.5f, "Curried Sausages", 240, ModItems.itemFoodCurriedSausages); GT_OreDictUnificator.registerOre("foodHotCurriedSausages", ItemUtils.getItemStack(CORE.MODID+":itemHotFoodCurriedSausages", 1)); - + } - + } diff --git a/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java b/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java index 6a55356f1e..2c6479fbd4 100644 --- a/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java +++ b/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java @@ -14,60 +14,60 @@ public class ItemsMultiTools { public static void load(){ run(); } - + private static void run(){ - + //Load Multitools - boolean gtStyleTools = LoadedMods.Gregtech; - if (CORE.configSwitches.enableMultiSizeTools){ - - //GT Materials - Materials[] rm = Materials.values(); - for (Materials m : rm){ - toolFactoryGT(m, gtStyleTools); - } - - //GT++ Materials - toolFactory(ALLOY.HASTELLOY_C276); - toolFactory(ALLOY.HASTELLOY_N); - toolFactory(ALLOY.HASTELLOY_W); - toolFactory(ALLOY.HASTELLOY_X); - toolFactory(ALLOY.INCOLOY_020); - toolFactory(ALLOY.INCOLOY_DS); - toolFactory(ALLOY.INCOLOY_MA956); - toolFactory(ALLOY.INCONEL_625); - toolFactory(ALLOY.INCONEL_690); - toolFactory(ALLOY.INCONEL_792); - toolFactory(ALLOY.LEAGRISIUM); - toolFactory(ALLOY.TANTALLOY_60); - toolFactory(ALLOY.TANTALLOY_61); - toolFactory(ALLOY.STABALLOY); - toolFactory(ALLOY.QUANTUM); - //toolFactory(ALLOY.BEDROCKIUM); - toolFactory(ALLOY.POTIN); - toolFactory(ALLOY.TUMBAGA); - toolFactory(ALLOY.TALONITE); - toolFactory(ALLOY.STELLITE); - toolFactory(ALLOY.TUNGSTEN_CARBIDE); - toolFactory(ALLOY.TANTALUM_CARBIDE); - - - } - + final boolean gtStyleTools = LoadedMods.Gregtech; + if (CORE.configSwitches.enableMultiSizeTools){ + + //GT Materials + final Materials[] rm = Materials.values(); + for (final Materials m : rm){ + toolFactoryGT(m, gtStyleTools); + } + + //GT++ Materials + toolFactory(ALLOY.HASTELLOY_C276); + toolFactory(ALLOY.HASTELLOY_N); + toolFactory(ALLOY.HASTELLOY_W); + toolFactory(ALLOY.HASTELLOY_X); + toolFactory(ALLOY.INCOLOY_020); + toolFactory(ALLOY.INCOLOY_DS); + toolFactory(ALLOY.INCOLOY_MA956); + toolFactory(ALLOY.INCONEL_625); + toolFactory(ALLOY.INCONEL_690); + toolFactory(ALLOY.INCONEL_792); + toolFactory(ALLOY.LEAGRISIUM); + toolFactory(ALLOY.TANTALLOY_60); + toolFactory(ALLOY.TANTALLOY_61); + toolFactory(ALLOY.STABALLOY); + toolFactory(ALLOY.QUANTUM); + //toolFactory(ALLOY.BEDROCKIUM); + toolFactory(ALLOY.POTIN); + toolFactory(ALLOY.TUMBAGA); + toolFactory(ALLOY.TALONITE); + toolFactory(ALLOY.STELLITE); + toolFactory(ALLOY.TUNGSTEN_CARBIDE); + toolFactory(ALLOY.TANTALUM_CARBIDE); + + + } + } - - - private static boolean toolFactoryGT(Materials m, boolean b){ + + + private static boolean toolFactoryGT(final Materials m, final boolean b){ ModItems.MP_GTMATERIAL = ItemUtils.generateMultiPick(b, m); ModItems.MS_GTMATERIAL = ItemUtils.generateMultiShovel(b, m); return true; } - - private static boolean toolFactory(Material m){ + + private static boolean toolFactory(final Material m){ Utils.LOG_WARNING("Generating Multi-Tools for "+m.getLocalizedName()); ModItems.MP_GTMATERIAL = ItemUtils.generateMultiPick(m); ModItems.MS_GTMATERIAL = ItemUtils.generateMultiShovel(m); return true; } - + } diff --git a/src/Java/gtPlusPlus/core/item/materials/MaterialHandler.java b/src/Java/gtPlusPlus/core/item/materials/MaterialHandler.java index 0f89f2a0ff..40fc6539e6 100644 --- a/src/Java/gtPlusPlus/core/item/materials/MaterialHandler.java +++ b/src/Java/gtPlusPlus/core/item/materials/MaterialHandler.java @@ -4,7 +4,7 @@ public class MaterialHandler { @SuppressWarnings("unused") private String Staballoy; - - - + + + } diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java b/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java index 108ac4b83d..b78f81aa98 100644 --- a/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java +++ b/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java @@ -1,16 +1,15 @@ package gtPlusPlus.core.item.tool.misc; -import gtPlusPlus.core.item.base.BaseItemWithDamageValue; -import gtPlusPlus.core.lib.CORE; - import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.item.base.BaseItemWithDamageValue; +import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class SandstoneHammer extends BaseItemWithDamageValue{ @@ -18,14 +17,14 @@ public class SandstoneHammer extends BaseItemWithDamageValue{ * @see net.minecraft.item.Item#getColorFromItemStack(net.minecraft.item.ItemStack, int) */ @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { //Figure Out Damage return super.getColorFromItemStack(stack, HEX_OxFFFFFF); } - public SandstoneHammer(String unlocalizedName) { + public SandstoneHammer(final String unlocalizedName) { super(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); this.setMaxStackSize(1); @@ -34,13 +33,13 @@ public class SandstoneHammer extends BaseItemWithDamageValue{ @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { list.add(EnumChatFormatting.GRAY+"Allows you to craft sand from cobble, or sandstone from sand."); super.addInformation(stack, aPlayer, list, bool); - } + } @Override - public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) + public boolean doesContainerItemLeaveCraftingGrid(final ItemStack itemStack) { return false; } @@ -52,12 +51,12 @@ public class SandstoneHammer extends BaseItemWithDamageValue{ } @Override - public boolean hasContainerItem(ItemStack itemStack) + public boolean hasContainerItem(final ItemStack itemStack) { return true; } @Override - public ItemStack getContainerItem(ItemStack itemStack) + public ItemStack getContainerItem(final ItemStack itemStack) { itemStack.setItemDamage(itemStack.getItemDamage() + 8); @@ -66,12 +65,12 @@ public class SandstoneHammer extends BaseItemWithDamageValue{ @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ + public EnumRarity getRarity(final ItemStack par1ItemStack){ return EnumRarity.uncommon; } @Override - public boolean hasEffect(ItemStack par1ItemStack){ + public boolean hasEffect(final ItemStack par1ItemStack){ return false; } diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java index 55584faf2d..6499dc696b 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java @@ -1,5 +1,10 @@ package gtPlusPlus.core.item.tool.staballoy; +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; @@ -14,19 +19,13 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.*; import net.minecraft.world.World; -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class MultiPickaxeBase extends StaballoyPickaxe{ /* (non-Javadoc) * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) */ @Override - public double getDurabilityForDisplay(ItemStack stack) { + public double getDurabilityForDisplay(final ItemStack stack) { if (super.getDurabilityForDisplay(stack) > 0){ return super.getDurabilityForDisplay(stack);} return 0; @@ -38,7 +37,7 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ public boolean isValid = true; private final Pair<?, ?> enchantment; - public MultiPickaxeBase(String unlocalizedName, ToolMaterial material, int materialDurability, int colour, Object enchant) { + public MultiPickaxeBase(final String unlocalizedName, final ToolMaterial material, final int materialDurability, final int colour, final Object enchant) { super(Utils.sanitizeString(unlocalizedName), material); this.setUnlocalizedName(Utils.sanitizeString(unlocalizedName)); //this.setTextureName(CORE.MODID + ":" + "itemPickaxe"); @@ -50,13 +49,13 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ this.materialName = material.name(); this.displayName = unlocalizedName; this.setCreativeTab(AddToCreativeTab.tabTools); - miningLevel = material.getHarvestLevel(); - - - + this.miningLevel = material.getHarvestLevel(); + + + if (enchant != null){ if (enchant instanceof Pair){ - this.enchantment = (Pair<?, ?>) enchant; + this.enchantment = (Pair<?, ?>) enchant; } else { this.enchantment = null; @@ -65,38 +64,38 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ else { this.enchantment = null; } - - try {isValid = addRecipe();} catch (Throwable e){} - if (colour != 0 && isValid && materialDurability > 10000){ + + try {this.isValid = this.addRecipe();} catch (final Throwable e){} + if ((colour != 0) && this.isValid && (materialDurability > 10000)){ if (GameRegistry.findItem(CORE.MODID, Utils.sanitizeString(unlocalizedName)) == null){ - GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); - } + GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); + } } } /* - * - * - * - * Methods - * - * - * + * + * + * + * Methods + * + * + * */ private boolean addRecipe(){ - - String cleanName = Utils.sanitizeString(materialName); - - String plateDense = "plateDense"+cleanName; - String plateDouble = "plateDouble"+cleanName; - String rodLong = "stickLong"+cleanName; - String toolHammer = "craftingToolHardHammer"; - String toolWrench = "craftingToolWrench"; - String toolFile = "craftingToolFile"; - String toolScrewDriver = "craftingToolScrewdriver"; - + + final String cleanName = Utils.sanitizeString(this.materialName); + + final String plateDense = "plateDense"+cleanName; + final String plateDouble = "plateDouble"+cleanName; + final String rodLong = "stickLong"+cleanName; + final String toolHammer = "craftingToolHardHammer"; + final String toolWrench = "craftingToolWrench"; + final String toolFile = "craftingToolFile"; + final String toolScrewDriver = "craftingToolScrewdriver"; + if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){ Utils.LOG_WARNING("stickLong of "+cleanName+" does not exist."); return false; @@ -127,12 +126,12 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ } public final String getMaterialName() { - return materialName; + return this.materialName; } @Override - public String getItemStackDisplayName(ItemStack iStack) { - return displayName; + public String getItemStackDisplayName(final ItemStack iStack) { + return this.displayName; /*String name; if (getUnlocalizedName().toLowerCase().contains("wood")){ name = "Wooden"; @@ -155,22 +154,22 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colour == 0){ + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.colour == 0){ return MathUtils.generateSingularRandomHexValue(); } - return colour; + return this.colour; } @SuppressWarnings("static-method") - private float calculateDurabilityLoss(World world, int X, int Y, int Z){ + private float calculateDurabilityLoss(final World world, final int X, final int Y, final int Z){ float bDurabilityLoss = 0; Boolean correctTool = false; float bHardness = 0; - if (!world.isRemote){ + if (!world.isRemote){ try { - Block removalist = world.getBlock(X, Y, Z); + final Block removalist = world.getBlock(X, Y, Z); //Utils.LOG_WARNING(removalist.toString()); bHardness = removalist.getBlockHardness(world, X, Y, Z)*100; @@ -179,14 +178,14 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ bDurabilityLoss = 100; //Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss); - correctTool = canPickaxeBlock(removalist, world, new int[]{X,Y,Z}); + correctTool = this.canPickaxeBlock(removalist, world, new int[]{X,Y,Z}); Utils.LOG_WARNING(""+correctTool); if (!correctTool){ return 0; } - } catch (NullPointerException e){ + } catch (final NullPointerException e){ } } @@ -204,7 +203,7 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ String removalTool = ""; removalTool = block.getHarvestTool(1); - if (removalTool.equals("pickaxe") || UtilsMining.getBlockType(block, world, new int[]{X,Y,Z}, miningLevel)){ + if (removalTool.equals("pickaxe") || UtilsMining.getBlockType(block, world, new int[]{X,Y,Z}, miningLevel)){ if (canPickaxeBlock(block, world, new int[]{X,Y,Z})){ if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ @@ -229,70 +228,72 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ } }*/ - public void damageItem(ItemStack item, int damage, EntityPlayer localPlayer){ + @Override + public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer){ item.damageItem(damage, localPlayer); } - public void setItemDamage(ItemStack item, int damage){ + @Override + public void setItemDamage(final ItemStack item, final int damage){ item.setItemDamage(damage-1); } @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ + public EnumRarity getRarity(final ItemStack par1ItemStack){ return EnumRarity.uncommon; } @Override - public boolean hasEffect(ItemStack par1ItemStack){ + public boolean hasEffect(final ItemStack par1ItemStack){ return false; } @Override - public void onCreated(ItemStack mThisItem, World mWorld, EntityPlayer mPlayer) { + public void onCreated(final ItemStack mThisItem, final World mWorld, final EntityPlayer mPlayer) { Enchantment enchant = null; int enchantmentLevel = 0; - Pair<?, ?> Y = this.enchantment; + final Pair<?, ?> Y = this.enchantment; if (Y != null){ if (Y.getKey() != null){ - enchant = (Enchantment) ((Pair<?, ?>) this.enchantment).getKey(); + enchant = (Enchantment) ((Pair<?, ?>) this.enchantment).getKey(); } if (Y.getValue() != null){ - enchantmentLevel = (byte) ((Pair<?, ?>) this.enchantment).getValue(); + enchantmentLevel = (byte) ((Pair<?, ?>) this.enchantment).getValue(); } } - ItemStack itemToEnchant = mThisItem; - if (enchant != null && enchantmentLevel != 0 && enchantmentLevel >= 1){ + final ItemStack itemToEnchant = mThisItem; + if ((enchant != null) && (enchantmentLevel != 0) && (enchantmentLevel >= 1)){ itemToEnchant.addEnchantment(enchant, enchantmentLevel); } super.onCreated(itemToEnchant, mWorld, mPlayer); } @Override - public void getSubItems(Item mItem, CreativeTabs mCreativeTab, List mList) { + public void getSubItems(final Item mItem, final CreativeTabs mCreativeTab, final List mList) { Enchantment enchant = null; int enchantmentLevel = 0; - Pair<?, ?> Y = this.enchantment; + final Pair<?, ?> Y = this.enchantment; if (Y != null){ if (Y.getKey() != null){ - enchant = (Enchantment) ((Pair<?, ?>) this.enchantment).getKey(); + enchant = (Enchantment) ((Pair<?, ?>) this.enchantment).getKey(); } if (Y.getValue() != null){ - enchantmentLevel = (byte) ((Pair<?, ?>) this.enchantment).getValue(); + enchantmentLevel = (byte) ((Pair<?, ?>) this.enchantment).getValue(); } } - - Item thisItem = mItem; - ItemStack itemToEnchant = ItemUtils.getSimpleStack(thisItem); - if (enchant != null && enchantmentLevel != 0 && enchantmentLevel >= 1){ + + final Item thisItem = mItem; + final ItemStack itemToEnchant = ItemUtils.getSimpleStack(thisItem); + if ((enchant != null) && (enchantmentLevel != 0) && (enchantmentLevel >= 1)){ itemToEnchant.addEnchantment(enchant, enchantmentLevel); mList.add(itemToEnchant); } else { - mList.add(new ItemStack(thisItem, 1, 0)); + mList.add(new ItemStack(thisItem, 1, 0)); } - + } } diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java index 627108f509..175c212a6c 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.item.tool.staballoy; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; @@ -8,9 +11,6 @@ import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class MultiSpadeBase extends StaballoySpade{ @@ -18,7 +18,7 @@ public class MultiSpadeBase extends StaballoySpade{ * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) */ @Override - public double getDurabilityForDisplay(ItemStack stack) { + public double getDurabilityForDisplay(final ItemStack stack) { if (super.getDurabilityForDisplay(stack) > 0){ return super.getDurabilityForDisplay(stack);} return 0; @@ -29,7 +29,7 @@ public class MultiSpadeBase extends StaballoySpade{ protected final String displayName; public boolean isValid = true; - public MultiSpadeBase(String unlocalizedName, ToolMaterial material, int materialDurability, int colour) { + public MultiSpadeBase(final String unlocalizedName, final ToolMaterial material, final int materialDurability, final int colour) { super(Utils.sanitizeString(unlocalizedName), material); this.setUnlocalizedName(Utils.sanitizeString(unlocalizedName)); //this.setTextureName(CORE.MODID + ":" + "itemShovel"); @@ -41,23 +41,23 @@ public class MultiSpadeBase extends StaballoySpade{ this.materialName = material.name(); this.displayName = unlocalizedName; this.setCreativeTab(AddToCreativeTab.tabTools); - try {isValid = addRecipe();} catch (Throwable e){} - if (colour != 0 && isValid){ + try {this.isValid = this.addRecipe();} catch (final Throwable e){} + if ((colour != 0) && this.isValid){ if (GameRegistry.findItem(CORE.MODID, Utils.sanitizeString(unlocalizedName)) == null){ - GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); + GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); } } } private boolean addRecipe(){ - String cleanName = Utils.sanitizeString(materialName); - String plateDense = "plateDense"+cleanName; - String plateDouble = "plateDouble"+cleanName; - String rodLong = "stickLong"+cleanName; - String toolHammer = "craftingToolHardHammer"; - String toolWrench = "craftingToolWrench"; - String toolFile = "craftingToolFile"; - String toolScrewDriver = "craftingToolScrewdriver"; + final String cleanName = Utils.sanitizeString(this.materialName); + final String plateDense = "plateDense"+cleanName; + final String plateDouble = "plateDouble"+cleanName; + final String rodLong = "stickLong"+cleanName; + final String toolHammer = "craftingToolHardHammer"; + final String toolWrench = "craftingToolWrench"; + final String toolFile = "craftingToolFile"; + final String toolScrewDriver = "craftingToolScrewdriver"; if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){ return false; @@ -73,7 +73,7 @@ public class MultiSpadeBase extends StaballoySpade{ return true; } return false; - } + } RecipeUtils.recipeBuilder( toolFile, plateDense, toolHammer, @@ -85,12 +85,12 @@ public class MultiSpadeBase extends StaballoySpade{ } public final String getMaterialName() { - return materialName; + return this.materialName; } @Override - public String getItemStackDisplayName(ItemStack iStack) { - return displayName; + public String getItemStackDisplayName(final ItemStack iStack) { + return this.displayName; /*String name; if (getUnlocalizedName().toLowerCase().contains("wood")){ name = "Wooden"; @@ -101,21 +101,21 @@ public class MultiSpadeBase extends StaballoySpade{ } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colour == 0){ + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.colour == 0){ return MathUtils.generateSingularRandomHexValue(); } - return colour; - } + return this.colour; + } @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ + public EnumRarity getRarity(final ItemStack par1ItemStack){ return EnumRarity.uncommon; } @Override - public boolean hasEffect(ItemStack par1ItemStack){ + public boolean hasEffect(final ItemStack par1ItemStack){ return false; } diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java index 301671fc24..7ec396a8b1 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java @@ -1,9 +1,10 @@ package gtPlusPlus.core.item.tool.staballoy; -import gtPlusPlus.core.lib.CORE; - import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.lib.CORE; import net.minecraft.block.*; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLivingBase; @@ -12,179 +13,249 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.*; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class StaballoyAxe extends ItemAxe{ public String mat; - public StaballoyAxe(String unlocalizedName, ToolMaterial material) { + public StaballoyAxe(final String unlocalizedName, final ToolMaterial material) { super(material); this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); } - + // EXPLODE TREE byte[] tre= new byte[32000]; byte unchecked=0; byte needcheck=1; byte ignore =2; byte harvest =3; - - private boolean setcheck(int x, int y, int z) { - if(x<0 || x>19 || z<0 || z>19 || y<0 || y>79) return false; - int o=x+z*20+y*400; - if (tre[o]==unchecked) tre[o]=needcheck; + + private boolean setcheck(final int x, final int y, final int z) { + if((x<0) || (x>19) || (z<0) || (z>19) || (y<0) || (y>79)) { + return false; + } + final int o=x+(z*20)+(y*400); + if (this.tre[o]==this.unchecked) { + this.tre[o]=this.needcheck; + } return true; } - + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { list.add(EnumChatFormatting.GOLD+"Fells entire trees in a single swipe!.."); list.add(EnumChatFormatting.GRAY+"Ask Alkalus for new trees to be supported."); super.addInformation(stack, aPlayer, list, bool); } - - public static boolean canIgnore(Block bit){ - if (bit instanceof BlockAir)return true; - if (bit instanceof BlockGrass)return true; - if (bit instanceof BlockSand)return true; - if (bit instanceof BlockDirt)return true; - if (bit instanceof BlockCocoa)return true; - if (bit instanceof BlockVine)return true; - if (bit instanceof BlockMushroom)return true; - if (bit instanceof BlockSnow)return true; - if (bit instanceof BlockSnowBlock)return true; - if (bit instanceof BlockFlower)return true; - if (bit instanceof BlockTallGrass)return true; - if (bit instanceof BlockDoublePlant)return true; - + + public static boolean canIgnore(final Block bit){ + if (bit instanceof BlockAir) { + return true; + } + if (bit instanceof BlockGrass) { + return true; + } + if (bit instanceof BlockSand) { + return true; + } + if (bit instanceof BlockDirt) { + return true; + } + if (bit instanceof BlockCocoa) { + return true; + } + if (bit instanceof BlockVine) { + return true; + } + if (bit instanceof BlockMushroom) { + return true; + } + if (bit instanceof BlockSnow) { + return true; + } + if (bit instanceof BlockSnowBlock) { + return true; + } + if (bit instanceof BlockFlower) { + return true; + } + if (bit instanceof BlockTallGrass) { + return true; + } + if (bit instanceof BlockDoublePlant) { + return true; + } + //LoonTools.log("Found uncuttable "+bit.getClass().getSimpleName()); return false; } - - private int check(World par1World, int x, int y, int z, int xo, int yo,int zo) { + + private int check(final World par1World, final int x, final int y, final int z, final int xo, final int yo,final int zo) { int f=0; - int o=x+z*20+y*400; - if (tre[o]==needcheck){ - tre[o]=ignore; - Block bit = par1World.getBlock(x+xo, y+yo, z+zo); + final int o=x+(z*20)+(y*400); + if (this.tre[o]==this.needcheck){ + this.tre[o]=this.ignore; + final Block bit = par1World.getBlock(x+xo, y+yo, z+zo); if ((bit instanceof BlockLog)||(bit instanceof BlockLeavesBase)||(bit instanceof BlockHugeMushroom) || (bit.getUnlocalizedName().toLowerCase().contains("log")) || (bit.getUnlocalizedName().toLowerCase().contains("wood"))){ f=1; - tre[o]=harvest; + this.tre[o]=this.harvest; //if (bit instanceof BlockLog){ // LoonTools.log("^ Found log @ "+x+xo+" "+y+yo+" "+z+zo+" "); //} - for(int xb=-1;xb<2;xb++) - for(int yb=-1;yb<2;yb++) - for(int zb=-1;zb<2;zb++) - if (!setcheck(x+xb,y+yb,z+zb))return 3; + for(int xb=-1;xb<2;xb++) { + for(int yb=-1;yb<2;yb++) { + for(int zb=-1;zb<2;zb++) { + if (!this.setcheck(x+xb,y+yb,z+zb)) { + return 3; + } + } + } + } }else{ - if (!canIgnore(bit)) return 2; + if (!canIgnore(bit)) { + return 2; + } } } return f; } - - public int checkTree(World par1World,int xo,int yo,int zo){ + + public int checkTree(final World par1World,final int xo,final int yo,final int zo){ boolean f; for (f=true;f==true;){ f=false; - for (int y=0;y<80;y++) - for(int z=0;z<20;z++) + for (int y=0;y<80;y++) { + for(int z=0;z<20;z++) { for(int x=0;x<20;x++){ - int r=check(par1World,x,y,z,xo,yo,zo); - if (r==3) return 3; - if (r==2) return 2; - if (r==1) f=true; + final int r=this.check(par1World,x,y,z,xo,yo,zo); + if (r==3) { + return 3; + } + if (r==2) { + return 2; + } + if (r==1) { + f=true; + } } - - for (int y=79;y>=0;y--) - for(int z=19;z>=0;z--) + } + } + + for (int y=79;y>=0;y--) { + for(int z=19;z>=0;z--) { for(int x=19;x>=0;x--){ - int r=check(par1World,x,y,z,xo,yo,zo); - if (r==2) return 3; + final int r=this.check(par1World,x,y,z,xo,yo,zo); + if (r==2) { + return 3; + } //if (r==2) return 2; - if (r==1) f=true; + if (r==1) { + f=true; + } } + } + } } return 1; } - - private int check2(World par1World, int x, int y, int z, int xo, int yo,int zo) { + + private int check2(final World par1World, final int x, final int y, final int z, final int xo, final int yo,final int zo) { int f=0; - int o=x+z*20+y*400; - if (tre[o]==needcheck){ - tre[o]=ignore; - Block bit = par1World.getBlock(x+xo, y+yo, z+zo); + final int o=x+(z*20)+(y*400); + if (this.tre[o]==this.needcheck){ + this.tre[o]=this.ignore; + final Block bit = par1World.getBlock(x+xo, y+yo, z+zo); if (bit instanceof BlockLog){ f=1; - tre[o]=harvest; + this.tre[o]=this.harvest; //if (bit instanceof BlockLog){ // LoonTools.log("^ Found log @ "+x+xo+" "+y+yo+" "+z+zo+" "); //} - for(int xb=-1;xb<2;xb++) - for(int yb=-1;yb<2;yb++) - for(int zb=-1;zb<2;zb++) - if (!setcheck(x+xb,y+yb,z+zb))return 3; + for(int xb=-1;xb<2;xb++) { + for(int yb=-1;yb<2;yb++) { + for(int zb=-1;zb<2;zb++) { + if (!this.setcheck(x+xb,y+yb,z+zb)) { + return 3; + } + } + } + } }else if (bit instanceof BlockLeavesBase){ }else{ - if (!canIgnore(bit)) return 2; + if (!canIgnore(bit)) { + return 2; + } } } return f; } - public int checkTree2(World par1World,int xo,int yo,int zo){ + public int checkTree2(final World par1World,final int xo,final int yo,final int zo){ boolean f; for (f=true;f==true;){ f=false; - for (int y=0;y<80;y++) - for(int z=0;z<20;z++) + for (int y=0;y<80;y++) { + for(int z=0;z<20;z++) { for(int x=0;x<20;x++){ - int r=check2(par1World,x,y,z,xo,yo,zo); - if (r==3) return 3; - if (r==2) return 2; - if (r==1) f=true; + final int r=this.check2(par1World,x,y,z,xo,yo,zo); + if (r==3) { + return 3; + } + if (r==2) { + return 2; + } + if (r==1) { + f=true; + } } - - for (int y=79;y>=0;y--) - for(int z=19;z>=0;z--) + } + } + + for (int y=79;y>=0;y--) { + for(int z=19;z>=0;z--) { for(int x=19;x>=0;x--){ - int r=check2(par1World,x,y,z,xo,yo,zo); - if (r==2) return 3; + final int r=this.check2(par1World,x,y,z,xo,yo,zo); + if (r==2) { + return 3; + } //if (r==2) return 2; - if (r==1) f=true; + if (r==1) { + f=true; + } } + } + } } return 1; } - - public void exploadTree(World par1World,int xo,int yo,int zo, EntityPlayer plr){ - for (int y=0;y<80;y++) - for(int z=0;z<20;z++) + + public void exploadTree(final World par1World,final int xo,final int yo,final int zo, final EntityPlayer plr){ + for (int y=0;y<80;y++) { + for(int z=0;z<20;z++) { for(int x=0;x<20;x++){ - int o=x+z*20+y*400; - if (tre[o]==harvest){ - Block bit = par1World.getBlock(x+xo, y+yo, z+zo); - int met = par1World.getBlockMetadata(x+xo, y+yo, z+zo); - + final int o=x+(z*20)+(y*400); + if (this.tre[o]==this.harvest){ + final Block bit = par1World.getBlock(x+xo, y+yo, z+zo); + final int met = par1World.getBlockMetadata(x+xo, y+yo, z+zo); + if ((bit instanceof BlockLog)||(bit instanceof BlockLeavesBase) || (bit.getUnlocalizedName().toLowerCase().contains("log")) || (bit.getUnlocalizedName().toLowerCase().contains("wood"))){ bit.harvestBlock(par1World, plr, x+xo, y+yo, z+zo,met); par1World.setBlockToAir(x+xo, y+yo, z+zo); } } } + } + } } - private static void breakMushroom(World wld, Block bit, EntityPlayer plr, boolean silk, int x, int y, int z, int met) { + private static void breakMushroom(final World wld, final Block bit, final EntityPlayer plr, final boolean silk, final int x, final int y, final int z, final int met) { if (silk){ - ItemStack stk = null; //TODO + final ItemStack stk = null; //TODO /*if (bit==Blocks.brown_mushroom_block) stk = new ItemStack(LoonToolItems.brown_mushroom_block,1,met); else if (bit==Blocks.red_mushroom_block) stk = new ItemStack(LoonToolItems.red_mushroom_block,1,met); else stk = new ItemStack(bit,1,met);*/ - EntityItem entityitem = new EntityItem(wld, x+0.5, y+0.5, z+0.5, stk); + final EntityItem entityitem = new EntityItem(wld, x+0.5, y+0.5, z+0.5, stk); entityitem.delayBeforeCanPickup = 10; wld.spawnEntityInWorld(entityitem); }else{ @@ -192,15 +263,15 @@ public class StaballoyAxe extends ItemAxe{ } wld.setBlockToAir(x, y, z); } - - public void exploadMushroom(World par1World,int xo,int yo,int zo, EntityPlayer plr, boolean silk){ - for (int y=0;y<80;y++) - for(int z=0;z<20;z++) + + public void exploadMushroom(final World par1World,final int xo,final int yo,final int zo, final EntityPlayer plr, final boolean silk){ + for (int y=0;y<80;y++) { + for(int z=0;z<20;z++) { for(int x=0;x<20;x++){ - int o=x+z*20+y*400; - if (tre[o]==harvest){ - Block bit = par1World.getBlock(x+xo, y+yo, z+zo); - int met = par1World.getBlockMetadata(x+xo, y+yo, z+zo); + final int o=x+(z*20)+(y*400); + if (this.tre[o]==this.harvest){ + final Block bit = par1World.getBlock(x+xo, y+yo, z+zo); + final int met = par1World.getBlockMetadata(x+xo, y+yo, z+zo); if (bit instanceof BlockHugeMushroom){ breakMushroom(par1World, bit, plr, silk, x+xo, y+yo, z+zo,met); }else{ @@ -209,54 +280,62 @@ public class StaballoyAxe extends ItemAxe{ } } } + } + } } - + @Override - public boolean onBlockDestroyed(ItemStack itm, World wld,Block blk, int x, int y,int z, EntityLivingBase plr) { + public boolean onBlockDestroyed(final ItemStack itm, final World wld,final Block blk, final int x, final int y,final int z, final EntityLivingBase plr) { if (!wld.isRemote){ - Block bit = wld.getBlock(x, y, z); - boolean silk=EnchantmentHelper.getSilkTouchModifier(plr); + final Block bit = wld.getBlock(x, y, z); + final boolean silk=EnchantmentHelper.getSilkTouchModifier(plr); if ((bit instanceof BlockHugeMushroom)){ - for (int n=0;n<32000;n++) tre[n]=unchecked; - int met = wld.getBlockMetadata(x, y, z); + for (int n=0;n<32000;n++) { + this.tre[n]=this.unchecked; + } + final int met = wld.getBlockMetadata(x, y, z); breakMushroom(wld, bit, (EntityPlayer) plr, silk, x, y, z,met); wld.setBlockToAir(x,y,z); - tre[2210]=needcheck; - if (checkTree(wld,x-10,y-4,z-10)==1){ - exploadMushroom(wld,x-10,y-4,z-10,(EntityPlayer) plr,silk); + this.tre[2210]=this.needcheck; + if (this.checkTree(wld,x-10,y-4,z-10)==1){ + this.exploadMushroom(wld,x-10,y-4,z-10,(EntityPlayer) plr,silk); } } - - if (bit instanceof BlockLog || (bit.getUnlocalizedName().toLowerCase().contains("log")) || (bit.getUnlocalizedName().toLowerCase().contains("wood"))){ + + if ((bit instanceof BlockLog) || (bit.getUnlocalizedName().toLowerCase().contains("log")) || (bit.getUnlocalizedName().toLowerCase().contains("wood"))){ //LoonTools.log("cutting tree @ "+x+" "+y+" "+z+" "); - for (int n=0;n<32000;n++) tre[n]=unchecked; - int met = wld.getBlockMetadata(x, y, z); + for (int n=0;n<32000;n++) { + this.tre[n]=this.unchecked; + } + final int met = wld.getBlockMetadata(x, y, z); bit.harvestBlock(wld, (EntityPlayer) plr, x, y, z,met); wld.setBlockToAir(x,y,z); - tre[2210]=needcheck; - if (checkTree(wld,x-10,y-4,z-10)==1){ - exploadTree(wld,x-10,y-4,z-10,(EntityPlayer) plr); + this.tre[2210]=this.needcheck; + if (this.checkTree(wld,x-10,y-4,z-10)==1){ + this.exploadTree(wld,x-10,y-4,z-10,(EntityPlayer) plr); }else{ - for (int n=0;n<32000;n++) tre[n]=unchecked; - tre[2210]=needcheck; - if (checkTree2(wld,x-10,y-4,z-10)==1){ - exploadTree(wld,x-10,y-4,z-10,(EntityPlayer) plr); + for (int n=0;n<32000;n++) { + this.tre[n]=this.unchecked; + } + this.tre[2210]=this.needcheck; + if (this.checkTree2(wld,x-10,y-4,z-10)==1){ + this.exploadTree(wld,x-10,y-4,z-10,(EntityPlayer) plr); } } } } return super.onBlockDestroyed(itm, wld, blk, x, y, z, plr); } - + @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ + public EnumRarity getRarity(final ItemStack par1ItemStack){ return EnumRarity.rare; } @Override - public boolean hasEffect(ItemStack par1ItemStack){ + public boolean hasEffect(final ItemStack par1ItemStack){ return true; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java index 81943536ae..64a53a4eb7 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java @@ -1,11 +1,12 @@ package gtPlusPlus.core.item.tool.staballoy; +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.player.UtilsMining; - -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -13,8 +14,6 @@ import net.minecraft.init.Blocks; import net.minecraft.item.*; import net.minecraft.util.*; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class StaballoyPickaxe extends ItemPickaxe{ @@ -22,7 +21,7 @@ public class StaballoyPickaxe extends ItemPickaxe{ * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) */ @Override - public double getDurabilityForDisplay(ItemStack stack) { + public double getDurabilityForDisplay(final ItemStack stack) { if (super.getDurabilityForDisplay(stack) > 0){ return super.getDurabilityForDisplay(stack);} return 0; @@ -37,46 +36,46 @@ public class StaballoyPickaxe extends ItemPickaxe{ protected int miningLevel; /* - * - * - * - * Methods - * - * - * + * + * + * + * Methods + * + * + * */ @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer aPlayer) { - localPlayer = aPlayer; - localWorld = world; - thisPickaxe = stack; + public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer aPlayer) { + this.localPlayer = aPlayer; + this.localWorld = world; + this.thisPickaxe = stack; return super.onItemRightClick(stack, world, aPlayer); } @Override - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int X, int Y, int Z, EntityLivingBase entity) { + public boolean onBlockDestroyed(final ItemStack stack, final World world, final Block block, final int X, final int Y, final int Z, final EntityLivingBase entity) { //super.onBlockDestroyed(stack, world, block, X, Y, Z, entity); - localWorld = world; - thisPickaxe = stack; + this.localWorld = world; + this.thisPickaxe = stack; //checkFacing(world); - if (!world.isRemote){ - GetDestroyOrientation(block, lookingDirection, world, X, Y, Z, stack); + if (!world.isRemote){ + this.GetDestroyOrientation(block, this.lookingDirection, world, X, Y, Z, stack); } return super.onBlockDestroyed(stack, world, block, X, Y, Z, entity); } @SuppressWarnings("static-method") - private float calculateDurabilityLoss(World world, int X, int Y, int Z){ + private float calculateDurabilityLoss(final World world, final int X, final int Y, final int Z){ float bDurabilityLoss = 0; Boolean correctTool = false; float bHardness = 0; - if (!world.isRemote){ + if (!world.isRemote){ try { - Block removalist = world.getBlock(X, Y, Z); + final Block removalist = world.getBlock(X, Y, Z); //Utils.LOG_WARNING(removalist.toString()); bHardness = removalist.getBlockHardness(world, X, Y, Z); @@ -85,36 +84,36 @@ public class StaballoyPickaxe extends ItemPickaxe{ bDurabilityLoss = (bDurabilityLoss + bHardness); //Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss); - correctTool = canPickaxeBlock(removalist, world, new int[]{X,Y,Z}); + correctTool = this.canPickaxeBlock(removalist, world, new int[]{X,Y,Z}); Utils.LOG_WARNING(""+correctTool); if (!correctTool){ return 0; } - } catch (NullPointerException e){ + } catch (final NullPointerException e){ } } return 100; } - public Boolean canPickaxeBlock(Block currentBlock, World currentWorld, int[] xyz){ + public Boolean canPickaxeBlock(final Block currentBlock, final World currentWorld, final int[] xyz){ String correctTool = ""; - if (!currentWorld.isRemote){ + if (!currentWorld.isRemote){ try { correctTool = currentBlock.getHarvestTool(0); - if (UtilsMining.getBlockType(currentBlock, currentWorld, xyz, miningLevel) || correctTool.equals("pickaxe") || correctTool.equals("null")){ - //Utils.LOG_WARNING(correctTool); + if (UtilsMining.getBlockType(currentBlock, currentWorld, xyz, this.miningLevel) || correctTool.equals("pickaxe") || correctTool.equals("null")){ + //Utils.LOG_WARNING(correctTool); return true;} - } catch (NullPointerException e){ + } catch (final NullPointerException e){ return false;} } return false; } - private void GetDestroyOrientation(Block block, String FACING, World world, int X, int Y, int Z, ItemStack heldItem){ - localWorld = world; + private void GetDestroyOrientation(final Block block, final String FACING, final World world, final int X, final int Y, final int Z, final ItemStack heldItem){ + this.localWorld = world; float DURABILITY_LOSS = 0; if (!world.isRemote){ @@ -123,10 +122,10 @@ public class StaballoyPickaxe extends ItemPickaxe{ DURABILITY_LOSS = 0; for(int i = -1; i < 2; i++) { for(int j = -1; j < 2; j++) { - float dur = calculateDurabilityLoss(world, X + i, Y, Z + j); - DURABILITY_LOSS = (DURABILITY_LOSS + dur); + final float dur = this.calculateDurabilityLoss(world, X + i, Y, Z + j); + DURABILITY_LOSS = (DURABILITY_LOSS + dur); Utils.LOG_WARNING("Added Loss: "+dur); - removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem); + this.removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem); } } } @@ -135,10 +134,10 @@ public class StaballoyPickaxe extends ItemPickaxe{ DURABILITY_LOSS = 0; for(int i = -1; i < 2; i++) { for(int j = -1; j < 2; j++) { - float dur = calculateDurabilityLoss(world, X, Y + i, Z + j); + final float dur = this.calculateDurabilityLoss(world, X, Y + i, Z + j); DURABILITY_LOSS = (DURABILITY_LOSS + dur); Utils.LOG_WARNING("Added Loss: "+dur); - removeBlockAndDropAsItem(world, X , Y + i, Z + j, heldItem); + this.removeBlockAndDropAsItem(world, X , Y + i, Z + j, heldItem); } } } @@ -147,10 +146,10 @@ public class StaballoyPickaxe extends ItemPickaxe{ DURABILITY_LOSS = 0; for(int i = -1; i < 2; i++) { for(int j = -1; j < 2; j++) { - float dur = calculateDurabilityLoss(world, X + j, Y + i, Z); + final float dur = this.calculateDurabilityLoss(world, X + j, Y + i, Z); DURABILITY_LOSS = (DURABILITY_LOSS + dur); Utils.LOG_WARNING("Added Loss: "+dur); - removeBlockAndDropAsItem(world, X + j, Y + i, Z, heldItem); + this.removeBlockAndDropAsItem(world, X + j, Y + i, Z, heldItem); } } } @@ -158,15 +157,15 @@ public class StaballoyPickaxe extends ItemPickaxe{ //int heldItemDurability = heldItem.getDamage(1); Utils.LOG_WARNING("Total Loss: "+(int)DURABILITY_LOSS); //heldItem.setDamage(heldStack, DURABILITY_LOSS); - //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); + //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); //Utils.LOG_WARNING("Durability: "+heldStack.getDamage(heldStack)); Utils.LOG_WARNING("1x: "+(heldItem.getItemDamage())); - int itemdmg = heldItem.getItemDamage(); - int maxdmg = heldItem.getMaxDamage(); - int dodmg = (int)DURABILITY_LOSS; - int durNow = (int) maxdmg-itemdmg; - int durLeft = (int) ((maxdmg-itemdmg)-DURABILITY_LOSS); - + final int itemdmg = heldItem.getItemDamage(); + final int maxdmg = heldItem.getMaxDamage(); + final int dodmg = (int)DURABILITY_LOSS; + final int durNow = maxdmg-itemdmg; + final int durLeft = (int) ((maxdmg-itemdmg)-DURABILITY_LOSS); + Utils.LOG_WARNING( "Current Damage: " + itemdmg + " Max Damage: " + maxdmg @@ -174,10 +173,10 @@ public class StaballoyPickaxe extends ItemPickaxe{ + " Current Durability: " + durNow + " Remaining Durability: " + durLeft ); - - + + //Break Tool - if ((durNow-dodmg) <= (99) && itemdmg != 0){ + if (((durNow-dodmg) <= (99)) && (itemdmg != 0)){ //TODO break tool Utils.LOG_WARNING("Breaking Tool"); heldItem.stackSize = 0; @@ -186,10 +185,10 @@ public class StaballoyPickaxe extends ItemPickaxe{ else { //setItemDamage(heldItem, durLeft); Utils.LOG_WARNING(""+(durNow-durLeft)); - damageItem(heldItem, (durNow-durLeft)-1, localPlayer); + this.damageItem(heldItem, (durNow-durLeft)-1, this.localPlayer); } - - + + /*if (heldItem.getItemDamage() <= ((heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS)){ Utils.LOG_WARNING("2: "+DURABILITY_LOSS+" 3: "+((heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS)); setItemDamage(heldItem, (int) (heldItem.getMaxDamage()-(heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS)); @@ -203,64 +202,64 @@ public class StaballoyPickaxe extends ItemPickaxe{ } } - - public void damageItem(ItemStack item, int damage, EntityPlayer localPlayer){ + + public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer){ item.damageItem(damage, localPlayer); } - - public void setItemDamage(ItemStack item, int damage){ + + public void setItemDamage(final ItemStack item, final int damage){ item.setItemDamage(damage-1); } //Should clear up blocks quicker if I chain it. - public final void removeBlockAndDropAsItem(World world, int X, int Y, int Z, ItemStack heldItem){ - localWorld = world; + public final void removeBlockAndDropAsItem(final World world, final int X, final int Y, final int Z, final ItemStack heldItem){ + this.localWorld = world; try { - Block block = world.getBlock(X, Y, Z); - float dur = calculateDurabilityLoss(world, X, Y, Z); + final Block block = world.getBlock(X, Y, Z); + final float dur = this.calculateDurabilityLoss(world, X, Y, Z); Utils.LOG_WARNING(block.toString()); String removalTool = ""; removalTool = block.getHarvestTool(1); Utils.LOG_WARNING("Removing.1 "+removalTool); /*if ((removalTool.equalsIgnoreCase("pickaxe") || removalTool.equalsIgnoreCase("null") || removalTool == null)){ - Utils.LOG_WARNING("Removing.2"); + Utils.LOG_WARNING("Removing.2"); if (UtilsMining.getBlockType(block, world, new int[]{X,Y,Z}, miningLevel)) { - Utils.LOG_WARNING("Removing.3"); */ - if (canPickaxeBlock(block, world, new int[]{X,Y,Z})){ - Utils.LOG_WARNING("Removing.4"); - - if (block == Blocks.air){ - return; - } - - if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) >= 0) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ + Utils.LOG_WARNING("Removing.3"); */ + if (this.canPickaxeBlock(block, world, new int[]{X,Y,Z})){ + Utils.LOG_WARNING("Removing.4"); + + if (block == Blocks.air){ + return; + } + + if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) >= 0) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ + + Utils.LOG_WARNING("Removing.5"); + if (heldItem.getItemDamage() <= (heldItem.getMaxDamage()-dur)){ - Utils.LOG_WARNING("Removing.5"); - if (heldItem.getItemDamage() <= (heldItem.getMaxDamage()-dur)){ - block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); world.setBlockToAir(X, Y, Z); - - } - + } + + } /*} - + }*/ } else { Utils.LOG_WARNING("Incorrect Tool for mining this block."); } - } catch (NullPointerException e){ + } catch (final NullPointerException e){ } } - public boolean checkFacing(World world){ - localWorld = world; - if (localPlayer != null){ - int direction = MathHelper.floor_double((double)((localPlayer.rotationYaw * 4F) / 360F) + 0.5D) & 3; + public boolean checkFacing(final World world){ + this.localWorld = world; + if (this.localPlayer != null){ + final int direction = MathHelper.floor_double((this.localPlayer.rotationYaw * 4F) / 360F + 0.5D) & 3; //Utils.LOG_WARNING("Player - F: "+direction); //Utils.LOG_WARNING("Player - getLookVec(): "+localPlayer.getLookVec().yCoord); @@ -268,64 +267,64 @@ public class StaballoyPickaxe extends ItemPickaxe{ localPlayer.getLookVec().yCoord; }*/ - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, (EntityPlayer) localPlayer, false); + final MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, this.localPlayer, false); if (movingobjectposition != null){ - int sideHit = movingobjectposition.sideHit; + final int sideHit = movingobjectposition.sideHit; String playerStandingPosition = ""; - if (movingobjectposition != null) { + if (movingobjectposition != null) { //System.out.println("Side Hit: "+movingobjectposition.sideHit); } if (sideHit == 0){ playerStandingPosition = "above"; - FACING_HORIZONTAL = false; + this.FACING_HORIZONTAL = false; } else if (sideHit == 1){ playerStandingPosition = "below"; - FACING_HORIZONTAL = false; + this.FACING_HORIZONTAL = false; } else if (sideHit == 2){ playerStandingPosition = "facingSouth"; - FACING_HORIZONTAL = true; + this.FACING_HORIZONTAL = true; } else if (sideHit == 3){ playerStandingPosition = "facingNorth"; - FACING_HORIZONTAL = true; + this.FACING_HORIZONTAL = true; } else if (sideHit == 4){ playerStandingPosition = "facingEast"; - FACING_HORIZONTAL = true; + this.FACING_HORIZONTAL = true; } else if (sideHit == 5){ playerStandingPosition = "facingWest"; - FACING_HORIZONTAL = true; + this.FACING_HORIZONTAL = true; } - lookingDirection = playerStandingPosition; + this.lookingDirection = playerStandingPosition; - if (direction == 0){ - FACING = "south"; - } - else if (direction == 1){ - FACING = "west"; + if (direction == 0){ + this.FACING = "south"; } - else if (direction == 2){ - FACING = "north"; - } - else if (direction == 3){ - FACING = "east"; + else if (direction == 1){ + this.FACING = "west"; + } + else if (direction == 2){ + this.FACING = "north"; + } + else if (direction == 3){ + this.FACING = "east"; } } return true; } - return false; + return false; } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - thisPickaxe = stack; + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + this.thisPickaxe = stack; list.add(EnumChatFormatting.GRAY+"Mines a 3x3 at 100 durability per block mined."); list.add(EnumChatFormatting.GRAY+"Durability: "+(stack.getMaxDamage()-stack.getItemDamage())+"/"+stack.getMaxDamage()); //super.addInformation(stack, aPlayer, list, bool); @@ -333,25 +332,25 @@ public class StaballoyPickaxe extends ItemPickaxe{ @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ + public EnumRarity getRarity(final ItemStack par1ItemStack){ return EnumRarity.rare; } @Override - public boolean hasEffect(ItemStack par1ItemStack){ + public boolean hasEffect(final ItemStack par1ItemStack){ return true; } @Override - public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer aPlayer) { - thisPickaxe = itemstack; - localPlayer = aPlayer; - checkFacing(localPlayer.worldObj); + public boolean onBlockStartBreak(final ItemStack itemstack, final int X, final int Y, final int Z, final EntityPlayer aPlayer) { + this.thisPickaxe = itemstack; + this.localPlayer = aPlayer; + this.checkFacing(this.localPlayer.worldObj); return super.onBlockStartBreak(itemstack, X, Y, Z, aPlayer); } - - public StaballoyPickaxe(String unlocalizedName, ToolMaterial material) { + + public StaballoyPickaxe(final String unlocalizedName, final ToolMaterial material) { super(material); this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java index e5c3c92ced..4208b8c1af 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java @@ -1,11 +1,12 @@ package gtPlusPlus.core.item.tool.staballoy; +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.player.UtilsMining; - -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -13,8 +14,6 @@ import net.minecraft.init.Blocks; import net.minecraft.item.*; import net.minecraft.util.*; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class StaballoySpade extends ItemSpade{ @@ -22,7 +21,7 @@ public class StaballoySpade extends ItemSpade{ * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) */ @Override - public double getDurabilityForDisplay(ItemStack stack) { + public double getDurabilityForDisplay(final ItemStack stack) { if (super.getDurabilityForDisplay(stack) > 0){ return super.getDurabilityForDisplay(stack);} return 0; @@ -37,56 +36,56 @@ public class StaballoySpade extends ItemSpade{ private int miningLevel; /* - * - * - * - * Methods - * - * - * + * + * + * + * Methods + * + * + * */ @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer aPlayer) { - localPlayer = aPlayer; - localWorld = world; - thisPickaxe = stack; + public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer aPlayer) { + this.localPlayer = aPlayer; + this.localWorld = world; + this.thisPickaxe = stack; return super.onItemRightClick(stack, world, aPlayer); } @Override - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int X, int Y, int Z, EntityLivingBase entity) { + public boolean onBlockDestroyed(final ItemStack stack, final World world, final Block block, final int X, final int Y, final int Z, final EntityLivingBase entity) { //super.onBlockDestroyed(stack, world, block, X, Y, Z, entity); - localWorld = world; - thisPickaxe = stack; + this.localWorld = world; + this.thisPickaxe = stack; //checkFacing(world); - if (!world.isRemote){ - GetDestroyOrientation(lookingDirection, world, X, Y, Z, stack); + if (!world.isRemote){ + this.GetDestroyOrientation(this.lookingDirection, world, X, Y, Z, stack); } return super.onBlockDestroyed(stack, world, block, X, Y, Z, entity); } - public Boolean canPickaxeBlock(Block currentBlock, World currentWorld, int[] xyz){ + public Boolean canPickaxeBlock(final Block currentBlock, final World currentWorld, final int[] xyz){ String correctTool = ""; - if (!currentWorld.isRemote){ + if (!currentWorld.isRemote){ try { correctTool = currentBlock.getHarvestTool(0); //Utils.LOG_WARNING(correctTool); Utils.LOG_INFO("Tool for Block: "+correctTool+" | Current block: "+currentBlock.getLocalizedName()); - if (UtilsMining.getBlockType(currentBlock, currentWorld, xyz, miningLevel) || correctTool.equals("shovel")){ + if (UtilsMining.getBlockType(currentBlock, currentWorld, xyz, this.miningLevel) || correctTool.equals("shovel")){ return true;} - } catch (NullPointerException e){ + } catch (final NullPointerException e){ return false;} } return false; } - private void GetDestroyOrientation(String FACING, World world, int X, int Y, int Z, ItemStack heldItem){ - localWorld = world; + private void GetDestroyOrientation(final String FACING, final World world, final int X, final int Y, final int Z, final ItemStack heldItem){ + this.localWorld = world; float DURABILITY_LOSS = 0; if (!world.isRemote){ @@ -94,7 +93,7 @@ public class StaballoySpade extends ItemSpade{ DURABILITY_LOSS = 0; for(int i = -1; i < 2; i++) { for(int j = -1; j < 2; j++) { - DURABILITY_LOSS = (DURABILITY_LOSS + removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem)); + DURABILITY_LOSS = (DURABILITY_LOSS + this.removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem)); } } } @@ -103,7 +102,7 @@ public class StaballoySpade extends ItemSpade{ DURABILITY_LOSS = 0; for(int i = -1; i < 2; i++) { for(int j = -1; j < 2; j++) { - DURABILITY_LOSS = (DURABILITY_LOSS + removeBlockAndDropAsItem(world, X , Y + i, Z + j, heldItem)); + DURABILITY_LOSS = (DURABILITY_LOSS + this.removeBlockAndDropAsItem(world, X , Y + i, Z + j, heldItem)); } } } @@ -112,7 +111,7 @@ public class StaballoySpade extends ItemSpade{ DURABILITY_LOSS = 0; for(int i = -1; i < 2; i++) { for(int j = -1; j < 2; j++) { - DURABILITY_LOSS = (DURABILITY_LOSS + removeBlockAndDropAsItem(world, X + j, Y + i, Z, heldItem)); + DURABILITY_LOSS = (DURABILITY_LOSS + this.removeBlockAndDropAsItem(world, X + j, Y + i, Z, heldItem)); } } } @@ -120,14 +119,14 @@ public class StaballoySpade extends ItemSpade{ //int heldItemDurability = heldItem.getDamage(1); Utils.LOG_INFO("Total Loss: "+(int)DURABILITY_LOSS); //heldItem.setDamage(heldStack, DURABILITY_LOSS); - //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); + //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); //Utils.LOG_WARNING("Durability: "+heldStack.getDamage(heldStack)); Utils.LOG_INFO("1x: "+(heldItem.getItemDamage())); - int itemdmg = heldItem.getItemDamage(); - int maxdmg = heldItem.getMaxDamage(); - int dodmg = (int)DURABILITY_LOSS; - int durNow = (int) maxdmg-itemdmg; - int durLeft = (int) ((maxdmg-itemdmg)-DURABILITY_LOSS); + final int itemdmg = heldItem.getItemDamage(); + final int maxdmg = heldItem.getMaxDamage(); + final int dodmg = (int)DURABILITY_LOSS; + final int durNow = maxdmg-itemdmg; + final int durLeft = (int) ((maxdmg-itemdmg)-DURABILITY_LOSS); Utils.LOG_INFO( "Current Damage: " + itemdmg @@ -139,7 +138,7 @@ public class StaballoySpade extends ItemSpade{ //Break Tool - if ((durNow-dodmg) <= (900) && itemdmg != 0){ + if (((durNow-dodmg) <= (900)) && (itemdmg != 0)){ //TODO break tool Utils.LOG_INFO("Breaking Tool"); heldItem.stackSize = 0; @@ -148,72 +147,72 @@ public class StaballoySpade extends ItemSpade{ else { //setItemDamage(heldItem, durLeft); Utils.LOG_INFO(""+(durNow-durLeft)); - damageItem(heldItem, (durNow-durLeft)-1, localPlayer); + this.damageItem(heldItem, (durNow-durLeft)-1, this.localPlayer); } DURABILITY_LOSS = 0; } } - public void damageItem(ItemStack item, int damage, EntityPlayer localPlayer){ + public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer){ item.damageItem(damage, localPlayer); } - public void setItemDamage(ItemStack item, int damage){ + public void setItemDamage(final ItemStack item, final int damage){ item.setItemDamage(damage-1); } //Should clear up blocks quicker if I chain it. - public int removeBlockAndDropAsItem(World world, int X, int Y, int Z, ItemStack heldItem){ - localWorld = world; + public int removeBlockAndDropAsItem(final World world, final int X, final int Y, final int Z, final ItemStack heldItem){ + this.localWorld = world; Utils.LOG_INFO("Trying to drop/remove a block."); try { - Block block = world.getBlock(X, Y, Z); + final Block block = world.getBlock(X, Y, Z); Utils.LOG_WARNING(block.toString()); String removalTool = ""; removalTool = block.getHarvestTool(0); if (removalTool != null){ - if (removalTool.equals("shovel")){ - if (canPickaxeBlock(block, world, new int[]{X,Y,Z})){ - if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ - - int itemdmg = heldItem.getItemDamage(); - int maxdmg = heldItem.getMaxDamage(); - int dodmg = (int)100; - int durNow = (int) maxdmg-itemdmg; - int durLeft = (int) ((maxdmg-itemdmg)-100); - - if ((durNow-dodmg) <= (900) && itemdmg != 0){ - //Do Nothing, Tool is useless. - return 0; + if (removalTool.equals("shovel")){ + if (this.canPickaxeBlock(block, world, new int[]{X,Y,Z})){ + if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ + + final int itemdmg = heldItem.getItemDamage(); + final int maxdmg = heldItem.getMaxDamage(); + final int dodmg = 100; + final int durNow = maxdmg-itemdmg; + final int durLeft = (maxdmg-itemdmg)-100; + + if (((durNow-dodmg) <= (900)) && (itemdmg != 0)){ + //Do Nothing, Tool is useless. + return 0; + } + block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); + world.setBlockToAir(X, Y, Z); + Utils.LOG_INFO("Adding 100 damage to item."); + return 100; } - block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); - world.setBlockToAir(X, Y, Z); - Utils.LOG_INFO("Adding 100 damage to item."); - return 100; + Utils.LOG_INFO("Incorrect Tool for mining this block. Wrong Block Water/lava/bedrock/blacklist"); + return 0; } - Utils.LOG_INFO("Incorrect Tool for mining this block. Wrong Block Water/lava/bedrock/blacklist"); + Utils.LOG_INFO("Incorrect Tool for mining this block. Cannot Shovel this block type."); return 0; } - Utils.LOG_INFO("Incorrect Tool for mining this block. Cannot Shovel this block type."); + Utils.LOG_INFO("Incorrect Tool for mining this block. Blocks mining tool is now Shovel."); return 0; } - Utils.LOG_INFO("Incorrect Tool for mining this block. Blocks mining tool is now Shovel."); + Utils.LOG_INFO("Either the block was air or it declares an invalid mining tool."); return 0; - } - Utils.LOG_INFO("Either the block was air or it declares an invalid mining tool."); - return 0; - } catch (NullPointerException e){ + } catch (final NullPointerException e){ Utils.LOG_INFO("Something Broke"); e.printStackTrace(); return 0; } } - public boolean checkFacing(World world){ - localWorld = world; - if (localPlayer != null){ - int direction = MathHelper.floor_double((double)((localPlayer.rotationYaw * 4F) / 360F) + 0.5D) & 3; + public boolean checkFacing(final World world){ + this.localWorld = world; + if (this.localPlayer != null){ + final int direction = MathHelper.floor_double((this.localPlayer.rotationYaw * 4F) / 360F + 0.5D) & 3; //Utils.LOG_WARNING("Player - F: "+direction); //Utils.LOG_WARNING("Player - getLookVec(): "+localPlayer.getLookVec().yCoord); @@ -221,88 +220,88 @@ public class StaballoySpade extends ItemSpade{ localPlayer.getLookVec().yCoord; }*/ - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, (EntityPlayer) localPlayer, false); + final MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, this.localPlayer, false); if (movingobjectposition != null){ - int sideHit = movingobjectposition.sideHit; + final int sideHit = movingobjectposition.sideHit; String playerStandingPosition = ""; - if (movingobjectposition != null) { + if (movingobjectposition != null) { //System.out.println("Side Hit: "+movingobjectposition.sideHit); } if (sideHit == 0){ playerStandingPosition = "above"; - FACING_HORIZONTAL = false; + this.FACING_HORIZONTAL = false; } else if (sideHit == 1){ playerStandingPosition = "below"; - FACING_HORIZONTAL = false; + this.FACING_HORIZONTAL = false; } else if (sideHit == 2){ playerStandingPosition = "facingSouth"; - FACING_HORIZONTAL = true; + this.FACING_HORIZONTAL = true; } else if (sideHit == 3){ playerStandingPosition = "facingNorth"; - FACING_HORIZONTAL = true; + this.FACING_HORIZONTAL = true; } else if (sideHit == 4){ playerStandingPosition = "facingEast"; - FACING_HORIZONTAL = true; + this.FACING_HORIZONTAL = true; } else if (sideHit == 5){ playerStandingPosition = "facingWest"; - FACING_HORIZONTAL = true; + this.FACING_HORIZONTAL = true; } - lookingDirection = playerStandingPosition; + this.lookingDirection = playerStandingPosition; - if (direction == 0){ - FACING = "south"; - } - else if (direction == 1){ - FACING = "west"; + if (direction == 0){ + this.FACING = "south"; } - else if (direction == 2){ - FACING = "north"; - } - else if (direction == 3){ - FACING = "east"; + else if (direction == 1){ + this.FACING = "west"; + } + else if (direction == 2){ + this.FACING = "north"; + } + else if (direction == 3){ + this.FACING = "east"; } } return true; } - return false; + return false; } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - thisPickaxe = stack; + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + this.thisPickaxe = stack; list.add(EnumChatFormatting.GOLD+"Spades a 3x3 area in the direction you are facing."); super.addInformation(stack, aPlayer, list, bool); } @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ + public EnumRarity getRarity(final ItemStack par1ItemStack){ return EnumRarity.rare; } @Override - public boolean hasEffect(ItemStack par1ItemStack){ + public boolean hasEffect(final ItemStack par1ItemStack){ return true; } @Override - public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer aPlayer) { - thisPickaxe = itemstack; - localPlayer = aPlayer; - checkFacing(localPlayer.worldObj); + public boolean onBlockStartBreak(final ItemStack itemstack, final int X, final int Y, final int Z, final EntityPlayer aPlayer) { + this.thisPickaxe = itemstack; + this.localPlayer = aPlayer; + this.checkFacing(this.localPlayer.worldObj); return super.onBlockStartBreak(itemstack, X, Y, Z, aPlayer); } - public StaballoySpade(String unlocalizedName, ToolMaterial material) { + public StaballoySpade(final String unlocalizedName, final ToolMaterial material) { super(material); this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 2f7352c257..6faf131acb 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.lib; +import java.util.*; + import gregtech.api.GregTech_API; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.gregtech.recipehandlers.GregtechRecipe; @@ -9,28 +11,25 @@ import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; import gtPlusPlus.xmod.gregtech.api.objects.XSTR; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator; - -import java.util.*; - import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.config.Configuration; public class CORE { - + protected CORE(){ //import cpw.mods.fml.common.Optional; } - + //Math Related public static final float PI = (float) Math.PI; public static volatile Random RANDOM = new XSTR(); - public static final String name = "GT++"; + public static final String name = "GT++"; public static final String MODID = "miscutils"; public static final String VERSION = "1.4.9.70-alpha"; public static final String MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); public static boolean isModUpToDate = Utils.isModUpToDate(); - public static boolean DEBUG = false; + public static boolean DEBUG = false; public static final boolean LOAD_ALL_CONTENT = false; public static final int GREG_FIRST_ID = 760; public static Map PlayerCache; @@ -41,25 +40,25 @@ public class CORE { @Deprecated public static IGregtech_RecipeAdder sRecipeAdder; public static GregtechRecipe GT_Recipe = new GregtechRecipe(); - - public static Configuration Config; + + public static Configuration Config; public static final String GT_Tooltip = "Added by: " + EnumChatFormatting.DARK_GREEN+"Alkalus "+EnumChatFormatting.GRAY+"- "+EnumChatFormatting.RED+"[GT++]"; public static final String GT_Tooltip_Radioactive = EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.GREEN+"Radioactive! "+EnumChatFormatting.GOLD+" Avoid direct handling without hazmat protection."; public static final String noItem = ""; - + //Because I want to be lazy. public static boolean GTNH = false; - + /** * A List containing all the Materials, which are somehow in use by GT and therefor receive a specific Set of Items. */ public static final GT_Materials[] sMU_GeneratedMaterials = new GT_Materials[1000]; - + //Tesseract map - public static final Map<Integer, GT_MetaTileEntity_TesseractGenerator> sTesseractGenerators = new HashMap<Integer, GT_MetaTileEntity_TesseractGenerator>(); + public static final Map<Integer, GT_MetaTileEntity_TesseractGenerator> sTesseractGenerators = new HashMap<>(); //GUIS - public enum GUI_ENUM + public enum GUI_ENUM { ENERGYBUFFER, TOOLBUILDER, NULL, NULL1, NULL2 } @@ -68,17 +67,17 @@ public class CORE { * File Paths and Resource Paths */ public static final String - TEX_DIR = "textures/", - TEX_DIR_GUI = TEX_DIR + "gui/", - TEX_DIR_ITEM = TEX_DIR + "items/", + TEX_DIR = "textures/", + TEX_DIR_GUI = TEX_DIR + "gui/", + TEX_DIR_ITEM = TEX_DIR + "items/", TEX_DIR_BLOCK = TEX_DIR + "blocks/", - TEX_DIR_ENTITY = TEX_DIR + "entity/", - TEX_DIR_ASPECTS = TEX_DIR + "aspects/", + TEX_DIR_ENTITY = TEX_DIR + "entity/", + TEX_DIR_ASPECTS = TEX_DIR + "aspects/", TEX_DIR_FLUIDS = TEX_DIR_BLOCK + "fluids/", - RES_PATH = MODID + ":" + TEX_DIR, - RES_PATH_GUI = MODID + ":" + TEX_DIR_GUI, - RES_PATH_ITEM = MODID + ":" + TEX_DIR_ITEM, - RES_PATH_BLOCK = MODID + ":" + TEX_DIR_BLOCK, + RES_PATH = MODID + ":" + TEX_DIR, + RES_PATH_GUI = MODID + ":" + TEX_DIR_GUI, + RES_PATH_ITEM = MODID + ":" + TEX_DIR_ITEM, + RES_PATH_BLOCK = MODID + ":" + TEX_DIR_BLOCK, RES_PATH_ENTITY = MODID + ":" + TEX_DIR_ENTITY, RES_PATH_ASPECTS = MODID + ":" + TEX_DIR_ASPECTS, RES_PATH_FLUIDS = MODID + ":" + TEX_DIR_FLUIDS; @@ -92,24 +91,24 @@ public class CORE { //Debug public static boolean disableEnderIOIntegration = false; public static boolean MACHINE_INFO = true; - + //Tools public static boolean enableSkookumChoochers = true; public static boolean enableMultiSizeTools = true; - + //Block Drops public static int chanceToDropDrainedShard = 196; public static int chanceToDropFluoriteOre = 32; - + //Machine Related public static boolean enableAlternativeBatteryAlloy = false; public static boolean enableThaumcraftShardUnification = false; - public static boolean disableIC2Recipes = false; + public static boolean disableIC2Recipes = false; public static boolean enableAlternativeDivisionSigilRecipe = false; - + //Feature Related public static boolean enableCustomAlvearyBlocks = false; - + //Single Block Machines public static boolean enableMachine_SolarGenerators = false; public static boolean enableMachine_Safes = true; @@ -120,7 +119,7 @@ public class CORE { public static boolean enableMachine_GeothermalEngines = true; public static boolean enableCustom_Pipes = true; public static boolean enableCustom_Cables = true; - + //Multiblocks public static boolean enableMultiblock_AlloyBlastSmelter = true; public static boolean enableMultiblock_IndustrialCentrifuge = true; @@ -136,11 +135,11 @@ public class CORE { public static boolean enableMultiblock_LiquidFluorideThoriumReactor = true; public static boolean enableMultiblock_NuclearFuelRefinery = true; public static boolean enableMultiblock_TreeFarmer = true; - + //Visuals public static boolean enableTreeFarmerParticles = true; public static boolean useGregtechTextures = true; - + } - + } diff --git a/src/Java/gtPlusPlus/core/lib/LoadedMods.java b/src/Java/gtPlusPlus/core/lib/LoadedMods.java index 8d606f2c1a..055350b997 100644 --- a/src/Java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/Java/gtPlusPlus/core/lib/LoadedMods.java @@ -1,17 +1,16 @@ package gtPlusPlus.core.lib; +import static gtPlusPlus.core.lib.CORE.GTNH; + +import cpw.mods.fml.common.Loader; import gtPlusPlus.core.lib.CORE.configSwitches; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechTextures; import gtPlusPlus.xmod.gregtech.recipes.GregtechRecipeAdder; -import static gtPlusPlus.core.lib.CORE.GTNH; - -import cpw.mods.fml.common.Loader; - public class LoadedMods { - + //Initialize Variables public static boolean Gregtech = false; public static boolean PlayerAPI = false; @@ -42,9 +41,9 @@ public class LoadedMods { public static boolean OpenComputers = false; //OpenComputers public static boolean Computronics = false; //computronics public static boolean DreamCraft = false; //GT: New Horizons - - + + private static int totalMods; @SuppressWarnings("deprecation") public static void checkLoaded(){ @@ -59,11 +58,11 @@ public class LoadedMods { GregtechTextures.BlockIcons.VOID.name(); GregtechTextures.ItemIcons.VOID.name(); Utils.LOG_INFO("Created Gregtech texture handler."); - } catch (NullPointerException e){ + } catch (final NullPointerException e){ Utils.LOG_INFO("Could NOT create a Gregtech recipe handler."); } } - + totalMods++; } // @@ -75,7 +74,7 @@ public class LoadedMods { Utils.LOG_INFO("Components enabled for: GT: New Horizons"); totalMods++; } - + if (Loader.isModLoaded("PlayerAPI") == true){ PlayerAPI = true; Utils.LOG_INFO("Components enabled for: PlayerAPI"); @@ -86,7 +85,7 @@ public class LoadedMods { Utils.LOG_INFO("Components enabled for: BuildCraft"); totalMods++; } - if (Loader.isModLoaded("EnderIO") == true && !configSwitches.disableEnderIOIntegration){ + if ((Loader.isModLoaded("EnderIO") == true) && !configSwitches.disableEnderIOIntegration){ EnderIO = true; Utils.LOG_INFO("Components enabled for: EnderIO"); totalMods++; @@ -203,7 +202,7 @@ public class LoadedMods { IHL = true; Utils.LOG_INFO("Components enabled for: IHL"); totalMods++; - } + } if (Loader.isModLoaded("Baubles") == true){ Baubles = true; Utils.LOG_INFO("Components enabled for: Baubles"); @@ -219,14 +218,14 @@ public class LoadedMods { Utils.LOG_INFO("Components enabled for: Computronics"); totalMods++; } - + Utils.LOG_INFO("Content found for "+totalMods+" mods"); - + } - - public static String getModVersion(String modName){ + + public static String getModVersion(final String modName){ final String ver = cpw.mods.fml.common.FMLCommonHandler.instance().findContainerFor(modName).getVersion(); return ver; } - + } diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java index 30dd7dc87e..550a23b4c5 100644 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -1,12 +1,18 @@ package gtPlusPlus.core.material; +import gregtech.api.enums.Materials; import gtPlusPlus.core.material.state.MaterialState; +import gtPlusPlus.core.util.materials.MaterialUtils; public final class ALLOY { + + //Just some GT Alloys that I need within mine. + public static final Material BRONZE = MaterialUtils.generateMaterialFromGtENUM(Materials.Bronze); + public static final Material STEEL = MaterialUtils.generateMaterialFromGtENUM(Materials.Steel); public static final Material ENERGYCRYSTAL = new Material( "Energy Crystal", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{228, 255, 0, 0}, //Material Colour 5660, //Melting Point in C 0, //Boiling Point in C @@ -23,7 +29,7 @@ public final class ALLOY { public static final Material BLOODSTEEL = new Material( "Blood Steel", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{142, 28, 0, 0}, //Material Colour 2500, //Melting Point in C 0, //Boiling Point in C @@ -38,7 +44,7 @@ public final class ALLOY { public static final Material STABALLOY = new Material( "Staballoy", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{68, 75, 66, 0}, //Material Colour 3450, //Melting Point in C ((ELEMENT.getInstance().URANIUM238.getBoilingPointC()*9)+(ELEMENT.getInstance().TITANIUM.getBoilingPointC()*1))/10, //Boiling Point in C @@ -53,7 +59,7 @@ public final class ALLOY { public static final Material TANTALLOY_60 = new Material( "Tantalloy-60", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{213, 231, 237, 0}, //Material Colour 3025, //Melting Point in C ((ELEMENT.getInstance().TUNGSTEN.getBoilingPointC()*1)+(ELEMENT.getInstance().TANTALUM.getBoilingPointC()*8)+(ELEMENT.getInstance().TITANIUM.getBoilingPointC()*1))/10, //Boiling Point in C @@ -68,7 +74,7 @@ public final class ALLOY { public static final Material TANTALLOY_61 = new Material( "Tantalloy-61", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{193, 211, 217, 0}, //Material Colour 3030, //Melting Point in C ((ELEMENT.getInstance().TUNGSTEN.getBoilingPointC()*1)+(ELEMENT.getInstance().TANTALUM.getBoilingPointC()*7)+(ELEMENT.getInstance().TITANIUM.getBoilingPointC()*1)+(ELEMENT.getInstance().YTTRIUM.getBoilingPointC()*1))/10, //Boiling Point in C @@ -82,25 +88,9 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().YTTRIUM, 8) }); - public static final Material BRONZE = new Material( - "Bronze", //Material Name - MaterialState.SOLID, //State - new short[]{128, 128, 128, 0}, //Material Colour - ((ELEMENT.getInstance().TIN.getMeltingPointC()*1)+(ELEMENT.getInstance().COPPER.getMeltingPointC()*3))/4, //Melting point in C - ((ELEMENT.getInstance().TIN.getBoilingPointC()*1)+(ELEMENT.getInstance().COPPER.getBoilingPointC()*3))/4, //Boiling Point in C - ((ELEMENT.getInstance().TIN.getProtons()*1)+(ELEMENT.getInstance().COPPER.getProtons()*3))/4, //Protons - ((ELEMENT.getInstance().TIN.getNeutrons()*1)+(ELEMENT.getInstance().COPPER.getNeutrons()*3))/4, //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().COPPER, 35), - new MaterialStack(ELEMENT.getInstance().COPPER, 40), - new MaterialStack(ELEMENT.getInstance().TIN, 25) - }); - public static final Material TUMBAGA = new Material( "Tumbaga", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{255,178,15, 0}, //Material Colour ((ELEMENT.getInstance().GOLD.getMeltingPointC()*7)+(ELEMENT.getInstance().COPPER.getMeltingPointC()*3))/10, //Melting point in C ((ELEMENT.getInstance().GOLD.getBoilingPointC()*7)+(ELEMENT.getInstance().COPPER.getBoilingPointC()*3))/10, //Boiling Point in C @@ -116,7 +106,7 @@ public final class ALLOY { public static final Material POTIN = new Material( "Potin", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{201,151,129, 0}, //Material Colour ((ELEMENT.getInstance().LEAD.getMeltingPointC()*4)+(ALLOY.BRONZE.getMeltingPointC()*4)+(ELEMENT.getInstance().TIN.getMeltingPointC()*2))/10, //Melting point in C ((ELEMENT.getInstance().LEAD.getBoilingPointC()*4)+(ALLOY.BRONZE.getBoilingPointC()*4)+(ELEMENT.getInstance().TIN.getBoilingPointC()*2))/10, //Boiling Point in C @@ -143,7 +133,7 @@ public final class ALLOY { public static final Material INCONEL_625 = new Material( "Inconel-625", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{128, 200, 128, 0}, //Material Colour 1425, //Melting Point in C ((ELEMENT.getInstance().NICKEL.getBoilingPointC()*6)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*2)+(ELEMENT.getInstance().IRON.getBoilingPointC()*1)+(ELEMENT.getInstance().MOLYBDENUM.getBoilingPointC()*1))/10, //Boiling Point in C @@ -160,7 +150,7 @@ public final class ALLOY { public static final Material INCONEL_690 = new Material( "Inconel-690", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{118, 220, 138, 0}, //Material Colour 1425, //Melting Point in C ((ELEMENT.getInstance().NICKEL.getBoilingPointC()*6)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*2)+(ELEMENT.getInstance().NIOBIUM.getBoilingPointC()*1)+(ELEMENT.getInstance().MOLYBDENUM.getBoilingPointC()*1))/10, //Boiling Point in C @@ -177,7 +167,7 @@ public final class ALLOY { public static final Material INCONEL_792 = new Material( "Inconel-792", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{108, 240, 118, 0}, //Material Colour 1425, //Melting Point in C ((ELEMENT.getInstance().NICKEL.getBoilingPointC()*6)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*1)+(ELEMENT.getInstance().IRON.getBoilingPointC()*1)+(ELEMENT.getInstance().ALUMINIUM.getBoilingPointC()*2))/10, //Boiling Point in C @@ -191,27 +181,11 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().NIOBIUM, 10), new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 20) }); - - public static final Material STEEL = new Material( - "Steel", //Material Name - MaterialState.SOLID, //State - new short[]{180, 180, 20, 0}, //Material Colour - ((ELEMENT.getInstance().CARBON.getMeltingPointC()*5)+(ELEMENT.getInstance().IRON.getMeltingPointC()*95))/100, //Melting point in C - ((ELEMENT.getInstance().CARBON.getBoilingPointC()*5)+(ELEMENT.getInstance().IRON.getBoilingPointC()*95))/100, //Boiling Point in C - ((ELEMENT.getInstance().CARBON.getProtons()*5)+(ELEMENT.getInstance().IRON.getProtons()*95))/100, //Protons - ((ELEMENT.getInstance().CARBON.getNeutrons()*5)+(ELEMENT.getInstance().IRON.getNeutrons()*95))/100, //Neutrons - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().CARBON, 10), - new MaterialStack(ELEMENT.getInstance().IRON, 30), - new MaterialStack(ELEMENT.getInstance().IRON, 30), - new MaterialStack(ELEMENT.getInstance().IRON, 30) - }); + public static final Material ZERON_100 = new Material( "Zeron-100", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{180, 180, 20, 0}, //Material Colour ((ELEMENT.getInstance().CHROMIUM.getMeltingPointC()*25)+(ELEMENT.getInstance().NICKEL.getMeltingPointC()*6)+(ELEMENT.getInstance().COBALT.getMeltingPointC()*9)+(ALLOY.STEEL.getMeltingPointC()*60))/100, //Melting Point in C ((ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*25)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*6)+(ELEMENT.getInstance().COBALT.getBoilingPointC()*9)+(ALLOY.STEEL.getBoilingPointC()*60))/100, //Boiling Point in C @@ -226,11 +200,11 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().COPPER, 20), new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 4), new MaterialStack(ALLOY.STEEL, 40) - }); + }); public static final Material MARAGING250 = new Material( "Maraging Steel 250", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{140, 140, 140, 0}, //Material Colour 1413, //Melting Point in C ((ELEMENT.getInstance().TITANIUM.getBoilingPointC()*5)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*16)+(ELEMENT.getInstance().COBALT.getBoilingPointC()*9)+(ALLOY.STEEL.getBoilingPointC()*70))/100, //Boiling Point in C @@ -248,7 +222,7 @@ public final class ALLOY { public static final Material MARAGING300 = new Material( "Maraging Steel 300", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{150, 150, 150, 0}, //Material Colour 1413, //Melting Point in C ((ELEMENT.getInstance().TITANIUM.getBoilingPointC()*10)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*21)+(ELEMENT.getInstance().COBALT.getBoilingPointC()*14)+(ALLOY.STEEL.getBoilingPointC()*55))/100, //Boiling Point in C @@ -257,16 +231,16 @@ public final class ALLOY { true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ALLOY.STEEL, 64), - new MaterialStack(ELEMENT.getInstance().TITANIUM, 4), - new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 4), - new MaterialStack(ELEMENT.getInstance().NICKEL, 16), - new MaterialStack(ELEMENT.getInstance().COBALT, 8), + new MaterialStack(ALLOY.STEEL, 64), + new MaterialStack(ELEMENT.getInstance().TITANIUM, 4), + new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 4), + new MaterialStack(ELEMENT.getInstance().NICKEL, 16), + new MaterialStack(ELEMENT.getInstance().COBALT, 8), }); public static final Material MARAGING350 = new Material( "Maraging Steel 350", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{160, 160, 160, 0}, //Material Colour 1413, //Melting Point in C ((ELEMENT.getInstance().TITANIUM.getBoilingPointC()*15)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*21)+(ELEMENT.getInstance().COBALT.getBoilingPointC()*9)+(ALLOY.STEEL.getBoilingPointC()*55))/100, //Boiling Point in C @@ -275,16 +249,16 @@ public final class ALLOY { true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ALLOY.STEEL, 64), - new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 4), - new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 4), - new MaterialStack(ELEMENT.getInstance().NICKEL, 16), - new MaterialStack(ELEMENT.getInstance().COBALT, 8), + new MaterialStack(ALLOY.STEEL, 64), + new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 4), + new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 4), + new MaterialStack(ELEMENT.getInstance().NICKEL, 16), + new MaterialStack(ELEMENT.getInstance().COBALT, 8), }); public static final Material STELLITE = new Material( "Stellite", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{129, 75, 120, 0}, //Material Colour 1310, //Melting Point in C ((ELEMENT.getInstance().TITANIUM.getBoilingPointC()*10)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*35)+(ELEMENT.getInstance().COBALT.getBoilingPointC()*35)+(ELEMENT.getInstance().MANGANESE.getBoilingPointC()*20))/100, //Boiling Point in C @@ -301,7 +275,7 @@ public final class ALLOY { public static final Material TALONITE = new Material( "Talonite", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{228, 75, 120, 0}, //Material Colour 1454, //Melting Point in C ((ELEMENT.getInstance().MOLYBDENUM.getBoilingPointC()*10)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*30)+(ELEMENT.getInstance().COBALT.getBoilingPointC()*40)+(ELEMENT.getInstance().PHOSPHORUS.getBoilingPointC()*20))/100, //Boiling Point in C @@ -318,7 +292,7 @@ public final class ALLOY { public static final Material HASTELLOY_W = new Material( "Hastelloy-W", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{218, 165, 32, 0}, //Material Colour 1350, //Melting Point in C ((ELEMENT.getInstance().IRON.getBoilingPointC()*6)+(ELEMENT.getInstance().MOLYBDENUM.getBoilingPointC()*24)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*5)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*65))/100, //Boiling Point in C @@ -348,10 +322,10 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().CHROMIUM, 22), new MaterialStack(ELEMENT.getInstance().NICKEL, 51) });*/ - + public static final Material HASTELLOY_X = new Material( "Hastelloy-X", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{255, 193, 37, 0}, //Material Colour 1350, //Melting Point in C ((ELEMENT.getInstance().IRON.getBoilingPointC()*18)+(ELEMENT.getInstance().MOLYBDENUM.getBoilingPointC()*9)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*22)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*51))/100, //Boiling Point in C @@ -368,7 +342,7 @@ public final class ALLOY { public static final Material HASTELLOY_N = new Material( "Hastelloy-N", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{236, 213, 48, 0}, //Material Colour 1350, //Melting Point in C ((ELEMENT.getInstance().YTTRIUM.getBoilingPointC()*5)+(ELEMENT.getInstance().MOLYBDENUM.getBoilingPointC()*16)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*7)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*72))/100, //Boiling Point in C @@ -385,7 +359,7 @@ public final class ALLOY { public static final Material HASTELLOY_C276 = new Material( "Hastelloy-C276", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{238, 180, 34, 0}, //Material Colour 1350, //Melting Point in C ((ELEMENT.getInstance().COBALT.getBoilingPointC()*2)+(ELEMENT.getInstance().MOLYBDENUM.getBoilingPointC()*16)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*16)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*66))/100, //Boiling Point in C @@ -402,7 +376,7 @@ public final class ALLOY { public static final Material INCOLOY_020 = new Material( "Incoloy-020", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{101, 81, 71, 0}, //Material Colour 1425, //Melting Point in C ((ELEMENT.getInstance().IRON.getBoilingPointC()*40)+(ELEMENT.getInstance().COPPER.getBoilingPointC()*4)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*20)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*36))/100, //Boiling Point in C @@ -419,7 +393,7 @@ public final class ALLOY { public static final Material INCOLOY_DS = new Material( "Incoloy-DS", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{71, 101, 81, 0}, //Material Colour 1425, //Melting Point in C ((ELEMENT.getInstance().IRON.getBoilingPointC()*46)+(ELEMENT.getInstance().COBALT.getBoilingPointC()*18)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*18)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*18))/100, //Boiling Point in C @@ -436,7 +410,7 @@ public final class ALLOY { public static final Material INCOLOY_MA956 = new Material( "Incoloy-MA956", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{81, 71, 101, 0}, //Material Colour 1425, //Melting Point in C ((ELEMENT.getInstance().IRON.getBoilingPointC()*75)+(ELEMENT.getInstance().ALUMINIUM.getBoilingPointC()*4)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*20)+(ELEMENT.getInstance().YTTRIUM.getBoilingPointC()*1))/100, //Boiling Point in C @@ -453,7 +427,7 @@ public final class ALLOY { public static final Material TUNGSTEN_CARBIDE = new Material( "Tungsten Carbide", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{44, 44, 44, 0}, //Material Colour 3422, //Melting Point in C ((ELEMENT.getInstance().TUNGSTEN.getBoilingPointC()*5)+(ELEMENT.getInstance().CARBON.getBoilingPointC()*5))/10, //Boiling Point in C @@ -468,7 +442,7 @@ public final class ALLOY { public static final Material SILICON_CARBIDE = new Material( "Silicon Carbide", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{40, 48, 36, 0}, //Material Colour 1414, //Melting Point in C ((ELEMENT.getInstance().SILICON.getBoilingPointC()*5)+(ELEMENT.getInstance().CARBON.getBoilingPointC()*5))/10, //Boiling Point in C @@ -484,7 +458,7 @@ public final class ALLOY { public static final Material TANTALUM_CARBIDE = new Material( "Tantalum Carbide", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{139, 136, 120, 0}, //Material Colour 2980, //Melting Point in C ((ELEMENT.getInstance().TANTALUM.getBoilingPointC()*5)+(ELEMENT.getInstance().CARBON.getBoilingPointC()*5))/10, //Boiling Point in C @@ -500,7 +474,7 @@ public final class ALLOY { public static final Material ZIRCONIUM_CARBIDE = new Material( "Zirconium Carbide", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{222, 202, 180, 0}, //Material Colour 1855, //Melting Point in C ((ELEMENT.getInstance().ZIRCONIUM.getBoilingPointC()*5)+(ELEMENT.getInstance().CARBON.getBoilingPointC()*5))/10, //Boiling Point in C @@ -516,7 +490,7 @@ public final class ALLOY { public static final Material NIOBIUM_CARBIDE = new Material( "Niobium Carbide", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{205, 197, 191, 0}, //Material Colour 2477, //Melting Point in C ((ELEMENT.getInstance().NIOBIUM.getBoilingPointC()*5)+(ELEMENT.getInstance().CARBON.getBoilingPointC()*5))/10, //Boiling Point in C @@ -529,10 +503,10 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().CARBON, 50), new MaterialStack(ELEMENT.getInstance().OXYGEN, 10) }); - + public static final Material LEAGRISIUM = new Material( "Grisium", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{53, 93, 106, 0}, //Material Colour 9001, //Melting Point in C 25000, //Boiling Point in C @@ -548,21 +522,21 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().HYDROGEN, 10) }); //Material Stacks with Percentage of required elements. - - - - - - - - - - - + + + + + + + + + + + //Quantum public static final Material QUANTUM = new Material( "Quantum", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{128, 128, 255, 50}, //Material Colour 9999, //Melting Point in C 25000, //Boiling Point in C @@ -580,7 +554,7 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().BERYLLIUM, 5), new MaterialStack(ELEMENT.getInstance().BISMUTH, 5) }); - - + + } diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java index 0fee6f3fbd..108f4f1097 100644 --- a/src/Java/gtPlusPlus/core/material/ELEMENT.java +++ b/src/Java/gtPlusPlus/core/material/ELEMENT.java @@ -5,15 +5,15 @@ import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.materials.MaterialUtils; public final class ELEMENT { - + private static final ELEMENT thisClass = new ELEMENT(); - + public ELEMENT(){ - - } - + + } + public static ELEMENT getInstance(){ - return thisClass; + return thisClass; } //First 50 Elements @@ -71,7 +71,7 @@ public final class ELEMENT { public final Material TELLURIUM = new Material("Tellurium", MaterialState.SOLID, 25600, new short[]{210, 210, 210}, 449, 989, 52, 76, false, "Te", 0);//Not a GT Inherited Material public final Material IODINE = new Material("Iodine", MaterialState.SOLID, 25600, new short[]{96, 96, 96}, 114, 184, 53, 74, false, "I", 0);//Not a GT Inherited Material public final Material XENON = new Material("Xenon", MaterialState.GAS, 12800, new short[]{255, 255, 255}, -111, -108, 54, 77, false, "Xe", 0);//Not a GT Inherited Material - public final Material CESIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Caesium); + public final Material CESIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Caesium); public final Material BARIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Barium); public final Material LANTHANUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Lanthanum); public final Material CERIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Cerium); @@ -95,12 +95,12 @@ public final class ELEMENT { public final Material TUNGSTEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Tungsten); public final Material RHENIUM = new Material("Rhenium", MaterialState.SOLID, 25600, new short[]{150, 150, 150}, 3180, 3627, 75, 111, false, "Re", 0);//Not a GT Inherited Material public final Material OSMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Osmium); - public final Material IRIDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Iridium); - public final Material PLATINUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Platinum); - public final Material GOLD = MaterialUtils.generateMaterialFromGtENUM(Materials.Gold); + public final Material IRIDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Iridium); + public final Material PLATINUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Platinum); + public final Material GOLD = MaterialUtils.generateMaterialFromGtENUM(Materials.Gold); public final Material MERCURY = MaterialUtils.generateMaterialFromGtENUM(Materials.Mercury); //Mercury public final Material THALLIUM = new Material("Thallium", MaterialState.SOLID, 25600, new short[]{175, 175, 175}, 304, 1457, 81, 123, false, "Tl", 0);//Not a GT Inherited Material - public final Material LEAD = MaterialUtils.generateMaterialFromGtENUM(Materials.Lead); + public final Material LEAD = MaterialUtils.generateMaterialFromGtENUM(Materials.Lead); public final Material BISMUTH = MaterialUtils.generateMaterialFromGtENUM(Materials.Bismuth); public final Material POLONIUM = new Material("Polonium", MaterialState.SOLID, 25600, new short[]{180, 170, 180}, 254, 962, 84, 125, false, "Po", 1);//Not a GT Inherited Material public final Material ASTATINE = new Material("Astatine", MaterialState.SOLID, 25600, new short[]{170, 180, 170}, 302, 337, 85, 125, false, "At", 1);//Not a GT Inherited Material @@ -108,7 +108,7 @@ public final class ELEMENT { public final Material FRANCIUM = new Material("Francium", MaterialState.SOLID, 25600, new short[]{170, 160, 170}, 27, 677, 87, 136, false, "Fr", 1);//Not a GT Inherited Material public final Material RADIUM = new Material("Radium", MaterialState.SOLID, 25600, new short[]{165, 165, 165}, 700, 1737, 88, 138, false, "Ra", 1);//Not a GT Inherited Material public final Material ACTINIUM = new Material("Actinium", MaterialState.SOLID, 25600, new short[]{150, 165, 165}, 1050, 3200, 89, 138, false, "Ac", 1);//Not a GT Inherited Material - public final Material THORIUM = new Material("Thorium", MaterialState.SOLID, 51200, Materials.Thorium.mRGBa, Materials.Thorium.mMeltingPoint, Materials.Thorium.mBlastFurnaceTemp, 90, 142, false, MaterialUtils.superscript("Th"), 1); + public final Material THORIUM = new Material("Thorium", MaterialState.SOLID, 51200, Materials.Thorium.mRGBa, Materials.Thorium.mMeltingPoint, Materials.Thorium.mBlastFurnaceTemp, 90, 142, false, MaterialUtils.superscript("Th"), 1); public final Material PROTACTINIUM = new Material("Protactinium", MaterialState.SOLID, 25600, new short[]{190, 150, 170}, 1568, 4027, 91, 140, false, "Pa", 1);//Not a GT Inherited Material public final Material URANIUM238 = MaterialUtils.generateMaterialFromGtENUM(Materials.Uranium); public final Material URANIUM235 = MaterialUtils.generateMaterialFromGtENUM(Materials.Uranium235); @@ -121,7 +121,7 @@ public final class ELEMENT { public final Material CALIFORNIUM = new Material("Californium", MaterialState.SOLID, 25600, new short[]{85, 110, 205}, 899, 1472, 98, 153, false, "Cf", 4);//Not a GT Inherited Material public final Material EINSTEINIUM = new Material("Einsteinium", MaterialState.SOLID, 25600, new short[]{255, 85, 110}, 860, 3500, 99, 153, false, "Es", 5);//Not a GT Inherited Material //Boiling Point is made up public final Material FERMIUM = new Material("Fermium", MaterialState.LIQUID, 25600, new short[]{75, 90, 25}, 1527, 3850, 100, 157, false, "Fm", 5);//Not a GT Inherited Material //Boiling Point is made up - + //Misc public final Material AER = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedAir); public final Material IGNIS = MaterialUtils.generateMaterialFromGtENUM(Materials.InfusedFire); diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index fe7370e777..581c5f4972 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -1,6 +1,9 @@ package gtPlusPlus.core.material; import static gregtech.api.enums.GT_Values.M; + +import java.util.ArrayList; + import gregtech.api.enums.*; import gtPlusPlus.core.item.base.cell.BaseItemCell; import gtPlusPlus.core.material.state.MaterialState; @@ -9,9 +12,6 @@ import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.materials.MaterialUtils; import gtPlusPlus.core.util.math.MathUtils; - -import java.util.ArrayList; - import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -22,7 +22,7 @@ public class Material { private final String unlocalizedName; private final String localizedName; - + private final MaterialState materialState; private final Fluid vMoltenFluid; @@ -30,7 +30,7 @@ public class Material { protected Object dataVar = MathUtils.generateSingularRandomHexValue(); - private ArrayList<MaterialStack> vMaterialInput = new ArrayList<MaterialStack>(); + private ArrayList<MaterialStack> vMaterialInput = new ArrayList<>(); public final long[] vSmallestRatio; public final short vComponentCount; @@ -57,23 +57,23 @@ public class Material { public final int vToolQuality; public final int vHarvestLevel; - public Material(final String materialName, MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final MaterialStack... inputs){ + public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final MaterialStack... inputs){ this(materialName, defaultState, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", 0, inputs); } - public Material(final String materialName, MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final int radiationLevel, MaterialStack... inputs){ + public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final int radiationLevel, final MaterialStack... inputs){ this(materialName, defaultState, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", radiationLevel, inputs); } - public Material(final String materialName, MaterialState defaultState,final long durability, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final int radiationLevel, MaterialStack... inputs){ + public Material(final String materialName, final MaterialState defaultState,final long durability, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final int radiationLevel, final MaterialStack... inputs){ this(materialName, defaultState, durability, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", radiationLevel, inputs); } - public Material(final String materialName, MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, final MaterialStack... inputs){ + public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, final MaterialStack... inputs){ this(materialName, defaultState, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, inputs); } - public Material(final String materialName, MaterialState defaultState, final long durability, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, final MaterialStack... inputs){ + public Material(final String materialName, final MaterialState defaultState, final long durability, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, final MaterialStack... inputs){ this.unlocalizedName = Utils.sanitizeString(materialName); this.localizedName = materialName; @@ -86,30 +86,30 @@ public class Material { else { this.boilingPointC = meltingPoint*4; } - this.meltingPointK = (int) MathUtils.celsiusToKelvin(meltingPointC); - this.boilingPointK = (int) MathUtils.celsiusToKelvin(boilingPointC); + this.meltingPointK = (int) MathUtils.celsiusToKelvin(this.meltingPointC); + this.boilingPointK = (int) MathUtils.celsiusToKelvin(this.boilingPointC); this.vProtons = protons; this.vNeutrons = neutrons; - this.vMass = getMass(); + this.vMass = this.getMass(); //Sets tool Durability - if (durability != 0){ + if (durability != 0){ this.vDurability = durability; } else { if (inputs != null){ long durabilityTemp = 0; int counterTemp = 0; - for (MaterialStack m : inputs){ + for (final MaterialStack m : inputs){ if (m.getStackMaterial() != null){ if (m.getStackMaterial().vDurability != 0){ durabilityTemp = (durabilityTemp+m.getStackMaterial().vDurability); counterTemp++; } - } + } } - if (durabilityTemp != 0 && counterTemp != 0){ + if ((durabilityTemp != 0) && (counterTemp != 0)){ this.vDurability = (durabilityTemp/counterTemp); } else { @@ -121,23 +121,23 @@ public class Material { } } - if (this.vDurability >= 0 && this.vDurability < 64000){ + if ((this.vDurability >= 0) && (this.vDurability < 64000)){ this.vToolQuality = 1; this.vHarvestLevel = 2; } - else if (this.vDurability >= 64000 && this.vDurability < 128000){ + else if ((this.vDurability >= 64000) && (this.vDurability < 128000)){ this.vToolQuality = 2; this.vHarvestLevel = 2; } - else if (this.vDurability >= 128000 && this.vDurability < 256000){ + else if ((this.vDurability >= 128000) && (this.vDurability < 256000)){ this.vToolQuality = 3; this.vHarvestLevel = 2; } - else if (this.vDurability >= 256000 && this.vDurability < 512000){ + else if ((this.vDurability >= 256000) && (this.vDurability < 512000)){ this.vToolQuality = 3; this.vHarvestLevel = 3; } - else if (this.vDurability >= 512000 && this.vDurability <= Integer.MAX_VALUE){ + else if ((this.vDurability >= 512000) && (this.vDurability <= Integer.MAX_VALUE)){ this.vToolQuality = 4; this.vHarvestLevel = 4; } @@ -163,7 +163,7 @@ public class Material { this.vVoltageMultiplier = this.getMeltingPointK() >= 2800 ? 64 : 16; if (inputs == null){ - this.vMaterialInput = null; + this.vMaterialInput = null; } else { if (inputs.length != 0){ @@ -175,25 +175,25 @@ public class Material { } } - this.vComponentCount = getComponentCount(inputs); - this.vSmallestRatio = getSmallestRatio(vMaterialInput); + this.vComponentCount = this.getComponentCount(inputs); + this.vSmallestRatio = this.getSmallestRatio(this.vMaterialInput); int tempSmallestSize = 0; - if (vSmallestRatio != null){ + if (this.vSmallestRatio != null){ for (int v=0;v<this.vSmallestRatio.length;v++){ - tempSmallestSize=(int) (tempSmallestSize+vSmallestRatio[v]); + tempSmallestSize=(int) (tempSmallestSize+this.vSmallestRatio[v]); } this.smallestStackSizeWhenProcessing = tempSmallestSize; //Valid stacksizes } else { - this.smallestStackSizeWhenProcessing = 1; //Valid stacksizes + this.smallestStackSizeWhenProcessing = 1; //Valid stacksizes } //Makes a Fancy Chemical Tooltip this.vChemicalSymbol = chemicalSymbol; - if (vMaterialInput != null){ - this.vChemicalFormula = getToolTip(chemicalSymbol, OrePrefixes.dust.mMaterialAmount / M, true); + if (this.vMaterialInput != null){ + this.vChemicalFormula = this.getToolTip(chemicalSymbol, OrePrefixes.dust.mMaterialAmount / M, true); } else if (!this.vChemicalSymbol.equals("")){ Utils.LOG_WARNING("materialInput is null, using a valid chemical symbol."); @@ -204,11 +204,11 @@ public class Material { this.vChemicalFormula = "??"; } - Materials isValid = Materials.get(getLocalizedName()); + final Materials isValid = Materials.get(this.getLocalizedName()); if (isValid == Materials._NULL){ - this.vMoltenFluid = generateFluid(); + this.vMoltenFluid = this.generateFluid(); } - else { + else { if (isValid.mFluid != null){ this.vMoltenFluid = isValid.mFluid; } @@ -216,230 +216,234 @@ public class Material { this.vMoltenFluid = isValid.mGas; } else { - this.vMoltenFluid = generateFluid(); + this.vMoltenFluid = this.generateFluid(); } } - this.vPlasma = generatePlasma(); + this.vPlasma = this.generatePlasma(); //dataVar = MathUtils.generateSingularRandomHexValue(); String ratio = ""; - if (vSmallestRatio != null) { - for (int hu=0;hu<vSmallestRatio.length;hu++){ + if (this.vSmallestRatio != null) { + for (int hu=0;hu<this.vSmallestRatio.length;hu++){ if (ratio.equals("")){ - ratio = String.valueOf(vSmallestRatio[hu]); + ratio = String.valueOf(this.vSmallestRatio[hu]); } else { - ratio = ratio + ":" +vSmallestRatio[hu]; - } + ratio = ratio + ":" +this.vSmallestRatio[hu]; + } } } Utils.LOG_INFO("Creating a Material instance for "+materialName); - Utils.LOG_INFO("Formula: "+vChemicalFormula + " Smallest Stack: "+smallestStackSizeWhenProcessing+" Smallest Ratio:"+ratio); - Utils.LOG_INFO("Protons: "+vProtons); - Utils.LOG_INFO("Neutrons: "+vNeutrons); - Utils.LOG_INFO("Mass: "+vMass+"/units"); - Utils.LOG_INFO("Melting Point: "+meltingPointC+"C."); - Utils.LOG_INFO("Boiling Point: "+boilingPointC+"C."); + Utils.LOG_INFO("Formula: "+this.vChemicalFormula + " Smallest Stack: "+this.smallestStackSizeWhenProcessing+" Smallest Ratio:"+ratio); + Utils.LOG_INFO("Protons: "+this.vProtons); + Utils.LOG_INFO("Neutrons: "+this.vNeutrons); + Utils.LOG_INFO("Mass: "+this.vMass+"/units"); + Utils.LOG_INFO("Melting Point: "+this.meltingPointC+"C."); + Utils.LOG_INFO("Boiling Point: "+this.boilingPointC+"C."); } public final String getLocalizedName(){ - if (this.localizedName != null) + if (this.localizedName != null) { return this.localizedName; + } return "ERROR BAD LOCALIZED NAME"; } public final String getUnlocalizedName(){ - if (this.unlocalizedName != null) + if (this.unlocalizedName != null) { return this.unlocalizedName; + } return "ERROR.BAD.UNLOCALIZED.NAME"; } - + final public MaterialState getState(){ return this.materialState; } final public short[] getRGBA(){ - if (this.RGBA != null) + if (this.RGBA != null) { return this.RGBA; + } return new short[] {255,0,0}; } final public int getRgbAsHex(){ - int returnValue = Utils.rgbtoHexValue(RGBA[0], RGBA[1], RGBA[2]); + final int returnValue = Utils.rgbtoHexValue(this.RGBA[0], this.RGBA[1], this.RGBA[2]); if (returnValue == 0){ - return (int) dataVar; - } - return Utils.rgbtoHexValue(RGBA[0], RGBA[1], RGBA[2]); + return (int) this.dataVar; + } + return Utils.rgbtoHexValue(this.RGBA[0], this.RGBA[1], this.RGBA[2]); } final public long getProtons() { - return vProtons; + return this.vProtons; } public final long getNeutrons() { - return vNeutrons; + return this.vNeutrons; } final public long getMass() { - return vProtons + vNeutrons; + return this.vProtons + this.vNeutrons; } public final int getMeltingPointC() { - return meltingPointC; + return this.meltingPointC; } public final int getBoilingPointC() { - return boilingPointC; + return this.boilingPointC; } public final int getMeltingPointK() { - return meltingPointK; + return this.meltingPointK; } public final int getBoilingPointK() { - return boilingPointK; + return this.boilingPointK; } public final boolean requiresBlastFurnace(){ - return usesBlastFurnace; + return this.usesBlastFurnace; } final public Block getBlock(){ - return Block.getBlockFromItem(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("block"+unlocalizedName, 1).getItem()); + return Block.getBlockFromItem(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("block"+this.unlocalizedName, 1).getItem()); } - public final ItemStack getBlock(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("block"+unlocalizedName, stacksize); + public final ItemStack getBlock(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("block"+this.unlocalizedName, stacksize); } - public final ItemStack getDust(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+unlocalizedName, stacksize); + public final ItemStack getDust(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+this.unlocalizedName, stacksize); } - public final ItemStack getSmallDust(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustSmall"+unlocalizedName, stacksize); + public final ItemStack getSmallDust(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustSmall"+this.unlocalizedName, stacksize); } - public final ItemStack getTinyDust(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustTiny"+unlocalizedName, stacksize); + public final ItemStack getTinyDust(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustTiny"+this.unlocalizedName, stacksize); } public final ItemStack[] getValidInputStacks(){ - return ItemUtils.validItemsForOreDict(unlocalizedName); + return ItemUtils.validItemsForOreDict(this.unlocalizedName); } - public final ItemStack getIngot(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingot"+unlocalizedName, stacksize); + public final ItemStack getIngot(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingot"+this.unlocalizedName, stacksize); } - public final ItemStack getPlate(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plate"+unlocalizedName, stacksize); + public final ItemStack getPlate(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plate"+this.unlocalizedName, stacksize); } - public final ItemStack getPlateDouble(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateDouble"+unlocalizedName, stacksize); + public final ItemStack getPlateDouble(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateDouble"+this.unlocalizedName, stacksize); } - public final ItemStack getGear(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("gear"+unlocalizedName, stacksize); + public final ItemStack getGear(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("gear"+this.unlocalizedName, stacksize); } - public final ItemStack getRod(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("stick"+unlocalizedName, stacksize); + public final ItemStack getRod(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("stick"+this.unlocalizedName, stacksize); } - public final ItemStack getLongRod(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("stickLong"+unlocalizedName, stacksize); + public final ItemStack getLongRod(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("stickLong"+this.unlocalizedName, stacksize); } - public final ItemStack getBolt(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("bolt"+unlocalizedName, stacksize); + public final ItemStack getBolt(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("bolt"+this.unlocalizedName, stacksize); } - public final ItemStack getScrew(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("screw"+unlocalizedName, stacksize); + public final ItemStack getScrew(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("screw"+this.unlocalizedName, stacksize); } - public final ItemStack getRing(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ring"+unlocalizedName, stacksize); + public final ItemStack getRing(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ring"+this.unlocalizedName, stacksize); } - public final ItemStack getRotor(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("rotor"+unlocalizedName, stacksize); + public final ItemStack getRotor(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("rotor"+this.unlocalizedName, stacksize); } - public final ItemStack getFrameBox(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("frameGt"+unlocalizedName, stacksize); + public final ItemStack getFrameBox(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("frameGt"+this.unlocalizedName, stacksize); } - public final ItemStack getCell(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, stacksize); + public final ItemStack getCell(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.unlocalizedName, stacksize); } - public final ItemStack getPlasmaCell(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+unlocalizedName, stacksize); + public final ItemStack getPlasmaCell(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+this.unlocalizedName, stacksize); } - public final ItemStack getNugget(int stacksize){ - return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nugget"+unlocalizedName, stacksize); + public final ItemStack getNugget(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nugget"+this.unlocalizedName, stacksize); } final public ItemStack[] getMaterialComposites(){ - if (vMaterialInput != null){ - if (!vMaterialInput.isEmpty()){ - ItemStack[] temp = new ItemStack[vMaterialInput.size()]; - for (int i=0;i<vMaterialInput.size();i++){ + if (this.vMaterialInput != null){ + if (!this.vMaterialInput.isEmpty()){ + final ItemStack[] temp = new ItemStack[this.vMaterialInput.size()]; + for (int i=0;i<this.vMaterialInput.size();i++){ //Utils.LOG_WARNING("i:"+i); ItemStack testNull = null; try { - testNull = vMaterialInput.get(i).getValidStack(); - } catch (Throwable r){ - Utils.LOG_WARNING("Failed gathering material stack for "+localizedName+"."); - Utils.LOG_WARNING("What Failed: Length:"+vMaterialInput.size()+" current:"+i); + testNull = this.vMaterialInput.get(i).getValidStack(); + } catch (final Throwable r){ + Utils.LOG_WARNING("Failed gathering material stack for "+this.localizedName+"."); + Utils.LOG_WARNING("What Failed: Length:"+this.vMaterialInput.size()+" current:"+i); } try { if (testNull != null){ //Utils.LOG_WARNING("not null"); - temp[i] = vMaterialInput.get(i).getValidStack(); + temp[i] = this.vMaterialInput.get(i).getValidStack(); } - } catch (Throwable r){ - Utils.LOG_WARNING("Failed setting slot "+i+", using "+localizedName); + } catch (final Throwable r){ + Utils.LOG_WARNING("Failed setting slot "+i+", using "+this.localizedName); } - } + } return temp; } } return new ItemStack[]{}; } - public final ArrayList<MaterialStack> getComposites(){ + public final ArrayList<MaterialStack> getComposites(){ return this.vMaterialInput; } final public int[] getMaterialCompositeStackSizes(){ - if (!vMaterialInput.isEmpty()){ - int[] temp = new int[vMaterialInput.size()]; - for (int i=0;i<vMaterialInput.size();i++){ - if (vMaterialInput.get(i) != null) - temp[i] = vMaterialInput.get(i).getDustStack().stackSize; - else + if (!this.vMaterialInput.isEmpty()){ + final int[] temp = new int[this.vMaterialInput.size()]; + for (int i=0;i<this.vMaterialInput.size();i++){ + if (this.vMaterialInput.get(i) != null) { + temp[i] = this.vMaterialInput.get(i).getDustStack().stackSize; + } else { temp[i]=0; - } + } + } return temp; } return new int[]{}; } - private final short getComponentCount(MaterialStack[] inputs){ + private final short getComponentCount(final MaterialStack[] inputs){ int counterTemp = 0; - for (MaterialStack m : inputs){ + for (final MaterialStack m : inputs){ if (m.getStackMaterial() != null){ - counterTemp++; - } + counterTemp++; + } } if (counterTemp != 0){ return (short) counterTemp; @@ -451,22 +455,22 @@ public class Material { @SuppressWarnings("static-method") - public final long[] getSmallestRatio(ArrayList<MaterialStack> tempInput){ + public final long[] getSmallestRatio(final ArrayList<MaterialStack> tempInput){ if (tempInput != null){ if (!tempInput.isEmpty()){ Utils.LOG_WARNING("length: "+tempInput.size()); Utils.LOG_WARNING("(inputs != null): "+(tempInput != null)); //Utils.LOG_WARNING("length: "+inputs.length); - long[] tempRatio = new long[tempInput.size()]; + final long[] tempRatio = new long[tempInput.size()]; for (int x=0;x<tempInput.size();x++){ //tempPercentage = tempPercentage+inputs[x].percentageToUse; //this.mMaterialList.add(inputs[x]); if (tempInput.get(x) != null){ - tempRatio[x] = tempInput.get(x).getPartsPerOneHundred(); + tempRatio[x] = tempInput.get(x).getPartsPerOneHundred(); } } - long[] smallestRatio = MathUtils.simplifyNumbersToSmallestForm(tempRatio); + final long[] smallestRatio = MathUtils.simplifyNumbersToSmallestForm(tempRatio); if (smallestRatio.length > 0){ String tempRatioStringThing1 = ""; @@ -485,21 +489,24 @@ public class Material { Utils.LOG_WARNING("Smallest Ratio: "+tempRatioStringThing); return smallestRatio; } - } + } } return null; } - public final String getToolTip(String chemSymbol, long aMultiplier, boolean aShowQuestionMarks) { - if (!aShowQuestionMarks && (vChemicalFormula.equals("?")||vChemicalFormula.equals("??"))) return ""; + public final String getToolTip(final String chemSymbol, final long aMultiplier, final boolean aShowQuestionMarks) { + if (!aShowQuestionMarks && (this.vChemicalFormula.equals("?")||this.vChemicalFormula.equals("??"))) { + return ""; + } Utils.LOG_WARNING("===============| Calculating Atomic Formula for "+this.localizedName+" |==============="); - if (!chemSymbol.equals("")) + if (!chemSymbol.equals("")) { return chemSymbol; - ArrayList<MaterialStack> tempInput = vMaterialInput; + } + final ArrayList<MaterialStack> tempInput = this.vMaterialInput; if (tempInput != null){ if (!tempInput.isEmpty()){ String dummyFormula = ""; - long[] dummyFormulaArray = getSmallestRatio(tempInput); + final long[] dummyFormulaArray = this.getSmallestRatio(tempInput); if (dummyFormulaArray != null){ if (dummyFormulaArray.length >= 1){ for (int e=0;e<tempInput.size();e++){ @@ -509,18 +516,18 @@ public class Material { if (dummyFormulaArray[e] > 1){ if (tempInput.get(e).getStackMaterial().vChemicalFormula.length() > 3){ - dummyFormula = dummyFormula + "(" + tempInput.get(e).getStackMaterial().vChemicalFormula + ")" + dummyFormulaArray[e]; + dummyFormula = dummyFormula + "(" + tempInput.get(e).getStackMaterial().vChemicalFormula + ")" + dummyFormulaArray[e]; } else { - dummyFormula = dummyFormula + tempInput.get(e).getStackMaterial().vChemicalFormula + dummyFormulaArray[e]; + dummyFormula = dummyFormula + tempInput.get(e).getStackMaterial().vChemicalFormula + dummyFormulaArray[e]; } } else if (dummyFormulaArray[e] == 1){ if (tempInput.get(e).getStackMaterial().vChemicalFormula.length() > 3){ - dummyFormula = dummyFormula + "(" +tempInput.get(e).getStackMaterial().vChemicalFormula + ")"; + dummyFormula = dummyFormula + "(" +tempInput.get(e).getStackMaterial().vChemicalFormula + ")"; } else { - dummyFormula = dummyFormula +tempInput.get(e).getStackMaterial().vChemicalFormula; + dummyFormula = dummyFormula +tempInput.get(e).getStackMaterial().vChemicalFormula; } } } else { @@ -548,69 +555,70 @@ public class Material { public final Fluid generateFluid(){ try { - if (Materials.get(localizedName) == Materials.Clay){ + if (Materials.get(this.localizedName) == Materials.Clay){ return null; } - } catch (Throwable e){} + } catch (final Throwable e){} - if (Materials.get(localizedName).mFluid == null){ + if (Materials.get(this.localizedName).mFluid == null){ Utils.LOG_WARNING("Generating our own fluid."); //Generate a Cell if we need to - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+getUnlocalizedName(), 1) == null){ + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1) == null){ @SuppressWarnings("unused") + final Item temp = new BaseItemCell(this); } - + if (this.materialState == MaterialState.SOLID){ return FluidUtils.addGTFluid( this.getUnlocalizedName(), - "Molten "+this.getLocalizedName(), + "Molten "+this.getLocalizedName(), this.RGBA, this.materialState.ID(), this.getMeltingPointK(), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+getUnlocalizedName(), 1), + ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), ItemList.Cell_Empty.get(1L, new Object[0]), 1000); } else if (this.materialState == MaterialState.LIQUID){ return FluidUtils.addGTFluid( this.getUnlocalizedName(), - this.getLocalizedName(), + this.getLocalizedName(), this.RGBA, this.materialState.ID(), this.getMeltingPointK(), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+getUnlocalizedName(), 1), + ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), ItemList.Cell_Empty.get(1L, new Object[0]), 1000); } else if (this.materialState == MaterialState.GAS){ return FluidUtils.addGTFluid( this.getUnlocalizedName(), - this.getLocalizedName()+" Gas", + this.getLocalizedName()+" Gas", this.RGBA, this.materialState.ID(), this.getMeltingPointK(), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+getUnlocalizedName(), 1), + ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), ItemList.Cell_Empty.get(1L, new Object[0]), 1000); } else { //Plasma - return generatePlasma(); - } + return this.generatePlasma(); + } } Utils.LOG_WARNING("Getting the fluid from a GT material instead."); - return Materials.get(localizedName).mFluid; + return Materials.get(this.localizedName).mFluid; } public final Fluid generatePlasma(){ - Materials isValid = Materials.get(getLocalizedName()); - if (isValid != Materials._NULL && isValid != null && isValid != Materials.Clay){ + final Materials isValid = Materials.get(this.getLocalizedName()); + if ((isValid != Materials._NULL) && (isValid != null) && (isValid != Materials.Clay)){ if (isValid.mPlasma != null){ Utils.LOG_INFO("Using a pre-defined Plasma from GT."); return isValid.mPlasma; } - } + } Utils.LOG_INFO("Generating our own Plasma."); return FluidUtils.addGTPlasma(this); //return null; @@ -618,9 +626,9 @@ public class Material { - final public FluidStack getFluid(int fluidAmount) { + final public FluidStack getFluid(final int fluidAmount) { Utils.LOG_WARNING("Attempting to get "+fluidAmount+"L of "+this.vMoltenFluid.getName()); - FluidStack moltenFluid = new FluidStack(this.vMoltenFluid, fluidAmount); + final FluidStack moltenFluid = new FluidStack(this.vMoltenFluid, fluidAmount); Utils.LOG_WARNING("Info: "+moltenFluid.getFluid().getName()+" Info: "+moltenFluid.amount+" Info: "+moltenFluid.getFluidID()); return moltenFluid; } diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java index ffc864feb3..d4ed2c3be8 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java +++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java @@ -22,36 +22,37 @@ import gtPlusPlus.xmod.gregtech.loaders.*; import net.minecraft.block.Block; import net.minecraft.item.Item; -public class MaterialGenerator { +public class MaterialGenerator { - public static void generate(final Material matInfo){ - generate(matInfo, true); + public static void generate(final Material matInfo){ + generate(matInfo, true); } - public static void generate(final Material matInfo, boolean generateEverything){ + public static void generate(final Material matInfo, final boolean generateEverything){ generate(matInfo, generateEverything, true); } - public static void generate(final Material matInfo, boolean generateEverything, boolean generateBlastSmelterRecipes){ - String unlocalizedName = matInfo.getUnlocalizedName(); - String materialName = matInfo.getLocalizedName(); - short[] C = matInfo.getRGBA(); - int Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); - boolean hotIngot = matInfo.requiresBlastFurnace(); + @SuppressWarnings("unused") + public static void generate(final Material matInfo, final boolean generateEverything, final boolean generateBlastSmelterRecipes){ + final String unlocalizedName = matInfo.getUnlocalizedName(); + final String materialName = matInfo.getLocalizedName(); + final short[] C = matInfo.getRGBA(); + final int Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); + final boolean hotIngot = matInfo.requiresBlastFurnace(); int materialTier = matInfo.vTier; //TODO - if (materialTier > 10 || materialTier <= 0){ + if ((materialTier > 10) || (materialTier <= 0)){ materialTier = 2; - } + } int sRadiation = 0; if (ItemUtils.isRadioactive(materialName)){ sRadiation = matInfo.vRadioationLevel; } - if (matInfo.getState() == MaterialState.SOLID){ - if (generateEverything == true){ + if (matInfo.getState() == MaterialState.SOLID){ + if (generateEverything == true){ if (sRadiation >= 1){ Item temp; Block tempBlock; @@ -89,7 +90,7 @@ public class MaterialGenerator { temp = new BaseItemScrew(matInfo); temp = new BaseItemRotor(matInfo); temp = new BaseItemGear(matInfo); - } + } } else { Item temp; Block tempBlock; @@ -103,32 +104,45 @@ public class MaterialGenerator { temp = new BaseItemPlateDouble(matInfo); } } + else if (matInfo.getState() == MaterialState.LIQUID){ + Item temp; + Block tempBlock; + 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 BaseItemNugget(matInfo); + temp = new BaseItemPlate(matInfo); + temp = new BaseItemPlateDouble(matInfo); + } //Add A jillion Recipes - old code RecipeGen_AlloySmelter.generateRecipes(matInfo); RecipeGen_Assembler.generateRecipes(matInfo); RecipeGen_BlastSmelter.generateARecipe(matInfo); - RecipeGen_DustGeneration.generateRecipes(matInfo); + RecipeGen_DustGeneration.generateRecipes(matInfo); RecipeGen_Extruder.generateRecipes(matInfo); RecipeGen_Fluids.generateRecipes(matInfo); RecipeGen_Plates.generateRecipes(matInfo); RecipeGen_ShapedCrafting.generateRecipes(matInfo); } - public static void generateNuclearMaterial(final Material matInfo){ + public static void generateNuclearMaterial(final Material matInfo){ generateNuclearMaterial(matInfo, true); } - public static void generateNuclearMaterial(final Material matInfo, boolean generatePlates){ - String unlocalizedName = matInfo.getUnlocalizedName(); - String materialName = matInfo.getLocalizedName(); - short[] C = matInfo.getRGBA(); - int Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); + @SuppressWarnings("unused") + public static void generateNuclearMaterial(final Material matInfo, final boolean generatePlates){ + final String unlocalizedName = matInfo.getUnlocalizedName(); + final String materialName = matInfo.getLocalizedName(); + final short[] C = matInfo.getRGBA(); + final int Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); int sRadiation = 0; if (matInfo.vRadioationLevel != 0){ sRadiation = matInfo.vRadioationLevel; - } + } Item temp; Block tempBlock; diff --git a/src/Java/gtPlusPlus/core/material/MaterialStack.java b/src/Java/gtPlusPlus/core/material/MaterialStack.java index 710a9b645a..e18d738b97 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialStack.java +++ b/src/Java/gtPlusPlus/core/material/MaterialStack.java @@ -1,10 +1,9 @@ package gtPlusPlus.core.material; -import gtPlusPlus.core.util.item.ItemUtils; - import java.math.BigDecimal; import java.math.RoundingMode; +import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; public class MaterialStack { @@ -16,27 +15,27 @@ public class MaterialStack { public MaterialStack(final Material inputs, final double partOutOf100){ this.stackMaterial = inputs; this.vPercentageToUse = partOutOf100; - this.vAmount = math(partOutOf100); + this.vAmount = this.math(partOutOf100); } @SuppressWarnings("static-method") - private int[] math(final double val){ + private int[] math(final double val){ double i; //Cast to a BigDecimal to round it. final BigDecimal bd = new BigDecimal(val).setScale(2, RoundingMode.HALF_EVEN); i = bd.doubleValue(); //Split the string into xx.xx final String[] arr=String.valueOf(i).split("\\."); - int[] intArr=new int[2]; + final int[] intArr=new int[2]; intArr[0]=Integer.parseInt(arr[0]); intArr[1]=Integer.parseInt(arr[1]); return intArr; } - + public ItemStack getValidStack(){ if (this.stackMaterial.getDust(1) == null){ //if (this.stackMaterial.getCell(1) == null){ - return null; + return null; //} //return this.stackMaterial.getCell(this.vAmount[0]); } @@ -46,26 +45,26 @@ public class MaterialStack { public ItemStack getDustStack(){ return this.stackMaterial.getDust(this.vAmount[0]); } - + public ItemStack getDustStack(final int amount){ return this.stackMaterial.getDust(amount); } - + public Material getStackMaterial(){ return this.stackMaterial; } - + public double getvPercentageToUse(){ return this.vPercentageToUse; } - + public long[] getSmallestStackSizes(){ - return this.stackMaterial.getSmallestRatio(stackMaterial.getComposites()); + return this.stackMaterial.getSmallestRatio(this.stackMaterial.getComposites()); } - + public int getPartsPerOneHundred(){ if (this.vAmount != null){ - if (this.vAmount[0] >= 1 && this.vAmount[0] <= 100){ + if ((this.vAmount[0] >= 1) && (this.vAmount[0] <= 100)){ return this.vAmount[0]; } } @@ -74,21 +73,21 @@ public class MaterialStack { public ItemStack getLeftOverStacksFromDecimalValue(){ final int temp = this.vAmount[1]; int getCount; - if (temp >= 25 && temp <=99){ + if ((temp >= 25) && (temp <=99)){ getCount = temp/25; return this.stackMaterial.getSmallDust(getCount); } - else if (temp >= 11 && temp <= 24){ + else if ((temp >= 11) && (temp <= 24)){ getCount = temp/11; return this.stackMaterial.getTinyDust(getCount); } else { return null; - } + } } public ItemStack[] getValidItemStacks(){ - return ItemUtils.validItemsForOreDict(stackMaterial.getUnlocalizedName()); + return ItemUtils.validItemsForOreDict(this.stackMaterial.getUnlocalizedName()); } diff --git a/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java b/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java index a95703349e..0971431828 100644 --- a/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java +++ b/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java @@ -9,10 +9,10 @@ public class FLUORIDES { private static final FLUORIDES thisClass = new FLUORIDES(); public FLUORIDES(){} public static FLUORIDES getInstance(){return thisClass;} - + public static final Material FLUORITE = new Material( "Fluorite", //Material Name - MaterialState.SOLID, //State + MaterialState.SOLID, //State new short[]{75, 70, 25, 0}, //Material Colour Materials.Fluorine.mMeltingPoint, //Melting Point in C Materials.Fluorine.mBlastFurnaceTemp, //Boiling Point in C @@ -26,39 +26,39 @@ public class FLUORIDES { }); public static final Material THORIUM_TETRAFLUORIDE = new Material( - "Thorium Tetrafluoride", //Material Name - MaterialState.LIQUID, //State - new short[]{25, 70, 25, 0}, //Material Colour - Materials.Thorium.mMeltingPoint, //Melting Point in C - Materials.Thorium.mBlastFurnaceTemp, //Boiling Point in C - ((NUCLIDE.getInstance().THORIUM232.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*4))/5), //Protons - ((NUCLIDE.getInstance().THORIUM232.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*4))/5), //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(NUCLIDE.getInstance().THORIUM232, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 4) - }); + "Thorium Tetrafluoride", //Material Name + MaterialState.LIQUID, //State + new short[]{25, 70, 25, 0}, //Material Colour + Materials.Thorium.mMeltingPoint, //Melting Point in C + Materials.Thorium.mBlastFurnaceTemp, //Boiling Point in C + ((NUCLIDE.getInstance().THORIUM232.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*4))/5), //Protons + ((NUCLIDE.getInstance().THORIUM232.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*4))/5), //Neutrons + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(NUCLIDE.getInstance().THORIUM232, 1), + new MaterialStack(ELEMENT.getInstance().FLUORINE, 4) + }); public static final Material THORIUM_HEXAFLUORIDE = new Material( - "Thorium Hexafluoride", //Material Name - MaterialState.LIQUID, //State - new short[]{10, 50, 10, 0}, //Material Colour - Materials.Thorium.mMeltingPoint, //Melting Point in C - Materials.Thorium.mBlastFurnaceTemp, //Boiling Point in C - ((NUCLIDE.getInstance().THORIUM232.getProtons()+NUCLIDE.getInstance().THORIUM232.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*6))/8), //Protons - ((NUCLIDE.getInstance().THORIUM232.getNeutrons()+NUCLIDE.getInstance().THORIUM232.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*6))/8), //Neutrons - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(NUCLIDE.getInstance().THORIUM232, 1), - new MaterialStack(ELEMENT.getInstance().THORIUM, 1), - new MaterialStack(ELEMENT.getInstance().FLUORINE, 12) - }); - + "Thorium Hexafluoride", //Material Name + MaterialState.LIQUID, //State + new short[]{10, 50, 10, 0}, //Material Colour + Materials.Thorium.mMeltingPoint, //Melting Point in C + Materials.Thorium.mBlastFurnaceTemp, //Boiling Point in C + ((NUCLIDE.getInstance().THORIUM232.getProtons()+NUCLIDE.getInstance().THORIUM232.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*6))/8), //Protons + ((NUCLIDE.getInstance().THORIUM232.getNeutrons()+NUCLIDE.getInstance().THORIUM232.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*6))/8), //Neutrons + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(NUCLIDE.getInstance().THORIUM232, 1), + new MaterialStack(ELEMENT.getInstance().THORIUM, 1), + new MaterialStack(ELEMENT.getInstance().FLUORINE, 12) + }); + public static final Material URANIUM_TETRAFLUORIDE = new Material( "Uranium Tetrafluoride", //Material Name - MaterialState.LIQUID, //State + MaterialState.LIQUID, //State new short[]{50, 240, 50, 0}, //Material Colour Materials.Uranium235.mMeltingPoint, //Melting Point in C Materials.Uranium235.mBlastFurnaceTemp, //Boiling Point in C @@ -70,10 +70,10 @@ public class FLUORIDES { new MaterialStack(NUCLIDE.getInstance().URANIUM233, 1), new MaterialStack(ELEMENT.getInstance().FLUORINE, 4) }); - + public static final Material URANIUM_HEXAFLUORIDE = new Material( "Uranium Hexafluoride", //Material Name - MaterialState.LIQUID, //State + MaterialState.LIQUID, //State new short[]{70, 250, 70, 0}, //Material Colour Materials.Uranium235.mMeltingPoint, //Melting Point in C Materials.Uranium235.mBlastFurnaceTemp, //Boiling Point in C @@ -85,12 +85,12 @@ public class FLUORIDES { new MaterialStack(FLUORIDES.URANIUM_TETRAFLUORIDE, 1), new MaterialStack(ELEMENT.getInstance().FLUORINE, 2) }); - + // - + public static final Material ZIRCONIUM_TETRAFLUORIDE = new Material( "Zirconium Tetrafluoride", //Material Name - MaterialState.LIQUID, //State + MaterialState.LIQUID, //State ELEMENT.getInstance().ZIRCONIUM.getRGBA(), //Material Colour ELEMENT.getInstance().ZIRCONIUM.getMeltingPointC(), //Melting Point in C ELEMENT.getInstance().ZIRCONIUM.getBoilingPointC(), //Boiling Point in C @@ -102,10 +102,10 @@ public class FLUORIDES { new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 1), new MaterialStack(ELEMENT.getInstance().FLUORINE, 4) }); - + public static final Material BERYLLIUM_FLUORIDE = new Material( "Beryllium Tetrafluoride", //Material Name - MaterialState.LIQUID, //State + MaterialState.LIQUID, //State new short[]{120, 180, 120, 0}, //Material Colour Materials.Beryllium.mMeltingPoint, //Melting Point in C Materials.Beryllium.mBlastFurnaceTemp, //Boiling Point in C @@ -117,10 +117,10 @@ public class FLUORIDES { new MaterialStack(ELEMENT.getInstance().BERYLLIUM, 1), new MaterialStack(ELEMENT.getInstance().FLUORINE, 2) }); - + public static final Material LITHIUM_FLUORIDE = new Material( "Lithium Tetrafluoride", //Material Name - MaterialState.LIQUID, //State + MaterialState.LIQUID, //State new short[]{225, 220, 255, 0}, //Material Colour Materials.Lithium.mMeltingPoint, //Melting Point in C Materials.Lithium.mBlastFurnaceTemp, //Boiling Point in C @@ -132,14 +132,14 @@ public class FLUORIDES { new MaterialStack(NUCLIDE.getInstance().LITHIUM7, 1), new MaterialStack(ELEMENT.getInstance().FLUORINE, 1) }); - - + + //LFTR Output - - + + public static final Material NEPTUNIUM_HEXAFLUORIDE = new Material( "Neptunium Hexafluoride", //Material Name - MaterialState.GAS, //State + MaterialState.GAS, //State ELEMENT.getInstance().NEPTUNIUM.getRGBA(), //Material Colour ELEMENT.getInstance().NEPTUNIUM.getMeltingPointC(), //Melting Point in C ELEMENT.getInstance().NEPTUNIUM.getBoilingPointC(), //Boiling Point in C @@ -151,10 +151,10 @@ public class FLUORIDES { new MaterialStack(ELEMENT.getInstance().NEPTUNIUM, 1), new MaterialStack(ELEMENT.getInstance().FLUORINE, 6) }); - + public static final Material TECHNETIUM_HEXAFLUORIDE = new Material( "Technetium Hexafluoride", //Material Name - MaterialState.GAS, //State + MaterialState.GAS, //State ELEMENT.getInstance().TECHNETIUM.getRGBA(), //Material Colour ELEMENT.getInstance().TECHNETIUM.getMeltingPointC(), //Melting Point in C ELEMENT.getInstance().TECHNETIUM.getBoilingPointC(), //Boiling Point in C @@ -166,10 +166,10 @@ public class FLUORIDES { new MaterialStack(ELEMENT.getInstance().TECHNETIUM, 1), new MaterialStack(ELEMENT.getInstance().FLUORINE, 6) }); - + public static final Material SELENIUM_HEXAFLUORIDE = new Material( "Selenium Hexafluoride", //Material Name - MaterialState.GAS, //State + MaterialState.GAS, //State ELEMENT.getInstance().SELENIUM.getRGBA(), //Material Colour ELEMENT.getInstance().SELENIUM.getMeltingPointC(), //Melting Point in C ELEMENT.getInstance().SELENIUM.getBoilingPointC(), //Boiling Point in C @@ -181,5 +181,5 @@ public class FLUORIDES { new MaterialStack(ELEMENT.getInstance().SELENIUM, 1), new MaterialStack(ELEMENT.getInstance().FLUORINE, 6) }); - + } diff --git a/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java b/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java index f598102630..404710e4bf 100644 --- a/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java +++ b/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java @@ -18,12 +18,12 @@ public final class NUCLIDE { public final Material URANIUM233 = new Material("Uranium 233", MaterialState.SOLID, new short[]{73, 220, 83, 0}, 1132, 4131, 92, 141, false, MaterialUtils.superscript("233U"), 2);//Not a GT Inherited Material public final Material THORIUM232 = new Material("Thorium 232", MaterialState.SOLID, new short[]{15, 60, 15, 0}, Materials.Thorium.mMeltingPoint, Materials.Thorium.mBlastFurnaceTemp, 90, 142, false, MaterialUtils.superscript("232Th"), 1);//Not a GT Inherited Material public final Material PLUTONIUM238 = new Material("Plutonium-238", MaterialState.SOLID, Materials.Plutonium241.mDurability, Materials.Plutonium241.mRGBa, Materials.Plutonium241.mMeltingPoint, Materials.Plutonium241.mBlastFurnaceTemp, 94, 144, false, MaterialUtils.superscript("238Pu"), 2);//Not a GT Inherited Material - - - + + + public static final Material LiFBeF2ThF4UF4 = new Material( "LiFBeF2ThF4UF4", //Material Name - MaterialState.LIQUID, //State + MaterialState.LIQUID, //State new short[]{40, 90, 25, 0}, //Material Colour 566, //Melting Point in C 870, //Boiling Point in C @@ -39,10 +39,10 @@ public final class NUCLIDE { new MaterialStack(FLUORIDES.THORIUM_TETRAFLUORIDE, 1), new MaterialStack(FLUORIDES.URANIUM_TETRAFLUORIDE, 1) }); - + public static final Material LiFBeF2ZrF4UF4 = new Material( "LiFBeF2ZrF4UF4", //Material Name - MaterialState.LIQUID, //State + MaterialState.LIQUID, //State new short[]{20, 70, 45, 0}, //Material Colour 650, //Melting Point in C 940, //Boiling Point in C @@ -58,10 +58,10 @@ public final class NUCLIDE { new MaterialStack(FLUORIDES.ZIRCONIUM_TETRAFLUORIDE, 5), new MaterialStack(FLUORIDES.URANIUM_TETRAFLUORIDE, 2) }); - + public static final Material LiFBeF2ZrF4U235 = new Material( "LiFBeF2ZrF4U235", //Material Name - MaterialState.LIQUID, //State + MaterialState.LIQUID, //State new short[]{50, 70, 15, 0}, //Material Colour 590, //Melting Point in C 890, //Boiling Point in C diff --git a/src/Java/gtPlusPlus/core/material/state/MaterialState.java b/src/Java/gtPlusPlus/core/material/state/MaterialState.java index a640976281..200e80e8ab 100644 --- a/src/Java/gtPlusPlus/core/material/state/MaterialState.java +++ b/src/Java/gtPlusPlus/core/material/state/MaterialState.java @@ -10,6 +10,6 @@ public enum MaterialState { this.STATE = State; } public int ID() { - return STATE; + return this.STATE; } } diff --git a/src/Java/gtPlusPlus/core/players/FakeFarmer.java b/src/Java/gtPlusPlus/core/players/FakeFarmer.java index a7db952efd..8d3e9199b3 100644 --- a/src/Java/gtPlusPlus/core/players/FakeFarmer.java +++ b/src/Java/gtPlusPlus/core/players/FakeFarmer.java @@ -2,6 +2,9 @@ package gtPlusPlus.core.players; import java.util.UUID; +import com.mojang.authlib.GameProfile; + +import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -12,21 +15,17 @@ import net.minecraft.util.*; import net.minecraft.world.World; import net.minecraft.world.WorldServer; -import com.mojang.authlib.GameProfile; - -import cpw.mods.fml.common.FMLCommonHandler; - public class FakeFarmer extends EntityPlayerMP { private static final UUID uuid = UUID.fromString("c1ddfd7f-120a-4437-8b64-38660d3ec62d"); private static GameProfile FAKE_PROFILE = new GameProfile(uuid, "[GT_Farm_Manager]"); - public FakeFarmer(WorldServer world) { + public FakeFarmer(final WorldServer world) { super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, FAKE_PROFILE, new ItemInWorldManager(world)); } @Override - public boolean canCommandSenderUseCommand(int i, String s) { + public boolean canCommandSenderUseCommand(final int i, final String s) { return false; } @@ -36,19 +35,19 @@ public class FakeFarmer extends EntityPlayerMP { } @Override - public void addChatComponentMessage(IChatComponent chatmessagecomponent) { + public void addChatComponentMessage(final IChatComponent chatmessagecomponent) { } @Override - public void addChatMessage(IChatComponent p_145747_1_) { + public void addChatMessage(final IChatComponent p_145747_1_) { } @Override - public void addStat(StatBase par1StatBase, int par2) { + public void addStat(final StatBase par1StatBase, final int par2) { } @Override - public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) { + public void openGui(final Object mod, final int modGuiId, final World world, final int x, final int y, final int z) { } @Override @@ -57,12 +56,12 @@ public class FakeFarmer extends EntityPlayerMP { } @Override - public boolean canAttackPlayer(EntityPlayer player) { + public boolean canAttackPlayer(final EntityPlayer player) { return false; } @Override - public void onDeath(DamageSource source) { + public void onDeath(final DamageSource source) { } @Override @@ -70,15 +69,15 @@ public class FakeFarmer extends EntityPlayerMP { } @Override - public void travelToDimension(int dim) { + public void travelToDimension(final int dim) { } @Override - public void func_147100_a(C15PacketClientSettings pkt) { + public void func_147100_a(final C15PacketClientSettings pkt) { } @Override - public boolean canPlayerEdit(int par1, int par2, int par3, int par4, ItemStack par5ItemStack) { + public boolean canPlayerEdit(final int par1, final int par2, final int par3, final int par4, final ItemStack par5ItemStack) { return true; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java index 3648bfa080..222c1e891b 100644 --- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java @@ -1,9 +1,14 @@ package gtPlusPlus.core.proxy; +import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.event.*; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.common.CommonProxy; import gtPlusPlus.core.common.compat.COMPAT_PlayerAPI; -import gtPlusPlus.core.handler.events.SneakManager; import gtPlusPlus.core.handler.render.FirepitRender; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.tileentities.general.TileEntityFirepit; @@ -11,52 +16,45 @@ import gtPlusPlus.core.util.particles.EntityParticleFXMysterious; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.entity.Entity; -import net.minecraftforge.common.MinecraftForge; -import cpw.mods.fml.client.registry.ClientRegistry; -import cpw.mods.fml.client.registry.RenderingRegistry; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.event.*; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class ClientProxy extends CommonProxy{ /*private final HashSet<String> mCapeList = new HashSet<String>(); private final CapeHandler mCapeRenderer; - + ClientProxy(){ mCapeRenderer = new CapeHandler(mCapeList); } - */ - + */ + @SideOnly(Side.CLIENT) public static String playerName = ""; - + @Override - public void preInit(FMLPreInitializationEvent e) { + public void preInit(final FMLPreInitializationEvent e) { // TODO Auto-generated method stub super.preInit(e); //Do this weird things for textures. - GTplusplus.loadTextures(); + GTplusplus.loadTextures(); //We boot up the sneak manager. if (LoadedMods.PlayerAPI){ - init_PlayerAPI_PRE(); + this.init_PlayerAPI_PRE(); } } @Override - public void init(FMLInitializationEvent e) { + public void init(final FMLInitializationEvent e) { // TODO Auto-generated method stub - + if (LoadedMods.PlayerAPI){ - init_PlayerAPI_INIT(); + this.init_PlayerAPI_INIT(); } - + super.init(e); } @Override - public void postInit(FMLPostInitializationEvent e) { + public void postInit(final FMLPostInitializationEvent e) { // TODO Auto-generated method stub super.postInit(e); } @@ -70,48 +68,48 @@ public class ClientProxy extends CommonProxy{ //ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBloodSteelChest.class, new BloodSteelChestRenderer()); //MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.tutChest), new ItemRenderBloodSteelChest()); - + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFirepit.class, new FirepitRender()); } @Override - public int addArmor(String armor){ + public int addArmor(final String armor){ return RenderingRegistry.addNewArmourRendererPrefix(armor); } @Override - public void generateMysteriousParticles(Entity theEntity) + public void generateMysteriousParticles(final Entity theEntity) { - double motionX = theEntity.worldObj.rand.nextGaussian() * 0.02D; - double motionY = theEntity.worldObj.rand.nextGaussian() * 0.02D; - double motionZ = theEntity.worldObj.rand.nextGaussian() * 0.02D; - EntityFX particleMysterious = new EntityParticleFXMysterious( + final double motionX = theEntity.worldObj.rand.nextGaussian() * 0.02D; + final double motionY = theEntity.worldObj.rand.nextGaussian() * 0.02D; + final double motionZ = theEntity.worldObj.rand.nextGaussian() * 0.02D; + final EntityFX particleMysterious = new EntityParticleFXMysterious( - theEntity.worldObj, - theEntity.posX + theEntity.worldObj.rand.nextFloat() * theEntity.width + theEntity.worldObj, + (theEntity.posX + (theEntity.worldObj.rand.nextFloat() * theEntity.width - * 2.0F - theEntity.width, - theEntity.posY + 0.5D + theEntity.worldObj.rand.nextFloat() + * 2.0F)) - theEntity.width, + theEntity.posY + 0.5D + (theEntity.worldObj.rand.nextFloat() - * theEntity.height, - theEntity.posZ + theEntity.worldObj.rand.nextFloat() * theEntity.width + * theEntity.height), + (theEntity.posZ + (theEntity.worldObj.rand.nextFloat() * theEntity.width - * 2.0F - theEntity.width, + * 2.0F)) - theEntity.width, - motionX, + motionX, - motionY, + motionY, motionZ); - Minecraft.getMinecraft().effectRenderer.addEffect(particleMysterious); + Minecraft.getMinecraft().effectRenderer.addEffect(particleMysterious); } @Override - public void serverStarting(FMLServerStartingEvent e) + public void serverStarting(final FMLServerStartingEvent e) { - + } - + /*@SubscribeEvent public void receiveRenderSpecialsEvent(net.minecraftforge.client.event.RenderPlayerEvent.Specials.Pre aEvent) { mCapeRenderer.receiveRenderSpecialsEvent(aEvent); @@ -122,13 +120,13 @@ public class ClientProxy extends CommonProxy{ //Register player instance COMPAT_PlayerAPI.clientProxy.initPre(); } - + @Optional.Method(modid = "PlayerAPI") private void init_PlayerAPI_INIT(){ //Register player instance COMPAT_PlayerAPI.clientProxy.Init(); } - + } diff --git a/src/Java/gtPlusPlus/core/proxy/ServerProxy.java b/src/Java/gtPlusPlus/core/proxy/ServerProxy.java index 742f116613..6da767781f 100644 --- a/src/Java/gtPlusPlus/core/proxy/ServerProxy.java +++ b/src/Java/gtPlusPlus/core/proxy/ServerProxy.java @@ -1,24 +1,24 @@ package gtPlusPlus.core.proxy; -import gtPlusPlus.core.common.CommonProxy; import cpw.mods.fml.common.event.*; +import gtPlusPlus.core.common.CommonProxy; public class ServerProxy extends CommonProxy{ @Override - public void preInit(FMLPreInitializationEvent e) { + public void preInit(final FMLPreInitializationEvent e) { // TODO Auto-generated method stub super.preInit(e); } @Override - public void init(FMLInitializationEvent e) { + public void init(final FMLInitializationEvent e) { // TODO Auto-generated method stub super.init(e); } @Override - public void postInit(FMLPostInitializationEvent e) { + public void postInit(final FMLPostInitializationEvent e) { // TODO Auto-generated method stub super.postInit(e); } diff --git a/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java b/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java index bb5732c319..f9db59ddb4 100644 --- a/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java +++ b/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java @@ -17,22 +17,22 @@ public class Gregtech_Recipe_Adder { private static ItemStack outputStack2; public static void addRecipe( - Item maceratorInput, int maceratorInputAmount1, - Item maceratorOutput, int maceratorOutputAmount1, - Item compressorInput, int compressorInputAmount1, - Item compressorOutput, int compressorOutputAmount1, - Item blastFurnaceInput, int blastFurnaceInputAmount1, - Item blastFurnaceOutput, int blastFurnaceOutputAmount1, - Item blastFurnaceInput2, int blastFurnaceInputAmount2, - Item blastFurnaceOutput2, int blastFurnaceOutputAmount2, - Item smeltingInput, int smeltingInputAmount1, - Item smeltingOutput, int smeltingOutputAmount1, - - int euPerTick, int timeInTicks, - boolean addMaceratorRecipe, boolean addCompressorRecipe, boolean addBlastFurnaceRecipe, int blastFurnaceTemp, boolean addSmeltingRecipe, boolean addMixerRecipe){ + final Item maceratorInput, final int maceratorInputAmount1, + final Item maceratorOutput, final int maceratorOutputAmount1, + final Item compressorInput, final int compressorInputAmount1, + final Item compressorOutput, final int compressorOutputAmount1, + final Item blastFurnaceInput, final int blastFurnaceInputAmount1, + final Item blastFurnaceOutput, final int blastFurnaceOutputAmount1, + final Item blastFurnaceInput2, final int blastFurnaceInputAmount2, + final Item blastFurnaceOutput2, final int blastFurnaceOutputAmount2, + final Item smeltingInput, final int smeltingInputAmount1, + final Item smeltingOutput, final int smeltingOutputAmount1, + + final int euPerTick, final int timeInTicks, + final boolean addMaceratorRecipe, final boolean addCompressorRecipe, final boolean addBlastFurnaceRecipe, final int blastFurnaceTemp, final boolean addSmeltingRecipe, final boolean addMixerRecipe){ euT = euPerTick; ticks = timeInTicks; - + resetVars(); if (addMaceratorRecipe){ inputStack1 = ItemUtils.getSimpleStack(maceratorInput, maceratorInputAmount1); @@ -62,7 +62,7 @@ public class Gregtech_Recipe_Adder { resetVars(); } - + private static void resetVars(){ inputStack1 = null; inputStack2 = null; @@ -70,15 +70,15 @@ public class Gregtech_Recipe_Adder { outputStack2 = null; } - private static void addMaceratorRecipe(ItemStack input1, ItemStack output1){ + private static void addMaceratorRecipe(final ItemStack input1, final ItemStack output1){ GT_ModHandler.addPulverisationRecipe(input1, output1); } - private static void addCompressorRecipe(ItemStack input1, ItemStack output1){ + private static void addCompressorRecipe(final ItemStack input1, final ItemStack output1){ GT_ModHandler.addCompressionRecipe(input1, output1); } - private static void addBlastFurnaceRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, int tempRequired){ + private static void addBlastFurnaceRecipe(final ItemStack input1, final ItemStack input2, final ItemStack output1, final ItemStack output2, final int tempRequired){ Utils.LOG_INFO("Registering Blast Furnace Recipes."); GT_Values.RA.addBlastRecipe( input1, @@ -87,11 +87,11 @@ public class Gregtech_Recipe_Adder { output1, output2, ticks, - euT, + euT, tempRequired); } - private static void addSmeltingRecipe(ItemStack input1, ItemStack output1){ + private static void addSmeltingRecipe(final ItemStack input1, final ItemStack output1){ GT_ModHandler.addSmeltingRecipe(input1, output1); } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index 85ae1873f8..617850105b 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -48,17 +48,17 @@ public class RECIPES_GREGTECH { try { - //GT Logs to Charcoal Recipe + //GT Logs to Charcoal Recipe //With Sulfuric Acid CORE.RA.addCokeOvenRecipe( GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 1L), //Input 1 GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 1L), //Input 2 Materials.SulfuricAcid.getFluid(20L), //Fluid Input Materials.Creosote.getFluid(175L), //Fluid Output - GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 2L), //Item Output + GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 2L), //Item Output 800, //Time in ticks 30); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { //Coal -> Coke Recipe @@ -68,23 +68,23 @@ public class RECIPES_GREGTECH { GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 1L), //Input 2 Materials.SulfuricAcid.getFluid(60L), //Fluid Input Materials.Creosote.getFluid(250L), //Fluid Output - ItemUtils.getItemStack("Railcraft:fuel.coke", 2), //Item Output + ItemUtils.getItemStack("Railcraft:fuel.coke", 2), //Item Output 600, //Time in ticks - 120); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + 120); //EU + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { - //GT Logs to Charcoal Recipe + //GT Logs to Charcoal Recipe //Without Sulfuric Acid CORE.RA.addCokeOvenRecipe( GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 1L), //Input 1 GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 1L), //Input 2 FluidUtils.getFluidStack("oxygen", 80), //Fluid Input Materials.Creosote.getFluid(145L), //Fluid Output - GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 2L), //Item Output + GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 2L), //Item Output 1200, //Time in ticks 30); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { //Coal -> Coke Recipe @@ -94,10 +94,10 @@ public class RECIPES_GREGTECH { GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 1L), //Input 2 FluidUtils.getFluidStack("oxygen", 185), //Fluid Input Materials.Creosote.getFluid(200L), //Fluid Output - ItemUtils.getItemStack("Railcraft:fuel.coke", 2), //Item Output + ItemUtils.getItemStack("Railcraft:fuel.coke", 2), //Item Output 900, //Time in ticks 120); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} } private static void matterFabRecipes(){ @@ -110,15 +110,15 @@ public class RECIPES_GREGTECH { Materials.UUMatter.getFluid(1L), //Fluid Output 800, //Time in ticks 32); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { CORE.RA.addMatterFabricatorRecipe( null, //Fluid Input Materials.UUMatter.getFluid(1L), //Fluid Output 3200, //Time in ticks - 32); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + 32); //EU + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} } @@ -131,16 +131,16 @@ public class RECIPES_GREGTECH { ItemUtils.getItemStackOfAmountFromOreDict("cellSulfuricLithium", 1), //Item Input FluidUtils.getFluidStack("sulfuriclithium", 440), //Fluid input (slot 1) new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 3), - ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustSodium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustLithium7", 3) - }, //Output Array of Items - Upto 9 + ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 3), + ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustSodium", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustLithium7", 3) + }, //Output Array of Items - Upto 9 30*20, //Time in ticks - 30); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + 30); //EU + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { ItemStack cells = ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemCellEmpty", "Empty Fluid Cells", 0, 12); @@ -149,24 +149,24 @@ public class RECIPES_GREGTECH { cells = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellEmpty", 12); } - ItemStack[] input = {cells, ItemUtils.getItemStackOfAmountFromOreDict("dustLepidolite", 20)}; + final ItemStack[] input = {cells, ItemUtils.getItemStackOfAmountFromOreDict("dustLepidolite", 20)}; CORE.RA.addDehydratorRecipe( input, //Item input (Array, up to 2) FluidUtils.getFluidStack("sulfuricacid", 10000), //Fluid input (slot 1) FluidUtils.getFluidStack("sulfuriclithium", 10000), //Fluid output (slot 2) new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustPotassium", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 4), - ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 10), - ItemUtils.getItemStackOfAmountFromOreDict("cellFluorine", 2), - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumCarbonate", 3), //LithiumCarbonate + ItemUtils.getItemStackOfAmountFromOreDict("dustPotassium", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 4), + ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 10), + ItemUtils.getItemStackOfAmountFromOreDict("cellFluorine", 2), + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumCarbonate", 3), //LithiumCarbonate }, //Output Array of Items - Upto 9, new int[]{0}, 75*20, //Time in ticks - 1000); //EU + 1000); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { CORE.RA.addDehydratorRecipe( @@ -176,14 +176,14 @@ public class RECIPES_GREGTECH { FluidUtils.getFluidStack("molten.uraniumtetrafluoride", 1440), //Fluid input (slot 1) null, //Fluid output (slot 2) new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustUraniumTetrafluoride", 10), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellEmpty", 10) + ItemUtils.getItemStackOfAmountFromOreDict("dustUraniumTetrafluoride", 10), + ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellEmpty", 10) }, //Output Array of Items - Upto 9, new int[]{0}, 150*20, //Time in ticks - 2000); //EU + 2000); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { CORE.RA.addDehydratorRecipe( @@ -193,18 +193,18 @@ public class RECIPES_GREGTECH { FluidUtils.getFluidStack("molten.uraniumhexafluoride", 1440), //Fluid input (slot 1) null, //Fluid output (slot 2) new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustUraniumHexafluoride", 10), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellEmpty", 10) + ItemUtils.getItemStackOfAmountFromOreDict("dustUraniumHexafluoride", 10), + ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellEmpty", 10) }, //Output Array of Items - Upto 9, new int[]{0}, 300*20, //Time in ticks - 4000); //EU + 4000); //EU + + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} - //Raisins from Grapes try { - + CORE.RA.addDehydratorRecipe( new ItemStack[]{ ItemUtils.getItemStackOfAmountFromOreDict("cropGrape", 1) @@ -212,18 +212,18 @@ public class RECIPES_GREGTECH { null, //Fluid input (slot 1) null, //Fluid output (slot 2) new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("foodRaisins", 1) + ItemUtils.getItemStackOfAmountFromOreDict("foodRaisins", 1) }, //Output Array of Items - Upto 9, new int[]{0}, 10*20, //Time in ticks - 8); //EU + 8); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} //Calcium Hydroxide - if (ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1).getItem() != ModItems.AAA_Broken || LoadedMods.IHL){ + if ((ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1).getItem() != ModItems.AAA_Broken) || LoadedMods.IHL){ try { - + CORE.RA.addDehydratorRecipe( new ItemStack[]{ ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 10) @@ -231,17 +231,17 @@ public class RECIPES_GREGTECH { FluidUtils.getFluidStack("water", 10000), //Fluid input (slot 1) null, //Fluid output (slot 2) new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumHydroxide", 20) + ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumHydroxide", 20) }, //Output Array of Items - Upto 9, new int[]{0}, 120*20, //Time in ticks - 120); //EU + 120); //EU + + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} - //2 LiOH + CaCO3 try { - + CORE.RA.addDehydratorRecipe( new ItemStack[]{ ItemUtils.getItemStackOfAmountFromOreDict("dustLi2CO3CaOH2", 5) @@ -249,18 +249,18 @@ public class RECIPES_GREGTECH { null, //Fluid input (slot 1) null, //Fluid output (slot 2) new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 2), - ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumCarbonate", 3) + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 2), + ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumCarbonate", 3) }, //Output Array of Items - Upto 9, new int[]{0}, 120*20, //Time in ticks - 1000); //EU + 1000); //EU + + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} - //LiOH Liquid to Dust try { - + CORE.RA.addDehydratorRecipe( new ItemStack[]{ ItemUtils.getGregtechCircuit(0) @@ -268,17 +268,17 @@ public class RECIPES_GREGTECH { FluidUtils.getFluidStack("lithiumhydroxide", 144), //Fluid input (slot 1) null, //Fluid output (slot 2) new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 1) + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 1) }, //Output Array of Items - Upto 9, new int[]{0}, 1*20, //Time in ticks - 64); //EU + 64); //EU + + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} - //Zirconium Chloride -> TetraFluoride try { - + CORE.RA.addDehydratorRecipe( new ItemStack[]{ ItemUtils.getItemStackOfAmountFromOreDict("dustCookedZrCl4", 9), @@ -287,18 +287,18 @@ public class RECIPES_GREGTECH { FluidUtils.getFluidStack("hydrofluoricacid", 9*144), //Fluid input (slot 1) null, //Fluid output (slot 2) new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenChloride", 9), - ItemUtils.getItemStackOfAmountFromOreDict("dustZrF4", 9) + ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenChloride", 9), + ItemUtils.getItemStackOfAmountFromOreDict("dustZrF4", 9) }, //Output Array of Items - Upto 9, new int[]{0}, 120*20, //Time in ticks - 500); //EU + 500); //EU + + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} - //CaF2 + H2SO4 → CaSO4(solid) + 2 HF try { - + CORE.RA.addDehydratorRecipe( new ItemStack[]{ ItemUtils.getItemStackOfAmountFromOreDict("dustFluorite", 37), @@ -307,26 +307,26 @@ public class RECIPES_GREGTECH { FluidUtils.getFluidStack("sulfuricacid", 56*144), //Fluid input (slot 1) null, //Fluid output (slot 2) new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumSulfate", 30), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrofluoricAcid", 16), - ItemUtils.getItemStackOfAmountFromOreDict("dustSilver", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustGold", 2), - ItemUtils.getItemStackOfAmountFromOreDict("dustTin", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 2) + ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumSulfate", 30), + ItemUtils.getItemStackOfAmountFromOreDict("cellHydrofluoricAcid", 16), + ItemUtils.getItemStackOfAmountFromOreDict("dustSilver", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustGold", 2), + ItemUtils.getItemStackOfAmountFromOreDict("dustTin", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 2) }, //Output Array of Items - Upto 9, new int[]{0, 0, 100, 100, 300, 200}, 10*60*20, //Time in ticks - 230); //EU + 230); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} } - + } - + private static void lftrRecipes(){ - try { - - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + try { + + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { //Fli2BeF4 + Thorium TetraFluoride = Uranium233 CORE.RA.addLFTRRecipe( @@ -334,9 +334,9 @@ public class RECIPES_GREGTECH { FluidUtils.getFluidStack("molten.li2bef4", 1200), //Fluid output (slot 2) FluidUtils.getFluidStack("molten.uraniumhexafluoride", (1200+(144*4))), //Output Array of Items - Upto 9, 300*60*20, //Time in ticks - 3500); //EU - - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + 3500); //EU + + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { //Fli2BeF4 + Uranium235 = 1x Uranium233 CORE.RA.addLFTRRecipe( @@ -344,8 +344,8 @@ public class RECIPES_GREGTECH { FluidUtils.getFluidStack("molten.li2bef4", 144*12), //Fluid output (slot 2) FluidUtils.getFluidStack("molten.uraniumhexafluoride", 3*144), //Output Array of Items - Upto 9, 120*60*20, //Time in ticks - 8000); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + 8000); //EU + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { //Fli2BeF4 + Uranium233 TetraFluoride = Uranium233 CORE.RA.addLFTRRecipe( @@ -353,29 +353,29 @@ public class RECIPES_GREGTECH { FluidUtils.getFluidStack("molten.li2bef4", 500), //Fluid output (slot 2) FluidUtils.getFluidStack("molten.uraniumhexafluoride", 1288), //Output Array of Items - Upto 9, 420*60*20, //Time in ticks - 4000); //EU + 4000); //EU - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} } - + private static void fissionFuelRecipes(){ try { - - String salt_LiFBeF2ThF4UF4 = "LiFBeF2ThF4UF4".toLowerCase(); - String salt_LiFBeF2ZrF4U235 = "LiFBeF2ZrF4U235".toLowerCase(); - String salt_LiFBeF2ZrF4UF4 = "LiFBeF2ZrF4UF4".toLowerCase(); - - FluidStack LithiumFluoride = FluidUtils.getFluidStack("molten.lithiumtetrafluoride", 100); //Re-usable FluidStacks - FluidStack BerylliumFluoride = FluidUtils.getFluidStack("molten.berylliumtetrafluoride", 100); //Re-usable FluidStacks - FluidStack ThoriumFluoride = FluidUtils.getFluidStack("molten.thoriumtetrafluoride", 100); //Re-usable FluidStacks - FluidStack ZirconiumFluoride = FluidUtils.getFluidStack("molten.zirconiumtetrafluoride", 100); //Re-usable FluidStacks - FluidStack UraniumTetraFluoride = FluidUtils.getFluidStack("molten.uraniumtetrafluoride", 100); //Re-usable FluidStacks - FluidStack Uranium235 = FluidUtils.getFluidStack("molten.uranium235", 1000); //Re-usable FluidStacks - - FluidStack LiFBeF2ThF4UF4 = FluidUtils.getFluidStack("molten."+salt_LiFBeF2ThF4UF4, 100); //Re-usable FluidStacks - FluidStack LiFBeF2ZrF4U235 = FluidUtils.getFluidStack("molten."+salt_LiFBeF2ZrF4U235, 100); //Re-usable FluidStacks - FluidStack LiFBeF2ZrF4UF4 = FluidUtils.getFluidStack("molten."+salt_LiFBeF2ZrF4UF4, 100); //Re-usable FluidStacks - + + final String salt_LiFBeF2ThF4UF4 = "LiFBeF2ThF4UF4".toLowerCase(); + final String salt_LiFBeF2ZrF4U235 = "LiFBeF2ZrF4U235".toLowerCase(); + final String salt_LiFBeF2ZrF4UF4 = "LiFBeF2ZrF4UF4".toLowerCase(); + + final FluidStack LithiumFluoride = FluidUtils.getFluidStack("molten.lithiumtetrafluoride", 100); //Re-usable FluidStacks + final FluidStack BerylliumFluoride = FluidUtils.getFluidStack("molten.berylliumtetrafluoride", 100); //Re-usable FluidStacks + final FluidStack ThoriumFluoride = FluidUtils.getFluidStack("molten.thoriumtetrafluoride", 100); //Re-usable FluidStacks + final FluidStack ZirconiumFluoride = FluidUtils.getFluidStack("molten.zirconiumtetrafluoride", 100); //Re-usable FluidStacks + final FluidStack UraniumTetraFluoride = FluidUtils.getFluidStack("molten.uraniumtetrafluoride", 100); //Re-usable FluidStacks + final FluidStack Uranium235 = FluidUtils.getFluidStack("molten.uranium235", 1000); //Re-usable FluidStacks + + final FluidStack LiFBeF2ThF4UF4 = FluidUtils.getFluidStack("molten."+salt_LiFBeF2ThF4UF4, 100); //Re-usable FluidStacks + final FluidStack LiFBeF2ZrF4U235 = FluidUtils.getFluidStack("molten."+salt_LiFBeF2ZrF4U235, 100); //Re-usable FluidStacks + final FluidStack LiFBeF2ZrF4UF4 = FluidUtils.getFluidStack("molten."+salt_LiFBeF2ZrF4UF4, 100); //Re-usable FluidStacks + //7LiF - BeF2 - ZrF4 - UF4 - 650C CORE.RA.addFissionFuel( FluidUtils.getFluidStack(LithiumFluoride, 6500), //Input A @@ -387,7 +387,7 @@ public class RECIPES_GREGTECH { null, //Output Fluid 2 60*60*20, //Duration 4740); - + //7LiF - BeF2 - ZrF4 - U235 - 590C CORE.RA.addFissionFuel( FluidUtils.getFluidStack(LithiumFluoride, 5500), //Input A @@ -399,7 +399,7 @@ public class RECIPES_GREGTECH { null, //Output Fluid 2 45*60*20, //Duration 4740); - + //7liF - BeF2 - ThF4 - UF4 - 566C CORE.RA.addFissionFuel( FluidUtils.getFluidStack(LithiumFluoride, 6200), //Input A @@ -410,9 +410,9 @@ public class RECIPES_GREGTECH { FluidUtils.getFluidStack(LiFBeF2ThF4UF4, 10000), //Output Fluid 1 null, //Output Fluid 2 60*60*20, //Duration - 4740); + 4740); - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} } private static void assemblerRecipes(){ @@ -425,13 +425,13 @@ public class RECIPES_GREGTECH { Utils.LOG_INFO("Registering Distillery/Distillation Tower Recipes."); GT_Values.RA.addDistilleryRecipe(ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), FluidUtils.getFluidStack("air", 1000), FluidUtils.getFluidStack("helium", 1), 400, 30, false); GT_Values.RA.addDistillationTowerRecipe(FluidUtils.getFluidStack("air", 20000), FluidUtils.getFluidStackArray("helium", 25), ItemUtils.getSimpleStack(ModItems.itemHydrogenBlob, 1), 200, 60); - + //Apatite Distillation /* * so if you dissolve aparite in sulphuric acid * you'll get a mixture of SO2, H2O, HF and HCl */ - FluidStack[] apatiteOutput = { + final FluidStack[] apatiteOutput = { FluidUtils.getFluidStack("sulfurousacid", 3800), FluidUtils.getFluidStack("hydrogenchloride", 1000), FluidUtils.getFluidStack("hydrofluoricacid", 400) @@ -443,7 +443,7 @@ public class RECIPES_GREGTECH { 45*20, 256); - FluidStack[] sulfurousacidOutput = { + final FluidStack[] sulfurousacidOutput = { FluidUtils.getFluidStack("sulfurdioxide", 500), FluidUtils.getFluidStack("water", 500) }; @@ -454,7 +454,7 @@ public class RECIPES_GREGTECH { 10*20, 60); - FluidStack[] sulfurdioxideOutput = { + final FluidStack[] sulfurdioxideOutput = { FluidUtils.getFluidStack("oxygen", 144*2) }; GT_Values.RA.addDistillationTowerRecipe( @@ -488,28 +488,28 @@ public class RECIPES_GREGTECH { } private static void chemicalBathRecipes(){ - int[] chances = {}; + final int[] chances = {}; GT_Values.RA.addChemicalBathRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustTin", 12), FluidUtils.getFluidStack("chlorine", 2400), ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 3), ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 3), - ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 3), + ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 3), chances, 30*20, 240); - + GT_Values.RA.addChemicalBathRecipe( ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumCarbonate", 10), FluidUtils.getFluidStack("hydrofluoricacid", 20000), ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumTetrafluoride", 5), null, - null, + null, new int[]{}, 90*20, 500); - - + + } - + private static void centrifugeRecipes(){ GT_Values.RA.addCentrifugeRecipe( ItemUtils.getItemStackOfAmountFromOreDict("dustThorium", 8), @@ -525,15 +525,15 @@ public class RECIPES_GREGTECH { new int[]{0, 0, 10}, 500*20, 2000); - + } - + private static void mixerRecipes(){ GT_Values.RA.addMixerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 1), null, null, null, FluidUtils.getFluidStack("oxygen", 288), FluidUtils.getFluidStack("sulfurdioxide", 432), null, 600, 60); GT_Values.RA.addMixerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustUranium233", 4), ItemUtils.getItemStackOfAmountFromOreDict("dustUranium235", 1), null, null, FluidUtils.getFluidStack("hydrofluoricacid", 2000), FluidUtils.getFluidStack("molten.uraniumtetrafluoride", 144*3), null, 3000, 500); //GT_Values.RA.addMixerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("cellFluorine", 1), ItemUtils.getItemStackOfAmountFromOreDict("cellFluorine", 1), null, null, FluidUtils.getFluidStack("molten.uraniumtetrafluoride", 720), FluidUtils.getFluidStack("molten.uraniumhexafluoride", 288), null, 5000, 2000); } - + private static void chemicalReactorRecipes(){ GT_Values.RA.addChemicalRecipe( ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumCarbonate", 5), //Input Stack 1 @@ -542,8 +542,8 @@ public class RECIPES_GREGTECH { null, //Fluid Output ItemUtils.getItemStackOfAmountFromOreDict("dustLi2CO3CaOH2", 10), //Output Stack 600*20 - ); - + ); + GT_Values.RA.addChemicalRecipe( ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 5), //Input Stack 1 null, //Input Stack 2 @@ -551,33 +551,33 @@ public class RECIPES_GREGTECH { FluidUtils.getFluidStack("water", 2500), //Fluid Output ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumTetrafluoride", 5), //Output Stack 600*20 - ); - + ); + GT_Values.RA.addChemicalRecipe( ItemUtils.getItemStackOfAmountFromOreDict("dustApatite", 16), null, - FluidUtils.getFluidStack("sulfuricacid", 144*32), + FluidUtils.getFluidStack("sulfuricacid", 144*32), FluidUtils.getFluidStack("sulfuricapatite", 144*4), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallSulfur", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallSulfur", 1), 20*20); - + GT_Values.RA.addChemicalRecipe( ItemUtils.getItemStackOfAmountFromOreDict("dustLithium7", 1), null, - FluidUtils.getFluidStack("sulfuricacid", 144*8), + FluidUtils.getFluidStack("sulfuricacid", 144*8), FluidUtils.getFluidStack("sulfuriclithium", 144*2), - ItemUtils.getItemStackOfAmountFromOreDict("dustSmallLithium7", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallLithium7", 1), 20*20); - + GT_Values.RA.addChemicalRecipe( ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1), ItemUtils.getItemStackOfAmountFromOreDict("dustLithium7", 16), - FluidUtils.getFluidStack("water", 1000), + FluidUtils.getFluidStack("water", 1000), FluidUtils.getFluidStack("lithiumhydroxide", 144*4), - null, + null, 300*20); } - + private static void blastFurnaceRecipes(){ GT_Values.RA.addBlastRecipe( ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumTetrafluoride", 2), @@ -586,7 +586,7 @@ public class RECIPES_GREGTECH { ItemUtils.getItemStackOfAmountFromOreDict("dustLi2BeF4", 3), null, 60*20, - 2000, + 2000, 3000); GT_Values.RA.addBlastRecipe( ItemUtils.getItemStackOfAmountFromOreDict("dustZrCl4", 1), @@ -595,10 +595,10 @@ public class RECIPES_GREGTECH { ItemUtils.getItemStackOfAmountFromOreDict("dustCookedZrCl4", 1), null, 60*20, - 340, + 340, 300); } - + private static void autoclaveRecipes(){ GT_Values.RA.addAutoclaveRecipe( ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 9), @@ -608,7 +608,7 @@ public class RECIPES_GREGTECH { 120*20, 30); } - + private static void macerationRecipes(){ GT_ModHandler.addPulverisationRecipe( ItemUtils.getItemStackOfAmountFromOreDict("pelletZirconium", 1), @@ -617,20 +617,20 @@ public class RECIPES_GREGTECH { ItemUtils.getSimpleStack(Item.getItemFromBlock(ModBlocks.blockOreFluorite)), ItemUtils.getItemStackOfAmountFromOreDict("dustFluorite", 4)); } - - public static boolean addPulverisationRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3) { + + public static boolean addPulverisationRecipe(final ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, final ItemStack aOutput3) { aOutput1 = GT_OreDictUnificator.get(true, aOutput1); aOutput2 = GT_OreDictUnificator.get(true, aOutput2); if ((GT_Utility.isStackInvalid(aInput)) || (GT_Utility.isStackInvalid(aOutput1))){ return false; } if (GT_Utility.getContainerItem(aInput, false) == null) { - + if (GregTech_API.sRecipeFile.get(ConfigCategories.Machines.maceration, aInput, true)) { GT_Utility.addSimpleIC2MachineRecipe(aInput, GT_ModHandler.getMaceratorRecipeList(), null, new Object[] { aOutput1 }); } GT_Values.RA.addPulveriserRecipe(aInput, new ItemStack[] { - aOutput1, aOutput2, aOutput3 }, + aOutput1, aOutput2, aOutput3 }, new int[] {10000, 10000, 10000}, 400, 2); diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java index 53ad2e3ba1..5c58e1ec3f 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java @@ -39,7 +39,7 @@ public class RECIPES_General { RECIPE_Paper, RECIPE_LapisDust, NULL, RECIPE_Paper, RECIPE_LapisDust, NULL, RECIPE_LapisDust, RECIPE_LapisDust, NULL, - OUTPUT_Blueprint); + OUTPUT_Blueprint); //Bronze Workbench RecipeUtils.recipeBuilder( diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_LaserEngraver.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_LaserEngraver.java index c55b32cbfc..c3726dbddc 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_LaserEngraver.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_LaserEngraver.java @@ -15,8 +15,8 @@ public class RECIPES_LaserEngraver implements IOreRecipeRegistrator { } @Override - public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { - if (aOreDictName.equals(OreDictNames.craftingLensBlue.toString())) { + public void registerOre(final OrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, final String aModName, final ItemStack aStack) { + if (aOreDictName.equals(OreDictNames.craftingLensBlue.toString())) { if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foilYttriumBariumCuprate", 1) != null){ GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.YttriumBariumCuprate, 2L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Circuit_Parts_Wiring_IV.get(1L, new Object[0]), 64, 480); } @@ -39,8 +39,8 @@ public class RECIPES_LaserEngraver implements IOreRecipeRegistrator { Utils.LOG_INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); } - - } else if (aOreDictName.equals(OreDictNames.craftingLensYellow.toString())) { + + } else if (aOreDictName.equals(OreDictNames.craftingLensYellow.toString())) { if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foilOsmium", 1) != null){ GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmium, 2L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Circuit_Parts_Wiring_LuV.get(1L, new Object[0]), 64, 1024); } @@ -48,7 +48,7 @@ public class RECIPES_LaserEngraver implements IOreRecipeRegistrator { Utils.LOG_INFO("foilOsmium does not exist within Gregtech, please report this issue to Blood-asp on github."); Utils.LOG_INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); } - + } else if (aOreDictName.equals(OreDictNames.craftingLensCyan.toString())) { } else if (aOreDictName.equals(OreDictNames.craftingLensRed.toString())) { } else if (aOreDictName.equals(OreDictNames.craftingLensGreen.toString())) { @@ -75,7 +75,7 @@ public class RECIPES_LaserEngraver implements IOreRecipeRegistrator { Utils.LOG_INFO("dustLithium does not exist within Gregtech, please report this issue to Blood-asp on github."); Utils.LOG_INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); } - + } } } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java index 14f4a1c998..8f7304588d 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java @@ -1,12 +1,11 @@ package gtPlusPlus.core.recipe; +import java.util.ArrayList; + import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.core.util.wrapper.var; - -import java.util.ArrayList; - import net.minecraft.item.ItemStack; public class RECIPES_MTWRAPPER { @@ -26,53 +25,53 @@ public class RECIPES_MTWRAPPER { static var stoneBlock = new var("minecraft:stone>"); public static void run(){ - /*addShaped(button.getStack(2), + /*addShaped(button.getStack(2), null, stoneBlock, null, null, stoneBlock, null, null, null, null);*/ - /*addShaped(stoneStick.getStack(1), + /*addShaped(stoneStick.getStack(1), stoneBlock, null, null, stoneBlock, null, null, null, null, null);*/ - addShaped(chestWood.getStack(2), + addShaped(chestWood.getStack(2), logWood, logWood, logWood, logWood, null, logWood, logWood, logWood, logWood); - addShaped(chestWood.getStack(4), + addShaped(chestWood.getStack(4), logWood, logWood, logWood, logWood, saw, logWood, logWood, logWood, logWood); //Recipe Fixes //remove(sensorDaylight); - addShaped(sensorDaylight.getStack(1), + addShaped(sensorDaylight.getStack(1), glass, glass, glass, gemNetherQuartz, gemNetherQuartz, gemNetherQuartz, slabWood, slabWood, slabWood); - /*addShaped(ironBars .getStack( 8), + /*addShaped(ironBars .getStack( 8), null, "<ore:craftingToolWrench>", null, "<ore:stickAnyIron>", "<ore:stickAnyIron>", "<ore:stickAnyIron>", "<ore:stickAnyIron>", "<ore:stickAnyIron>", "<ore:stickAnyIron>");*/ } - public static void addShaped(Object item_Output, - Object item_1, Object item_2, Object item_3, - Object item_4, Object item_5, Object item_6, - Object item_7, Object item_8, Object item_9){ + public static void addShaped(final Object item_Output, + final Object item_1, final Object item_2, final Object item_3, + final Object item_4, final Object item_5, final Object item_6, + final Object item_7, final Object item_8, final Object item_9){ /* - * + * * var item_1, var item_2, var item_3, var item_4, var item_5, var item_6, var item_7, var item_8, var item_9 - * - * + * + * */ - ItemStack outputItem = ItemUtils.getCorrectStacktype(item_Output, 1); + final ItemStack outputItem = ItemUtils.getCorrectStacktype(item_Output, 1); - ArrayList<Object> validSlots = new ArrayList<Object>(); + final ArrayList<Object> validSlots = new ArrayList<>(); String a,b,c,d,e,f,g,h,i; if (item_1 == null){ a = " ";} else { a = "1";validSlots.add('1');validSlots.add(item_1);} if (item_2 == null){ b = " ";} else { b = "2";validSlots.add('2');validSlots.add(item_2);} @@ -84,16 +83,16 @@ public class RECIPES_MTWRAPPER { if (item_8 == null){ h = " ";} else { h = "8";validSlots.add('8');validSlots.add(item_8);} if (item_9 == null){ i = " ";} else { i = "9";validSlots.add('9');validSlots.add(item_9);} - String lineOne = a+b+c; - String lineTwo = d+e+f; - String lineThree = g+h+i; + final String lineOne = a+b+c; + final String lineTwo = d+e+f; + final String lineThree = g+h+i; validSlots.add(0, lineOne); validSlots.add(1, lineTwo); validSlots.add(2, lineThree); try { - RecipeUtils.recipeBuilder((Object[]) validSlots.toArray(), outputItem.copy()); - MT_RECIPES_LOADED++; + RecipeUtils.recipeBuilder(validSlots.toArray(), outputItem.copy()); + MT_RECIPES_LOADED++; } catch(NullPointerException | ClassCastException k){ k.getMessage(); @@ -102,7 +101,7 @@ public class RECIPES_MTWRAPPER { k.getLocalizedMessage(); Utils.LOG_WARNING("@@@: Invalid Recipe detected for: "+((var) item_Output).getsanitizedName()); MT_RECIPES_FAILED++; - } + } } public static void addShapeless(){ diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java index fd84b895a2..fa8dad30b5 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java @@ -8,7 +8,7 @@ import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; public class RECIPES_MachineComponents { - + //Wire static String wireTier6 = "wireGt08NiobiumTitanium"; static String wireTier7 = "wireGt08Osmium"; @@ -82,10 +82,10 @@ public class RECIPES_MachineComponents { static String craftingToolWrench = "craftingToolWrench"; static String craftingToolScrewdriver = "craftingToolScrewdriver"; - public static final void RECIPES_LOAD(){ - Utils.LOG_INFO("Loading Recipes for the Various Circuits and Machine components."); + public static final void RECIPES_LOAD(){ + Utils.LOG_INFO("Loading Recipes for the Various Circuits and Machine components."); if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - run(); + run(); } else { onlyMaxComponents(); @@ -272,8 +272,8 @@ public class RECIPES_MachineComponents { Utils.LOG_INFO("Done loading recipes for the Various machine components."); - } - + } + private static void onlyMaxComponents(){ RecipeUtils.addShapedGregtechRecipe( cableTier10, wireTier10, rodTier10a, @@ -328,14 +328,14 @@ public class RECIPES_MachineComponents { GT_Values.RA.addForgeHammerRecipe(ItemList.Circuit_Master.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_Crystal_Chip_IV.get(5L, new Object[0]), 32, 256); GT_Values.RA.addForgeHammerRecipe(GregtechItemList.Circuit_IV.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_Crystal_Chip_LuV.get(5L, new Object[0]), 64, 512); GT_Values.RA.addForgeHammerRecipe(GregtechItemList.Circuit_LuV.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_Crystal_Chip_ZPM.get(5L, new Object[0]), 128, 1024); - for (Materials tMat : Materials.values()) { + for (final Materials tMat : Materials.values()) { if ((tMat.mStandardMoltenFluid != null) && (tMat.contains(SubTag.SOLDERING_MATERIAL))) { - int tMultiplier = tMat.contains(SubTag.SOLDERING_MATERIAL_GOOD) ? 1 : tMat.contains(SubTag.SOLDERING_MATERIAL_BAD) ? 4 : 2; - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Circuit_Board_IV.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_IV.get(1L, new Object[0]), tMat.getMolten(144L * tMultiplier / 4L), GregtechItemList.Circuit_IV.get(1L, new Object[0]), 32, 512); - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Circuit_Board_LuV.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_LuV.get(1L, new Object[0]), tMat.getMolten(144L * tMultiplier / 4L), GregtechItemList.Circuit_LuV.get(1L, new Object[0]), 64, 1024); - GT_Values.RA.addAssemblerRecipe(GregtechItemList.Circuit_Board_ZPM.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_ZPM.get(1L, new Object[0]), tMat.getMolten(144L * tMultiplier / 4L), GregtechItemList.Circuit_ZPM.get(1L, new Object[0]), 96, 2048); + final int tMultiplier = tMat.contains(SubTag.SOLDERING_MATERIAL_GOOD) ? 1 : tMat.contains(SubTag.SOLDERING_MATERIAL_BAD) ? 4 : 2; + GT_Values.RA.addAssemblerRecipe(GregtechItemList.Circuit_Board_IV.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_IV.get(1L, new Object[0]), tMat.getMolten((144L * tMultiplier) / 4L), GregtechItemList.Circuit_IV.get(1L, new Object[0]), 32, 512); + GT_Values.RA.addAssemblerRecipe(GregtechItemList.Circuit_Board_LuV.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_LuV.get(1L, new Object[0]), tMat.getMolten((144L * tMultiplier) / 4L), GregtechItemList.Circuit_LuV.get(1L, new Object[0]), 64, 1024); + GT_Values.RA.addAssemblerRecipe(GregtechItemList.Circuit_Board_ZPM.get(1L, new Object[0]), GregtechItemList.Circuit_Parts_ZPM.get(1L, new Object[0]), tMat.getMolten((144L * tMultiplier) / 4L), GregtechItemList.Circuit_ZPM.get(1L, new Object[0]), 96, 2048); } - } + } } } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 296b3d4199..507e09153a 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -6,7 +6,8 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; -import gtPlusPlus.xmod.gregtech.api.enums.*; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import net.minecraft.item.ItemStack; @@ -138,14 +139,14 @@ public class RECIPES_Machines { //Machine Casings - static ItemStack machineCasing_ULV; - static ItemStack machineCasing_LV; + static ItemStack machineCasing_ULV; + static ItemStack machineCasing_LV; static ItemStack machineCasing_MV; static ItemStack machineCasing_HV; static ItemStack machineCasing_EV; static ItemStack machineCasing_IV; - static ItemStack machineCasing_LuV; - static ItemStack machineCasing_ZPM; + static ItemStack machineCasing_LuV; + static ItemStack machineCasing_ZPM; static ItemStack machineCasing_UV; static ItemStack machineCasing_MAX; @@ -155,7 +156,7 @@ public class RECIPES_Machines { static ItemStack gearboxCasing_Tier_3; static ItemStack gearboxCasing_Tier_4; - //IV MACHINES + //IV MACHINES public static ItemStack IV_MACHINE_Electrolyzer; public static ItemStack IV_MACHINE_Centrifuge; public static ItemStack IV_MACHINE_BendingMachine; @@ -170,7 +171,7 @@ public class RECIPES_Machines { //Plates - static String plateElectricalSteel= "plateElectricalSteel"; + static String plateElectricalSteel= "plateElectricalSteel"; static String plateEnergeticAlloy= "plateEnergeticAlloy"; static String plateCobalt = "plateCobalt"; static String plateBronze = "plateBronze"; @@ -265,7 +266,7 @@ public class RECIPES_Machines { private static void run(){ initModItems(); - } + } private static void initModItems(){ if (LoadedMods.IndustrialCraft2){ @@ -337,7 +338,7 @@ public class RECIPES_Machines { sensor_IV = ItemList.Sensor_IV.get(1); - //IV MACHINES + //IV MACHINES IV_MACHINE_Electrolyzer = ItemList.Machine_IV_Electrolyzer.get(1); IV_MACHINE_BendingMachine= ItemList.Machine_IV_Bender.get(1); IV_MACHINE_Wiremill= ItemList.Machine_IV_Wiremill.get(1); @@ -358,10 +359,10 @@ public class RECIPES_Machines { INPUT_IECokeOvenBlock = ItemUtils.getItemStackWithMeta(LoadedMods.ImmersiveEngineering, "ImmersiveEngineering:stoneDecoration", "Coke_Oven_IE", 1, 1); } runModRecipes(); - } + } private static void runModRecipes(){ - if (LoadedMods.Gregtech){ + if (LoadedMods.Gregtech){ RecipeUtils.addShapedGregtechRecipe( ItemList.Electric_Piston_EV, GregtechOrePrefixes.circuit.get(Materials.Ultimate), ItemList.Electric_Piston_EV, @@ -502,7 +503,7 @@ public class RECIPES_Machines { "plateAnyIron", blockBricks, "plateAnyIron", "plateAnyIron", RECIPES_Tools.craftingToolWrench, "plateAnyIron", RECIPE_IronPlatedBricks); - + //Add recycle recipes for the Iron Plated Bricks //GT_ModHandler.addPulverisationRecipe(RECIPE_IronPlatedBricks, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustIron", 6), ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustClay", 2), true); RECIPES_GREGTECH.addPulverisationRecipe( @@ -511,7 +512,7 @@ public class RECIPES_Machines { ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustClay", 2), null); GT_Values.RA.addArcFurnaceRecipe(RECIPE_IronPlatedBricks, new ItemStack[]{ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotWroughtIron", 6), ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustAsh", 2)}, new int[]{0}, 32*20, 32); - + /*//Electrolyzer Frame Casing UtilsRecipe.addShapedGregtechRecipe( "platePotin", "stickLongChrome", "platePotin", @@ -605,7 +606,7 @@ public class RECIPES_Machines { "stickPlatinum", "frameGtInconel625", "stickPlatinum", "platePalladium", "stickLongPalladium", "platePalladium", RECIPE_IndustrialMacerationStackFrame); - //Industrial Maceration stack + //Industrial Maceration stack RecipeUtils.addShapedGregtechRecipe( "plateTungstenCarbide", IV_MACHINE_Macerator, "plateTungstenCarbide", EV_MACHINE_Macerator, circuitTier7, EV_MACHINE_Macerator, @@ -630,59 +631,59 @@ public class RECIPES_Machines { //Tiered Tanks Utils.LOG_INFO("Is New Horizons Loaded? "+CORE.GTNH); if (!CORE.GTNH){ - RecipeUtils.addShapedGregtechRecipe( - plateTier1, plateTier1, plateTier1, - plateTier1, pipeTier1, plateTier1, - plateTier1, GregtechItemList.Fluid_Cell_144L.get(1), plateTier1, - GregtechItemList.GT_FluidTank_ULV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - plateTier2, plateTier2, plateTier2, - plateTier2, pipeTier2, plateTier2, - plateTier2, electricPump_LV, plateTier2, - GregtechItemList.GT_FluidTank_LV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - plateTier3, plateTier3, plateTier3, - plateTier3, pipeTier3, plateTier3, - plateTier3, electricPump_MV, plateTier3, - GregtechItemList.GT_FluidTank_MV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - plateTier4, plateTier4, plateTier4, - plateTier4, pipeTier4, plateTier4, - plateTier4, electricPump_HV, plateTier4, - GregtechItemList.GT_FluidTank_HV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - plateTier5, plateTier5, plateTier5, - plateTier5, pipeTier5, plateTier5, - plateTier5, electricPump_EV, plateTier5, - GregtechItemList.GT_FluidTank_EV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - plateTier6, plateTier6, plateTier6, - plateTier6, pipeTier6, plateTier6, - plateTier6, electricPump_IV, plateTier6, - GregtechItemList.GT_FluidTank_IV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - plateTier7, plateTier7, plateTier7, - plateTier7, pipeTier7, plateTier7, - plateTier7, RECIPE_CONSTANTS.electricPump_LuV, plateTier7, - GregtechItemList.GT_FluidTank_LuV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - plateTier8, plateTier8, plateTier8, - plateTier8, pipeTier8, plateTier8, - plateTier8, RECIPE_CONSTANTS.electricPump_ZPM, plateTier8, - GregtechItemList.GT_FluidTank_ZPM.get(1)); - RecipeUtils.addShapedGregtechRecipe( - plateTier9, plateTier9, plateTier9, - plateTier9, pipeTier9, plateTier9, - plateTier9, RECIPE_CONSTANTS.electricPump_UV, plateTier9, - GregtechItemList.GT_FluidTank_UV.get(1)); - RecipeUtils.addShapedGregtechRecipe( - plateTier10, plateTier10, plateTier10, - plateTier10, pipeTier10, plateTier10, - plateTier10, RECIPE_CONSTANTS.electricPump_MAX, plateTier10, - GregtechItemList.GT_FluidTank_MAX.get(1)); + RecipeUtils.addShapedGregtechRecipe( + plateTier1, plateTier1, plateTier1, + plateTier1, pipeTier1, plateTier1, + plateTier1, GregtechItemList.Fluid_Cell_144L.get(1), plateTier1, + GregtechItemList.GT_FluidTank_ULV.get(1)); + RecipeUtils.addShapedGregtechRecipe( + plateTier2, plateTier2, plateTier2, + plateTier2, pipeTier2, plateTier2, + plateTier2, electricPump_LV, plateTier2, + GregtechItemList.GT_FluidTank_LV.get(1)); + RecipeUtils.addShapedGregtechRecipe( + plateTier3, plateTier3, plateTier3, + plateTier3, pipeTier3, plateTier3, + plateTier3, electricPump_MV, plateTier3, + GregtechItemList.GT_FluidTank_MV.get(1)); + RecipeUtils.addShapedGregtechRecipe( + plateTier4, plateTier4, plateTier4, + plateTier4, pipeTier4, plateTier4, + plateTier4, electricPump_HV, plateTier4, + GregtechItemList.GT_FluidTank_HV.get(1)); + RecipeUtils.addShapedGregtechRecipe( + plateTier5, plateTier5, plateTier5, + plateTier5, pipeTier5, plateTier5, + plateTier5, electricPump_EV, plateTier5, + GregtechItemList.GT_FluidTank_EV.get(1)); + RecipeUtils.addShapedGregtechRecipe( + plateTier6, plateTier6, plateTier6, + plateTier6, pipeTier6, plateTier6, + plateTier6, electricPump_IV, plateTier6, + GregtechItemList.GT_FluidTank_IV.get(1)); + RecipeUtils.addShapedGregtechRecipe( + plateTier7, plateTier7, plateTier7, + plateTier7, pipeTier7, plateTier7, + plateTier7, RECIPE_CONSTANTS.electricPump_LuV, plateTier7, + GregtechItemList.GT_FluidTank_LuV.get(1)); + RecipeUtils.addShapedGregtechRecipe( + plateTier8, plateTier8, plateTier8, + plateTier8, pipeTier8, plateTier8, + plateTier8, RECIPE_CONSTANTS.electricPump_ZPM, plateTier8, + GregtechItemList.GT_FluidTank_ZPM.get(1)); + RecipeUtils.addShapedGregtechRecipe( + plateTier9, plateTier9, plateTier9, + plateTier9, pipeTier9, plateTier9, + plateTier9, RECIPE_CONSTANTS.electricPump_UV, plateTier9, + GregtechItemList.GT_FluidTank_UV.get(1)); + RecipeUtils.addShapedGregtechRecipe( + plateTier10, plateTier10, plateTier10, + plateTier10, pipeTier10, plateTier10, + plateTier10, RECIPE_CONSTANTS.electricPump_MAX, plateTier10, + GregtechItemList.GT_FluidTank_MAX.get(1)); } else { - + plateTier1 = "plateTin"; pipeTier1 = "pipeLargeClay"; plateTier2 = "plateCopper"; @@ -695,7 +696,7 @@ public class RECIPES_Machines { pipeTier5 = "pipeLargeBronze"; plateTier6 = "plateAluminium"; pipeTier6 = "pipeMediumSteel"; - + Utils.LOG_INFO("Loading New Horizon Tanks, with custom recipes."); Utils.LOG_INFO("Using "+plateTier1+" with "+pipeTier1); Utils.LOG_INFO("Using "+plateTier2+" with "+pipeTier2); @@ -703,7 +704,7 @@ public class RECIPES_Machines { Utils.LOG_INFO("Using "+plateTier4+" with "+pipeTier4); Utils.LOG_INFO("Using "+plateTier5+" with "+pipeTier5); Utils.LOG_INFO("Using "+plateTier6+" with "+pipeTier6); - + RecipeUtils.addShapedGregtechRecipe( plateTier1, plateTier1, plateTier1, plateTier1, pipeTier1, plateTier1, @@ -762,14 +763,14 @@ public class RECIPES_Machines { rodTier5, "frameGtTumbaga", rodTier5, "plateZirconiumCarbide", rodTier5, "plateZirconiumCarbide", RECIPE_IndustrialBlastSmelterFrame); - //Blast Smelter Coil + //Blast Smelter Coil RecipeUtils.addShapedGregtechRecipe( "plateStaballoy", "plateStaballoy", "plateStaballoy", "frameGtStaballoy", gearboxCasing_Tier_3, "frameGtStaballoy", "plateStaballoy", "plateStaballoy", "plateStaballoy", RECIPE_IndustrialBlastSmelterCoil); - - + + //Matter Fabricator CPU RecipeUtils.addShapedGregtechRecipe( "plateDoubleQuantum", circuitTier5, "plateDoubleQuantum", @@ -782,7 +783,7 @@ public class RECIPES_Machines { rodTier8, "frameGtInconel690", rodTier8, "plateNiobiumCarbide", rodTier8, "plateNiobiumCarbide", RECIPE_IndustrialMatterFabFrame); - //Matter Fabricator Coil + //Matter Fabricator Coil RecipeUtils.addShapedGregtechRecipe( "plateQuantum", "plateQuantum", "plateQuantum", "frameGtStellite", machineCasing_UV, "frameGtStellite", diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java index fa11783f70..640a524a21 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java @@ -7,20 +7,20 @@ import gtPlusPlus.core.util.recipe.RecipeUtils; import net.minecraft.item.ItemStack; public class RECIPES_Shapeless { - + static ItemStack dustStaballoy; - + //Circuits - static String circuitPrimitive = "circuitPrimitive"; - static String circuitBasic = "circuitBasic"; - static String circuitGood = "circuitGood"; - static String circuitAdvanced = "circuitAdvanced"; - static String circuitData = "circuitData"; - static String circuitElite = "circuitElite"; - static String circuitMaster = "circuitMaster"; - static String circuitUltimate = "circuitUltimate"; - static ItemStack gearboxCasing_Tier_1; - + static String circuitPrimitive = "circuitPrimitive"; + static String circuitBasic = "circuitBasic"; + static String circuitGood = "circuitGood"; + static String circuitAdvanced = "circuitAdvanced"; + static String circuitData = "circuitData"; + static String circuitElite = "circuitElite"; + static String circuitMaster = "circuitMaster"; + static String circuitUltimate = "circuitUltimate"; + static ItemStack gearboxCasing_Tier_1; + public static final void RECIPES_LOAD(){ //run(); Utils.LOG_INFO("Loading Shapeless Recipes."); @@ -28,19 +28,19 @@ public class RECIPES_Shapeless { private static void run(){ //Gregtech items - if (LoadedMods.Gregtech){ - gearboxCasing_Tier_1 = ItemList.Casing_Gearbox_Bronze.get(1); - - RecipeUtils.shapelessBuilder(dustStaballoy, - "dustTitanium", "dustUranium", "dustUranium", - "dustUranium", "dustUranium", "dustUranium", - "dustUranium", "dustUranium", "dustUranium"); - - RecipeUtils.shapelessBuilder(gearboxCasing_Tier_1, - circuitPrimitive, circuitPrimitive, circuitPrimitive, - circuitPrimitive, circuitPrimitive, circuitPrimitive, - circuitPrimitive, circuitPrimitive, circuitPrimitive); + if (LoadedMods.Gregtech){ + gearboxCasing_Tier_1 = ItemList.Casing_Gearbox_Bronze.get(1); + + RecipeUtils.shapelessBuilder(dustStaballoy, + "dustTitanium", "dustUranium", "dustUranium", + "dustUranium", "dustUranium", "dustUranium", + "dustUranium", "dustUranium", "dustUranium"); + + RecipeUtils.shapelessBuilder(gearboxCasing_Tier_1, + circuitPrimitive, circuitPrimitive, circuitPrimitive, + circuitPrimitive, circuitPrimitive, circuitPrimitive, + circuitPrimitive, circuitPrimitive, circuitPrimitive); } } - + } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java index 0393dc4e46..b45e2ba92f 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java @@ -125,7 +125,7 @@ public class RECIPES_Tools { public static String plateDoubleNiChrome = "plateDoubleNichrome"; public static String plateIridiumAlloy = "plateAlloyIridium"; - public static final void RECIPES_LOAD(){ + public static final void RECIPES_LOAD(){ run(); @@ -175,7 +175,7 @@ public class RECIPES_Tools { plateElectrum, ingotElectrum, plateElectrum, craftingToolScrewdriver, stickBronze, craftingToolHardHammer, null, stickSteel, null, - RECIPE_SandstoneHammer); + RECIPE_SandstoneHammer); //Basic Firemaker RecipeUtils.recipeBuilder( diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPE_Batteries.java b/src/Java/gtPlusPlus/core/recipe/RECIPE_Batteries.java index 440f8815bc..3d59742805 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPE_Batteries.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPE_Batteries.java @@ -8,7 +8,7 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import net.minecraft.item.ItemStack; public class RECIPE_Batteries { - + static ItemStack RECIPE_Battery_Sodium = GregtechItemList.Battery_RE_EV_Sodium.get(1); static ItemStack RECIPE_Battery_Cadmium = GregtechItemList.Battery_RE_EV_Cadmium.get(1); static ItemStack RECIPE_Battery_Lithium = GregtechItemList.Battery_RE_EV_Lithium.get(1); @@ -18,16 +18,16 @@ public class RECIPE_Batteries { static ItemStack machineTransformer_EV; public static void RECIPES_LOAD(){ - + if (LoadedMods.Gregtech){ machineTransformer_EV = ItemList.Transformer_EV_HV.get(1); - run(); + run(); } } - + private static void run(){ - - + + RecipeUtils.addShapedGregtechRecipe( GT_Battery_Sodium, RECIPES_Machines.cableTier4, GT_Battery_Sodium, RECIPES_Machines.circuitTier3, machineTransformer_EV, RECIPES_Machines.circuitTier3, @@ -43,7 +43,7 @@ public class RECIPE_Batteries { RECIPES_Machines.circuitTier3, machineTransformer_EV, RECIPES_Machines.circuitTier3, GT_Battery_Lithium, RECIPES_Machines.cableTier4, GT_Battery_Lithium, RECIPE_Battery_Lithium); - + } - + } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPE_CONSTANTS.java b/src/Java/gtPlusPlus/core/recipe/RECIPE_CONSTANTS.java index c0548e9e74..dec8de8755 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPE_CONSTANTS.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPE_CONSTANTS.java @@ -40,7 +40,7 @@ public class RECIPE_CONSTANTS { public static ItemStack sensor_ZPM; public static ItemStack sensor_UV; public static ItemStack sensor_MAX; - + public static void initialise(){ if(CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ registerGTExperimentalComponents(); @@ -49,7 +49,7 @@ public class RECIPE_CONSTANTS { registerGTStandardComponents(); } } - + private static void registerGTExperimentalComponents(){ //Machine Components electricMotor_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32606, 1); @@ -76,7 +76,7 @@ public class RECIPE_CONSTANTS { sensor_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32695, 1); sensor_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32696, 1); sensor_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32697, 1); - + //Max Tier Components Blood Never added... Useless, lol. electricMotor_MAX = GregtechItemList.Electric_Motor_MAX.get(1); electricPump_MAX = GregtechItemList.Electric_Pump_MAX.get(1); @@ -87,7 +87,7 @@ public class RECIPE_CONSTANTS { fieldGenerator_MAX = GregtechItemList.Field_Generator_MAX.get(1); sensor_MAX = GregtechItemList.Sensor_MAX.get(1); } - + private static void registerGTStandardComponents(){ electricMotor_LuV = GregtechItemList.Electric_Motor_LuV.get(1); electricMotor_ZPM = GregtechItemList.Electric_Motor_ZPM.get(1); diff --git a/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java b/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java index 348f9907c0..9719416766 100644 --- a/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java +++ b/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java @@ -16,12 +16,12 @@ public class ShapedRecipeObject { public Object object_H; public Object object_I; public ItemStack object_OUTPUT; - + public ShapedRecipeObject( - Object input_A,Object input_B,Object input_C, - Object input_D,Object input_E,Object input_F, - Object input_G,Object input_H,Object input_I, - ItemStack input_Output){ + final Object input_A,final Object input_B,final Object input_C, + final Object input_D,final Object input_E,final Object input_F, + final Object input_G,final Object input_H,final Object input_I, + final ItemStack input_Output){ this.object_A = input_A; this.object_B = input_B; this.object_C = input_C; @@ -34,9 +34,9 @@ public class ShapedRecipeObject { this.object_OUTPUT = input_Output; Utils.LOG_SPECIFIC_WARNING("ShapedRecipeObject", "New object created.", 36); } - + public void buildRecipe(){ - RecipeUtils.recipeBuilder(object_A, object_B, object_C, object_D, object_E, object_F, object_G, object_H, object_I, object_OUTPUT); + RecipeUtils.recipeBuilder(this.object_A, this.object_B, this.object_C, this.object_D, this.object_E, this.object_F, this.object_G, this.object_H, this.object_I, this.object_OUTPUT); } - + } diff --git a/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java b/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java index 3c5c30966e..99c6eca8df 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java +++ b/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java @@ -8,17 +8,17 @@ import net.minecraft.item.ItemStack; public class SlotBlueprint extends Slot{ - public SlotBlueprint(IInventory inventory, int x, int y, int z) { + public SlotBlueprint(final IInventory inventory, final int x, final int y, final int z) { super(inventory, x, y, z); } @Override - public boolean isItemValid(ItemStack itemstack) { + public boolean isItemValid(final ItemStack itemstack) { if (itemstack.getItem() instanceof IItemBlueprint){ Utils.LOG_WARNING(itemstack.getDisplayName()+" is a valid Blueprint."); return true; } - Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Blueprint."); + Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Blueprint."); return false; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java b/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java index 0d8ce34ab5..2434344184 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java +++ b/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java @@ -11,43 +11,43 @@ public class SlotBuzzSaw extends Slot{ public SAWTOOL currentTool = SAWTOOL.NONE; - public SlotBuzzSaw(IInventory inventory, int slot, int x, int y) { + public SlotBuzzSaw(final IInventory inventory, final int slot, final int x, final int y) { super(inventory, slot, x, y); } @Override - public boolean isItemValid(ItemStack itemstack) { + public boolean isItemValid(final ItemStack itemstack) { boolean isValid = false; if (itemstack != null){ - if (itemstack.getItem() instanceof GT_MetaGenerated_Item_02 || itemstack.getItem() instanceof GT_MetaGenerated_Tool){ + if ((itemstack.getItem() instanceof GT_MetaGenerated_Item_02) || (itemstack.getItem() instanceof GT_MetaGenerated_Tool)){ //Buzzsaw Blade //TODO /*if (OrePrefixes.toolHeadBuzzSaw.contains(itemstack)){ - isValid = false; + isValid = false; }*/ if (OrePrefixes.craftingTool.contains(itemstack)){ - if (itemstack.getDisplayName().toLowerCase().contains("saw")){ + if (itemstack.getDisplayName().toLowerCase().contains("saw")){ if (itemstack.getItemDamage() == 10){ isValid = true; - currentTool = SAWTOOL.SAW; + this.currentTool = SAWTOOL.SAW; } if (itemstack.getItemDamage() == 140){ isValid = true; - currentTool = SAWTOOL.BUZZSAW; + this.currentTool = SAWTOOL.BUZZSAW; } } } else { - currentTool = SAWTOOL.NONE; + this.currentTool = SAWTOOL.NONE; } } else { - currentTool = SAWTOOL.NONE; + this.currentTool = SAWTOOL.NONE; } - } + } else { - currentTool = SAWTOOL.NONE; + this.currentTool = SAWTOOL.NONE; } return isValid; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotCrafting.java b/src/Java/gtPlusPlus/core/slots/SlotCrafting.java index d38de0e0a4..6bcf3ed58c 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotCrafting.java +++ b/src/Java/gtPlusPlus/core/slots/SlotCrafting.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.slots; +import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -9,152 +10,156 @@ import net.minecraft.item.*; import net.minecraft.stats.AchievementList; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; -import cpw.mods.fml.common.FMLCommonHandler; public class SlotCrafting extends Slot { - /** The craft matrix inventory linked to this result slot. */ - private final IInventory craftMatrix; - /** The player that is using the GUI where this slot resides. */ - private EntityPlayer thePlayer; - /** The number of items that have been crafted so far. Gets passed to ItemStack.onCrafting before being reset. */ - private int amountCrafted; - private static final String __OBFID = "CL_00001761"; - - public SlotCrafting(EntityPlayer p_i1823_1_, IInventory p_i1823_2_, IInventory p_i1823_3_, int p_i1823_4_, int p_i1823_5_, int p_i1823_6_) - { - super(p_i1823_3_, p_i1823_4_, p_i1823_5_, p_i1823_6_); - this.thePlayer = p_i1823_1_; - this.craftMatrix = p_i1823_2_; - } - - /** - * Check if the stack is a valid item for this slot. Always true beside for the armor slots. - */ - public boolean isItemValid(ItemStack p_75214_1_) - { - return false; - } - - /** - * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new - * stack. - */ - public ItemStack decrStackSize(int p_75209_1_) - { - if (this.getHasStack()) - { - this.amountCrafted += Math.min(p_75209_1_, this.getStack().stackSize); - } - - return super.decrStackSize(p_75209_1_); - } - - /** - * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an - * internal count then calls onCrafting(item). - */ - protected void onCrafting(ItemStack p_75210_1_, int p_75210_2_) - { - this.amountCrafted += p_75210_2_; - this.onCrafting(p_75210_1_); - } - - /** - * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. - */ - protected void onCrafting(ItemStack p_75208_1_) - { - p_75208_1_.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); - this.amountCrafted = 0; - - if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.crafting_table)) - { - this.thePlayer.addStat(AchievementList.buildWorkBench, 1); - } - - if (p_75208_1_.getItem() instanceof ItemPickaxe) - { - this.thePlayer.addStat(AchievementList.buildPickaxe, 1); - } - - if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.furnace)) - { - this.thePlayer.addStat(AchievementList.buildFurnace, 1); - } - - if (p_75208_1_.getItem() instanceof ItemHoe) - { - this.thePlayer.addStat(AchievementList.buildHoe, 1); - } - - if (p_75208_1_.getItem() == Items.bread) - { - this.thePlayer.addStat(AchievementList.makeBread, 1); - } - - if (p_75208_1_.getItem() == Items.cake) - { - this.thePlayer.addStat(AchievementList.bakeCake, 1); - } - - if (p_75208_1_.getItem() instanceof ItemPickaxe && ((ItemPickaxe)p_75208_1_.getItem()).func_150913_i() != Item.ToolMaterial.WOOD) - { - this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1); - } - - if (p_75208_1_.getItem() instanceof ItemSword) - { - this.thePlayer.addStat(AchievementList.buildSword, 1); - } - - if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.enchanting_table)) - { - this.thePlayer.addStat(AchievementList.enchantments, 1); - } - - if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.bookshelf)) - { - this.thePlayer.addStat(AchievementList.bookcase, 1); - } - } - - public void onPickupFromSlot(EntityPlayer p_82870_1_, ItemStack p_82870_2_) - { - FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, craftMatrix); - this.onCrafting(p_82870_2_); - - for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) - { - ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); - - if (itemstack1 != null) - { - this.craftMatrix.decrStackSize(i, 1); - - if (itemstack1.getItem().hasContainerItem(itemstack1)) - { - ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); - - if (itemstack2 != null && itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) - { - MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2)); - continue; - } - - if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) - { - if (this.craftMatrix.getStackInSlot(i) == null) - { - this.craftMatrix.setInventorySlotContents(i, itemstack2); - } - else - { - this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); - } - } - } - } - } - } + /** The craft matrix inventory linked to this result slot. */ + private final IInventory craftMatrix; + /** The player that is using the GUI where this slot resides. */ + private final EntityPlayer thePlayer; + /** The number of items that have been crafted so far. Gets passed to ItemStack.onCrafting before being reset. */ + private int amountCrafted; + private static final String __OBFID = "CL_00001761"; + + public SlotCrafting(final EntityPlayer p_i1823_1_, final IInventory p_i1823_2_, final IInventory p_i1823_3_, final int p_i1823_4_, final int p_i1823_5_, final int p_i1823_6_) + { + super(p_i1823_3_, p_i1823_4_, p_i1823_5_, p_i1823_6_); + this.thePlayer = p_i1823_1_; + this.craftMatrix = p_i1823_2_; + } + + /** + * Check if the stack is a valid item for this slot. Always true beside for the armor slots. + */ + @Override + public boolean isItemValid(final ItemStack p_75214_1_) + { + return false; + } + + /** + * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new + * stack. + */ + @Override + public ItemStack decrStackSize(final int p_75209_1_) + { + if (this.getHasStack()) + { + this.amountCrafted += Math.min(p_75209_1_, this.getStack().stackSize); + } + + return super.decrStackSize(p_75209_1_); + } + + /** + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an + * internal count then calls onCrafting(item). + */ + @Override + protected void onCrafting(final ItemStack p_75210_1_, final int p_75210_2_) + { + this.amountCrafted += p_75210_2_; + this.onCrafting(p_75210_1_); + } + + /** + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. + */ + @Override + protected void onCrafting(final ItemStack p_75208_1_) + { + p_75208_1_.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); + this.amountCrafted = 0; + + if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.crafting_table)) + { + this.thePlayer.addStat(AchievementList.buildWorkBench, 1); + } + + if (p_75208_1_.getItem() instanceof ItemPickaxe) + { + this.thePlayer.addStat(AchievementList.buildPickaxe, 1); + } + + if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.furnace)) + { + this.thePlayer.addStat(AchievementList.buildFurnace, 1); + } + + if (p_75208_1_.getItem() instanceof ItemHoe) + { + this.thePlayer.addStat(AchievementList.buildHoe, 1); + } + + if (p_75208_1_.getItem() == Items.bread) + { + this.thePlayer.addStat(AchievementList.makeBread, 1); + } + + if (p_75208_1_.getItem() == Items.cake) + { + this.thePlayer.addStat(AchievementList.bakeCake, 1); + } + + if ((p_75208_1_.getItem() instanceof ItemPickaxe) && (((ItemPickaxe)p_75208_1_.getItem()).func_150913_i() != Item.ToolMaterial.WOOD)) + { + this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1); + } + + if (p_75208_1_.getItem() instanceof ItemSword) + { + this.thePlayer.addStat(AchievementList.buildSword, 1); + } + + if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.enchanting_table)) + { + this.thePlayer.addStat(AchievementList.enchantments, 1); + } + + if (p_75208_1_.getItem() == Item.getItemFromBlock(Blocks.bookshelf)) + { + this.thePlayer.addStat(AchievementList.bookcase, 1); + } + } + + @Override + public void onPickupFromSlot(final EntityPlayer p_82870_1_, final ItemStack p_82870_2_) + { + FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, this.craftMatrix); + this.onCrafting(p_82870_2_); + + for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) + { + final ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); + + if (itemstack1 != null) + { + this.craftMatrix.decrStackSize(i, 1); + + if (itemstack1.getItem().hasContainerItem(itemstack1)) + { + final ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); + + if ((itemstack2 != null) && itemstack2.isItemStackDamageable() && (itemstack2.getItemDamage() > itemstack2.getMaxDamage())) + { + MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this.thePlayer, itemstack2)); + continue; + } + + if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)) + { + if (this.craftMatrix.getStackInSlot(i) == null) + { + this.craftMatrix.setInventorySlotContents(i, itemstack2); + } + else + { + this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); + } + } + } + } + } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/slots/SlotFrame.java b/src/Java/gtPlusPlus/core/slots/SlotFrame.java index 13bc8fa717..bb2cabc61f 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotFrame.java +++ b/src/Java/gtPlusPlus/core/slots/SlotFrame.java @@ -1,19 +1,19 @@ package gtPlusPlus.core.slots; +import forestry.api.apiculture.IHiveFrame; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import forestry.api.apiculture.IHiveFrame; public class SlotFrame extends Slot{ - public SlotFrame(IInventory inventory, int x, int y, int z) { + public SlotFrame(final IInventory inventory, final int x, final int y, final int z) { super(inventory, x, y, z); } @Override - public boolean isItemValid(ItemStack itemstack) { + public boolean isItemValid(final ItemStack itemstack) { return itemstack.getItem() instanceof IHiveFrame; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotGeneric.java b/src/Java/gtPlusPlus/core/slots/SlotGeneric.java index bf7dc1fff5..7ff350845e 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotGeneric.java +++ b/src/Java/gtPlusPlus/core/slots/SlotGeneric.java @@ -6,13 +6,13 @@ import net.minecraft.item.ItemStack; public class SlotGeneric extends Slot{ - public SlotGeneric(IInventory inventory, int x, int y, int z) { + public SlotGeneric(final IInventory inventory, final int x, final int y, final int z) { super(inventory, x, y, z); } @Override - public boolean isItemValid(ItemStack itemstack) { + public boolean isItemValid(final ItemStack itemstack) { return true; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotGtTool.java b/src/Java/gtPlusPlus/core/slots/SlotGtTool.java index cdea2fa43f..a2fd83baee 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotGtTool.java +++ b/src/Java/gtPlusPlus/core/slots/SlotGtTool.java @@ -8,18 +8,18 @@ import net.minecraft.item.ItemStack; public class SlotGtTool extends Slot{ - public SlotGtTool(IInventory inventory, int x, int y, int z) { + public SlotGtTool(final IInventory inventory, final int x, final int y, final int z) { super(inventory, x, y, z); } @Override - public boolean isItemValid(ItemStack itemstack) { + public boolean isItemValid(final ItemStack itemstack) { if (itemstack.getItem() instanceof GT_MetaGenerated_Tool){ Utils.LOG_WARNING(itemstack.getDisplayName()+" is a valid Tool."); return true; } - Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Tool."); + Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Tool."); return false; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java index 461fa6ff04..46ceb3209e 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java +++ b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java @@ -13,14 +13,14 @@ public class SlotGtToolElectric extends SlotGtTool { public int tier; private ItemStack content; - public SlotGtToolElectric(IInventory base, int x, int y, int z, int tier, boolean allowRedstoneDust) + public SlotGtToolElectric(final IInventory base, final int x, final int y, final int z, final int tier, final boolean allowRedstoneDust) { super(base, x, y, z); this.tier = tier; this.allowRedstoneDust = allowRedstoneDust; } - public boolean accepts(ItemStack stack) + public boolean accepts(final ItemStack stack) { if (stack == null) { return false; @@ -31,12 +31,12 @@ public class SlotGtToolElectric extends SlotGtTool { return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), this.tier, true, true, true) > 0.0D); } - public double discharge(double amount, boolean ignoreLimit) + public double discharge(final double amount, final boolean ignoreLimit) { if (amount <= 0.0D) { throw new IllegalArgumentException("Amount must be > 0."); } - ItemStack stack = get(0); + final ItemStack stack = this.get(0); if (stack == null) { return 0.0D; } @@ -49,13 +49,13 @@ public class SlotGtToolElectric extends SlotGtTool { } stack.stackSize -= 1; if (stack.stackSize <= 0) { - put(0, null); + this.put(0, null); } } return realAmount; } - public void setTier(int tier1) + public void setTier(final int tier1) { this.tier = tier1; } @@ -64,34 +64,34 @@ public class SlotGtToolElectric extends SlotGtTool { public ItemStack get() { - return get(0); + return this.get(0); } - public ItemStack get(int index) + public ItemStack get(final int index) { return this.content; } - public void put(ItemStack content) + public void put(final ItemStack content) { - put(0, content); + this.put(0, content); } - public void put(int index, ItemStack content) + public void put(final int index, final ItemStack content) { this.content = content; - onChanged(); + this.onChanged(); } public void onChanged() {} @Override - public boolean isItemValid(ItemStack itemstack) { - if (itemstack.getItem() instanceof GT_MetaGenerated_Tool || itemstack.getItem() instanceof IElectricItem){ + public boolean isItemValid(final ItemStack itemstack) { + if ((itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof IElectricItem)){ Utils.LOG_WARNING(itemstack.getDisplayName()+" is a valid Tool."); return true; } - Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Tool."); + Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Tool."); return false; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java b/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java index 7a22086949..fbc3e36aef 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java +++ b/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java @@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack; public class SlotItemBackpackInv extends Slot { - public SlotItemBackpackInv(IInventory inv, int index, int xPos, int yPos) + public SlotItemBackpackInv(final IInventory inv, final int index, final int xPos, final int yPos) { super(inv, index, xPos, yPos); } @@ -20,7 +20,7 @@ public class SlotItemBackpackInv extends Slot * Check if the stack is a valid item for this slot. */ @Override - public boolean isItemValid(ItemStack itemstack) + public boolean isItemValid(final ItemStack itemstack) { // Everything returns true except an instance of our Item return !(itemstack.getItem() instanceof BaseItemBackpack); diff --git a/src/Java/gtPlusPlus/core/slots/SlotNoInput.java b/src/Java/gtPlusPlus/core/slots/SlotNoInput.java index fe51631a5d..3177c24868 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotNoInput.java +++ b/src/Java/gtPlusPlus/core/slots/SlotNoInput.java @@ -6,12 +6,12 @@ import net.minecraft.item.ItemStack; public class SlotNoInput extends Slot{ - public SlotNoInput(IInventory inventory, int x, int y, int z) { + public SlotNoInput(final IInventory inventory, final int x, final int y, final int z) { super(inventory, x, y, z); } @Override - public boolean isItemValid(ItemStack itemstack) { + public boolean isItemValid(final ItemStack itemstack) { return false; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotOutput.java b/src/Java/gtPlusPlus/core/slots/SlotOutput.java index a0f895d554..9219b50261 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotOutput.java +++ b/src/Java/gtPlusPlus/core/slots/SlotOutput.java @@ -1,12 +1,12 @@ package gtPlusPlus.core.slots; +import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; -import cpw.mods.fml.common.FMLCommonHandler; public class SlotOutput extends SlotCrafting{ @@ -15,7 +15,7 @@ public class SlotOutput extends SlotCrafting{ private int amountCrafted; - public SlotOutput(EntityPlayer player, InventoryCrafting craftingInventory, IInventory p_i45790_3_, int slotIndex, int xPosition, int yPosition) + public SlotOutput(final EntityPlayer player, final InventoryCrafting craftingInventory, final IInventory p_i45790_3_, final int slotIndex, final int xPosition, final int yPosition) { super(player, craftingInventory, p_i45790_3_, slotIndex, xPosition, yPosition); this.thePlayer = player; @@ -25,7 +25,7 @@ public class SlotOutput extends SlotCrafting{ * Check if the stack is a valid item for this slot. Always true beside for the armor slots. */ @Override - public boolean isItemValid(ItemStack par1ItemStack) + public boolean isItemValid(final ItemStack par1ItemStack) { return false; } @@ -34,7 +34,7 @@ public class SlotOutput extends SlotCrafting{ * stack. */ @Override - public ItemStack decrStackSize(int par1) + public ItemStack decrStackSize(final int par1) { if (this.getHasStack()) { @@ -47,7 +47,7 @@ public class SlotOutput extends SlotCrafting{ * internal count then calls onCrafting(item). */ @Override - protected void onCrafting(ItemStack par1ItemStack, int par2) + protected void onCrafting(final ItemStack par1ItemStack, final int par2) { this.amountCrafted += par2; this.onCrafting(par1ItemStack); @@ -56,30 +56,30 @@ public class SlotOutput extends SlotCrafting{ * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. */ @Override - protected void onCrafting(ItemStack stack) + protected void onCrafting(final ItemStack stack) { stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); this.amountCrafted = 0; } @Override - public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + public void onPickupFromSlot(final EntityPlayer playerIn, final ItemStack stack) { { - FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix); + FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, this.craftMatrix); this.onCrafting(stack); for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) { - ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); + final ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); if (itemstack1 != null) { this.craftMatrix.decrStackSize(i, 1); if (itemstack1.getItem().hasContainerItem(itemstack1)) { ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); - if (itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) + if (itemstack2.isItemStackDamageable() && (itemstack2.getItemDamage() > itemstack2.getMaxDamage())) { - MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2)); + MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this.thePlayer, itemstack2)); itemstack2 = null; } if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2)) diff --git a/src/Java/gtPlusPlus/core/slots/SlotRTG.java b/src/Java/gtPlusPlus/core/slots/SlotRTG.java index 1f16463de2..398bae08a5 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotRTG.java +++ b/src/Java/gtPlusPlus/core/slots/SlotRTG.java @@ -7,13 +7,13 @@ import net.minecraft.item.ItemStack; public class SlotRTG extends Slot{ - public SlotRTG(IInventory inventory, int x, int y, int z) { + public SlotRTG(final IInventory inventory, final int x, final int y, final int z) { super(inventory, x, y, z); } @Override - public boolean isItemValid(ItemStack itemstack) { + public boolean isItemValid(final ItemStack itemstack) { return itemstack.getItem().getClass() == Ic2Items.RTGPellets.getItem().getClass(); } diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java index 535fc0c957..46f2416ee1 100644 --- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java +++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java @@ -1,11 +1,11 @@ package gtPlusPlus.core.tileentities; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.tileentities.general.TileEntityFirepit; import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; import gtPlusPlus.core.util.Utils; -import cpw.mods.fml.common.registry.GameRegistry; public class ModTileEntities { diff --git a/src/Java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java b/src/Java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java index 67c592c79c..839bcc353a 100644 --- a/src/Java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java +++ b/src/Java/gtPlusPlus/core/tileentities/base/TILE_ENTITY_BASE.java @@ -9,31 +9,31 @@ import net.minecraft.tileentity.TileEntity; public class TILE_ENTITY_BASE extends TileEntity { @Override - public void writeToNBT(NBTTagCompound tag) { + public void writeToNBT(final NBTTagCompound tag) { super.writeToNBT(tag); - writeCustomNBT(tag); + this.writeCustomNBT(tag); } @Override - public void readFromNBT(NBTTagCompound tag) { + public void readFromNBT(final NBTTagCompound tag) { super.readFromNBT(tag); - readCustomNBT(tag); + this.readCustomNBT(tag); } - public void writeCustomNBT(NBTTagCompound tag) {} - public void readCustomNBT(NBTTagCompound tag) {} + public void writeCustomNBT(final NBTTagCompound tag) {} + public void readCustomNBT(final NBTTagCompound tag) {} @Override public Packet getDescriptionPacket() { - NBTTagCompound tag = new NBTTagCompound(); - writeCustomNBT(tag); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, tag); + final NBTTagCompound tag = new NBTTagCompound(); + this.writeCustomNBT(tag); + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, -999, tag); } @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { + public void onDataPacket(final NetworkManager net, final S35PacketUpdateTileEntity packet) { super.onDataPacket(net, packet); - readCustomNBT(packet.func_148857_g()); + this.readCustomNBT(packet.func_148857_g()); } } diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java index 0f2cd3390e..49fde8ee64 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFirepit.java @@ -6,34 +6,34 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; public class TileEntityFirepit extends TileEntity{ - + private UUID ownerUUID; public UUID getOwnerUUID() { - return ownerUUID; + return this.ownerUUID; } - public void setOwnerUUID(UUID ownerUUID) { + public void setOwnerUUID(final UUID ownerUUID) { this.ownerUUID = ownerUUID; - markDirty(); + this.markDirty(); } @Override - public void writeToNBT(NBTTagCompound tagCompound) { + public void writeToNBT(final NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); - UUID ownerUUID = getOwnerUUID(); + final UUID ownerUUID = this.getOwnerUUID(); if (ownerUUID != null){ - tagCompound.setLong("OwnerUUIDMost", ownerUUID.getMostSignificantBits()); - tagCompound.setLong("OwnerUUIDLeast", ownerUUID.getLeastSignificantBits()); + tagCompound.setLong("OwnerUUIDMost", ownerUUID.getMostSignificantBits()); + tagCompound.setLong("OwnerUUIDLeast", ownerUUID.getLeastSignificantBits()); } } @Override - public void readFromNBT(NBTTagCompound tagCompound) { + public void readFromNBT(final NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); - setOwnerUUID(new UUID(tagCompound.getLong("OwnerUUIDMost"), tagCompound.getLong("OwnerUUIDLeast"))); + this.setOwnerUUID(new UUID(tagCompound.getLong("OwnerUUIDMost"), tagCompound.getLong("OwnerUUIDLeast"))); } - + } diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java index 5d07020bf3..e003de4392 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.tileentities.general; import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.*; +import gtPlusPlus.core.inventories.InventoryFishTrap; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; @@ -16,7 +16,7 @@ public class TileEntityFishTrap extends TileEntity{ private int tickCount = 0; private boolean isInWater = false; - private InventoryFishTrap inventoryContents; + private final InventoryFishTrap inventoryContents; private int locationX; private int locationY; private int locationZ; @@ -25,38 +25,38 @@ public class TileEntityFishTrap extends TileEntity{ public TileEntityFishTrap(){ this.inventoryContents = new InventoryFishTrap();//number of slots - without product slot - setTileLocation(); + this.setTileLocation(); } public boolean setTileLocation(){ if (this.hasWorldObj()){ if (!this.getWorldObj().isRemote){ - locationX = this.xCoord; - locationY = this.yCoord; - locationZ = this.zCoord; + this.locationX = this.xCoord; + this.locationY = this.yCoord; + this.locationZ = this.zCoord; return true; } } - return false; + return false; } public final boolean isSurroundedByWater(){ - setTileLocation(); - Block[] surroundingBlocks = new Block[6]; + this.setTileLocation(); + final Block[] surroundingBlocks = new Block[6]; if (this.hasWorldObj()){ if (!this.getWorldObj().isRemote){ - surroundingBlocks[0] = worldObj.getBlock(locationX, locationY+1, locationZ); //Above - surroundingBlocks[1] = worldObj.getBlock(locationX, locationY-1, locationZ); //Below - surroundingBlocks[2] = worldObj.getBlock(locationX+1, locationY, locationZ); - surroundingBlocks[3] = worldObj.getBlock(locationX-1, locationY, locationZ); - surroundingBlocks[4] = worldObj.getBlock(locationX, locationY, locationZ+1); - surroundingBlocks[5] = worldObj.getBlock(locationX, locationY, locationZ-1); + surroundingBlocks[0] = this.worldObj.getBlock(this.locationX, this.locationY+1, this.locationZ); //Above + surroundingBlocks[1] = this.worldObj.getBlock(this.locationX, this.locationY-1, this.locationZ); //Below + surroundingBlocks[2] = this.worldObj.getBlock(this.locationX+1, this.locationY, this.locationZ); + surroundingBlocks[3] = this.worldObj.getBlock(this.locationX-1, this.locationY, this.locationZ); + surroundingBlocks[4] = this.worldObj.getBlock(this.locationX, this.locationY, this.locationZ+1); + surroundingBlocks[5] = this.worldObj.getBlock(this.locationX, this.locationY, this.locationZ-1); int waterCount = 0; int trapCount = 0; - for (Block checkBlock : surroundingBlocks){ - if (checkBlock == Blocks.water || checkBlock == Blocks.flowing_water || checkBlock.getUnlocalizedName().toLowerCase().contains("water") || checkBlock == ModBlocks.blockFishTrap){ + for (final Block checkBlock : surroundingBlocks){ + if ((checkBlock == Blocks.water) || (checkBlock == Blocks.flowing_water) || checkBlock.getUnlocalizedName().toLowerCase().contains("water") || (checkBlock == ModBlocks.blockFishTrap)){ if (checkBlock != ModBlocks.blockFishTrap){ - waterCount++; + waterCount++; } else { waterCount++; @@ -64,11 +64,11 @@ public class TileEntityFishTrap extends TileEntity{ } } } - if (waterCount >= 2 && trapCount <= 4){ + if ((waterCount >= 2) && (trapCount <= 4)){ this.waterSides = waterCount; return true; } - else if (waterCount >= 2 && trapCount > 4){ + else if ((waterCount >= 2) && (trapCount > 4)){ Utils.LOG_INFO("Too many fish traps surrounding this one."); Utils.LOG_INFO("Not adding Loot to the fishtrap at x["+this.locationX+"] y["+this.locationY+"] z["+this.locationZ+"] (Ticking for loot every "+this.baseTickRate+" ticks)"); } @@ -85,8 +85,8 @@ public class TileEntityFishTrap extends TileEntity{ public boolean tryAddLoot(){ if (this.getInventory().getInventory() != null){ int checkingSlot = 0; - ItemStack loot = generateLootForFishTrap(); - for (ItemStack contents : this.getInventory().getInventory()){ + final ItemStack loot = this.generateLootForFishTrap(); + for (final ItemStack contents : this.getInventory().getInventory()){ if (contents == null){ this.getInventory().setInventorySlotContents(checkingSlot, loot); this.markDirty(); @@ -115,10 +115,10 @@ public class TileEntityFishTrap extends TileEntity{ } private ItemStack generateLootForFishTrap() { - int lootWeight = MathUtils.randInt(0, 100); + final int lootWeight = MathUtils.randInt(0, 100); ItemStack loot; if (lootWeight <= 10){ - loot = ItemUtils.getSimpleStack(Items.slime_ball); + loot = ItemUtils.getSimpleStack(Items.slime_ball); } else if (lootWeight <= 20){ loot = ItemUtils.getSimpleStack(Items.bone); @@ -144,29 +144,29 @@ public class TileEntityFishTrap extends TileEntity{ this.tickCount++; //Utils.LOG_INFO("Ticking "+this.tickCount); //Check if the Tile is within water once per second. - if (this.tickCount%20==0){ - this.isInWater = isSurroundedByWater(); + if ((this.tickCount%20)==0){ + this.isInWater = this.isSurroundedByWater(); } else { } - + if (this.isInWater){ - calculateTickrate(); + this.calculateTickrate(); } - + //Try add some loot once every 30 seconds. - if (this.tickCount%this.baseTickRate==0){ + if ((this.tickCount%this.baseTickRate)==0){ if (this.isInWater){ //Add loot Utils.LOG_INFO("Adding Loot to the fishtrap at x["+this.locationX+"] y["+this.locationY+"] z["+this.locationZ+"] (Ticking for loot every "+this.baseTickRate+" ticks)"); - tryAddLoot(); - markDirty(); - } + this.tryAddLoot(); + this.markDirty(); + } else { Utils.LOG_INFO("This Trap does not have enough water around it."); Utils.LOG_INFO("Not adding Loot to the fishtrap at x["+this.locationX+"] y["+this.locationY+"] z["+this.locationZ+"] (Ticking for loot every "+this.baseTickRate+" ticks)"); - markDirty(); + this.markDirty(); } this.tickCount = 0; } @@ -177,21 +177,21 @@ public class TileEntityFishTrap extends TileEntity{ } } - + public void calculateTickrate(){ int calculateTickrate = 0; if (this.waterSides < 2){ calculateTickrate = 0; } - else if (this.waterSides >= 2 && this.waterSides < 4){ + else if ((this.waterSides >= 2) && (this.waterSides < 4)){ calculateTickrate = 3000; } - else if (this.waterSides >= 4 && this.waterSides < 6){ + else if ((this.waterSides >= 4) && (this.waterSides < 6)){ calculateTickrate = 2000; } else if (this.waterSides == 6){ calculateTickrate = 900; - } + } this.baseTickRate = calculateTickrate; } @@ -199,7 +199,7 @@ public class TileEntityFishTrap extends TileEntity{ return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; } - public NBTTagCompound getTag(NBTTagCompound nbt, String tag){ + public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag){ if(!nbt.hasKey(tag)){ nbt.setTag(tag, new NBTTagCompound()); } @@ -208,19 +208,19 @@ public class TileEntityFishTrap extends TileEntity{ @Override - public void writeToNBT(NBTTagCompound nbt){ + public void writeToNBT(final NBTTagCompound nbt){ super.writeToNBT(nbt); //Utils.LOG_INFO("Trying to write NBT data to TE."); - NBTTagCompound chestData = new NBTTagCompound(); - inventoryContents.writeToNBT(chestData); + final NBTTagCompound chestData = new NBTTagCompound(); + this.inventoryContents.writeToNBT(chestData); nbt.setTag("ContentsChest", chestData); } @Override - public void readFromNBT(NBTTagCompound nbt){ + public void readFromNBT(final NBTTagCompound nbt){ super.readFromNBT(nbt); //Utils.LOG_INFO("Trying to read NBT data from TE."); - inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest")); + this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest")); } } diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityReverter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityReverter.java index 8767b6607c..7f5c0ed8da 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityReverter.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityReverter.java @@ -1,9 +1,8 @@ package gtPlusPlus.core.tileentities.general; -import gtPlusPlus.core.block.ModBlocks; - import java.util.Random; +import gtPlusPlus.core.block.ModBlocks; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; @@ -14,7 +13,7 @@ public class TileEntityReverter extends TileEntity { private static final int REVERT_CHANCE = 10; public int radius = 16; - public int diameter = 8 * this.radius + 4; + public int diameter = (8 * this.radius) + 4; public double requiredPlayerRange = 64.0D; public Random rand = new Random(); private int tickCount; @@ -23,38 +22,40 @@ public class TileEntityReverter extends TileEntity private Block[] blockData; private byte[] metaData; + @Override public boolean canUpdate(){ return true; } + @Override public void updateEntity() { - if (anyPlayerInRange()) + if (this.anyPlayerInRange()) { this.tickCount += 1; if (this.worldObj.isRemote) { - double var1 = this.xCoord + this.worldObj.rand.nextFloat(); - double var3 = this.yCoord + this.worldObj.rand.nextFloat(); - double var5 = this.zCoord + this.worldObj.rand.nextFloat(); + final double var1 = this.xCoord + this.worldObj.rand.nextFloat(); + final double var3 = this.yCoord + this.worldObj.rand.nextFloat(); + final double var5 = this.zCoord + this.worldObj.rand.nextFloat(); this.worldObj.spawnParticle("enchantmenttable", var1, var3, var5, 0.0D, 0.0D, 0.0D); if (this.rand.nextInt(5) == 0) { - makeRandomOutline(); - makeRandomOutline(); - makeRandomOutline(); + this.makeRandomOutline(); + this.makeRandomOutline(); + this.makeRandomOutline(); } } else { if ((this.blockData == null) || (this.metaData == null)) { - captureBlockData(); + this.captureBlockData(); this.slowScan = true; } - if ((!this.slowScan) || (this.tickCount % 20 == 0)) { - if (scanAndRevertChanges()) + if ((!this.slowScan) || ((this.tickCount % 20) == 0)) { + if (this.scanAndRevertChanges()) { this.slowScan = false; this.ticksSinceChange = 0; @@ -80,10 +81,10 @@ public class TileEntityReverter extends TileEntity private void makeRandomOutline() { - makeOutline(this.rand.nextInt(12)); + this.makeOutline(this.rand.nextInt(12)); } - private void makeOutline(int outline) + private void makeOutline(final int outline) { double sx = this.xCoord; double sy = this.yCoord; @@ -94,57 +95,57 @@ public class TileEntityReverter extends TileEntity double dz = this.zCoord; switch (outline) { - case 0: + case 0: sx -= this.radius; dx -= this.radius; sz -= this.radius; dz += this.radius + 1; - case 8: + case 8: sx -= this.radius; dx += this.radius + 1; sz -= this.radius; dz -= this.radius; break; - case 1: - case 9: + case 1: + case 9: sx -= this.radius; dx -= this.radius; sz -= this.radius; dz += this.radius + 1; break; - case 2: - case 10: + case 2: + case 10: sx -= this.radius; dx += this.radius + 1; sz += this.radius + 1; dz += this.radius + 1; break; - case 3: - case 11: + case 3: + case 11: sx += this.radius + 1; dx += this.radius + 1; sz -= this.radius; dz += this.radius + 1; break; - case 4: + case 4: sx -= this.radius; dx -= this.radius; sz -= this.radius; dz -= this.radius; break; - case 5: + case 5: sx += this.radius + 1; dx += this.radius + 1; sz -= this.radius; dz -= this.radius; break; - case 6: + case 6: sx += this.radius + 1; dx += this.radius + 1; sz += this.radius + 1; dz += this.radius + 1; break; - case 7: + case 7: sx -= this.radius; dx -= this.radius; sz += this.radius + 1; @@ -152,45 +153,45 @@ public class TileEntityReverter extends TileEntity } switch (outline) { - case 0: - case 1: - case 2: - case 3: + case 0: + case 1: + case 2: + case 3: sy += this.radius + 1; dy += this.radius + 1; break; - case 4: - case 5: - case 6: - case 7: + case 4: + case 5: + case 6: + case 7: sy -= this.radius; dy += this.radius + 1; break; - case 8: - case 9: - case 10: - case 11: + case 8: + case 9: + case 10: + case 11: sy -= this.radius; dy -= this.radius; } if (this.rand.nextBoolean()) { - drawParticleLine(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, dx, dy, dz); + this.drawParticleLine(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, dx, dy, dz); } else { - drawParticleLine(sx, sy, sz, this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D); + this.drawParticleLine(sx, sy, sz, this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D); } - drawParticleLine(sx, sy, sz, dx, dy, dz); + this.drawParticleLine(sx, sy, sz, dx, dy, dz); } - protected void drawParticleLine(double srcX, double srcY, double srcZ, double destX, double destY, double destZ) + protected void drawParticleLine(final double srcX, final double srcY, final double srcZ, final double destX, final double destY, final double destZ) { - int particles = 16; + final int particles = 16; for (int i = 0; i < particles; i++) { - double trailFactor = i / (particles - 1.0D); + final double trailFactor = i / (particles - 1.0D); - double tx = srcX + (destX - srcX) * trailFactor + this.rand.nextFloat() * 0.005D; - double ty = srcY + (destY - srcY) * trailFactor + this.rand.nextFloat() * 0.005D; - double tz = srcZ + (destZ - srcZ) * trailFactor + this.rand.nextFloat() * 0.005D; + final double tx = srcX + ((destX - srcX) * trailFactor) + (this.rand.nextFloat() * 0.005D); + final double ty = srcY + ((destY - srcY) * trailFactor) + (this.rand.nextFloat() * 0.005D); + final double tz = srcZ + ((destZ - srcZ) * trailFactor) + (this.rand.nextFloat() * 0.005D); this.worldObj.spawnParticle("portal", tx, ty, tz, 0.0D, 0.0D, 0.0D); } } @@ -203,10 +204,10 @@ public class TileEntityReverter extends TileEntity for (int y = -this.radius; y <= this.radius; y++) { for (int z = -this.radius; z <= this.radius; z++) { - Block blockID = this.worldObj.getBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z); - byte meta = (byte)this.worldObj.getBlockMetadata(this.xCoord + x, this.yCoord + y, this.zCoord + z); + final Block blockID = this.worldObj.getBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z); + final byte meta = (byte)this.worldObj.getBlockMetadata(this.xCoord + x, this.yCoord + y, this.zCoord + z); if (this.blockData[index] != blockID) { - if (revertBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z, blockID, meta, this.blockData[index], this.metaData[index])) + if (this.revertBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z, blockID, meta, this.blockData[index], this.metaData[index])) { reverted = true; } @@ -223,7 +224,7 @@ public class TileEntityReverter extends TileEntity return reverted; } - private boolean revertBlock(int x, int y, int z, Block thereBlockID, byte thereMeta, Block replaceBlockID, byte replaceMeta) + private boolean revertBlock(final int x, final int y, final int z, final Block thereBlockID, final byte thereMeta, final Block replaceBlockID, byte replaceMeta) { /*if ((thereBlockID == Blocks.air) && (!replaceBlockID.getMaterial().blocksMovement())) { @@ -231,7 +232,7 @@ public class TileEntityReverter extends TileEntity return false; }*/ - if (isUnrevertable(thereBlockID, thereMeta, replaceBlockID, replaceMeta)) { + if (this.isUnrevertable(thereBlockID, thereMeta, replaceBlockID, replaceMeta)) { return false; } if (this.rand.nextInt(5) == 0) @@ -255,7 +256,7 @@ public class TileEntityReverter extends TileEntity return true; } - private boolean isUnrevertable(Block thereBlockID, byte thereMeta, Block replaceBlockID, byte replaceMeta) + private boolean isUnrevertable(final Block thereBlockID, final byte thereMeta, final Block replaceBlockID, final byte replaceMeta) { if ((thereBlockID == ModBlocks.blockGriefSaver) || (replaceBlockID == ModBlocks.blockGriefSaver)) { return true; @@ -291,8 +292,8 @@ public class TileEntityReverter extends TileEntity for (int y = -this.radius; y <= this.radius; y++) { for (int z = -this.radius; z <= this.radius; z++) { - Block blockID = this.worldObj.getBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z); - int meta = this.worldObj.getBlockMetadata(this.xCoord + x, this.yCoord + y, this.zCoord + z); + final Block blockID = this.worldObj.getBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z); + final int meta = this.worldObj.getBlockMetadata(this.xCoord + x, this.yCoord + y, this.zCoord + z); this.blockData[index] = blockID; this.metaData[index] = ((byte)meta); diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java index 8a38269609..eac2724aa0 100644 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java @@ -1,15 +1,13 @@ package gtPlusPlus.core.tileentities.machines; +import java.util.List; +import java.util.Vector; + import gtPlusPlus.core.inventories.*; import ic2.api.network.INetworkDataProvider; import ic2.api.network.INetworkUpdateListener; import ic2.api.tile.IWrenchable; import ic2.core.IC2; -import ic2.core.network.NetworkManager; - -import java.util.List; -import java.util.Vector; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; @@ -24,8 +22,8 @@ public class TileEntityWorkbench extends TileEntity implements INetworkDataProvi public InventoryWorkbenchChest inventoryChest; public InventoryWorkbenchTools inventoryTool; - public InventoryWorkbenchHoloSlots inventoryHolo; - public InventoryWorkbenchHoloCrafting inventoryCrafting; + public InventoryWorkbenchHoloSlots inventoryHolo; + public InventoryWorkbenchHoloCrafting inventoryCrafting; public IInventory inventoryCraftResult = new InventoryCraftResult(); @@ -38,7 +36,7 @@ public class TileEntityWorkbench extends TileEntity implements INetworkDataProvi } @SuppressWarnings("static-method") - public NBTTagCompound getTag(NBTTagCompound nbt, String tag) + public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { if(!nbt.hasKey(tag)) { @@ -48,75 +46,76 @@ public class TileEntityWorkbench extends TileEntity implements INetworkDataProvi } @Override - public void writeToNBT(NBTTagCompound nbt) + public void writeToNBT(final NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setShort("facing", this.facing); - - inventoryChest.writeToNBT(getTag(nbt, "ContentsChest")); - inventoryTool.writeToNBT(getTag(nbt, "ContentsTools")); + + this.inventoryChest.writeToNBT(this.getTag(nbt, "ContentsChest")); + this.inventoryTool.writeToNBT(this.getTag(nbt, "ContentsTools")); //inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting")); - inventoryHolo.writeToNBT(getTag(nbt, "ContentsHolo")); + this.inventoryHolo.writeToNBT(this.getTag(nbt, "ContentsHolo")); // Write Crafting Matrix to NBT - NBTTagList craftingTag = new NBTTagList(); - for (int currentIndex = 0; currentIndex < inventoryCrafting.getSizeInventory(); ++currentIndex) { - if (inventoryCrafting.getStackInSlot(currentIndex) != null) { - NBTTagCompound tagCompound = new NBTTagCompound(); + final NBTTagList craftingTag = new NBTTagList(); + for (int currentIndex = 0; currentIndex < this.inventoryCrafting.getSizeInventory(); ++currentIndex) { + if (this.inventoryCrafting.getStackInSlot(currentIndex) != null) { + final NBTTagCompound tagCompound = new NBTTagCompound(); tagCompound.setByte("Slot", (byte) currentIndex); - inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound); + this.inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound); craftingTag.appendTag(tagCompound); } } nbt.setTag("CraftingMatrix", craftingTag); // Write craftingResult to NBT - if (inventoryCraftResult.getStackInSlot(0) != null) - nbt.setTag("CraftingResult", inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound())); + if (this.inventoryCraftResult.getStackInSlot(0) != null) { + nbt.setTag("CraftingResult", this.inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound())); + } } @Override - public void readFromNBT(NBTTagCompound nbt) + public void readFromNBT(final NBTTagCompound nbt) { super.readFromNBT(nbt); - this.prevFacing = (this.facing = nbt.getShort("facing")); - - inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest")); - inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools")); + this.prevFacing = (this.facing = nbt.getShort("facing")); + + this.inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest")); + this.inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools")); //inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting")); - inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo")); + this.inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo")); // Read in the Crafting Matrix from NBT - NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10); - inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number + final NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10); + this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number for (int i = 0; i < craftingTag.tagCount(); ++i) { - NBTTagCompound tagCompound = (NBTTagCompound) craftingTag.getCompoundTagAt(i); - byte slot = tagCompound.getByte("Slot"); - if (slot >= 0 && slot < inventoryCrafting.getSizeInventory()) { - inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound)); + final NBTTagCompound tagCompound = craftingTag.getCompoundTagAt(i); + final byte slot = tagCompound.getByte("Slot"); + if ((slot >= 0) && (slot < this.inventoryCrafting.getSizeInventory())) { + this.inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound)); } } // Read craftingResult from NBT - NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult"); - inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult)); + final NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult"); + this.inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult)); } @Override public List<String> getNetworkedFields(){ - List<String> ret = new Vector(2); - ret.add("facing"); + final List<String> ret = new Vector(2); + ret.add("facing"); return ret; } @Override - public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) + public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side) { return false; } @@ -125,11 +124,11 @@ public class TileEntityWorkbench extends TileEntity implements INetworkDataProvi public short prevFacing = 0; @Override - public void setFacing(short facing1) + public void setFacing(final short facing1) { this.facing = facing1; if (this.prevFacing != facing1) { - ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "facing"); + IC2.network.get().updateTileEntityField(this, "facing"); } this.prevFacing = facing1; } @@ -142,7 +141,7 @@ public class TileEntityWorkbench extends TileEntity implements INetworkDataProvi @Override - public boolean wrenchCanRemove(EntityPlayer entityPlayer) + public boolean wrenchCanRemove(final EntityPlayer entityPlayer) { return true; } @@ -154,16 +153,16 @@ public class TileEntityWorkbench extends TileEntity implements INetworkDataProvi } @Override - public ItemStack getWrenchDrop(EntityPlayer entityPlayer) + public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) { return new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord), 1, this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)); } @Override - public void onNetworkUpdate(String field) { + public void onNetworkUpdate(final String field) { + + this.prevFacing = this.facing; - this.prevFacing = this.facing; - } diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java index 011498fd5d..fdf89e523b 100644 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.tileentities.machines; +import java.util.List; +import java.util.Vector; + import gtPlusPlus.core.inventories.*; import ic2.api.energy.event.EnergyTileLoadEvent; import ic2.api.energy.event.EnergyTileUnloadEvent; @@ -8,11 +11,6 @@ import ic2.api.network.INetworkDataProvider; import ic2.api.network.INetworkUpdateListener; import ic2.api.tile.IWrenchable; import ic2.core.IC2; -import ic2.core.network.NetworkManager; - -import java.util.List; -import java.util.Vector; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; @@ -29,8 +27,8 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi public InventoryWorkbenchChest inventoryChest; public InventoryWorkbenchToolsElectric inventoryTool; - public InventoryWorkbenchHoloSlots inventoryHolo; - public InventoryWorkbenchHoloCrafting inventoryCrafting; + public InventoryWorkbenchHoloSlots inventoryHolo; + public InventoryWorkbenchHoloCrafting inventoryCrafting; public IInventory inventoryCraftResult = new InventoryCraftResult(); @@ -46,7 +44,7 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi private float guiChargeLevel; - public TileEntityWorkbenchAdvanced(int maxenergy, int tier1){ + public TileEntityWorkbenchAdvanced(final int maxenergy, final int tier1){ this.inventoryTool = new InventoryWorkbenchToolsElectric();//number of slots - without product slot this.inventoryChest = new InventoryWorkbenchChest();//number of slots - without product slot this.inventoryHolo = new InventoryWorkbenchHoloSlots(); @@ -60,7 +58,7 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi } @SuppressWarnings("static-method") - public NBTTagCompound getTag(NBTTagCompound nbt, String tag) + public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { if(!nbt.hasKey(tag)) { @@ -70,68 +68,69 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi } @Override - public void writeToNBT(NBTTagCompound nbt) + public void writeToNBT(final NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setDouble("energy", this.energy); nbt.setShort("facing", this.facing); - inventoryChest.writeToNBT(getTag(nbt, "ContentsChest")); - inventoryTool.writeToNBT(getTag(nbt, "ContentsTools")); + this.inventoryChest.writeToNBT(this.getTag(nbt, "ContentsChest")); + this.inventoryTool.writeToNBT(this.getTag(nbt, "ContentsTools")); //inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting")); - inventoryHolo.writeToNBT(getTag(nbt, "ContentsHolo")); + this.inventoryHolo.writeToNBT(this.getTag(nbt, "ContentsHolo")); // Write Crafting Matrix to NBT - NBTTagList craftingTag = new NBTTagList(); - for (int currentIndex = 0; currentIndex < inventoryCrafting.getSizeInventory(); ++currentIndex) { - if (inventoryCrafting.getStackInSlot(currentIndex) != null) { - NBTTagCompound tagCompound = new NBTTagCompound(); + final NBTTagList craftingTag = new NBTTagList(); + for (int currentIndex = 0; currentIndex < this.inventoryCrafting.getSizeInventory(); ++currentIndex) { + if (this.inventoryCrafting.getStackInSlot(currentIndex) != null) { + final NBTTagCompound tagCompound = new NBTTagCompound(); tagCompound.setByte("Slot", (byte) currentIndex); - inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound); + this.inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound); craftingTag.appendTag(tagCompound); } } nbt.setTag("CraftingMatrix", craftingTag); // Write craftingResult to NBT - if (inventoryCraftResult.getStackInSlot(0) != null) - nbt.setTag("CraftingResult", inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound())); + if (this.inventoryCraftResult.getStackInSlot(0) != null) { + nbt.setTag("CraftingResult", this.inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound())); + } } @Override - public void readFromNBT(NBTTagCompound nbt) + public void readFromNBT(final NBTTagCompound nbt) { super.readFromNBT(nbt); this.energy = nbt.getDouble("energy"); this.prevFacing = (this.facing = nbt.getShort("facing")); - inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest")); - inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools")); + this.inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest")); + this.inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools")); //inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting")); - inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo")); + this.inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo")); // Read in the Crafting Matrix from NBT - NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10); - inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number + final NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10); + this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number for (int i = 0; i < craftingTag.tagCount(); ++i) { - NBTTagCompound tagCompound = (NBTTagCompound) craftingTag.getCompoundTagAt(i); - byte slot = tagCompound.getByte("Slot"); - if (slot >= 0 && slot < inventoryCrafting.getSizeInventory()) { - inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound)); + final NBTTagCompound tagCompound = craftingTag.getCompoundTagAt(i); + final byte slot = tagCompound.getByte("Slot"); + if ((slot >= 0) && (slot < this.inventoryCrafting.getSizeInventory())) { + this.inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound)); } } // Read craftingResult from NBT - NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult"); - inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult)); + final NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult"); + this.inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult)); } @Override - public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) + public boolean acceptsEnergyFrom(final TileEntity emitter, final ForgeDirection direction) { return true; } @@ -149,7 +148,7 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi } @Override - public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) + public double injectEnergy(final ForgeDirection directionFrom, final double amount, final double voltage) { if (this.energy >= this.maxEnergy) { return amount; @@ -163,12 +162,12 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi return this.guiChargeLevel; } - public void setTier(int tier1) + public void setTier(final int tier1) { if (this.tier == tier1) { return; } - boolean addedToENet = this.addedToEnergyNet; + final boolean addedToENet = this.addedToEnergyNet; if (addedToENet) { MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); @@ -176,7 +175,7 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi } this.tier = tier1; - for (int i=0; i<inventoryTool.getSizeInventory(); i++){ + for (int i=0; i<this.inventoryTool.getSizeInventory(); i++){ //this.inventoryTool..setTier(tier1); TODO } @@ -189,24 +188,24 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi @Override public List<String> getNetworkedFields(){ - List<String> ret = new Vector(2); - ret.add("facing"); + final List<String> ret = new Vector(2); + ret.add("facing"); return ret; } @Override - public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) + public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side) { return false; } @Override - public void setFacing(short facing1) + public void setFacing(final short facing1) { this.facing = facing1; if (this.prevFacing != facing1) { - ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "facing"); + IC2.network.get().updateTileEntityField(this, "facing"); } this.prevFacing = facing1; } @@ -219,7 +218,7 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi @Override - public boolean wrenchCanRemove(EntityPlayer entityPlayer) + public boolean wrenchCanRemove(final EntityPlayer entityPlayer) { return true; } @@ -231,13 +230,13 @@ public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySi } @Override - public ItemStack getWrenchDrop(EntityPlayer entityPlayer) + public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) { return new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord), 1, this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)); } @Override - public void onNetworkUpdate(String field) { + public void onNetworkUpdate(final String field) { this.prevFacing = this.facing; diff --git a/src/Java/gtPlusPlus/core/util/BaseHandler.java b/src/Java/gtPlusPlus/core/util/BaseHandler.java index 63f22f3763..9457dc363f 100644 --- a/src/Java/gtPlusPlus/core/util/BaseHandler.java +++ b/src/Java/gtPlusPlus/core/util/BaseHandler.java @@ -3,9 +3,9 @@ package gtPlusPlus.core.util; public abstract class BaseHandler { public abstract void preInit(); - + public abstract void init(); - + public abstract void postInit(); - + } diff --git a/src/Java/gtPlusPlus/core/util/ClassUtils.java b/src/Java/gtPlusPlus/core/util/ClassUtils.java index dfd8ec898b..20ca894211 100644 --- a/src/Java/gtPlusPlus/core/util/ClassUtils.java +++ b/src/Java/gtPlusPlus/core/util/ClassUtils.java @@ -10,31 +10,31 @@ public class ClassUtils { // There is therefore no more risk of code throwing NoClassDefFoundException. executeCodeLinkingToDependency(); }*/ - public static boolean isPresent(String className) { + public static boolean isPresent(final String className) { try { Class.forName(className); return true; - } catch (Throwable ex) { + } catch (final Throwable ex) { // Class or one of its dependencies is not present... return false; } } - public static Method getMethodViaReflection(Class<?> lookupClass, String methodName, boolean invoke) throws Exception{ - Class<? extends Class> lookup = lookupClass.getClass(); - Method m = lookup.getDeclaredMethod(methodName); - m.setAccessible(true);// Abracadabra + public static Method getMethodViaReflection(final Class<?> lookupClass, final String methodName, final boolean invoke) throws Exception{ + final Class<? extends Class> lookup = lookupClass.getClass(); + final Method m = lookup.getDeclaredMethod(methodName); + m.setAccessible(true);// Abracadabra if (invoke){ m.invoke(lookup);// now its OK } return m; } - public static Class getNonPublicClass(String className){ + public static Class getNonPublicClass(final String className){ Class<?> c = null; try { c = Class.forName(className); - } catch (ClassNotFoundException e) { + } catch (final ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } @@ -59,7 +59,7 @@ public class ClassUtils { constructor.setAccessible(true);//ABRACADABRA! try { - Object o = constructor.newInstance(); + final Object o = constructor.newInstance(); return (Class) o; } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { diff --git a/src/Java/gtPlusPlus/core/util/Log.java b/src/Java/gtPlusPlus/core/util/Log.java index ea7076e453..aa0231b954 100644 --- a/src/Java/gtPlusPlus/core/util/Log.java +++ b/src/Java/gtPlusPlus/core/util/Log.java @@ -5,25 +5,25 @@ import org.apache.logging.log4j.Logger; public final class Log { - public static final Logger LOGGER = LogManager.getLogger("MiscUtils"); - - public static void warn(String msg) - { - LOGGER.warn(msg); - } - - public static void error(String msg) - { - LOGGER.error(msg); - } - - public static void info(String msg) - { - LOGGER.info(msg); - } - - public static void debug(String msg) - { - LOGGER.debug(msg); - } + public static final Logger LOGGER = LogManager.getLogger("MiscUtils"); + + public static void warn(final String msg) + { + LOGGER.warn(msg); + } + + public static void error(final String msg) + { + LOGGER.error(msg); + } + + public static void info(final String msg) + { + LOGGER.info(msg); + } + + public static void debug(final String msg) + { + LOGGER.debug(msg); + } } diff --git a/src/Java/gtPlusPlus/core/util/LoggingUtils.java b/src/Java/gtPlusPlus/core/util/LoggingUtils.java index 607771bc8e..3e8219d53a 100644 --- a/src/Java/gtPlusPlus/core/util/LoggingUtils.java +++ b/src/Java/gtPlusPlus/core/util/LoggingUtils.java @@ -5,47 +5,47 @@ import java.util.Date; public class LoggingUtils { - public static void profileLog(Object o){ - try { + public static void profileLog(final Object o){ + try { String content; - File file = new File("GregtechTimingsTC.txt"); + final File file = new File("GregtechTimingsTC.txt"); // if file doesnt exists, then create it if (!file.exists()) { file.createNewFile(); - FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); - BufferedWriter bw = new BufferedWriter(fw); + final FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); + final BufferedWriter bw = new BufferedWriter(fw); bw.write("============================================================"); bw.write(System.lineSeparator()); bw.close(); - } + } if (o instanceof String){ content = (String) o; - } - else { - content = o.toString(); - } - FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); - BufferedWriter bw = new BufferedWriter(fw); + } + else { + content = o.toString(); + } + final FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); + final BufferedWriter bw = new BufferedWriter(fw); bw.write(content); bw.write(System.lineSeparator()); bw.close(); System.out.println("Data Logged."); - } catch (IOException e) { + } catch (final IOException e) { System.out.println("Data logging failed."); } - } - - public static boolean logCurrentSystemTime(String message){ - Date date = new Date(System.currentTimeMillis()); - try { - profileLog(message+" | "+date.toString()); - return true; - } - catch (Throwable r) { - return false; - } - } - + + public static boolean logCurrentSystemTime(final String message){ + final Date date = new Date(System.currentTimeMillis()); + try { + profileLog(message+" | "+date.toString()); + return true; + } + catch (final Throwable r) { + return false; + } + + } + } diff --git a/src/Java/gtPlusPlus/core/util/Quality.java b/src/Java/gtPlusPlus/core/util/Quality.java index 1ce29c7a58..b866b2e28b 100644 --- a/src/Java/gtPlusPlus/core/util/Quality.java +++ b/src/Java/gtPlusPlus/core/util/Quality.java @@ -4,13 +4,13 @@ import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.util.EnumChatFormatting; public enum Quality { - + // Magic Blue // Rare Yellow // Set Green // Unique Gold/Purple // Trade-off Brown - + POOR("Poor", EnumChatFormatting.GRAY), COMMON("Common", EnumChatFormatting.WHITE), UNCOMMON("Uncommon", EnumChatFormatting.DARK_GREEN), @@ -31,27 +31,28 @@ public enum Quality { } public String getQuality() { - return LOOT; + return this.LOOT; } - + protected EnumChatFormatting getColour(){ - return COLOUR; + return this.COLOUR; } - + public String formatted(){ return this.COLOUR+this.LOOT; } - + public static Quality getRandomQuality(){ - int lootChance = MathUtils.randInt(0, 100); + final int lootChance = MathUtils.randInt(0, 100); if (lootChance <= 10){return Quality.POOR;} else if (lootChance <= 45){return Quality.COMMON;} else if (lootChance <= 65){return Quality.UNCOMMON;} else if (lootChance <= 82){return Quality.MAGIC;} else if (lootChance <= 92){return Quality.EPIC;} else if (lootChance <= 97){return Quality.RARE;} - else if (lootChance <= 99){return Quality.ARTIFACT;} - else return null; + else if (lootChance <= 99){return Quality.ARTIFACT;} else { + return null; + } } } diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index db8ed87231..72441660d2 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -1,6 +1,16 @@ package gtPlusPlus.core.util; -import gregtech.api.enums.*; +import java.awt.Color; +import java.awt.Graphics; +import java.lang.reflect.Method; +import java.util.*; + +import org.apache.commons.lang3.EnumUtils; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.FMLLog; +import gregtech.api.enums.Materials; +import gregtech.api.enums.TC_Aspects; import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.lib.CORE; @@ -12,14 +22,7 @@ import gtPlusPlus.core.util.math.MathUtils; import ic2.core.Ic2Items; import ic2.core.init.InternalName; import ic2.core.item.resources.ItemCell; - -import java.awt.Color; -import java.awt.Graphics; -import java.lang.reflect.Method; -import java.util.*; - import net.minecraft.block.Block; -import net.minecraft.block.Block.SoundType; import net.minecraft.entity.Entity; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; @@ -31,11 +34,6 @@ import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fluids.*; import net.minecraftforge.oredict.OreDictionary; -import org.apache.commons.lang3.EnumUtils; - -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.FMLLog; - public class Utils { public static final int WILDCARD_VALUE = Short.MAX_VALUE; @@ -55,27 +53,27 @@ public class Utils { if (CORE.MASTER_VERSION.toLowerCase().equals("offline")){ return false; - } + } if (CORE.MASTER_VERSION.equals(CORE.VERSION.toLowerCase())){ return true; - } + } return false; } - public static TC_AspectStack getTcAspectStack (TC_Aspects aspect, long size){ + public static TC_AspectStack getTcAspectStack (final TC_Aspects aspect, final long size){ return getTcAspectStack(aspect.name(), (int) size); } - public static TC_AspectStack getTcAspectStack (String aspect, long size){ + public static TC_AspectStack getTcAspectStack (final String aspect, final long size){ return getTcAspectStack(aspect, (int) size); } - public static TC_AspectStack getTcAspectStack (TC_Aspects aspect, int size){ + public static TC_AspectStack getTcAspectStack (final TC_Aspects aspect, final int size){ return getTcAspectStack(aspect.name(), size); } - public static TC_AspectStack getTcAspectStack (String aspect, int size){ + public static TC_AspectStack getTcAspectStack (final String aspect, final int size){ TC_AspectStack returnValue = null; @@ -89,13 +87,13 @@ public class Utils { else { Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITO"), size); - } - } catch (NoSuchFieldError r){ + } + } catch (final NoSuchFieldError r){ Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); } } else if (aspect.toUpperCase().equals("EXANIMUS")){ - //Adds in Compat for older GT Versions which Misspell aspects. + //Adds in Compat for older GT Versions which Misspell aspects. try { if (EnumUtils.isValidEnum(TC_Aspects.class, "EXANIMUS")){ Utils.LOG_WARNING("TC Aspect found - "+aspect); @@ -104,15 +102,15 @@ public class Utils { else { Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXAMINIS"), size); - } - } catch (NoSuchFieldError r){ + } + } catch (final NoSuchFieldError r){ Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); } } else if (aspect.toUpperCase().equals("PRAECANTATIO")){ - //Adds in Compat for older GT Versions which Misspell aspects. + //Adds in Compat for older GT Versions which Misspell aspects. try { if (EnumUtils.isValidEnum(TC_Aspects.class, "PRAECANTATIO")){ Utils.LOG_WARNING("TC Aspect found - "+aspect); @@ -121,10 +119,10 @@ public class Utils { else { Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTIO"), size); - } - } catch (NoSuchFieldError r){ + } + } catch (final NoSuchFieldError r){ Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); - } + } } else { Utils.LOG_WARNING("TC Aspect found - "+aspect); @@ -134,11 +132,11 @@ public class Utils { return returnValue; } - public static boolean containsMatch(boolean strict, ItemStack[] inputs, ItemStack... targets) + public static boolean containsMatch(final boolean strict, final ItemStack[] inputs, final ItemStack... targets) { - for (ItemStack input : inputs) + for (final ItemStack input : inputs) { - for (ItemStack target : targets) + for (final ItemStack target : targets) { if (itemMatches(target, input, strict)) { @@ -149,67 +147,67 @@ public class Utils { return false; } - public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict) + public static boolean itemMatches(final ItemStack target, final ItemStack input, final boolean strict) { - if (input == null || target == null) + if ((input == null) || (target == null)) { return false; } - return (target.getItem() == input.getItem() && ((target.getItemDamage() == WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage())); + return ((target.getItem() == input.getItem()) && (((target.getItemDamage() == WILDCARD_VALUE) && !strict) || (target.getItemDamage() == input.getItemDamage()))); } - //Non-Dev Comments - public static void LOG_INFO(String s){ + //Non-Dev Comments + public static void LOG_INFO(final String s){ //if (CORE.DEBUG){ FMLLog.info("GT++: "+s); //} } - //Non-Dev Comments - public static void LOG_MACHINE_INFO(String s){ + //Non-Dev Comments + public static void LOG_MACHINE_INFO(final String s){ if (CORE.configSwitches.MACHINE_INFO || ClientProxy.playerName.toLowerCase().contains("draknyte1")){ - FMLLog.info("GT++: Machine Info: "+s); + FMLLog.info("GT++: Machine Info: "+s); } } //Developer Comments - public static void LOG_WARNING(String s){ + public static void LOG_WARNING(final String s){ if (CORE.DEBUG){ FMLLog.warning("GT++: "+s); } } //Errors - public static void LOG_ERROR(String s){ + public static void LOG_ERROR(final String s){ if (CORE.DEBUG){ FMLLog.severe("GT++: "+s); } } //Developer Logger - public static void LOG_SPECIFIC_WARNING(String whatToLog, String msg, int line){ - //if (!CORE.DEBUG){ + public static void LOG_SPECIFIC_WARNING(final String whatToLog, final String msg, final int line){ + //if (!CORE.DEBUG){ FMLLog.warning("GT++ |"+line+"| "+whatToLog+" | "+msg); - //} + //} } - public static void paintBox(Graphics g, int MinA, int MinB, int MaxA, int MaxB){ - g.drawRect (MinA, MinB, MaxA, MaxB); + public static void paintBox(final Graphics g, final int MinA, final int MinB, final int MaxA, final int MaxB){ + g.drawRect (MinA, MinB, MaxA, MaxB); } // Send a message to all players on the server - public static void sendServerMessage(String translationKey) { + public static void sendServerMessage(final String translationKey) { sendServerMessage(new ChatComponentText(translationKey)); } // Send a message to all players on the server - public static void sendServerMessage(IChatComponent chatComponent) { + public static void sendServerMessage(final IChatComponent chatComponent) { MinecraftServer.getServer().getConfigurationManager().sendChatMsg(chatComponent); } /** * Returns if that Liquid is IC2Steam. */ - public static boolean isIC2Steam(FluidStack aFluid) { + public static boolean isIC2Steam(final FluidStack aFluid) { if (aFluid == null) { return false; } @@ -219,7 +217,7 @@ public class Utils { /** * Returns a Liquid Stack with given amount of IC2Steam. */ - public static FluidStack getIC2Steam(long aAmount) { + public static FluidStack getIC2Steam(final long aAmount) { return FluidRegistry.getFluidStack("ic2steam", (int)aAmount); } @@ -231,17 +229,17 @@ public class Utils { 'A',slot_1,'B',slot_2,'C',slot_3, 'D',slot_4,'E',slot_5,'F',slot_6, 'G',slot_7,'H',slot_8,'I',slot_9 - }); + }); }*/ - public static String checkCorrectMiningToolForBlock(Block currentBlock, World currentWorld){ + public static String checkCorrectMiningToolForBlock(final Block currentBlock, final World currentWorld){ String correctTool = ""; - if (!currentWorld.isRemote){ + if (!currentWorld.isRemote){ try { correctTool = currentBlock.getHarvestTool(0); Utils.LOG_WARNING(correctTool); - } catch (NullPointerException e){ + } catch (final NullPointerException e){ } } @@ -250,17 +248,17 @@ public class Utils { } /** - * + * * @param colourStr e.g. "#FFFFFF" * @return String - formatted "rgb(0,0,0)" */ - public static String hex2RgbFormatted(String hexString) { - Color c = new Color( - Integer.valueOf(hexString.substring(1, 3), 16), - Integer.valueOf(hexString.substring(3, 5), 16), + public static String hex2RgbFormatted(final String hexString) { + final Color c = new Color( + Integer.valueOf(hexString.substring(1, 3), 16), + Integer.valueOf(hexString.substring(3, 5), 16), Integer.valueOf(hexString.substring(5, 7), 16)); - StringBuffer sb = new StringBuffer(); + final StringBuffer sb = new StringBuffer(); sb.append("rgb("); sb.append(c.getRed()); sb.append(","); @@ -272,11 +270,11 @@ public class Utils { } /** - * + * * @param colourStr e.g. "#FFFFFF" - * @return + * @return */ - public static Color hex2Rgb(String colorStr) { + public static Color hex2Rgb(final String colorStr) { return new Color( Integer.valueOf( colorStr.substring( 1, 3 ), 16 ), Integer.valueOf( colorStr.substring( 3, 5 ), 16 ), @@ -284,72 +282,72 @@ public class Utils { } /** - * + * * @param colourInt e.g. 0XFFFFFF * @return Colour */ - public static Color hex2Rgb(int colourInt) { + public static Color hex2Rgb(final int colourInt) { return Color.decode(String.valueOf(colourInt)); } /** - * + * * @param colourInt e.g. 0XFFFFFF * @return short[] */ - public static short[] hex2RgbShort(int colourInt) { - Color rgb = Color.decode(String.valueOf(colourInt)); - short[] rgba = {(short) rgb.getRed(), (short) rgb.getGreen(), (short) rgb.getBlue(), (short) rgb.getAlpha()}; + public static short[] hex2RgbShort(final int colourInt) { + final Color rgb = Color.decode(String.valueOf(colourInt)); + final short[] rgba = {(short) rgb.getRed(), (short) rgb.getGreen(), (short) rgb.getBlue(), (short) rgb.getAlpha()}; return rgba; } - public static Timer ShortTimer(int seconds) { + public static Timer ShortTimer(final int seconds) { Timer timer; timer = new Timer(); timer.schedule(new ShortTimerTask(), seconds * 1000); return timer; } - public static String byteToHex(byte b) { - int i = b & 0xFF; + public static String byteToHex(final byte b) { + final int i = b & 0xFF; return Integer.toHexString(i); } - public static Object[] convertListToArray(List<Object> sourceList) { - Object[] targetArray = sourceList.toArray(new Object[sourceList.size()]); + public static Object[] convertListToArray(final List<Object> sourceList) { + final Object[] targetArray = sourceList.toArray(new Object[sourceList.size()]); return targetArray; } - public static List<Object> convertArrayToFixedSizeList(Object[] sourceArray) { - List<Object> targetList = Arrays.asList(sourceArray); + public static List<Object> convertArrayToFixedSizeList(final Object[] sourceArray) { + final List<Object> targetList = Arrays.asList(sourceArray); return targetList; } - public static List<Object> convertArrayToList(Object[] sourceArray) { - List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray)); + public static List<Object> convertArrayToList(final Object[] sourceArray) { + final List<Object> targetList = new ArrayList<>(Arrays.asList(sourceArray)); return targetList; } - public static List<Object> convertArrayListToList(ArrayList sourceArray) { - List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray)); + public static List<Object> convertArrayListToList(final ArrayList sourceArray) { + final List<Object> targetList = new ArrayList<>(Arrays.asList(sourceArray)); return targetList; } - public static void spawnCustomParticle(Entity entity){ + public static void spawnCustomParticle(final Entity entity){ GTplusplus.proxy.generateMysteriousParticles(entity); - } + } - public static void spawnFX(World world, int x, int y, int z, String particleName, Object particleName2){ + public static void spawnFX(final World world, final int x, final int y, final int z, final String particleName, Object particleName2){ if (!world.isRemote){ - if (particleName2 == null || particleName2.equals("")){ + if ((particleName2 == null) || particleName2.equals("")){ particleName2 = particleName; } - int l = MathUtils.randInt(0, 4); - double d0 = (double)((float)x + 0.5F); - double d1 = (double)((float)y + 0.7F); - double d2 = (double)((float)z + 0.5F); - double d3 = 0.2199999988079071D; - double d4 = 0.27000001072883606D; + final int l = MathUtils.randInt(0, 4); + final double d0 = x + 0.5F; + final double d1 = y + 0.7F; + final double d2 = z + 0.5F; + final double d3 = 0.2199999988079071D; + final double d4 = 0.27000001072883606D; if (l == 1) { @@ -377,14 +375,14 @@ public class Utils { } } - public static int rgbtoHexValue(int r, int g, int b){ - if (r > 255 || g > 255 || b > 255 || r < 0 || g < 0 || b < 0){ + public static int rgbtoHexValue(final int r, final int g, final int b){ + if ((r > 255) || (g > 255) || (b > 255) || (r < 0) || (g < 0) || (b < 0)){ return 0; } - Color c = new Color(r,g,b); - String temp = Integer.toHexString( c.getRGB() & 0xFFFFFF ).toUpperCase(); + final Color c = new Color(r,g,b); + String temp = Integer.toHexString( c.getRGB() & 0xFFFFFF ).toUpperCase(); - //System.out.println( "hex: " + Integer.toHexString( c.getRGB() & 0xFFFFFF ) + " hex value:"+temp); + //System.out.println( "hex: " + Integer.toHexString( c.getRGB() & 0xFFFFFF ) + " hex value:"+temp); temp = Utils.appenedHexNotationToString(String.valueOf(temp)); Utils.LOG_WARNING("Made "+temp+" - Hopefully it's not a mess."); Utils.LOG_WARNING("It will decode into "+Integer.decode(temp)+"."); @@ -394,26 +392,26 @@ public class Utils { /* * http://javadevnotes.com/java-left-pad-string-with-zeros-examples */ - public static String leftPadWithZeroes(String originalString, int length) { - StringBuilder sb = new StringBuilder(); - while (sb.length() + originalString.length() < length) { + public static String leftPadWithZeroes(final String originalString, final int length) { + final StringBuilder sb = new StringBuilder(); + while ((sb.length() + originalString.length()) < length) { sb.append('0'); } sb.append(originalString); - String paddedString = sb.toString(); + final String paddedString = sb.toString(); return paddedString; } /* * Original Code by Chandana Napagoda - https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator.html - */ - public static Map<Integer, String> hexColourGenerator(int colorCount){ - int maxColorValue = 16777215; + */ + public static Map<Integer, String> hexColourGenerator(final int colorCount){ + final int maxColorValue = 16777215; // this is decimal value of the "FFFFFF" - int devidedvalue = maxColorValue/colorCount; + final int devidedvalue = maxColorValue/colorCount; int countValue = 0; - HashMap<Integer, String> hexColorMap = new HashMap<Integer, String>(); - for(int a=0; a < colorCount && maxColorValue >= countValue ; a++){ + final HashMap<Integer, String> hexColorMap = new HashMap<>(); + for(int a=0; (a < colorCount) && (maxColorValue >= countValue) ; a++){ if(a != 0){ countValue+=devidedvalue; hexColorMap.put(a,Integer.toHexString( 0x10000 | countValue).substring(1).toUpperCase()); @@ -428,33 +426,33 @@ public class Utils { /* * Original Code by Chandana Napagoda - https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator.html */ - public static Map<Integer, String> hexColourGeneratorRandom(int colorCount){ - HashMap<Integer, String> hexColorMap = new HashMap<Integer, String>(); + public static Map<Integer, String> hexColourGeneratorRandom(final int colorCount){ + final HashMap<Integer, String> hexColorMap = new HashMap<>(); for(int a=0;a < colorCount; a++){ String code = ""+(int)(Math.random()*256); code = code+code+code; - int i = Integer.parseInt(code); + final int i = Integer.parseInt(code); hexColorMap.put(a,Integer.toHexString( 0x1000000 | i).substring(1).toUpperCase()); Utils.LOG_WARNING(""+Integer.toHexString( 0x1000000 | i).substring(1).toUpperCase()); } return hexColorMap; } - public static String appenedHexNotationToString(Object hexAsStringOrInt){ - String hexChar = "0x"; + public static String appenedHexNotationToString(final Object hexAsStringOrInt){ + final String hexChar = "0x"; String result; if (hexAsStringOrInt.getClass() == String.class){ if (((String) hexAsStringOrInt).length() != 6){ - String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6); + final String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6); result = temp; } result = hexChar+hexAsStringOrInt; return result; } - else if (hexAsStringOrInt.getClass() == Integer.class){ + else if (hexAsStringOrInt.getClass() == Integer.class){ if (((String) hexAsStringOrInt).length() != 6){ - String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6); + final String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6); result = temp; } result = hexChar+String.valueOf(hexAsStringOrInt); @@ -465,22 +463,22 @@ public class Utils { } } - public static Integer appenedHexNotationToInteger(int hexAsStringOrInt){ - String hexChar = "0x"; + public static Integer appenedHexNotationToInteger(final int hexAsStringOrInt){ + final String hexChar = "0x"; String result; Utils.LOG_WARNING(String.valueOf(hexAsStringOrInt)); result = hexChar+String.valueOf(hexAsStringOrInt); return Integer.getInteger(result); } - public static boolean doesEntryExistAlreadyInOreDictionary(String OreDictName){ + public static boolean doesEntryExistAlreadyInOreDictionary(final String OreDictName){ if (OreDictionary.getOres(OreDictName).size() != 0) { return true; } return false; } - public static boolean invertBoolean(boolean booleans){ + public static boolean invertBoolean(final boolean booleans){ if (booleans == true){ return false; } @@ -488,34 +486,34 @@ public class Utils { } private static short cellID = 15; - public static ItemStack createInternalNameAndFluidCell(String s){ + public static ItemStack createInternalNameAndFluidCell(final String s){ Utils.LOG_WARNING("1"); - InternalName yourName = EnumHelper.addEnum(InternalName.class, s, new Class[0], new Object[0]); + final InternalName yourName = EnumHelper.addEnum(InternalName.class, s, new Class[0], new Object[0]); Utils.LOG_WARNING("2 "+yourName.name()); - ItemCell item = (ItemCell)Ic2Items.cell.getItem(); + final ItemCell item = (ItemCell)Ic2Items.cell.getItem(); Utils.LOG_WARNING("3 "+item.getUnlocalizedName()); try { Utils.LOG_WARNING("4"); - Class<? extends ItemCell> clz = item.getClass(); + final Class<? extends ItemCell> clz = item.getClass(); Utils.LOG_WARNING("5 "+clz.getSimpleName()); - Method methode = clz.getDeclaredMethod("addCell", int.class, InternalName.class, Block[].class); + final Method methode = clz.getDeclaredMethod("addCell", int.class, InternalName.class, Block[].class); Utils.LOG_WARNING("6 "+methode.getName()); methode.setAccessible(true); Utils.LOG_WARNING("7 "+methode.isAccessible()); - ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]); + final ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]); Utils.LOG_WARNING("Successfully created "+temp.getDisplayName()+"s."); FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(s.toLowerCase(), 0), temp.copy(), Ic2Items.cell.copy()); ItemUtils.addItemToOreDictionary(temp.copy(), "cell"+s); return temp; } - catch(Exception e){ + catch(final Exception e){ e.printStackTrace(); } return null; } - public static String sanitizeString(String input){ + public static String sanitizeString(final String input){ String temp; String output; @@ -533,39 +531,39 @@ public class Utils { temp = temp.replace("[", ""); temp = temp.replace("]", ""); temp = temp.replace(" ", ""); - output = temp; + output = temp; return output; } - - public static String[] parseVersion(String version){ + + public static String[] parseVersion(final String version){ return parseVersion(version, "//."); } - - public static String[] parseVersion(String version, String delimiter){ - String[] versionArray = version.split(delimiter); + + public static String[] parseVersion(final String version, final String delimiter){ + final String[] versionArray = version.split(delimiter); return versionArray; } - - public static Versioning compareModVersion (String currentVersion, String expectedVersion){ + + public static Versioning compareModVersion (final String currentVersion, final String expectedVersion){ return compareModVersion(currentVersion, expectedVersion, "//."); } - - public static Versioning compareModVersion (String currentVersion, String expectedVersion, String delimiter){ - String[] a = parseVersion(currentVersion, delimiter); - String[] b = parseVersion(expectedVersion, delimiter); - int[] c = new int[a.length]; - int[] d = new int[b.length]; + + public static Versioning compareModVersion (final String currentVersion, final String expectedVersion, final String delimiter){ + final String[] a = parseVersion(currentVersion, delimiter); + final String[] b = parseVersion(expectedVersion, delimiter); + final int[] c = new int[a.length]; + final int[] d = new int[b.length]; for (int r=0;r<a.length;r++){ c[r]=Integer.parseInt(a[r]); } for (int r=0;r<b.length;r++){ d[r]=Integer.parseInt(b[r]); } - Versioning[] e = new Versioning[MathUtils.returnLargestNumber(c.length, d.length)]; + final Versioning[] e = new Versioning[MathUtils.returnLargestNumber(c.length, d.length)]; for (int r=0;r<e.length;r++){ - - + + if (c[r] > d[r]){ e[r] = Versioning.NEWER; } @@ -576,7 +574,7 @@ public class Utils { e[r] = Versioning.EQUAL; } } - + for (int r=0;r<e.length;r++){ if (e[0] == Versioning.NEWER){ return Versioning.NEWER; @@ -584,69 +582,69 @@ public class Utils { else if (e[0] == Versioning.OLDER){ return Versioning.OLDER; } - else { + else { if (e[r] == Versioning.OLDER){ - + } - + return Versioning.NEWER; } } - - return null; + + return null; } - - - public static ToolMaterial generateToolMaterialFromGT(Materials gtMaterial){ - String name = Utils.sanitizeString(gtMaterial.mDefaultLocalName); - int harvestLevel = gtMaterial.mToolQuality; - int durability = gtMaterial.mDurability; - float damage = gtMaterial.mToolQuality; - int efficiency = (int) gtMaterial.mToolSpeed; - int enchantability = gtMaterial.mEnchantmentToolsLevel; - ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, enchantability); + + + public static ToolMaterial generateToolMaterialFromGT(final Materials gtMaterial){ + final String name = Utils.sanitizeString(gtMaterial.mDefaultLocalName); + final int harvestLevel = gtMaterial.mToolQuality; + final int durability = gtMaterial.mDurability; + final float damage = gtMaterial.mToolQuality; + final int efficiency = (int) gtMaterial.mToolSpeed; + final int enchantability = gtMaterial.mEnchantmentToolsLevel; + final ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, enchantability); return temp; } - public static ToolMaterial generateToolMaterial(Material material){ - String name = material.getLocalizedName(); - int harvestLevel = material.vHarvestLevel; - int durability = (int) material.vDurability; - float damage = material.vToolQuality; - int efficiency = (int) material.vToolQuality; + public static ToolMaterial generateToolMaterial(final Material material){ + final String name = material.getLocalizedName(); + final int harvestLevel = material.vHarvestLevel; + final int durability = (int) material.vDurability; + final float damage = material.vToolQuality; + final int efficiency = material.vToolQuality; //int enchantability = material.mEnchantmentToolsLevel; Utils.LOG_INFO("ToolMaterial stats for "+material.getLocalizedName()+" | harvestLevel:"+harvestLevel+" | durability:"+durability+" | toolQuality:"+damage+" | toolSpeed:"+damage); - ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, 0); + final ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, 0); return temp; } - - - - - - - - - - - - + + + + + + + + + + + + public static enum Versioning { - EQUAL(0), - NEWER(1), - OLDER(-1); - private int versioningInfo; - private Versioning (final int versionStatus){ - this.versioningInfo = versionStatus; - } - public int getTexture() { - return versioningInfo; - } - } - + EQUAL(0), + NEWER(1), + OLDER(-1); + private final int versioningInfo; + private Versioning (final int versionStatus){ + this.versioningInfo = versionStatus; + } + public int getTexture() { + return this.versioningInfo; + } + } + } diff --git a/src/Java/gtPlusPlus/core/util/UtilsChatFormatting.java b/src/Java/gtPlusPlus/core/util/UtilsChatFormatting.java index 51589a1f5d..f340e9be59 100644 --- a/src/Java/gtPlusPlus/core/util/UtilsChatFormatting.java +++ b/src/Java/gtPlusPlus/core/util/UtilsChatFormatting.java @@ -8,146 +8,146 @@ import cpw.mods.fml.relauncher.SideOnly; public enum UtilsChatFormatting { - BLACK('0'), - DARK_BLUE('1'), - DARK_GREEN('2'), - DARK_AQUA('3'), - DARK_RED('4'), - DARK_PURPLE('5'), - GOLD('6'), - GRAY('7'), - DARK_GRAY('8'), - BLUE('9'), - GREEN('a'), - AQUA('b'), - RED('c'), - LIGHT_PURPLE('d'), - YELLOW('e'), - WHITE('f'), - OBFUSCATED('k', true), - BOLD('l', true), - STRIKETHROUGH('m', true), - UNDERLINE('n', true), - ITALIC('o', true), - RESET('r'); - /** Maps a formatting code (e.g., 'f') to its corresponding enum value (e.g., WHITE). */ - private static final Map<Character, UtilsChatFormatting> formattingCodeMapping = new HashMap<Character, UtilsChatFormatting>(); - /** Maps a name (e.g., 'underline') to its corresponding enum value (e.g., UNDERLINE). */ - private static final Map<String, UtilsChatFormatting> nameMapping = new HashMap<String, UtilsChatFormatting>(); - /** - * Matches formatting codes that indicate that the client should treat the following text as bold, recolored, - * obfuscated, etc. - */ - private static final Pattern formattingCodePattern = Pattern.compile("(?i)" + String.valueOf('\u00a7') + "[0-9A-FK-OR]"); - /** The formatting code that produces this format. */ - private final char formattingCode; - private final boolean fancyStyling; - /** - * The control string (section sign + formatting code) that can be inserted into client-side text to display - * subsequent text in this format. - */ - private final String controlString; - - private UtilsChatFormatting(char p_i1336_3_) - { - this(p_i1336_3_, false); - } - - private UtilsChatFormatting(char p_i1337_3_, boolean p_i1337_4_) - { - this.formattingCode = p_i1337_3_; - this.fancyStyling = p_i1337_4_; - this.controlString = "\u00a7" + p_i1337_3_; - } - - /** - * Gets the formatting code that produces this format. - */ - public char getFormattingCode() - { - return this.formattingCode; - } - - /** - * False if this is just changing the color or resetting; true otherwise. - */ - public boolean isFancyStyling() - { - return this.fancyStyling; - } - - /** - * Checks if typo is a color. - */ - public boolean isColor() - { - return !this.fancyStyling && this != RESET; - } - - /** - * Gets the friendly name of this value. - */ - public String getFriendlyName() - { - return this.name().toLowerCase(); - } - - @Override + BLACK('0'), + DARK_BLUE('1'), + DARK_GREEN('2'), + DARK_AQUA('3'), + DARK_RED('4'), + DARK_PURPLE('5'), + GOLD('6'), + GRAY('7'), + DARK_GRAY('8'), + BLUE('9'), + GREEN('a'), + AQUA('b'), + RED('c'), + LIGHT_PURPLE('d'), + YELLOW('e'), + WHITE('f'), + OBFUSCATED('k', true), + BOLD('l', true), + STRIKETHROUGH('m', true), + UNDERLINE('n', true), + ITALIC('o', true), + RESET('r'); + /** Maps a formatting code (e.g., 'f') to its corresponding enum value (e.g., WHITE). */ + private static final Map<Character, UtilsChatFormatting> formattingCodeMapping = new HashMap<>(); + /** Maps a name (e.g., 'underline') to its corresponding enum value (e.g., UNDERLINE). */ + private static final Map<String, UtilsChatFormatting> nameMapping = new HashMap<>(); + /** + * Matches formatting codes that indicate that the client should treat the following text as bold, recolored, + * obfuscated, etc. + */ + private static final Pattern formattingCodePattern = Pattern.compile("(?i)" + String.valueOf('\u00a7') + "[0-9A-FK-OR]"); + /** The formatting code that produces this format. */ + private final char formattingCode; + private final boolean fancyStyling; + /** + * The control string (section sign + formatting code) that can be inserted into client-side text to display + * subsequent text in this format. + */ + private final String controlString; + + private UtilsChatFormatting(final char p_i1336_3_) + { + this(p_i1336_3_, false); + } + + private UtilsChatFormatting(final char p_i1337_3_, final boolean p_i1337_4_) + { + this.formattingCode = p_i1337_3_; + this.fancyStyling = p_i1337_4_; + this.controlString = "\u00a7" + p_i1337_3_; + } + + /** + * Gets the formatting code that produces this format. + */ + public char getFormattingCode() + { + return this.formattingCode; + } + + /** + * False if this is just changing the color or resetting; true otherwise. + */ + public boolean isFancyStyling() + { + return this.fancyStyling; + } + + /** + * Checks if typo is a color. + */ + public boolean isColor() + { + return !this.fancyStyling && (this != RESET); + } + + /** + * Gets the friendly name of this value. + */ + public String getFriendlyName() + { + return this.name().toLowerCase(); + } + + @Override public String toString() - { - return this.controlString; - } - - /** - * Returns a copy of the given string, with formatting codes stripped away. - */ - @SideOnly(Side.CLIENT) - public static String getTextWithoutFormattingCodes(String p_110646_0_) - { - return p_110646_0_ == null ? null : formattingCodePattern.matcher(p_110646_0_).replaceAll(""); - } - - /** - * Gets a value by its friendly name; null if the given name does not map to a defined value. - */ - public static UtilsChatFormatting getValueByName(String p_96300_0_) - { - return p_96300_0_ == null ? null : (UtilsChatFormatting)nameMapping.get(p_96300_0_.toLowerCase()); - } - - /** - * Gets all the valid values. Args: @param par0: Whether or not to include color values. @param par1: Whether or not - * to include fancy-styling values (anything that isn't a color value or the "reset" value). - */ - public static Collection<String> getValidValues(boolean p_96296_0_, boolean p_96296_1_) - { - ArrayList<String> arraylist = new ArrayList<String>(); - UtilsChatFormatting[] aenumchatformatting = values(); - int i = aenumchatformatting.length; - - for (int j = 0; j < i; ++j) - { - UtilsChatFormatting enumchatformatting = aenumchatformatting[j]; - - if ((!enumchatformatting.isColor() || p_96296_0_) && (!enumchatformatting.isFancyStyling() || p_96296_1_)) - { - arraylist.add(enumchatformatting.getFriendlyName()); - } - } - - return arraylist; - } - - static - { - UtilsChatFormatting[] var0 = values(); - int var1 = var0.length; - - for (int var2 = 0; var2 < var1; ++var2) - { - UtilsChatFormatting var3 = var0[var2]; - formattingCodeMapping.put(Character.valueOf(var3.getFormattingCode()), var3); - nameMapping.put(var3.getFriendlyName(), var3); - } - } + { + return this.controlString; + } + + /** + * Returns a copy of the given string, with formatting codes stripped away. + */ + @SideOnly(Side.CLIENT) + public static String getTextWithoutFormattingCodes(final String p_110646_0_) + { + return p_110646_0_ == null ? null : formattingCodePattern.matcher(p_110646_0_).replaceAll(""); + } + + /** + * Gets a value by its friendly name; null if the given name does not map to a defined value. + */ + public static UtilsChatFormatting getValueByName(final String p_96300_0_) + { + return p_96300_0_ == null ? null : (UtilsChatFormatting)nameMapping.get(p_96300_0_.toLowerCase()); + } + + /** + * Gets all the valid values. Args: @param par0: Whether or not to include color values. @param par1: Whether or not + * to include fancy-styling values (anything that isn't a color value or the "reset" value). + */ + public static Collection<String> getValidValues(final boolean p_96296_0_, final boolean p_96296_1_) + { + final ArrayList<String> arraylist = new ArrayList<>(); + final UtilsChatFormatting[] aenumchatformatting = values(); + final int i = aenumchatformatting.length; + + for (int j = 0; j < i; ++j) + { + final UtilsChatFormatting enumchatformatting = aenumchatformatting[j]; + + if ((!enumchatformatting.isColor() || p_96296_0_) && (!enumchatformatting.isFancyStyling() || p_96296_1_)) + { + arraylist.add(enumchatformatting.getFriendlyName()); + } + } + + return arraylist; + } + + static + { + final UtilsChatFormatting[] var0 = values(); + final int var1 = var0.length; + + for (int var2 = 0; var2 < var1; ++var2) + { + final UtilsChatFormatting var3 = var0[var2]; + formattingCodeMapping.put(Character.valueOf(var3.getFormattingCode()), var3); + nameMapping.put(var3.getFriendlyName(), var3); + } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/UtilsRarity.java b/src/Java/gtPlusPlus/core/util/UtilsRarity.java index 19339b7717..78f3a10bdb 100644 --- a/src/Java/gtPlusPlus/core/util/UtilsRarity.java +++ b/src/Java/gtPlusPlus/core/util/UtilsRarity.java @@ -4,20 +4,20 @@ import net.minecraft.util.EnumChatFormatting; public enum UtilsRarity { - T1_poor(EnumChatFormatting.GRAY, "Poor"), - T2_normal(EnumChatFormatting.WHITE, "Common"), - T3_uncommon(EnumChatFormatting.GREEN, "Uncommon"), - T4_magic(EnumChatFormatting.BLUE, "Magic"), - T5_rare(EnumChatFormatting.LIGHT_PURPLE, "Rare"), - T6_epic(EnumChatFormatting.YELLOW, "Epic"), - T8_unique(EnumChatFormatting.GOLD, "Unique"); - - public final EnumChatFormatting rarityColor; - public final String rarityName; + T1_poor(EnumChatFormatting.GRAY, "Poor"), + T2_normal(EnumChatFormatting.WHITE, "Common"), + T3_uncommon(EnumChatFormatting.GREEN, "Uncommon"), + T4_magic(EnumChatFormatting.BLUE, "Magic"), + T5_rare(EnumChatFormatting.LIGHT_PURPLE, "Rare"), + T6_epic(EnumChatFormatting.YELLOW, "Epic"), + T8_unique(EnumChatFormatting.GOLD, "Unique"); - private UtilsRarity(EnumChatFormatting rarity, String name) - { - this.rarityColor = rarity; - this.rarityName = name; - } + public final EnumChatFormatting rarityColor; + public final String rarityName; + + private UtilsRarity(final EnumChatFormatting rarity, final String name) + { + this.rarityColor = rarity; + this.rarityName = name; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/UtilsText.java b/src/Java/gtPlusPlus/core/util/UtilsText.java index e91fa95e4c..6d26676ce3 100644 --- a/src/Java/gtPlusPlus/core/util/UtilsText.java +++ b/src/Java/gtPlusPlus/core/util/UtilsText.java @@ -20,13 +20,13 @@ public enum UtilsText { white('f'); private char colourValue; - private UtilsText (char value) + private UtilsText (final char value) { this.colourValue = value; } public String colour() { - return "§"+colourValue; + return "�"+this.colourValue; } } diff --git a/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java b/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java index ea02aaf1da..910c4597af 100644 --- a/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java +++ b/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java @@ -4,15 +4,15 @@ import java.util.Arrays; public class ArrayUtils { - public static void expandArray(Object[] someArray, Object newValueToAdd) { + public static void expandArray(final Object[] someArray, final Object newValueToAdd) { Object[] series = someArray; - series = addElement(series, newValueToAdd); + series = addElement(series, newValueToAdd); } - private static Object[] addElement(Object[] series, Object newValueToAdd) { - series = Arrays.copyOf(series, series.length + 1); - series[series.length - 1] = newValueToAdd; - return series; + private static Object[] addElement(Object[] series, final Object newValueToAdd) { + series = Arrays.copyOf(series, series.length + 1); + series[series.length - 1] = newValueToAdd; + return series; } - + } diff --git a/src/Java/gtPlusPlus/core/util/array/Pair.java b/src/Java/gtPlusPlus/core/util/array/Pair.java index 94437e6779..ec5971c449 100644 --- a/src/Java/gtPlusPlus/core/util/array/Pair.java +++ b/src/Java/gtPlusPlus/core/util/array/Pair.java @@ -1,21 +1,21 @@ package gtPlusPlus.core.util.array; -public class Pair<K,V> { - - private final K key; - private final V value; - +public class Pair<K,V> { + + private final K key; + private final V value; + public Pair(final K key, final V value){ this.key = key; this.value = value; } - + final public K getKey(){ - return key; - } - + return this.key; + } + final public V getValue(){ - return value; - } + return this.value; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/array/Triplet.java b/src/Java/gtPlusPlus/core/util/array/Triplet.java index 07f29ae6c8..2130491d5b 100644 --- a/src/Java/gtPlusPlus/core/util/array/Triplet.java +++ b/src/Java/gtPlusPlus/core/util/array/Triplet.java @@ -1,27 +1,27 @@ package gtPlusPlus.core.util.array; -public class Triplet<K,V,C> { - - private final K key; - private final V value; +public class Triplet<K,V,C> { + + private final K key; + private final V value; private final C count; - + public Triplet(final K key, final V value, final C value2){ this.key = key; this.value = value; this.count = value2; } - + final public K getKey(){ - return key; - } - + return this.key; + } + final public V getValue(){ - return value; - } - + return this.value; + } + final public C getSecondValue(){ - return count; - } + return this.count; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java index 74df9f90ba..28a47d9b14 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java @@ -11,20 +11,21 @@ public class DEBUG_BLOCK_ShapeSpawner extends DEBUG_MULTIBLOCK_ShapeSpawner { private static boolean controller; - public DEBUG_BLOCK_ShapeSpawner(int aID, String aName, String aNameRegional) { + public DEBUG_BLOCK_ShapeSpawner(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public DEBUG_BLOCK_ShapeSpawner(String aName) { + public DEBUG_BLOCK_ShapeSpawner(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new DEBUG_BLOCK_ShapeSpawner(this.mName); } - + + @Override public String[] getDescription() { return new String[]{ "Controller Block for the Testing", @@ -33,73 +34,73 @@ public class DEBUG_BLOCK_ShapeSpawner extends DEBUG_MULTIBLOCK_ShapeSpawner { @Override - public ITexture[] getTexture(IGregTechTileEntity arg0, byte arg1, - byte arg2, byte arg3, boolean arg4, boolean arg5) { + public ITexture[] getTexture(final IGregTechTileEntity arg0, final byte arg1, + final byte arg2, final byte arg3, final boolean arg4, final boolean arg5) { // TODO Auto-generated method stub return null; } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { + public boolean isCorrectMachinePart(final ItemStack aStack) { // TODO Auto-generated method stub return false; } @Override - public boolean checkRecipe(ItemStack aStack) { + public boolean checkRecipe(final ItemStack aStack) { // TODO Auto-generated method stub return false; } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { return false; } - + int stepX = aBaseMetaTileEntity.getXCoord(); - int stepY = aBaseMetaTileEntity.getYCoord(); + final int stepY = aBaseMetaTileEntity.getYCoord(); int stepZ = aBaseMetaTileEntity.getZCoord(); - int temp = 0; + final int temp = 0; - Utils.LOG_INFO("Starting Block located @ "+"[X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + Utils.LOG_INFO("Starting Block located @ "+"[X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); - int tAmount = 0; + final int tAmount = 0; switch (xDir) { case -1: stepX++; - Utils.LOG_INFO("Modifying stepX + accomodate a "+xDir+" xDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + Utils.LOG_INFO("Modifying stepX + accomodate a "+xDir+" xDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); break; case 1: stepX--; - Utils.LOG_INFO("Modifying stepX - accomodate a "+xDir+" xDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + Utils.LOG_INFO("Modifying stepX - accomodate a "+xDir+" xDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); break; } switch (zDir) { case -1: stepZ++; - Utils.LOG_INFO("Modifying stepZ + accomodate a "+zDir+" zDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + Utils.LOG_INFO("Modifying stepZ + accomodate a "+zDir+" zDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); break; case 1: stepZ--; - Utils.LOG_INFO("Modifying stepZ - accomodate a "+zDir+" zDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + Utils.LOG_INFO("Modifying stepZ - accomodate a "+zDir+" zDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); break; } - for (int i = stepX-1; i <= stepX+1; i++){ - for (int j = stepZ-1; j <= stepZ+1; j++){ - for (int h = stepY-1; h <= stepY+1; h++){ + for (int i = stepX-1; i <= (stepX+1); i++){ + for (int j = stepZ-1; j <= (stepZ+1); j++){ + for (int h = stepY-1; h <= (stepY+1); h++){ Utils.LOG_INFO("Block Facing - X:"+xDir+" Z:"+zDir); Utils.LOG_INFO("(h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))"); - Utils.LOG_INFO(" "+(h != 0)+" || "+(((xDir + i != 0)+" || "+(zDir + j != 0))+" && "+((i != 0)+" || "+(j != 0)))); + Utils.LOG_INFO(" "+(h != 0)+" || "+((((xDir + i) != 0)+" || "+((zDir + j) != 0))+" && "+((i != 0)+" || "+(j != 0)))); } } } @@ -107,19 +108,19 @@ public class DEBUG_BLOCK_ShapeSpawner extends DEBUG_MULTIBLOCK_ShapeSpawner { } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { // TODO Auto-generated method stub return 0; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { // TODO Auto-generated method stub return 0; } @Override - public int getDamageToComponent(ItemStack aStack) { + public int getDamageToComponent(final ItemStack aStack) { // TODO Auto-generated method stub return 0; } @@ -131,7 +132,7 @@ public class DEBUG_BLOCK_ShapeSpawner extends DEBUG_MULTIBLOCK_ShapeSpawner { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { // TODO Auto-generated method stub return false; } diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java index 440949471c..8ac31a038f 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java @@ -1,12 +1,12 @@ package gtPlusPlus.core.util.debug; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.item.base.BaseItemWithCharge; import gtPlusPlus.core.item.general.BedLocator_Base; import gtPlusPlus.core.lib.CORE; import net.minecraftforge.common.MinecraftForge; -import cpw.mods.fml.common.registry.GameRegistry; public class DEBUG_INIT { @@ -21,7 +21,7 @@ public class DEBUG_INIT { ModItems.itemDebugShapeSpawner = new DEBUG_ITEM_ShapeSpawner("itemDebugShapeSpawner", AddToCreativeTab.tabMisc, 1, 500); GameRegistry.registerItem(ModItems.itemDebugShapeSpawner, "itemDebugShapeSpawner"); ModItems.itemBedLocator_Base = new BedLocator_Base("itemBedLocator_Base"); - GameRegistry.registerItem(ModItems.itemBedLocator_Base, "itemBedLocator_Base"); + GameRegistry.registerItem(ModItems.itemBedLocator_Base, "itemBedLocator_Base"); ModItems.itemBaseItemWithCharge = new BaseItemWithCharge("itemBaseItemWithCharge", 0, 1000); GameRegistry.registerItem(ModItems.itemBaseItemWithCharge, "itemBaseItemWithCharge"); } @@ -37,7 +37,7 @@ public class DEBUG_INIT { } public static void registerHandlers(){ - MinecraftForge.EVENT_BUS.register(new DEBUG_ScreenOverlay()); + MinecraftForge.EVENT_BUS.register(new DEBUG_ScreenOverlay()); } } diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java index bfaa7404e1..a35d2c26de 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java @@ -1,19 +1,19 @@ package gtPlusPlus.core.util.debug; import static net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.BaseItemGeneric; -import gtPlusPlus.core.util.Utils; import java.util.List; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.item.base.BaseItemGeneric; +import gtPlusPlus.core.util.Utils; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric{ @@ -26,30 +26,32 @@ public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric{ } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ - + public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player){ + if (!world.isRemote){ Utils.LOG_INFO("Constructing the shape for the "+"VACUUM FREEZER"); - Thread thread = new Thread(new DEBUG_TimerThread(world, player)); - thread.start(); + final Thread thread = new Thread(new DEBUG_TimerThread(world, player)); + thread.start(); } - return stack; + return stack; } - - - + + + @SuppressWarnings("static-method") @SubscribeEvent - public void playerInteractEventHandler(PlayerInteractEvent event) + public void playerInteractEventHandler(final PlayerInteractEvent event) { - if (event.isCanceled() || event.world.isRemote || event.action != RIGHT_CLICK_BLOCK) return; + if (event.isCanceled() || event.world.isRemote || (event.action != RIGHT_CLICK_BLOCK)) { + return; + } } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { list.add(EnumChatFormatting.GOLD+"For Testing Gregtech Shapes!"); super.addInformation(stack, aPlayer, list, bool); - } + } } diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java index 8e4c34bf1a..d31fb10b84 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java @@ -1,6 +1,9 @@ package gtPlusPlus.core.util.debug; import static gregtech.api.enums.GT_Values.V; + +import java.util.ArrayList; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.*; @@ -15,9 +18,6 @@ import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.*; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.common.items.GT_MetaGenerated_Tool_01; - -import java.util.ArrayList; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -26,768 +26,887 @@ import net.minecraftforge.fluids.FluidStack; public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { - public static boolean disableMaintenance; - public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false; - public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, mUpdate = 0, mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0; - public ItemStack[] mOutputItems = null; - public FluidStack[] mOutputFluids = null; - public ArrayList<GT_MetaTileEntity_Hatch_Input> mInputHatches = new ArrayList<GT_MetaTileEntity_Hatch_Input>(); - public ArrayList<GT_MetaTileEntity_Hatch_Output> mOutputHatches = new ArrayList<GT_MetaTileEntity_Hatch_Output>(); - public ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<GT_MetaTileEntity_Hatch_InputBus>(); - public ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<GT_MetaTileEntity_Hatch_OutputBus>(); - public ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch_Dynamo>(); - public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<GT_MetaTileEntity_Hatch_Muffler>(); - public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch_Energy>(); - public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<GT_MetaTileEntity_Hatch_Maintenance>(); - - public DEBUG_MULTIBLOCK_ShapeSpawner(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, 2); - this.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); - } - - public DEBUG_MULTIBLOCK_ShapeSpawner(String aName) { - super(aName, 2); - this.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); - } - - public static boolean isValidMetaTileEntity(MetaTileEntity aMetaTileEntity) { - return aMetaTileEntity.getBaseMetaTileEntity() != null && aMetaTileEntity.getBaseMetaTileEntity().getMetaTileEntity() == aMetaTileEntity && !aMetaTileEntity.getBaseMetaTileEntity().isDead(); - } - - @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { - return aSide != getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return aIndex > 0; - } - - @Override - public int getProgresstime() { - return mProgresstime; - } - - @Override - public int maxProgresstime() { - return mMaxProgresstime; - } - - @Override - public int increaseProgress(int aProgress) { - return aProgress; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mEUt", mEUt); - aNBT.setInteger("mProgresstime", mProgresstime); - aNBT.setInteger("mMaxProgresstime", mMaxProgresstime); - aNBT.setInteger("mEfficiencyIncrease", mEfficiencyIncrease); - aNBT.setInteger("mEfficiency", mEfficiency); - aNBT.setInteger("mPollution", mPollution); - aNBT.setInteger("mRuntime", mRuntime); - - if (mOutputItems != null) for (int i = 0; i < mOutputItems.length; i++) - if (mOutputItems[i] != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputItems[i].writeToNBT(tNBT); - aNBT.setTag("mOutputItem" + i, tNBT); - } - if (mOutputFluids != null) for (int i = 0; i < mOutputFluids.length; i++) - if (mOutputFluids[i] != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputFluids[i].writeToNBT(tNBT); - aNBT.setTag("mOutputFluids" + i, tNBT); - } - - aNBT.setBoolean("mWrench", mWrench); - aNBT.setBoolean("mScrewdriver", mScrewdriver); - aNBT.setBoolean("mSoftHammer", mSoftHammer); - aNBT.setBoolean("mHardHammer", mHardHammer); - aNBT.setBoolean("mSolderingTool", mSolderingTool); - aNBT.setBoolean("mCrowbar", mCrowbar); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - mEUt = aNBT.getInteger("mEUt"); - mProgresstime = aNBT.getInteger("mProgresstime"); - mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); - if (mMaxProgresstime > 0) mRunningOnLoad = true; - mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease"); - mEfficiency = aNBT.getInteger("mEfficiency"); - mPollution = aNBT.getInteger("mPollution"); - mRuntime = aNBT.getInteger("mRuntime"); - mOutputItems = new ItemStack[getAmountOfOutputs()]; - for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); - mOutputFluids = new FluidStack[getAmountOfOutputs()]; - for (int i = 0; i < mOutputFluids.length; i++) - mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); - mWrench = aNBT.getBoolean("mWrench"); - mScrewdriver = aNBT.getBoolean("mScrewdriver"); - mSoftHammer = aNBT.getBoolean("mSoftHammer"); - mHardHammer = aNBT.getBoolean("mHardHammer"); - mSolderingTool = aNBT.getBoolean("mSolderingTool"); - mCrowbar = aNBT.getBoolean("mCrowbar"); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiblockDisplay.png"); - } - - @Override - public byte getTileEntityBaseType() { - return 2; - } - - @Override - public void onMachineBlockUpdate() { - mUpdate = 50; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (mEfficiency < 0) mEfficiency = 0; - if (--mUpdate == 0 || --mStartUpCheck == 0) { - mInputHatches.clear(); - mInputBusses.clear(); - mOutputHatches.clear(); - mOutputBusses.clear(); - mDynamoHatches.clear(); - mEnergyHatches.clear(); - mMufflerHatches.clear(); - mMaintenanceHatches.clear(); - mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]); - } - if (mStartUpCheck < 0) { - if (mMachine) { - for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (!this.disableMaintenance) { - if (tHatch.mWrench) mWrench = true; - if (tHatch.mScrewdriver) mScrewdriver = true; - if (tHatch.mSoftHammer) mSoftHammer = true; - if (tHatch.mHardHammer) mHardHammer = true; - if (tHatch.mSolderingTool) mSolderingTool = true; - if (tHatch.mCrowbar) mCrowbar = true; - } else { - mWrench = true; - mScrewdriver = true; - mSoftHammer = true; - mHardHammer = true; - mSolderingTool = true; - mCrowbar = true; - } - - tHatch.mWrench = false; - tHatch.mScrewdriver = false; - tHatch.mSoftHammer = false; - tHatch.mHardHammer = false; - tHatch.mSolderingTool = false; - tHatch.mCrowbar = false; - } - } - if (getRepairStatus() > 0) { - if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) { - if (onRunningTick(mInventory[1])) { - if (!polluteEnvironment(getPollutionPerTick(mInventory[1]))) { - stopMachine(); - } - if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { - if (mOutputItems != null) for (ItemStack tStack : mOutputItems) - if (tStack != null) { - try { - GT_Mod.instance.achievements.issueAchivementHatch(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack); - } catch (Exception e) { - } - addOutput(tStack); - } - if (mOutputFluids != null && mOutputFluids.length == 1) { - for (FluidStack tStack : mOutputFluids) - if (tStack != null) { - addOutput(tStack); - } - } else if (mOutputFluids != null && mOutputFluids.length > 1) { - addFluidOutputs(mOutputFluids); - } - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); - mOutputItems = null; - mProgresstime = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - if (aBaseMetaTileEntity.isAllowedToWork()) checkRecipe(mInventory[1]); - if (mOutputFluids != null && mOutputFluids.length > 0) { - if (mOutputFluids.length > 1) { - GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant"); - } - } - } - } - } else { - if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { - - if (aBaseMetaTileEntity.isAllowedToWork()) { - checkRecipe(mInventory[1]); - } - if (mMaxProgresstime <= 0) mEfficiency = Math.max(0, mEfficiency - 1000); - } - } - } else { - stopMachine(); - } - } else { - stopMachine(); - } - } - aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); - aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); - } - } - - public boolean polluteEnvironment(int aPollutionLevel) { - mPollution += aPollutionLevel; - for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (mPollution >= 10000) { - if (tHatch.polluteEnvironment()) { - mPollution -= 10000; - } - } else { - break; - } - } - } - return mPollution < 10000; - } - - /** - * Called every tick the Machine runs - */ - public boolean onRunningTick(ItemStack aStack) { - if (mEUt > 0) { - addEnergyOutput(((long) mEUt * mEfficiency) / 10000); - return true; - } - if (mEUt < 0) { - if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) { - stopMachine(); - return false; - } - } - return true; - } - - /** - * Checks if this is a Correct Machine Part for this kind of Machine (Turbine Rotor for example) - */ - public abstract boolean isCorrectMachinePart(ItemStack aStack); - - /** - * Checks the Recipe - */ - public abstract boolean checkRecipe(ItemStack aStack); - - /** - * Checks the Machine. You have to assign the MetaTileEntities for the Hatches here. - */ - public abstract boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack); - - /** - * Gets the maximum Efficiency that spare Part can get (0 - 10000) - */ - public abstract int getMaxEfficiency(ItemStack aStack); - - /** - * Gets the pollution this Device outputs to a Muffler per tick (10000 = one Pullution Block) - */ - public abstract int getPollutionPerTick(ItemStack aStack); - - /** - * Gets the damage to the ItemStack, usually 0 or 1. - */ - public abstract int getDamageToComponent(ItemStack aStack); - - /** - * Gets the Amount of possibly outputted Items for loading the Output Stack Array from NBT. - * This should be the largest Amount that can ever happen legitimately. - */ - public abstract int getAmountOfOutputs(); - - /** - * If it explodes when the Component has to be replaced. - */ - public abstract boolean explodesOnComponentBreak(ItemStack aStack); - - public void stopMachine() { - mOutputItems = null; - mEUt = 0; - mEfficiency = 0; - mProgresstime = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - getBaseMetaTileEntity().disableWorking(); - } - - public int getRepairStatus() { - return (mWrench ? 1 : 0) + (mScrewdriver ? 1 : 0) + (mSoftHammer ? 1 : 0) + (mHardHammer ? 1 : 0) + (mSolderingTool ? 1 : 0) + (mCrowbar ? 1 : 0); - } - - public int getIdealStatus() { - return 6; - } - - public boolean doRandomMaintenanceDamage() { - if (!isCorrectMachinePart(mInventory[1]) || getRepairStatus() == 0) { - stopMachine(); - return false; - } - if (mRuntime++ > 1000) { - mRuntime = 0; - if (getBaseMetaTileEntity().getRandomNumber(6000) == 0) { - switch (getBaseMetaTileEntity().getRandomNumber(6)) { - case 0: - mWrench = false; - break; - case 1: - mScrewdriver = false; - break; - case 2: - mSoftHammer = false; - break; - case 3: - mHardHammer = false; - break; - case 4: - mSolderingTool = false; - break; - case 5: - mCrowbar = false; - break; - } - } - if (mInventory[1] != null && getBaseMetaTileEntity().getRandomNumber(2) == 0 && !mInventory[1].getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.")) { - if (mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { - NBTTagCompound tNBT = mInventory[1].getTagCompound(); - if (tNBT != null) { - NBTTagCompound tNBT2 = tNBT.getCompoundTag("GT.CraftingComponents"); - if (!tNBT.getBoolean("mDis")) { - tNBT2 = new NBTTagCompound(); - Materials tMaterial = GT_MetaGenerated_Tool.getPrimaryMaterial(mInventory[1]); - ItemStack tTurbine = GT_OreDictUnificator.get(OrePrefixes.turbineBlade, tMaterial, 1); - int i = mInventory[1].getItemDamage(); - if (i == 170) { - ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Magnalium, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } else if (i == 172) { - ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.7", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.8", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Titanium, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } else if (i == 174) { - ItemStack tStack = GT_Utility.copyAmount(2, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.TungstenSteel, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } else if (i == 176) { - ItemStack tStack = GT_Utility.copyAmount(2, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.7", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.8", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Americium, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } - tNBT.setTag("GT.CraftingComponents", tNBT2); - tNBT.setBoolean("mDis", true); - mInventory[1].setTagCompound(tNBT); - - } - } - - ((GT_MetaGenerated_Tool) mInventory[1].getItem()).doDamage(mInventory[1], (long) Math.min(mEUt / 5, Math.pow(mEUt, 0.7))); - if (mInventory[1].stackSize == 0) mInventory[1] = null; - } - } - } - return true; - } - - public void explodeMultiblock() { - mInventory[1] = null; - for (MetaTileEntity tTileEntity : mInputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mOutputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mInputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mOutputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mDynamoHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mMufflerHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mEnergyHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mMaintenanceHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - getBaseMetaTileEntity().doExplosion(V[8]); - } - - public boolean addEnergyOutput(long aEU) { - if (aEU <= 0) return true; - for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(aEU, false)) { - return true; - } - } - } - return false; - } - - public long getMaxInputVoltage() { - long rVoltage = 0; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); - return rVoltage; - } - - public boolean drainEnergyInput(long aEU) { - if (aEU <= 0) return true; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) return true; - } - return false; - } - - public boolean addOutput(FluidStack aLiquid) { - if (aLiquid == null) return false; - FluidStack tLiquid = aLiquid.copy(); - for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { - if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) { - int tAmount = tHatch.fill(tLiquid, false); - if (tAmount >= tLiquid.amount) { - return tHatch.fill(tLiquid, true) >= tLiquid.amount; - } else if (tAmount > 0) { - tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true); - } - } - } - return false; - } - - private void addFluidOutputs(FluidStack[] mOutputFluids2) { - for (int i = 0; i < mOutputFluids2.length; i++) { - if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) { - mOutputHatches.get(i).fill(mOutputFluids2[i], true); - } - } - - } - - public boolean depleteInput(FluidStack aLiquid) { - if (aLiquid == null) return false; - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - FluidStack tLiquid = tHatch.getFluid(); - if (tLiquid != null && tLiquid.isFluidEqual(aLiquid)) { - tLiquid = tHatch.drain(aLiquid.amount, false); - if (tLiquid != null && tLiquid.amount >= aLiquid.amount) { - tLiquid = tHatch.drain(aLiquid.amount, true); - return tLiquid != null && tLiquid.amount >= aLiquid.amount; - } - } - } - } - return false; - } - - public boolean addOutput(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return false; - aStack = GT_Utility.copy(aStack); -// FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); -// if (aLiquid == null) { - for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) { - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getSizeInventory() - 1; i >= 0; i--) { - if (tHatch.getBaseMetaTileEntity().addStackToSlot(i, aStack)) return true; - } - } - } - for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { - if (isValidMetaTileEntity(tHatch) && tHatch.outputsItems()) { - if (tHatch.getBaseMetaTileEntity().addStackToSlot(1, aStack)) return true; - } - } -// }else { -// for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { -// if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid)?tHatch.outputsSteam():tHatch.outputsLiquids()) { -// int tAmount = tHatch.fill(aLiquid, false); -// if (tAmount >= aLiquid.amount) { -// return tHatch.fill(aLiquid, true) >= aLiquid.amount; -// } -// } -// } -// } - return false; - } - - public boolean depleteInput(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return false; - FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); - if (aLiquid != null) return depleteInput(aLiquid); - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { - tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); - return true; - } - } - } - } - for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { - tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); - return true; - } - } - } - } - } - return false; - } - - public ArrayList<ItemStack> getStoredOutputs() { - ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); - for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { - if (isValidMetaTileEntity(tHatch)) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1)); - } - } - for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) { - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); - } - } - } - return rList; - } - - public ArrayList<FluidStack> getStoredFluids() { - ArrayList<FluidStack> rList = new ArrayList<FluidStack>(); - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch) && tHatch.getFillableStack() != null) { - rList.add(tHatch.getFillableStack()); - } - } - return rList; - } - - public ArrayList<ItemStack> getStoredInputs() { - ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().getStackInSlot(0) != null) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(0)); - } - } - for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null) - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); - } - } - } - return rList; - } - - public GT_Recipe_Map getRecipeMap() { - return null; - } - - public void updateSlots() { - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) - if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); - for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) - if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); - } - - public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) - return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) - return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) - return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) - return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) - return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) - return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) - return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) - return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); - return false; - } - - public boolean addMaintenanceToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); - } - return false; - } - - public boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); - } - return false; - } - - public boolean addDynamoToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); - } - return false; - } - - public boolean addMufflerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); - } - return false; - } - - public boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); - } - return false; - } - - public boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); - } - return false; - } - - @Override - public String[] getInfoData() { - return new String[]{"Progress:", (mProgresstime / 20) + "secs", (mMaxProgresstime / 20) + "secs", "Efficiency:", (mEfficiency / 100.0F) + "%", "Problems:", "" + (getIdealStatus() - getRepairStatus())}; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } + public static boolean disableMaintenance; + public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false; + public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, mUpdate = 0, mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0; + public ItemStack[] mOutputItems = null; + public FluidStack[] mOutputFluids = null; + public ArrayList<GT_MetaTileEntity_Hatch_Input> mInputHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Output> mOutputHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<>(); + + public DEBUG_MULTIBLOCK_ShapeSpawner(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional, 2); + DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); + } + + public DEBUG_MULTIBLOCK_ShapeSpawner(final String aName) { + super(aName, 2); + DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); + } + + public static boolean isValidMetaTileEntity(final MetaTileEntity aMetaTileEntity) { + return (aMetaTileEntity.getBaseMetaTileEntity() != null) && (aMetaTileEntity.getBaseMetaTileEntity().getMetaTileEntity() == aMetaTileEntity) && !aMetaTileEntity.getBaseMetaTileEntity().isDead(); + } + + @Override + public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aCoverID) { + return aSide != this.getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return true; + } + + @Override + public boolean isAccessAllowed(final EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isValidSlot(final int aIndex) { + return aIndex > 0; + } + + @Override + public int getProgresstime() { + return this.mProgresstime; + } + + @Override + public int maxProgresstime() { + return this.mMaxProgresstime; + } + + @Override + public int increaseProgress(final int aProgress) { + return aProgress; + } + + @Override + public void saveNBTData(final NBTTagCompound aNBT) { + aNBT.setInteger("mEUt", this.mEUt); + aNBT.setInteger("mProgresstime", this.mProgresstime); + aNBT.setInteger("mMaxProgresstime", this.mMaxProgresstime); + aNBT.setInteger("mEfficiencyIncrease", this.mEfficiencyIncrease); + aNBT.setInteger("mEfficiency", this.mEfficiency); + aNBT.setInteger("mPollution", this.mPollution); + aNBT.setInteger("mRuntime", this.mRuntime); + + if (this.mOutputItems != null) { + for (int i = 0; i < this.mOutputItems.length; i++) { + if (this.mOutputItems[i] != null) { + final NBTTagCompound tNBT = new NBTTagCompound(); + this.mOutputItems[i].writeToNBT(tNBT); + aNBT.setTag("mOutputItem" + i, tNBT); + } + } + } + if (this.mOutputFluids != null) { + for (int i = 0; i < this.mOutputFluids.length; i++) { + if (this.mOutputFluids[i] != null) { + final NBTTagCompound tNBT = new NBTTagCompound(); + this.mOutputFluids[i].writeToNBT(tNBT); + aNBT.setTag("mOutputFluids" + i, tNBT); + } + } + } + + aNBT.setBoolean("mWrench", this.mWrench); + aNBT.setBoolean("mScrewdriver", this.mScrewdriver); + aNBT.setBoolean("mSoftHammer", this.mSoftHammer); + aNBT.setBoolean("mHardHammer", this.mHardHammer); + aNBT.setBoolean("mSolderingTool", this.mSolderingTool); + aNBT.setBoolean("mCrowbar", this.mCrowbar); + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + this.mEUt = aNBT.getInteger("mEUt"); + this.mProgresstime = aNBT.getInteger("mProgresstime"); + this.mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); + if (this.mMaxProgresstime > 0) { + this.mRunningOnLoad = true; + } + this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease"); + this.mEfficiency = aNBT.getInteger("mEfficiency"); + this.mPollution = aNBT.getInteger("mPollution"); + this.mRuntime = aNBT.getInteger("mRuntime"); + this.mOutputItems = new ItemStack[this.getAmountOfOutputs()]; + for (int i = 0; i < this.mOutputItems.length; i++) { + this.mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); + } + this.mOutputFluids = new FluidStack[this.getAmountOfOutputs()]; + for (int i = 0; i < this.mOutputFluids.length; i++) { + this.mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); + } + this.mWrench = aNBT.getBoolean("mWrench"); + this.mScrewdriver = aNBT.getBoolean("mScrewdriver"); + this.mSoftHammer = aNBT.getBoolean("mSoftHammer"); + this.mHardHammer = aNBT.getBoolean("mHardHammer"); + this.mSolderingTool = aNBT.getBoolean("mSolderingTool"); + this.mCrowbar = aNBT.getBoolean("mCrowbar"); + } + + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); + } + + @Override + public byte getTileEntityBaseType() { + return 2; + } + + @Override + public void onMachineBlockUpdate() { + this.mUpdate = 50; + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if (this.mEfficiency < 0) { + this.mEfficiency = 0; + } + if ((--this.mUpdate == 0) || (--this.mStartUpCheck == 0)) { + this.mInputHatches.clear(); + this.mInputBusses.clear(); + this.mOutputHatches.clear(); + this.mOutputBusses.clear(); + this.mDynamoHatches.clear(); + this.mEnergyHatches.clear(); + this.mMufflerHatches.clear(); + this.mMaintenanceHatches.clear(); + this.mMachine = this.checkMachine(aBaseMetaTileEntity, this.mInventory[1]); + } + if (this.mStartUpCheck < 0) { + if (this.mMachine) { + for (final GT_MetaTileEntity_Hatch_Maintenance tHatch : this.mMaintenanceHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (!DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance) { + if (tHatch.mWrench) { + this.mWrench = true; + } + if (tHatch.mScrewdriver) { + this.mScrewdriver = true; + } + if (tHatch.mSoftHammer) { + this.mSoftHammer = true; + } + if (tHatch.mHardHammer) { + this.mHardHammer = true; + } + if (tHatch.mSolderingTool) { + this.mSolderingTool = true; + } + if (tHatch.mCrowbar) { + this.mCrowbar = true; + } + } else { + this.mWrench = true; + this.mScrewdriver = true; + this.mSoftHammer = true; + this.mHardHammer = true; + this.mSolderingTool = true; + this.mCrowbar = true; + } + + tHatch.mWrench = false; + tHatch.mScrewdriver = false; + tHatch.mSoftHammer = false; + tHatch.mHardHammer = false; + tHatch.mSolderingTool = false; + tHatch.mCrowbar = false; + } + } + if (this.getRepairStatus() > 0) { + if ((this.mMaxProgresstime > 0) && this.doRandomMaintenanceDamage()) { + if (this.onRunningTick(this.mInventory[1])) { + if (!this.polluteEnvironment(this.getPollutionPerTick(this.mInventory[1]))) { + this.stopMachine(); + } + if ((this.mMaxProgresstime > 0) && (++this.mProgresstime >= this.mMaxProgresstime)) { + if (this.mOutputItems != null) { + for (final ItemStack tStack : this.mOutputItems) { + if (tStack != null) { + try { + GT_Mod.achievements.issueAchivementHatch(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack); + } catch (final Exception e) { + } + this.addOutput(tStack); + } + } + } + if ((this.mOutputFluids != null) && (this.mOutputFluids.length == 1)) { + for (final FluidStack tStack : this.mOutputFluids) { + if (tStack != null) { + this.addOutput(tStack); + } + } + } else if ((this.mOutputFluids != null) && (this.mOutputFluids.length > 1)) { + this.addFluidOutputs(this.mOutputFluids); + } + this.mEfficiency = Math.max(0, Math.min(this.mEfficiency + this.mEfficiencyIncrease, this.getMaxEfficiency(this.mInventory[1]) - ((this.getIdealStatus() - this.getRepairStatus()) * 1000))); + this.mOutputItems = null; + this.mProgresstime = 0; + this.mMaxProgresstime = 0; + this.mEfficiencyIncrease = 0; + if (aBaseMetaTileEntity.isAllowedToWork()) { + this.checkRecipe(this.mInventory[1]); + } + if ((this.mOutputFluids != null) && (this.mOutputFluids.length > 0)) { + if (this.mOutputFluids.length > 1) { + GT_Mod.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant"); + } + } + } + } + } else { + if (((aTick % 100) == 0) || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { + + if (aBaseMetaTileEntity.isAllowedToWork()) { + this.checkRecipe(this.mInventory[1]); + } + if (this.mMaxProgresstime <= 0) { + this.mEfficiency = Math.max(0, this.mEfficiency - 1000); + } + } + } + } else { + this.stopMachine(); + } + } else { + this.stopMachine(); + } + } + aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (this.mWrench ? 0 : 1) | (this.mScrewdriver ? 0 : 2) | (this.mSoftHammer ? 0 : 4) | (this.mHardHammer ? 0 : 8) | (this.mSolderingTool ? 0 : 16) | (this.mCrowbar ? 0 : 32) | (this.mMachine ? 0 : 64)); + aBaseMetaTileEntity.setActive(this.mMaxProgresstime > 0); + } + } + + public boolean polluteEnvironment(final int aPollutionLevel) { + this.mPollution += aPollutionLevel; + for (final GT_MetaTileEntity_Hatch_Muffler tHatch : this.mMufflerHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (this.mPollution >= 10000) { + if (tHatch.polluteEnvironment()) { + this.mPollution -= 10000; + } + } else { + break; + } + } + } + return this.mPollution < 10000; + } + + /** + * Called every tick the Machine runs + */ + public boolean onRunningTick(final ItemStack aStack) { + if (this.mEUt > 0) { + this.addEnergyOutput(((long) this.mEUt * this.mEfficiency) / 10000); + return true; + } + if (this.mEUt < 0) { + if (!this.drainEnergyInput(((long) -this.mEUt * 10000) / Math.max(1000, this.mEfficiency))) { + this.stopMachine(); + return false; + } + } + return true; + } + + /** + * Checks if this is a Correct Machine Part for this kind of Machine (Turbine Rotor for example) + */ + public abstract boolean isCorrectMachinePart(ItemStack aStack); + + /** + * Checks the Recipe + */ + public abstract boolean checkRecipe(ItemStack aStack); + + /** + * Checks the Machine. You have to assign the MetaTileEntities for the Hatches here. + */ + public abstract boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack); + + /** + * Gets the maximum Efficiency that spare Part can get (0 - 10000) + */ + public abstract int getMaxEfficiency(ItemStack aStack); + + /** + * Gets the pollution this Device outputs to a Muffler per tick (10000 = one Pullution Block) + */ + public abstract int getPollutionPerTick(ItemStack aStack); + + /** + * Gets the damage to the ItemStack, usually 0 or 1. + */ + public abstract int getDamageToComponent(ItemStack aStack); + + /** + * Gets the Amount of possibly outputted Items for loading the Output Stack Array from NBT. + * This should be the largest Amount that can ever happen legitimately. + */ + public abstract int getAmountOfOutputs(); + + /** + * If it explodes when the Component has to be replaced. + */ + public abstract boolean explodesOnComponentBreak(ItemStack aStack); + + public void stopMachine() { + this.mOutputItems = null; + this.mEUt = 0; + this.mEfficiency = 0; + this.mProgresstime = 0; + this.mMaxProgresstime = 0; + this.mEfficiencyIncrease = 0; + this.getBaseMetaTileEntity().disableWorking(); + } + + public int getRepairStatus() { + return (this.mWrench ? 1 : 0) + (this.mScrewdriver ? 1 : 0) + (this.mSoftHammer ? 1 : 0) + (this.mHardHammer ? 1 : 0) + (this.mSolderingTool ? 1 : 0) + (this.mCrowbar ? 1 : 0); + } + + public int getIdealStatus() { + return 6; + } + + public boolean doRandomMaintenanceDamage() { + if (!this.isCorrectMachinePart(this.mInventory[1]) || (this.getRepairStatus() == 0)) { + this.stopMachine(); + return false; + } + if (this.mRuntime++ > 1000) { + this.mRuntime = 0; + if (this.getBaseMetaTileEntity().getRandomNumber(6000) == 0) { + switch (this.getBaseMetaTileEntity().getRandomNumber(6)) { + case 0: + this.mWrench = false; + break; + case 1: + this.mScrewdriver = false; + break; + case 2: + this.mSoftHammer = false; + break; + case 3: + this.mHardHammer = false; + break; + case 4: + this.mSolderingTool = false; + break; + case 5: + this.mCrowbar = false; + break; + } + } + if ((this.mInventory[1] != null) && (this.getBaseMetaTileEntity().getRandomNumber(2) == 0) && !this.mInventory[1].getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.")) { + if (this.mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { + final NBTTagCompound tNBT = this.mInventory[1].getTagCompound(); + if (tNBT != null) { + NBTTagCompound tNBT2 = tNBT.getCompoundTag("GT.CraftingComponents"); + if (!tNBT.getBoolean("mDis")) { + tNBT2 = new NBTTagCompound(); + final Materials tMaterial = GT_MetaGenerated_Tool.getPrimaryMaterial(this.mInventory[1]); + final ItemStack tTurbine = GT_OreDictUnificator.get(OrePrefixes.turbineBlade, tMaterial, 1); + final int i = this.mInventory[1].getItemDamage(); + if (i == 170) { + ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); + tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); + tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Magnalium, 1); + tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); + } else if (i == 172) { + ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); + tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.7", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.8", tStack.writeToNBT(new NBTTagCompound())); + tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Titanium, 1); + tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); + } else if (i == 174) { + ItemStack tStack = GT_Utility.copyAmount(2, tTurbine); + tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); + tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.TungstenSteel, 1); + tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); + } else if (i == 176) { + ItemStack tStack = GT_Utility.copyAmount(2, tTurbine); + tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.7", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.8", tStack.writeToNBT(new NBTTagCompound())); + tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Americium, 1); + tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); + } + tNBT.setTag("GT.CraftingComponents", tNBT2); + tNBT.setBoolean("mDis", true); + this.mInventory[1].setTagCompound(tNBT); + + } + } + + ((GT_MetaGenerated_Tool) this.mInventory[1].getItem()).doDamage(this.mInventory[1], (long) Math.min(this.mEUt / 5, Math.pow(this.mEUt, 0.7))); + if (this.mInventory[1].stackSize == 0) { + this.mInventory[1] = null; + } + } + } + } + return true; + } + + public void explodeMultiblock() { + this.mInventory[1] = null; + for (final MetaTileEntity tTileEntity : this.mInputBusses) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mOutputBusses) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mInputHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mOutputHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mDynamoHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mMufflerHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mEnergyHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mMaintenanceHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + this.getBaseMetaTileEntity().doExplosion(V[8]); + } + + public boolean addEnergyOutput(final long aEU) { + if (aEU <= 0) { + return true; + } + for (final GT_MetaTileEntity_Hatch_Dynamo tHatch : this.mDynamoHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(aEU, false)) { + return true; + } + } + } + return false; + } + + public long getMaxInputVoltage() { + long rVoltage = 0; + for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) { + if (isValidMetaTileEntity(tHatch)) { + rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); + } + } + return rVoltage; + } + + public boolean drainEnergyInput(final long aEU) { + if (aEU <= 0) { + return true; + } + for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) { + return true; + } + } + } + return false; + } + + public boolean addOutput(final FluidStack aLiquid) { + if (aLiquid == null) { + return false; + } + final FluidStack tLiquid = aLiquid.copy(); + for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { + if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) { + final int tAmount = tHatch.fill(tLiquid, false); + if (tAmount >= tLiquid.amount) { + return tHatch.fill(tLiquid, true) >= tLiquid.amount; + } else if (tAmount > 0) { + tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true); + } + } + } + return false; + } + + private void addFluidOutputs(final FluidStack[] mOutputFluids2) { + for (int i = 0; i < mOutputFluids2.length; i++) { + if ((this.mOutputHatches.size() > i) && (this.mOutputHatches.get(i) != null) && (mOutputFluids2[i] != null) && isValidMetaTileEntity(this.mOutputHatches.get(i))) { + this.mOutputHatches.get(i).fill(mOutputFluids2[i], true); + } + } + + } + + public boolean depleteInput(final FluidStack aLiquid) { + if (aLiquid == null) { + return false; + } + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + FluidStack tLiquid = tHatch.getFluid(); + if ((tLiquid != null) && tLiquid.isFluidEqual(aLiquid)) { + tLiquid = tHatch.drain(aLiquid.amount, false); + if ((tLiquid != null) && (tLiquid.amount >= aLiquid.amount)) { + tLiquid = tHatch.drain(aLiquid.amount, true); + return (tLiquid != null) && (tLiquid.amount >= aLiquid.amount); + } + } + } + } + return false; + } + + public boolean addOutput(ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) { + return false; + } + aStack = GT_Utility.copy(aStack); + // FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); + // if (aLiquid == null) { + for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) { + if (isValidMetaTileEntity(tHatch)) { + for (int i = tHatch.getSizeInventory() - 1; i >= 0; i--) { + if (tHatch.getBaseMetaTileEntity().addStackToSlot(i, aStack)) { + return true; + } + } + } + } + for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { + if (isValidMetaTileEntity(tHatch) && tHatch.outputsItems()) { + if (tHatch.getBaseMetaTileEntity().addStackToSlot(1, aStack)) { + return true; + } + } + } + // }else { + // for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { + // if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid)?tHatch.outputsSteam():tHatch.outputsLiquids()) { + // int tAmount = tHatch.fill(aLiquid, false); + // if (tAmount >= aLiquid.amount) { + // return tHatch.fill(aLiquid, true) >= aLiquid.amount; + // } + // } + // } + // } + return false; + } + + public boolean depleteInput(final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) { + return false; + } + final FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); + if (aLiquid != null) { + return this.depleteInput(aLiquid); + } + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) { + if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { + tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); + return true; + } + } + } + } + for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) { + if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { + tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); + return true; + } + } + } + } + } + return false; + } + + public ArrayList<ItemStack> getStoredOutputs() { + final ArrayList<ItemStack> rList = new ArrayList<>(); + for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { + if (isValidMetaTileEntity(tHatch)) { + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1)); + } + } + for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) { + if (isValidMetaTileEntity(tHatch)) { + for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + } + return rList; + } + + public ArrayList<FluidStack> getStoredFluids() { + final ArrayList<FluidStack> rList = new ArrayList<>(); + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch) && (tHatch.getFillableStack() != null)) { + rList.add(tHatch.getFillableStack()); + } + } + return rList; + } + + public ArrayList<ItemStack> getStoredInputs() { + final ArrayList<ItemStack> rList = new ArrayList<>(); + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch) && (tHatch.getBaseMetaTileEntity().getStackInSlot(0) != null)) { + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(0)); + } + } + for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null) { + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + } + } + return rList; + } + + public GT_Recipe_Map getRecipeMap() { + return null; + } + + public void updateSlots() { + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + if (isValidMetaTileEntity(tHatch)) { + tHatch.updateSlots(); + } + } + for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { + if (isValidMetaTileEntity(tHatch)) { + tHatch.updateSlots(); + } + } + } + + public boolean addToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { + return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { + return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { + return this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { + return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { + return this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); + } + return false; + } + + public boolean addMaintenanceToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + } + return false; + } + + public boolean addEnergyInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + } + return false; + } + + public boolean addDynamoToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); + } + return false; + } + + public boolean addMufflerToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); + } + return false; + } + + public boolean addInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = this.getRecipeMap(); + return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = this.getRecipeMap(); + return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + } + return false; + } + + public boolean addOutputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); + } + return false; + } + + @Override + public String[] getInfoData() { + return new String[]{"Progress:", (this.mProgresstime / 20) + "secs", (this.mMaxProgresstime / 20) + "secs", "Efficiency:", (this.mEfficiency / 100.0F) + "%", "Problems:", "" + (this.getIdealStatus() - this.getRepairStatus())}; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return false; + } } diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java index 07b2872c7c..8c1336374c 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java @@ -1,10 +1,10 @@ package gtPlusPlus.core.util.debug; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.*; import net.minecraft.item.Item; import net.minecraftforge.client.event.RenderGameOverlayEvent; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class DEBUG_ScreenOverlay extends Gui { @@ -12,19 +12,19 @@ public class DEBUG_ScreenOverlay extends Gui { Minecraft mc = Minecraft.getMinecraft(); @SubscribeEvent - public void eventHandler(RenderGameOverlayEvent.Text event) + public void eventHandler(final RenderGameOverlayEvent.Text event) { //if (mc.thePlayer.getHeldItem().equals(ModItems.itemStaballoyPickaxe)){ - ScaledResolution res = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); - FontRenderer fontRender = mc.fontRenderer; + final ScaledResolution res = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); + final FontRenderer fontRender = this.mc.fontRenderer; this.width = res.getScaledWidth(); this.height = res.getScaledHeight(); Minecraft.getMinecraft().entityRenderer.setupOverlayRendering(); - String str = "Words"; + final String str = "Words"; Item heldItem = null; - try{heldItem = mc.thePlayer.getHeldItem().getItem(); + try{heldItem = this.mc.thePlayer.getHeldItem().getItem(); if (heldItem != null){ /*if (heldItem instanceof StaballoyPickaxe){ @@ -37,7 +37,7 @@ public class DEBUG_ScreenOverlay extends Gui { drawString(fontRender, str, (this.width - fontRender.getStringWidth(str)) / 2, this.height / 10, 0xFFAA00); }*/ } - }catch(NullPointerException e){} + }catch(final NullPointerException e){} } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java index 1eb69eb11b..a0690c9440 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java @@ -1,9 +1,8 @@ package gtPlusPlus.core.util.debug; -import gtPlusPlus.core.util.Utils; - import java.util.concurrent.TimeUnit; +import gtPlusPlus.core.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -12,51 +11,51 @@ import net.minecraftforge.common.util.ForgeDirection; public class DEBUG_TimerThread implements Runnable { - private World world; - private EntityPlayer player; - + private final World world; + private final EntityPlayer player; + - public DEBUG_TimerThread(World WORLD, EntityPlayer PLAYER) { - world = WORLD; - player = PLAYER; + public DEBUG_TimerThread(final World WORLD, final EntityPlayer PLAYER) { + this.world = WORLD; + this.player = PLAYER; } @Override public void run(){ - int xDir = ForgeDirection.getOrientation(player.getPlayerCoordinates().posX).offsetX; - int zDir = ForgeDirection.getOrientation(player.getPlayerCoordinates().posZ).offsetZ; - - int stepX = Minecraft.getMinecraft().objectMouseOver.blockX; - int stepY = Minecraft.getMinecraft().objectMouseOver.blockY; - int stepZ = Minecraft.getMinecraft().objectMouseOver.blockZ; + int xDir = ForgeDirection.getOrientation(this.player.getPlayerCoordinates().posX).offsetX; + int zDir = ForgeDirection.getOrientation(this.player.getPlayerCoordinates().posZ).offsetZ; + + final int stepX = Minecraft.getMinecraft().objectMouseOver.blockX; + final int stepY = Minecraft.getMinecraft().objectMouseOver.blockY; + final int stepZ = Minecraft.getMinecraft().objectMouseOver.blockZ; Utils.LOG_INFO("Clicked on a Block @ "+"[X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"+" with xDir:"+xDir+" zDir:"+zDir); - world.setBlock(stepX, stepY, stepZ, Blocks.bedrock,0,3); + this.world.setBlock(stepX, stepY, stepZ, Blocks.bedrock,0,3); Utils.LOG_INFO("Makng it Bedrock for future investment."); //for (int i = -1; i <= 1; i++) { //stepX = stepX+i; - for (int i = stepX-1; i <= stepX+1; i++){ - for (int j = stepZ-1; j <= stepZ+1; j++){ - for (int h = stepY-1; h <= stepY+1; h++){ - - xDir = ForgeDirection.getOrientation(player.getPlayerCoordinates().posX).offsetX; - zDir = ForgeDirection.getOrientation(player.getPlayerCoordinates().posZ).offsetZ; - - //for (int j = -1; j <= 1; j++) { - //stepZ = stepZ+j; - //for (int h = -1; h <= 1; h++) { + for (int i = stepX-1; i <= (stepX+1); i++){ + for (int j = stepZ-1; j <= (stepZ+1); j++){ + for (int h = stepY-1; h <= (stepY+1); h++){ + + xDir = ForgeDirection.getOrientation(this.player.getPlayerCoordinates().posX).offsetX; + zDir = ForgeDirection.getOrientation(this.player.getPlayerCoordinates().posZ).offsetZ; + + //for (int j = -1; j <= 1; j++) { + //stepZ = stepZ+j; + //for (int h = -1; h <= 1; h++) { //stepY = stepY+h; - Utils.LOG_INFO("Placing Block @ "+"[X:"+i+"][Y:"+h+"][Z:"+j+"]"+" with xDir:"+xDir+" zDir:"+zDir); - if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { - world.setBlock(i, h, j, Blocks.stone,0,3); + Utils.LOG_INFO("Placing Block @ "+"[X:"+i+"][Y:"+h+"][Z:"+j+"]"+" with xDir:"+xDir+" zDir:"+zDir); + if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { + this.world.setBlock(i, h, j, Blocks.stone,0,3); } else { Utils.LOG_INFO("Not even sure what this is for, but I got here."); } try { TimeUnit.MILLISECONDS.sleep(500); - } catch (InterruptedException e1) { + } catch (final InterruptedException e1) { e1.printStackTrace(); - } + } } } } diff --git a/src/Java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java b/src/Java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java index 59c652d73b..7cb1054d53 100644 --- a/src/Java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java +++ b/src/Java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java @@ -12,332 +12,332 @@ import org.lwjgl.opengl.GL11; */ public class UtilityGL11Debug { - public class GLproperty - { - public GLproperty(int init_gLconstant, String init_name, String init_description, String init_category, String init_fetchCommand) { - gLconstant = init_gLconstant; - name = init_name; - description = init_description; - category = init_category; - fetchCommand = init_fetchCommand; - } + public class GLproperty + { + public GLproperty(final int init_gLconstant, final String init_name, final String init_description, final String init_category, final String init_fetchCommand) { + this.gLconstant = init_gLconstant; + this.name = init_name; + this.description = init_description; + this.category = init_category; + this.fetchCommand = init_fetchCommand; + } - public int gLconstant; - public String name; - public String description; - public String category; - public String fetchCommand; - } + public int gLconstant; + public String name; + public String description; + public String category; + public String fetchCommand; + } - public static UtilityGL11Debug instance = new UtilityGL11Debug(); + public static UtilityGL11Debug instance = new UtilityGL11Debug(); - public GLproperty[] propertyList = + public GLproperty[] propertyList = - { - new GLproperty(GL11.GL_CURRENT_COLOR, "GL_CURRENT_COLOR", "Current color", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_INDEX, "GL_CURRENT_INDEX", "Current color index", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_TEXTURE_COORDS, "GL_CURRENT_TEXTURE_COORDS", "Current texture coordinates", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_NORMAL, "GL_CURRENT_NORMAL", "Current normal", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_POSITION, "GL_CURRENT_RASTER_POSITION", "Current raster position", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_DISTANCE, "GL_CURRENT_RASTER_DISTANCE", "Current raster distance", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_COLOR, "GL_CURRENT_RASTER_COLOR", "Color associated with raster position", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_INDEX, "GL_CURRENT_RASTER_INDEX", "Color index associated with raster position", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_TEXTURE_COORDS, "GL_CURRENT_RASTER_TEXTURE_COORDS", "Texture coordinates associated with raster position", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_POSITION_VALID, "GL_CURRENT_RASTER_POSITION_VALID", "Raster position valid bit", "current", "glGetBooleanv()"), - new GLproperty(GL11.GL_EDGE_FLAG, "GL_EDGE_FLAG", "Edge flag", "current", "glGetBooleanv()"), - new GLproperty(GL11.GL_VERTEX_ARRAY, "GL_VERTEX_ARRAY", "Vertex array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_VERTEX_ARRAY_SIZE, "GL_VERTEX_ARRAY_SIZE", "Coordinates per vertex", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_VERTEX_ARRAY_TYPE, "GL_VERTEX_ARRAY_TYPE", "Type of vertex coordinates", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_VERTEX_ARRAY_STRIDE, "GL_VERTEX_ARRAY_STRIDE", "Stride between vertices", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_VERTEX_ARRAY_POINTER, "GL_VERTEX_ARRAY_POINTER", "Pointer to the vertex array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_NORMAL_ARRAY, "GL_NORMAL_ARRAY", "Normal array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_NORMAL_ARRAY_TYPE, "GL_NORMAL_ARRAY_TYPE", "Type of normal coordinates", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_NORMAL_ARRAY_STRIDE, "GL_NORMAL_ARRAY_STRIDE", "Stride between normals", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_NORMAL_ARRAY_POINTER, "GL_NORMAL_ARRAY_POINTER", "Pointer to the normal array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_COLOR_ARRAY, "GL_COLOR_ARRAY", "RGBA color array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_ARRAY_SIZE, "GL_COLOR_ARRAY_SIZE", "Colors per vertex", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_ARRAY_TYPE, "GL_COLOR_ARRAY_TYPE", "Type of color components", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_ARRAY_STRIDE, "GL_COLOR_ARRAY_STRIDE", "Stride between colors", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_ARRAY_POINTER, "GL_COLOR_ARRAY_POINTER", "Pointer to the color array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_INDEX_ARRAY, "GL_INDEX_ARRAY", "Color-index array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_INDEX_ARRAY_TYPE, "GL_INDEX_ARRAY_TYPE", "Type of color indices", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_ARRAY_STRIDE, "GL_INDEX_ARRAY_STRIDE", "Stride between color indices", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_ARRAY_POINTER, "GL_INDEX_ARRAY_POINTER", "Pointer to the index array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY, "GL_TEXTURE_COORD_ARRAY", "Texture coordinate array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_SIZE, "GL_TEXTURE_COORD_ARRAY_SIZE", "Texture coordinates per element", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_TYPE, "GL_TEXTURE_COORD_ARRAY_TYPE", "Type of texture coordinates", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_STRIDE, "GL_TEXTURE_COORD_ARRAY_STRIDE", "Stride between texture coordinates", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_POINTER, "GL_TEXTURE_COORD_ARRAY_POINTER", "Pointer to the texture coordinate array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_EDGE_FLAG_ARRAY, "GL_EDGE_FLAG_ARRAY", "Edge flag array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_EDGE_FLAG_ARRAY_STRIDE, "GL_EDGE_FLAG_ARRAY_STRIDE", "Stride between edge flags", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_EDGE_FLAG_ARRAY_POINTER, "GL_EDGE_FLAG_ARRAY_POINTER", "Pointer to the edge flag array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_MODELVIEW_MATRIX, "GL_MODELVIEW_MATRIX", "Modelview matrix stack", "matrix", "glGetFloatv()"), - new GLproperty(GL11.GL_PROJECTION_MATRIX, "GL_PROJECTION_MATRIX", "Projection matrix stack", "matrix", "glGetFloatv()"), - new GLproperty(GL11.GL_TEXTURE_MATRIX, "GL_TEXTURE_MATRIX", "Texture matrix stack", "matrix", "glGetFloatv()"), - new GLproperty(GL11.GL_VIEWPORT, "GL_VIEWPORT", "Viewport origin and extent", "viewport", "glGetIntegerv()"), - new GLproperty(GL11.GL_DEPTH_RANGE, "GL_DEPTH_RANGE", "Depth range near and far", "viewport", "glGetFloatv()"), - new GLproperty(GL11.GL_MODELVIEW_STACK_DEPTH, "GL_MODELVIEW_STACK_DEPTH", "Modelview matrix stack pointer", "matrix", "glGetIntegerv()"), - new GLproperty(GL11.GL_PROJECTION_STACK_DEPTH, "GL_PROJECTION_STACK_DEPTH", "Projection matrix stack pointer", "matrix", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_STACK_DEPTH, "GL_TEXTURE_STACK_DEPTH", "Texture matrix stack pointer", "matrix", "glGetIntegerv()"), - new GLproperty(GL11.GL_MATRIX_MODE, "GL_MATRIX_MODE", "Current matrix mode", "transform", "glGetIntegerv()"), - new GLproperty(GL11.GL_NORMALIZE, "GL_NORMALIZE", "Current normal normalization on/off", "transform/ enable", "glIsEnabled()"), - new GLproperty(GL11.GL_FOG_COLOR, "GL_FOG_COLOR", "Fog color", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_INDEX, "GL_FOG_INDEX", "Fog index", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_DENSITY, "GL_FOG_DENSITY", "Exponential fog density", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_START, "GL_FOG_START", "Linear fog start", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_END, "GL_FOG_END", "Linear fog end", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_MODE, "GL_FOG_MODE", "Fog mode", "fog", "glGetIntegerv()"), - new GLproperty(GL11.GL_FOG, "GL_FOG", "True if fog enabled", "fog/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_SHADE_MODEL, "GL_SHADE_MODEL", "glShadeModel() setting", "lighting", "glGetIntegerv()"), - new GLproperty(GL11.GL_LIGHTING, "GL_LIGHTING", "True if lighting is enabled", "lighting/e nable", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_MATERIAL, "GL_COLOR_MATERIAL", "True if color tracking is enabled", "lighting", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_MATERIAL_PARAMETER, "GL_COLOR_MATERIAL_PARAMETER", "Material properties tracking current color", "lighting", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_MATERIAL_FACE, "GL_COLOR_MATERIAL_FACE", "Face(s) affected by color tracking", "lighting", "glGetIntegerv()"), - new GLproperty(GL11.GL_AMBIENT, "GL_AMBIENT", "Ambient material color", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_DIFFUSE, "GL_DIFFUSE", "Diffuse material color", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_SPECULAR, "GL_SPECULAR", "Specular material color", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_EMISSION, "GL_EMISSION", "Emissive material color", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_SHININESS, "GL_SHININESS", "Specular exponent of material", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_LIGHT_MODEL_AMBIENT, "GL_LIGHT_MODEL_AMBIENT", "Ambient scene color", "lighting", "glGetFloatv()"), - new GLproperty(GL11.GL_LIGHT_MODEL_LOCAL_VIEWER, "GL_LIGHT_MODEL_LOCAL_VIEWER", "Viewer is local", "lighting", "glGetBooleanv()"), - new GLproperty(GL11.GL_LIGHT_MODEL_TWO_SIDE, "GL_LIGHT_MODEL_TWO_SIDE", "Use two-sided lighting", "lighting", "glGetBooleanv()"), - new GLproperty(GL11.GL_AMBIENT, "GL_AMBIENT", "Ambient intensity of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_DIFFUSE, "GL_DIFFUSE", "Diffuse intensity of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_SPECULAR, "GL_SPECULAR", "Specular intensity of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_POSITION, "GL_POSITION", "Position of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_CONSTANT_ATTENUATION, "GL_CONSTANT_ATTENUATION", "Constant attenuation factor", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_LINEAR_ATTENUATION, "GL_LINEAR_ATTENUATION", "Linear attenuation factor", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_QUADRATIC_ATTENUATION, "GL_QUADRATIC_ATTENUATION", "Quadratic attenuation factor", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_SPOT_DIRECTION, "GL_SPOT_DIRECTION", "Spotlight direction of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_SPOT_EXPONENT, "GL_SPOT_EXPONENT", "Spotlight exponent of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_SPOT_CUTOFF, "GL_SPOT_CUTOFF", "Spotlight angle of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_LIGHT0, "GL_LIGHT0", "True if light 0 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT1, "GL_LIGHT1", "True if light 1 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT2, "GL_LIGHT2", "True if light 2 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT3, "GL_LIGHT3", "True if light 3 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT4, "GL_LIGHT4", "True if light 4 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT5, "GL_LIGHT5", "True if light 5 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT6, "GL_LIGHT6", "True if light 6 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT7, "GL_LIGHT7", "True if light 7 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_INDEXES, "GL_COLOR_INDEXES", "ca, cd, and cs for color-index lighting", "lighting/e nable", "glGetMaterialfv()"), - new GLproperty(GL11.GL_POINT_SIZE, "GL_POINT_SIZE", "Point size", "point", "glGetFloatv()"), - new GLproperty(GL11.GL_POINT_SMOOTH, "GL_POINT_SMOOTH", "Point antialiasing on", "point/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LINE_WIDTH, "GL_LINE_WIDTH", "Line width", "line", "glGetFloatv()"), - new GLproperty(GL11.GL_LINE_SMOOTH, "GL_LINE_SMOOTH", "Line antialiasing on", "line/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LINE_STIPPLE_PATTERN, "GL_LINE_STIPPLE_PATTERN", "Line stipple", "line", "glGetIntegerv()"), - new GLproperty(GL11.GL_LINE_STIPPLE_REPEAT, "GL_LINE_STIPPLE_REPEAT", "Line stipple repeat", "line", "glGetIntegerv()"), - new GLproperty(GL11.GL_LINE_STIPPLE, "GL_LINE_STIPPLE", "Line stipple enable", "line/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_CULL_FACE, "GL_CULL_FACE", "Polygon culling enabled", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_CULL_FACE_MODE, "GL_CULL_FACE_MODE", "Cull front-/back-facing polygons", "polygon", "glGetIntegerv()"), - new GLproperty(GL11.GL_FRONT_FACE, "GL_FRONT_FACE", "Polygon front-face CW/CCW indicator", "polygon", "glGetIntegerv()"), - new GLproperty(GL11.GL_POLYGON_SMOOTH, "GL_POLYGON_SMOOTH", "Polygon antialiasing on", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_POLYGON_MODE, "GL_POLYGON_MODE", "Polygon rasterization mode (front and back)", "polygon", "glGetIntegerv()"), - new GLproperty(GL11.GL_POLYGON_OFFSET_FACTOR, "GL_POLYGON_OFFSET_FACTOR", "Polygon offset factor", "polygon", "glGetFloatv()"), - new GLproperty(GL11.GL_POLYGON_OFFSET_POINT, "GL_POLYGON_OFFSET_POINT", "Polygon offset enable for GL_POINT mode rasterization", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_POLYGON_OFFSET_LINE, "GL_POLYGON_OFFSET_LINE", "Polygon offset enable for GL_LINE mode rasterization", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_POLYGON_OFFSET_FILL, "GL_POLYGON_OFFSET_FILL", "Polygon offset enable for GL_FILL mode rasterization", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_POLYGON_STIPPLE, "GL_POLYGON_STIPPLE", "Polygon stipple enable", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_1D, "GL_TEXTURE_1D", "True if 1-D texturing enabled ", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_2D, "GL_TEXTURE_2D", "True if 2-D texturing enabled ", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_BINDING_1D, "GL_TEXTURE_BINDING_1D", "Texture object bound to GL_TEXTURE_1D", "texture", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_BINDING_2D, "GL_TEXTURE_BINDING_2D", "Texture object bound to GL_TEXTURE_2D", "texture", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE, "GL_TEXTURE", "x-D texture image at level of detail i", "UNUSED", "glGetTexImage()"), - new GLproperty(GL11.GL_TEXTURE_WIDTH, "GL_TEXTURE_WIDTH", "x-D texture image i's width", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_HEIGHT, "GL_TEXTURE_HEIGHT", "x-D texture image i's height", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_BORDER, "GL_TEXTURE_BORDER", "x-D texture image i's border width", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_RED_SIZE, "GL_TEXTURE_RED_SIZE", "x-D texture image i's red resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_GREEN_SIZE, "GL_TEXTURE_GREEN_SIZE", "x-D texture image i's green resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_BLUE_SIZE, "GL_TEXTURE_BLUE_SIZE", "x-D texture image i's blue resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_ALPHA_SIZE, "GL_TEXTURE_ALPHA_SIZE", "x-D texture image i's alpha resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_LUMINANCE_SIZE, "GL_TEXTURE_LUMINANCE_SIZE", "x-D texture image i's luminance resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_INTENSITY_SIZE, "GL_TEXTURE_INTENSITY_SIZE", "x-D texture image i's intensity resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_BORDER_COLOR, "GL_TEXTURE_BORDER_COLOR", "Texture border color", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_MIN_FILTER, "GL_TEXTURE_MIN_FILTER", "Texture minification function", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_MAG_FILTER, "GL_TEXTURE_MAG_FILTER", "Texture magnification function", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_WRAP_S, "GL_TEXTURE_WRAP_S", "Texture wrap mode (x is S or T)", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_WRAP_T, "GL_TEXTURE_WRAP_T", "Texture wrap mode (x is S or T)", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_PRIORITY, "GL_TEXTURE_PRIORITY", "Texture object priority", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_ENV_MODE, "GL_TEXTURE_ENV_MODE", "Texture application function", "texture", "glGetTexEnviv()"), - new GLproperty(GL11.GL_TEXTURE_ENV_COLOR, "GL_TEXTURE_ENV_COLOR", "Texture environment color", "texture", "glGetTexEnvfv()"), - new GLproperty(GL11.GL_TEXTURE_GEN_S, "GL_TEXTURE_GEN_S", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_GEN_T, "GL_TEXTURE_GEN_T", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_GEN_R, "GL_TEXTURE_GEN_R", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_GEN_Q, "GL_TEXTURE_GEN_Q", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_EYE_PLANE, "GL_EYE_PLANE", "Texgen plane equation coefficients", "texture", "glGetTexGenfv()"), - new GLproperty(GL11.GL_OBJECT_PLANE, "GL_OBJECT_PLANE", "Texgen object linear coefficients", "texture", "glGetTexGenfv()"), - new GLproperty(GL11.GL_TEXTURE_GEN_MODE, "GL_TEXTURE_GEN_MODE", "Function used for texgen", "texture", "glGetTexGeniv()"), - new GLproperty(GL11.GL_SCISSOR_TEST, "GL_SCISSOR_TEST", "Scissoring enabled", "scissor/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_SCISSOR_BOX, "GL_SCISSOR_BOX", "Scissor box", "scissor", "glGetIntegerv()"), - new GLproperty(GL11.GL_ALPHA_TEST, "GL_ALPHA_TEST", "Alpha test enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_ALPHA_TEST_FUNC, "GL_ALPHA_TEST_FUNC", "Alpha test function", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_ALPHA_TEST_REF, "GL_ALPHA_TEST_REF", "Alpha test reference value", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_TEST, "GL_STENCIL_TEST", "Stenciling enabled", "stencil-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_STENCIL_FUNC, "GL_STENCIL_FUNC", "Stencil function", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_VALUE_MASK, "GL_STENCIL_VALUE_MASK", "Stencil mask", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_REF, "GL_STENCIL_REF", "Stencil reference value", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_FAIL, "GL_STENCIL_FAIL", "Stencil fail action", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_PASS_DEPTH_FAIL, "GL_STENCIL_PASS_DEPTH_FAIL", "Stencil depth buffer fail action", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_PASS_DEPTH_PASS, "GL_STENCIL_PASS_DEPTH_PASS", "Stencil depth buffer pass action", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_DEPTH_TEST, "GL_DEPTH_TEST", "Depth buffer enabled", "depth-buffer/ena ble", "glIsEnabled()"), - new GLproperty(GL11.GL_DEPTH_FUNC, "GL_DEPTH_FUNC", "Depth buffer test function", "depth-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_BLEND, "GL_BLEND", "Blending enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_BLEND_SRC, "GL_BLEND_SRC", "Blending source function", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_BLEND_DST, "GL_BLEND_DST", "Blending destination function", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_DITHER, "GL_DITHER", "Dithering enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_INDEX_LOGIC_OP, "GL_INDEX_LOGIC_OP", "Color index logical operation enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_LOGIC_OP, "GL_COLOR_LOGIC_OP", "RGBA color logical operation enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LOGIC_OP_MODE, "GL_LOGIC_OP_MODE", "Logical operation function", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_DRAW_BUFFER, "GL_DRAW_BUFFER", "Buffers selected for drawing", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_WRITEMASK, "GL_INDEX_WRITEMASK", "Color-index writemask", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_WRITEMASK, "GL_COLOR_WRITEMASK", "Color write enables; R, G, B, or A", "color-buffer", "glGetBooleanv()"), - new GLproperty(GL11.GL_DEPTH_WRITEMASK, "GL_DEPTH_WRITEMASK", "Depth buffer enabled for writing", "depth-buffer", "glGetBooleanv()"), - new GLproperty(GL11.GL_STENCIL_WRITEMASK, "GL_STENCIL_WRITEMASK", "Stencil-buffer writemask", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_CLEAR_VALUE, "GL_COLOR_CLEAR_VALUE", "Color-buffer clear value (RGBA mode)", "color-buffer", "glGetFloatv()"), - new GLproperty(GL11.GL_INDEX_CLEAR_VALUE, "GL_INDEX_CLEAR_VALUE", "Color-buffer clear value (color-index mode)", "color-buffer", "glGetFloatv()"), - new GLproperty(GL11.GL_DEPTH_CLEAR_VALUE, "GL_DEPTH_CLEAR_VALUE", "Depth-buffer clear value", "depth-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_CLEAR_VALUE, "GL_STENCIL_CLEAR_VALUE", "Stencil-buffer clear value", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_CLEAR_VALUE, "GL_ACCUM_CLEAR_VALUE", "Accumulation-buffer clear value", "accum-buffer", "glGetFloatv()"), - new GLproperty(GL11.GL_UNPACK_SWAP_BYTES, "GL_UNPACK_SWAP_BYTES", "Value of GL_UNPACK_SWAP_BYTES", "pixel-store", "glGetBooleanv()"), - new GLproperty(GL11.GL_UNPACK_LSB_FIRST, "GL_UNPACK_LSB_FIRST", "Value of GL_UNPACK_LSB_FIRST", "pixel-store", "glGetBooleanv()"), - new GLproperty(GL11.GL_UNPACK_ROW_LENGTH, "GL_UNPACK_ROW_LENGTH", "Value of GL_UNPACK_ROW_LENGTH", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_UNPACK_SKIP_ROWS, "GL_UNPACK_SKIP_ROWS", "Value of GL_UNPACK_SKIP_ROWS", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_UNPACK_SKIP_PIXELS, "GL_UNPACK_SKIP_PIXELS", "Value of GL_UNPACK_SKIP_PIXELS", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_UNPACK_ALIGNMENT, "GL_UNPACK_ALIGNMENT", "Value of GL_UNPACK_ALIGNMENT", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_PACK_SWAP_BYTES, "GL_PACK_SWAP_BYTES", "Value of GL_PACK_SWAP_BYTES", "pixel-store", "glGetBooleanv()"), - new GLproperty(GL11.GL_PACK_LSB_FIRST, "GL_PACK_LSB_FIRST", "Value of GL_PACK_LSB_FIRST", "pixel-store", "glGetBooleanv()"), - new GLproperty(GL11.GL_PACK_ROW_LENGTH, "GL_PACK_ROW_LENGTH", "Value of GL_PACK_ROW_LENGTH", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_PACK_SKIP_ROWS, "GL_PACK_SKIP_ROWS", "Value of GL_PACK_SKIP_ROWS", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_PACK_SKIP_PIXELS, "GL_PACK_SKIP_PIXELS", "Value of GL_PACK_SKIP_PIXELS", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_PACK_ALIGNMENT, "GL_PACK_ALIGNMENT", "Value of GL_PACK_ALIGNMENT", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAP_COLOR, "GL_MAP_COLOR", "True if colors are mapped", "pixel", "glGetBooleanv()"), - new GLproperty(GL11.GL_MAP_STENCIL, "GL_MAP_STENCIL", "True if stencil values are mapped", "pixel", "glGetBooleanv()"), - new GLproperty(GL11.GL_INDEX_SHIFT, "GL_INDEX_SHIFT", "Value of GL_INDEX_SHIFT", "pixel", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_OFFSET, "GL_INDEX_OFFSET", "Value of GL_INDEX_OFFSET", "pixel", "glGetIntegerv()"), - new GLproperty(GL11.GL_ZOOM_X, "GL_ZOOM_X", "x zoom factor", "pixel", "glGetFloatv()"), - new GLproperty(GL11.GL_ZOOM_Y, "GL_ZOOM_Y", "y zoom factor", "pixel", "glGetFloatv()"), - new GLproperty(GL11.GL_READ_BUFFER, "GL_READ_BUFFER", "Read source buffer", "pixel", "glGetIntegerv()"), - new GLproperty(GL11.GL_ORDER, "GL_ORDER", "1D map order", "capability", "glGetMapiv()"), - new GLproperty(GL11.GL_ORDER, "GL_ORDER", "2D map orders", "capability", "glGetMapiv()"), - new GLproperty(GL11.GL_COEFF, "GL_COEFF", "1D control points", "capability", "glGetMapfv()"), - new GLproperty(GL11.GL_COEFF, "GL_COEFF", "2D control points", "capability", "glGetMapfv()"), - new GLproperty(GL11.GL_DOMAIN, "GL_DOMAIN", "1D domain endpoints", "capability", "glGetMapfv()"), - new GLproperty(GL11.GL_DOMAIN, "GL_DOMAIN", "2D domain endpoints", "capability", "glGetMapfv()"), - new GLproperty(GL11.GL_MAP1_GRID_DOMAIN, "GL_MAP1_GRID_DOMAIN", "1D grid endpoints", "eval", "glGetFloatv()"), - new GLproperty(GL11.GL_MAP2_GRID_DOMAIN, "GL_MAP2_GRID_DOMAIN", "2D grid endpoints", "eval", "glGetFloatv()"), - new GLproperty(GL11.GL_MAP1_GRID_SEGMENTS, "GL_MAP1_GRID_SEGMENTS", "1D grid divisions", "eval", "glGetFloatv()"), - new GLproperty(GL11.GL_MAP2_GRID_SEGMENTS, "GL_MAP2_GRID_SEGMENTS", "2D grid divisions", "eval", "glGetFloatv()"), - new GLproperty(GL11.GL_AUTO_NORMAL, "GL_AUTO_NORMAL", "True if automatic normal generation enabled", "eval", "glIsEnabled()"), - new GLproperty(GL11.GL_PERSPECTIVE_CORRECTION_HINT, "GL_PERSPECTIVE_CORRECTION_HINT", "Perspective correction hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_POINT_SMOOTH_HINT, "GL_POINT_SMOOTH_HINT", "Point smooth hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_LINE_SMOOTH_HINT, "GL_LINE_SMOOTH_HINT", "Line smooth hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_POLYGON_SMOOTH_HINT, "GL_POLYGON_SMOOTH_HINT", "Polygon smooth hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_FOG_HINT, "GL_FOG_HINT", "Fog hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_LIGHTS, "GL_MAX_LIGHTS", "Maximum number of lights", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_CLIP_PLANES, "GL_MAX_CLIP_PLANES", "Maximum number of user clipping planes", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_MODELVIEW_STACK_DEPTH, "GL_MAX_MODELVIEW_STACK_DEPTH", "Maximum modelview-matrix stack depth", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_PROJECTION_STACK_DEPTH, "GL_MAX_PROJECTION_STACK_DEPTH", "Maximum projection-matrix stack depth", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_TEXTURE_STACK_DEPTH, "GL_MAX_TEXTURE_STACK_DEPTH", "Maximum depth of texture matrix stack", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_SUBPIXEL_BITS, "GL_SUBPIXEL_BITS", "Number of bits of subpixel precision in x and y", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_TEXTURE_SIZE, "GL_MAX_TEXTURE_SIZE", "See discussion in Texture Proxy in Chapter 9", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_PIXEL_MAP_TABLE, "GL_MAX_PIXEL_MAP_TABLE", "Maximum size of a glPixelMap() translation table", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_NAME_STACK_DEPTH, "GL_MAX_NAME_STACK_DEPTH", "Maximum selection-name stack depth", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_LIST_NESTING, "GL_MAX_LIST_NESTING", "Maximum display-list call nesting", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_EVAL_ORDER, "GL_MAX_EVAL_ORDER", "Maximum evaluator polynomial order", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_VIEWPORT_DIMS, "GL_MAX_VIEWPORT_DIMS", "Maximum viewport dimensions", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_ATTRIB_STACK_DEPTH, "GL_MAX_ATTRIB_STACK_DEPTH", "Maximum depth of the attribute stack", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", "Maximum depth of the client attribute stack", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_AUX_BUFFERS, "GL_AUX_BUFFERS", "Number of auxiliary buffers", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_RGBA_MODE, "GL_RGBA_MODE", "True if color buffers store RGBA", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_INDEX_MODE, "GL_INDEX_MODE", "True if color buffers store indices", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_DOUBLEBUFFER, "GL_DOUBLEBUFFER", "True if front and back buffers exist", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_STEREO, "GL_STEREO", "True if left and right buffers exist", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_POINT_SIZE_RANGE, "GL_POINT_SIZE_RANGE", "Range (low to high) of antialiased point sizes", "capability", "glGetFloatv()"), - new GLproperty(GL11.GL_POINT_SIZE_GRANULARITY, "GL_POINT_SIZE_GRANULARITY", "Antialiased point-size granularity", "capability", "glGetFloatv()"), - new GLproperty(GL11.GL_LINE_WIDTH_RANGE, "GL_LINE_WIDTH_RANGE", "Range (low to high) of antialiased line widths", "capability", "glGetFloatv()"), - new GLproperty(GL11.GL_LINE_WIDTH_GRANULARITY, "GL_LINE_WIDTH_GRANULARITY", "Antialiased line-width granularity", "capability", "glGetFloatv()"), - new GLproperty(GL11.GL_RED_BITS, "GL_RED_BITS", "Number of bits per red component in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_GREEN_BITS, "GL_GREEN_BITS", "Number of bits per green component in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_BLUE_BITS, "GL_BLUE_BITS", "Number of bits per blue component in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ALPHA_BITS, "GL_ALPHA_BITS", "Number of bits per alpha component in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_BITS, "GL_INDEX_BITS", "Number of bits per index in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_DEPTH_BITS, "GL_DEPTH_BITS", "Number of depth-buffer bitplanes", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_BITS, "GL_STENCIL_BITS", "Number of stencil bitplanes", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_RED_BITS, "GL_ACCUM_RED_BITS", "Number of bits per red component in the accumulation buffer", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_GREEN_BITS, "GL_ACCUM_GREEN_BITS", "Number of bits per green component in the accumulation buffer", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_BLUE_BITS, "GL_ACCUM_BLUE_BITS", "Number of bits per blue component in the accumulation buffer", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_ALPHA_BITS, "GL_ACCUM_ALPHA_BITS", "Number of bits per alpha component in the accumulation buffer", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_LIST_BASE, "GL_LIST_BASE", "Setting of glListBase()", "list", "glGetIntegerv()"), - new GLproperty(GL11.GL_LIST_INDEX, "GL_LIST_INDEX", "Number of display list under construction; 0 if none", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_LIST_MODE, "GL_LIST_MODE", "Mode of display list under construction; undefined if none", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_ATTRIB_STACK_DEPTH, "GL_ATTRIB_STACK_DEPTH", "Attribute stack pointer", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_CLIENT_ATTRIB_STACK_DEPTH, "GL_CLIENT_ATTRIB_STACK_DEPTH", "Client attribute stack pointer", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_NAME_STACK_DEPTH, "GL_NAME_STACK_DEPTH", "Name stack depth", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_RENDER_MODE, "GL_RENDER_MODE", "glRenderMode() setting", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_SELECTION_BUFFER_POINTER, "GL_SELECTION_BUFFER_POINTER", "Pointer to selection buffer", "select", "glGetPointerv()"), - new GLproperty(GL11.GL_SELECTION_BUFFER_SIZE, "GL_SELECTION_BUFFER_SIZE", "Size of selection buffer", "select", "glGetIntegerv()"), - new GLproperty(GL11.GL_FEEDBACK_BUFFER_POINTER, "GL_FEEDBACK_BUFFER_POINTER", "Pointer to feedback buffer", "feedback", "glGetPointerv()"), - new GLproperty(GL11.GL_FEEDBACK_BUFFER_SIZE, "GL_FEEDBACK_BUFFER_SIZE", "Size of feedback buffer", "feedback", "glGetIntegerv()"), - new GLproperty(GL11.GL_FEEDBACK_BUFFER_TYPE, "GL_FEEDBACK_BUFFER_TYPE", "Type of feedback buffer", "feedback", "glGetIntegerv()"), - }; + { + new GLproperty(GL11.GL_CURRENT_COLOR, "GL_CURRENT_COLOR", "Current color", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_INDEX, "GL_CURRENT_INDEX", "Current color index", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_TEXTURE_COORDS, "GL_CURRENT_TEXTURE_COORDS", "Current texture coordinates", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_NORMAL, "GL_CURRENT_NORMAL", "Current normal", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_RASTER_POSITION, "GL_CURRENT_RASTER_POSITION", "Current raster position", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_RASTER_DISTANCE, "GL_CURRENT_RASTER_DISTANCE", "Current raster distance", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_RASTER_COLOR, "GL_CURRENT_RASTER_COLOR", "Color associated with raster position", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_RASTER_INDEX, "GL_CURRENT_RASTER_INDEX", "Color index associated with raster position", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_RASTER_TEXTURE_COORDS, "GL_CURRENT_RASTER_TEXTURE_COORDS", "Texture coordinates associated with raster position", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_RASTER_POSITION_VALID, "GL_CURRENT_RASTER_POSITION_VALID", "Raster position valid bit", "current", "glGetBooleanv()"), + new GLproperty(GL11.GL_EDGE_FLAG, "GL_EDGE_FLAG", "Edge flag", "current", "glGetBooleanv()"), + new GLproperty(GL11.GL_VERTEX_ARRAY, "GL_VERTEX_ARRAY", "Vertex array enable", "vertex-array", "glIsEnabled()"), + new GLproperty(GL11.GL_VERTEX_ARRAY_SIZE, "GL_VERTEX_ARRAY_SIZE", "Coordinates per vertex", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_VERTEX_ARRAY_TYPE, "GL_VERTEX_ARRAY_TYPE", "Type of vertex coordinates", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_VERTEX_ARRAY_STRIDE, "GL_VERTEX_ARRAY_STRIDE", "Stride between vertices", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_VERTEX_ARRAY_POINTER, "GL_VERTEX_ARRAY_POINTER", "Pointer to the vertex array", "vertex-array", "glGetPointerv()"), + new GLproperty(GL11.GL_NORMAL_ARRAY, "GL_NORMAL_ARRAY", "Normal array enable", "vertex-array", "glIsEnabled()"), + new GLproperty(GL11.GL_NORMAL_ARRAY_TYPE, "GL_NORMAL_ARRAY_TYPE", "Type of normal coordinates", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_NORMAL_ARRAY_STRIDE, "GL_NORMAL_ARRAY_STRIDE", "Stride between normals", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_NORMAL_ARRAY_POINTER, "GL_NORMAL_ARRAY_POINTER", "Pointer to the normal array", "vertex-array", "glGetPointerv()"), + new GLproperty(GL11.GL_COLOR_ARRAY, "GL_COLOR_ARRAY", "RGBA color array enable", "vertex-array", "glIsEnabled()"), + new GLproperty(GL11.GL_COLOR_ARRAY_SIZE, "GL_COLOR_ARRAY_SIZE", "Colors per vertex", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_COLOR_ARRAY_TYPE, "GL_COLOR_ARRAY_TYPE", "Type of color components", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_COLOR_ARRAY_STRIDE, "GL_COLOR_ARRAY_STRIDE", "Stride between colors", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_COLOR_ARRAY_POINTER, "GL_COLOR_ARRAY_POINTER", "Pointer to the color array", "vertex-array", "glGetPointerv()"), + new GLproperty(GL11.GL_INDEX_ARRAY, "GL_INDEX_ARRAY", "Color-index array enable", "vertex-array", "glIsEnabled()"), + new GLproperty(GL11.GL_INDEX_ARRAY_TYPE, "GL_INDEX_ARRAY_TYPE", "Type of color indices", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_INDEX_ARRAY_STRIDE, "GL_INDEX_ARRAY_STRIDE", "Stride between color indices", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_INDEX_ARRAY_POINTER, "GL_INDEX_ARRAY_POINTER", "Pointer to the index array", "vertex-array", "glGetPointerv()"), + new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY, "GL_TEXTURE_COORD_ARRAY", "Texture coordinate array enable", "vertex-array", "glIsEnabled()"), + new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_SIZE, "GL_TEXTURE_COORD_ARRAY_SIZE", "Texture coordinates per element", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_TYPE, "GL_TEXTURE_COORD_ARRAY_TYPE", "Type of texture coordinates", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_STRIDE, "GL_TEXTURE_COORD_ARRAY_STRIDE", "Stride between texture coordinates", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_POINTER, "GL_TEXTURE_COORD_ARRAY_POINTER", "Pointer to the texture coordinate array", "vertex-array", "glGetPointerv()"), + new GLproperty(GL11.GL_EDGE_FLAG_ARRAY, "GL_EDGE_FLAG_ARRAY", "Edge flag array enable", "vertex-array", "glIsEnabled()"), + new GLproperty(GL11.GL_EDGE_FLAG_ARRAY_STRIDE, "GL_EDGE_FLAG_ARRAY_STRIDE", "Stride between edge flags", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_EDGE_FLAG_ARRAY_POINTER, "GL_EDGE_FLAG_ARRAY_POINTER", "Pointer to the edge flag array", "vertex-array", "glGetPointerv()"), + new GLproperty(GL11.GL_MODELVIEW_MATRIX, "GL_MODELVIEW_MATRIX", "Modelview matrix stack", "matrix", "glGetFloatv()"), + new GLproperty(GL11.GL_PROJECTION_MATRIX, "GL_PROJECTION_MATRIX", "Projection matrix stack", "matrix", "glGetFloatv()"), + new GLproperty(GL11.GL_TEXTURE_MATRIX, "GL_TEXTURE_MATRIX", "Texture matrix stack", "matrix", "glGetFloatv()"), + new GLproperty(GL11.GL_VIEWPORT, "GL_VIEWPORT", "Viewport origin and extent", "viewport", "glGetIntegerv()"), + new GLproperty(GL11.GL_DEPTH_RANGE, "GL_DEPTH_RANGE", "Depth range near and far", "viewport", "glGetFloatv()"), + new GLproperty(GL11.GL_MODELVIEW_STACK_DEPTH, "GL_MODELVIEW_STACK_DEPTH", "Modelview matrix stack pointer", "matrix", "glGetIntegerv()"), + new GLproperty(GL11.GL_PROJECTION_STACK_DEPTH, "GL_PROJECTION_STACK_DEPTH", "Projection matrix stack pointer", "matrix", "glGetIntegerv()"), + new GLproperty(GL11.GL_TEXTURE_STACK_DEPTH, "GL_TEXTURE_STACK_DEPTH", "Texture matrix stack pointer", "matrix", "glGetIntegerv()"), + new GLproperty(GL11.GL_MATRIX_MODE, "GL_MATRIX_MODE", "Current matrix mode", "transform", "glGetIntegerv()"), + new GLproperty(GL11.GL_NORMALIZE, "GL_NORMALIZE", "Current normal normalization on/off", "transform/ enable", "glIsEnabled()"), + new GLproperty(GL11.GL_FOG_COLOR, "GL_FOG_COLOR", "Fog color", "fog", "glGetFloatv()"), + new GLproperty(GL11.GL_FOG_INDEX, "GL_FOG_INDEX", "Fog index", "fog", "glGetFloatv()"), + new GLproperty(GL11.GL_FOG_DENSITY, "GL_FOG_DENSITY", "Exponential fog density", "fog", "glGetFloatv()"), + new GLproperty(GL11.GL_FOG_START, "GL_FOG_START", "Linear fog start", "fog", "glGetFloatv()"), + new GLproperty(GL11.GL_FOG_END, "GL_FOG_END", "Linear fog end", "fog", "glGetFloatv()"), + new GLproperty(GL11.GL_FOG_MODE, "GL_FOG_MODE", "Fog mode", "fog", "glGetIntegerv()"), + new GLproperty(GL11.GL_FOG, "GL_FOG", "True if fog enabled", "fog/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_SHADE_MODEL, "GL_SHADE_MODEL", "glShadeModel() setting", "lighting", "glGetIntegerv()"), + new GLproperty(GL11.GL_LIGHTING, "GL_LIGHTING", "True if lighting is enabled", "lighting/e nable", "glIsEnabled()"), + new GLproperty(GL11.GL_COLOR_MATERIAL, "GL_COLOR_MATERIAL", "True if color tracking is enabled", "lighting", "glIsEnabled()"), + new GLproperty(GL11.GL_COLOR_MATERIAL_PARAMETER, "GL_COLOR_MATERIAL_PARAMETER", "Material properties tracking current color", "lighting", "glGetIntegerv()"), + new GLproperty(GL11.GL_COLOR_MATERIAL_FACE, "GL_COLOR_MATERIAL_FACE", "Face(s) affected by color tracking", "lighting", "glGetIntegerv()"), + new GLproperty(GL11.GL_AMBIENT, "GL_AMBIENT", "Ambient material color", "lighting", "glGetMaterialfv()"), + new GLproperty(GL11.GL_DIFFUSE, "GL_DIFFUSE", "Diffuse material color", "lighting", "glGetMaterialfv()"), + new GLproperty(GL11.GL_SPECULAR, "GL_SPECULAR", "Specular material color", "lighting", "glGetMaterialfv()"), + new GLproperty(GL11.GL_EMISSION, "GL_EMISSION", "Emissive material color", "lighting", "glGetMaterialfv()"), + new GLproperty(GL11.GL_SHININESS, "GL_SHININESS", "Specular exponent of material", "lighting", "glGetMaterialfv()"), + new GLproperty(GL11.GL_LIGHT_MODEL_AMBIENT, "GL_LIGHT_MODEL_AMBIENT", "Ambient scene color", "lighting", "glGetFloatv()"), + new GLproperty(GL11.GL_LIGHT_MODEL_LOCAL_VIEWER, "GL_LIGHT_MODEL_LOCAL_VIEWER", "Viewer is local", "lighting", "glGetBooleanv()"), + new GLproperty(GL11.GL_LIGHT_MODEL_TWO_SIDE, "GL_LIGHT_MODEL_TWO_SIDE", "Use two-sided lighting", "lighting", "glGetBooleanv()"), + new GLproperty(GL11.GL_AMBIENT, "GL_AMBIENT", "Ambient intensity of light i", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_DIFFUSE, "GL_DIFFUSE", "Diffuse intensity of light i", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_SPECULAR, "GL_SPECULAR", "Specular intensity of light i", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_POSITION, "GL_POSITION", "Position of light i", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_CONSTANT_ATTENUATION, "GL_CONSTANT_ATTENUATION", "Constant attenuation factor", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_LINEAR_ATTENUATION, "GL_LINEAR_ATTENUATION", "Linear attenuation factor", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_QUADRATIC_ATTENUATION, "GL_QUADRATIC_ATTENUATION", "Quadratic attenuation factor", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_SPOT_DIRECTION, "GL_SPOT_DIRECTION", "Spotlight direction of light i", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_SPOT_EXPONENT, "GL_SPOT_EXPONENT", "Spotlight exponent of light i", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_SPOT_CUTOFF, "GL_SPOT_CUTOFF", "Spotlight angle of light i", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_LIGHT0, "GL_LIGHT0", "True if light 0 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LIGHT1, "GL_LIGHT1", "True if light 1 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LIGHT2, "GL_LIGHT2", "True if light 2 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LIGHT3, "GL_LIGHT3", "True if light 3 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LIGHT4, "GL_LIGHT4", "True if light 4 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LIGHT5, "GL_LIGHT5", "True if light 5 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LIGHT6, "GL_LIGHT6", "True if light 6 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LIGHT7, "GL_LIGHT7", "True if light 7 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_COLOR_INDEXES, "GL_COLOR_INDEXES", "ca, cd, and cs for color-index lighting", "lighting/e nable", "glGetMaterialfv()"), + new GLproperty(GL11.GL_POINT_SIZE, "GL_POINT_SIZE", "Point size", "point", "glGetFloatv()"), + new GLproperty(GL11.GL_POINT_SMOOTH, "GL_POINT_SMOOTH", "Point antialiasing on", "point/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LINE_WIDTH, "GL_LINE_WIDTH", "Line width", "line", "glGetFloatv()"), + new GLproperty(GL11.GL_LINE_SMOOTH, "GL_LINE_SMOOTH", "Line antialiasing on", "line/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LINE_STIPPLE_PATTERN, "GL_LINE_STIPPLE_PATTERN", "Line stipple", "line", "glGetIntegerv()"), + new GLproperty(GL11.GL_LINE_STIPPLE_REPEAT, "GL_LINE_STIPPLE_REPEAT", "Line stipple repeat", "line", "glGetIntegerv()"), + new GLproperty(GL11.GL_LINE_STIPPLE, "GL_LINE_STIPPLE", "Line stipple enable", "line/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_CULL_FACE, "GL_CULL_FACE", "Polygon culling enabled", "polygon/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_CULL_FACE_MODE, "GL_CULL_FACE_MODE", "Cull front-/back-facing polygons", "polygon", "glGetIntegerv()"), + new GLproperty(GL11.GL_FRONT_FACE, "GL_FRONT_FACE", "Polygon front-face CW/CCW indicator", "polygon", "glGetIntegerv()"), + new GLproperty(GL11.GL_POLYGON_SMOOTH, "GL_POLYGON_SMOOTH", "Polygon antialiasing on", "polygon/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_POLYGON_MODE, "GL_POLYGON_MODE", "Polygon rasterization mode (front and back)", "polygon", "glGetIntegerv()"), + new GLproperty(GL11.GL_POLYGON_OFFSET_FACTOR, "GL_POLYGON_OFFSET_FACTOR", "Polygon offset factor", "polygon", "glGetFloatv()"), + new GLproperty(GL11.GL_POLYGON_OFFSET_POINT, "GL_POLYGON_OFFSET_POINT", "Polygon offset enable for GL_POINT mode rasterization", "polygon/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_POLYGON_OFFSET_LINE, "GL_POLYGON_OFFSET_LINE", "Polygon offset enable for GL_LINE mode rasterization", "polygon/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_POLYGON_OFFSET_FILL, "GL_POLYGON_OFFSET_FILL", "Polygon offset enable for GL_FILL mode rasterization", "polygon/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_POLYGON_STIPPLE, "GL_POLYGON_STIPPLE", "Polygon stipple enable", "polygon/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_TEXTURE_1D, "GL_TEXTURE_1D", "True if 1-D texturing enabled ", "texture/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_TEXTURE_2D, "GL_TEXTURE_2D", "True if 2-D texturing enabled ", "texture/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_TEXTURE_BINDING_1D, "GL_TEXTURE_BINDING_1D", "Texture object bound to GL_TEXTURE_1D", "texture", "glGetIntegerv()"), + new GLproperty(GL11.GL_TEXTURE_BINDING_2D, "GL_TEXTURE_BINDING_2D", "Texture object bound to GL_TEXTURE_2D", "texture", "glGetIntegerv()"), + new GLproperty(GL11.GL_TEXTURE, "GL_TEXTURE", "x-D texture image at level of detail i", "UNUSED", "glGetTexImage()"), + new GLproperty(GL11.GL_TEXTURE_WIDTH, "GL_TEXTURE_WIDTH", "x-D texture image i's width", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_HEIGHT, "GL_TEXTURE_HEIGHT", "x-D texture image i's height", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_BORDER, "GL_TEXTURE_BORDER", "x-D texture image i's border width", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_RED_SIZE, "GL_TEXTURE_RED_SIZE", "x-D texture image i's red resolution", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_GREEN_SIZE, "GL_TEXTURE_GREEN_SIZE", "x-D texture image i's green resolution", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_BLUE_SIZE, "GL_TEXTURE_BLUE_SIZE", "x-D texture image i's blue resolution", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_ALPHA_SIZE, "GL_TEXTURE_ALPHA_SIZE", "x-D texture image i's alpha resolution", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_LUMINANCE_SIZE, "GL_TEXTURE_LUMINANCE_SIZE", "x-D texture image i's luminance resolution", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_INTENSITY_SIZE, "GL_TEXTURE_INTENSITY_SIZE", "x-D texture image i's intensity resolution", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_BORDER_COLOR, "GL_TEXTURE_BORDER_COLOR", "Texture border color", "texture", "glGetTexParameter*()"), + new GLproperty(GL11.GL_TEXTURE_MIN_FILTER, "GL_TEXTURE_MIN_FILTER", "Texture minification function", "texture", "glGetTexParameter*()"), + new GLproperty(GL11.GL_TEXTURE_MAG_FILTER, "GL_TEXTURE_MAG_FILTER", "Texture magnification function", "texture", "glGetTexParameter*()"), + new GLproperty(GL11.GL_TEXTURE_WRAP_S, "GL_TEXTURE_WRAP_S", "Texture wrap mode (x is S or T)", "texture", "glGetTexParameter*()"), + new GLproperty(GL11.GL_TEXTURE_WRAP_T, "GL_TEXTURE_WRAP_T", "Texture wrap mode (x is S or T)", "texture", "glGetTexParameter*()"), + new GLproperty(GL11.GL_TEXTURE_PRIORITY, "GL_TEXTURE_PRIORITY", "Texture object priority", "texture", "glGetTexParameter*()"), + new GLproperty(GL11.GL_TEXTURE_ENV_MODE, "GL_TEXTURE_ENV_MODE", "Texture application function", "texture", "glGetTexEnviv()"), + new GLproperty(GL11.GL_TEXTURE_ENV_COLOR, "GL_TEXTURE_ENV_COLOR", "Texture environment color", "texture", "glGetTexEnvfv()"), + new GLproperty(GL11.GL_TEXTURE_GEN_S, "GL_TEXTURE_GEN_S", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_TEXTURE_GEN_T, "GL_TEXTURE_GEN_T", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_TEXTURE_GEN_R, "GL_TEXTURE_GEN_R", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_TEXTURE_GEN_Q, "GL_TEXTURE_GEN_Q", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_EYE_PLANE, "GL_EYE_PLANE", "Texgen plane equation coefficients", "texture", "glGetTexGenfv()"), + new GLproperty(GL11.GL_OBJECT_PLANE, "GL_OBJECT_PLANE", "Texgen object linear coefficients", "texture", "glGetTexGenfv()"), + new GLproperty(GL11.GL_TEXTURE_GEN_MODE, "GL_TEXTURE_GEN_MODE", "Function used for texgen", "texture", "glGetTexGeniv()"), + new GLproperty(GL11.GL_SCISSOR_TEST, "GL_SCISSOR_TEST", "Scissoring enabled", "scissor/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_SCISSOR_BOX, "GL_SCISSOR_BOX", "Scissor box", "scissor", "glGetIntegerv()"), + new GLproperty(GL11.GL_ALPHA_TEST, "GL_ALPHA_TEST", "Alpha test enabled", "color-buffer/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_ALPHA_TEST_FUNC, "GL_ALPHA_TEST_FUNC", "Alpha test function", "color-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_ALPHA_TEST_REF, "GL_ALPHA_TEST_REF", "Alpha test reference value", "color-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_TEST, "GL_STENCIL_TEST", "Stenciling enabled", "stencil-buffer/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_STENCIL_FUNC, "GL_STENCIL_FUNC", "Stencil function", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_VALUE_MASK, "GL_STENCIL_VALUE_MASK", "Stencil mask", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_REF, "GL_STENCIL_REF", "Stencil reference value", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_FAIL, "GL_STENCIL_FAIL", "Stencil fail action", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_PASS_DEPTH_FAIL, "GL_STENCIL_PASS_DEPTH_FAIL", "Stencil depth buffer fail action", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_PASS_DEPTH_PASS, "GL_STENCIL_PASS_DEPTH_PASS", "Stencil depth buffer pass action", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_DEPTH_TEST, "GL_DEPTH_TEST", "Depth buffer enabled", "depth-buffer/ena ble", "glIsEnabled()"), + new GLproperty(GL11.GL_DEPTH_FUNC, "GL_DEPTH_FUNC", "Depth buffer test function", "depth-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_BLEND, "GL_BLEND", "Blending enabled", "color-buffer/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_BLEND_SRC, "GL_BLEND_SRC", "Blending source function", "color-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_BLEND_DST, "GL_BLEND_DST", "Blending destination function", "color-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_DITHER, "GL_DITHER", "Dithering enabled", "color-buffer/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_INDEX_LOGIC_OP, "GL_INDEX_LOGIC_OP", "Color index logical operation enabled", "color-buffer/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_COLOR_LOGIC_OP, "GL_COLOR_LOGIC_OP", "RGBA color logical operation enabled", "color-buffer/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LOGIC_OP_MODE, "GL_LOGIC_OP_MODE", "Logical operation function", "color-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_DRAW_BUFFER, "GL_DRAW_BUFFER", "Buffers selected for drawing", "color-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_INDEX_WRITEMASK, "GL_INDEX_WRITEMASK", "Color-index writemask", "color-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_COLOR_WRITEMASK, "GL_COLOR_WRITEMASK", "Color write enables; R, G, B, or A", "color-buffer", "glGetBooleanv()"), + new GLproperty(GL11.GL_DEPTH_WRITEMASK, "GL_DEPTH_WRITEMASK", "Depth buffer enabled for writing", "depth-buffer", "glGetBooleanv()"), + new GLproperty(GL11.GL_STENCIL_WRITEMASK, "GL_STENCIL_WRITEMASK", "Stencil-buffer writemask", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_COLOR_CLEAR_VALUE, "GL_COLOR_CLEAR_VALUE", "Color-buffer clear value (RGBA mode)", "color-buffer", "glGetFloatv()"), + new GLproperty(GL11.GL_INDEX_CLEAR_VALUE, "GL_INDEX_CLEAR_VALUE", "Color-buffer clear value (color-index mode)", "color-buffer", "glGetFloatv()"), + new GLproperty(GL11.GL_DEPTH_CLEAR_VALUE, "GL_DEPTH_CLEAR_VALUE", "Depth-buffer clear value", "depth-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_CLEAR_VALUE, "GL_STENCIL_CLEAR_VALUE", "Stencil-buffer clear value", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_ACCUM_CLEAR_VALUE, "GL_ACCUM_CLEAR_VALUE", "Accumulation-buffer clear value", "accum-buffer", "glGetFloatv()"), + new GLproperty(GL11.GL_UNPACK_SWAP_BYTES, "GL_UNPACK_SWAP_BYTES", "Value of GL_UNPACK_SWAP_BYTES", "pixel-store", "glGetBooleanv()"), + new GLproperty(GL11.GL_UNPACK_LSB_FIRST, "GL_UNPACK_LSB_FIRST", "Value of GL_UNPACK_LSB_FIRST", "pixel-store", "glGetBooleanv()"), + new GLproperty(GL11.GL_UNPACK_ROW_LENGTH, "GL_UNPACK_ROW_LENGTH", "Value of GL_UNPACK_ROW_LENGTH", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_UNPACK_SKIP_ROWS, "GL_UNPACK_SKIP_ROWS", "Value of GL_UNPACK_SKIP_ROWS", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_UNPACK_SKIP_PIXELS, "GL_UNPACK_SKIP_PIXELS", "Value of GL_UNPACK_SKIP_PIXELS", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_UNPACK_ALIGNMENT, "GL_UNPACK_ALIGNMENT", "Value of GL_UNPACK_ALIGNMENT", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_PACK_SWAP_BYTES, "GL_PACK_SWAP_BYTES", "Value of GL_PACK_SWAP_BYTES", "pixel-store", "glGetBooleanv()"), + new GLproperty(GL11.GL_PACK_LSB_FIRST, "GL_PACK_LSB_FIRST", "Value of GL_PACK_LSB_FIRST", "pixel-store", "glGetBooleanv()"), + new GLproperty(GL11.GL_PACK_ROW_LENGTH, "GL_PACK_ROW_LENGTH", "Value of GL_PACK_ROW_LENGTH", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_PACK_SKIP_ROWS, "GL_PACK_SKIP_ROWS", "Value of GL_PACK_SKIP_ROWS", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_PACK_SKIP_PIXELS, "GL_PACK_SKIP_PIXELS", "Value of GL_PACK_SKIP_PIXELS", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_PACK_ALIGNMENT, "GL_PACK_ALIGNMENT", "Value of GL_PACK_ALIGNMENT", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAP_COLOR, "GL_MAP_COLOR", "True if colors are mapped", "pixel", "glGetBooleanv()"), + new GLproperty(GL11.GL_MAP_STENCIL, "GL_MAP_STENCIL", "True if stencil values are mapped", "pixel", "glGetBooleanv()"), + new GLproperty(GL11.GL_INDEX_SHIFT, "GL_INDEX_SHIFT", "Value of GL_INDEX_SHIFT", "pixel", "glGetIntegerv()"), + new GLproperty(GL11.GL_INDEX_OFFSET, "GL_INDEX_OFFSET", "Value of GL_INDEX_OFFSET", "pixel", "glGetIntegerv()"), + new GLproperty(GL11.GL_ZOOM_X, "GL_ZOOM_X", "x zoom factor", "pixel", "glGetFloatv()"), + new GLproperty(GL11.GL_ZOOM_Y, "GL_ZOOM_Y", "y zoom factor", "pixel", "glGetFloatv()"), + new GLproperty(GL11.GL_READ_BUFFER, "GL_READ_BUFFER", "Read source buffer", "pixel", "glGetIntegerv()"), + new GLproperty(GL11.GL_ORDER, "GL_ORDER", "1D map order", "capability", "glGetMapiv()"), + new GLproperty(GL11.GL_ORDER, "GL_ORDER", "2D map orders", "capability", "glGetMapiv()"), + new GLproperty(GL11.GL_COEFF, "GL_COEFF", "1D control points", "capability", "glGetMapfv()"), + new GLproperty(GL11.GL_COEFF, "GL_COEFF", "2D control points", "capability", "glGetMapfv()"), + new GLproperty(GL11.GL_DOMAIN, "GL_DOMAIN", "1D domain endpoints", "capability", "glGetMapfv()"), + new GLproperty(GL11.GL_DOMAIN, "GL_DOMAIN", "2D domain endpoints", "capability", "glGetMapfv()"), + new GLproperty(GL11.GL_MAP1_GRID_DOMAIN, "GL_MAP1_GRID_DOMAIN", "1D grid endpoints", "eval", "glGetFloatv()"), + new GLproperty(GL11.GL_MAP2_GRID_DOMAIN, "GL_MAP2_GRID_DOMAIN", "2D grid endpoints", "eval", "glGetFloatv()"), + new GLproperty(GL11.GL_MAP1_GRID_SEGMENTS, "GL_MAP1_GRID_SEGMENTS", "1D grid divisions", "eval", "glGetFloatv()"), + new GLproperty(GL11.GL_MAP2_GRID_SEGMENTS, "GL_MAP2_GRID_SEGMENTS", "2D grid divisions", "eval", "glGetFloatv()"), + new GLproperty(GL11.GL_AUTO_NORMAL, "GL_AUTO_NORMAL", "True if automatic normal generation enabled", "eval", "glIsEnabled()"), + new GLproperty(GL11.GL_PERSPECTIVE_CORRECTION_HINT, "GL_PERSPECTIVE_CORRECTION_HINT", "Perspective correction hint", "hint", "glGetIntegerv()"), + new GLproperty(GL11.GL_POINT_SMOOTH_HINT, "GL_POINT_SMOOTH_HINT", "Point smooth hint", "hint", "glGetIntegerv()"), + new GLproperty(GL11.GL_LINE_SMOOTH_HINT, "GL_LINE_SMOOTH_HINT", "Line smooth hint", "hint", "glGetIntegerv()"), + new GLproperty(GL11.GL_POLYGON_SMOOTH_HINT, "GL_POLYGON_SMOOTH_HINT", "Polygon smooth hint", "hint", "glGetIntegerv()"), + new GLproperty(GL11.GL_FOG_HINT, "GL_FOG_HINT", "Fog hint", "hint", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_LIGHTS, "GL_MAX_LIGHTS", "Maximum number of lights", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_CLIP_PLANES, "GL_MAX_CLIP_PLANES", "Maximum number of user clipping planes", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_MODELVIEW_STACK_DEPTH, "GL_MAX_MODELVIEW_STACK_DEPTH", "Maximum modelview-matrix stack depth", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_PROJECTION_STACK_DEPTH, "GL_MAX_PROJECTION_STACK_DEPTH", "Maximum projection-matrix stack depth", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_TEXTURE_STACK_DEPTH, "GL_MAX_TEXTURE_STACK_DEPTH", "Maximum depth of texture matrix stack", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_SUBPIXEL_BITS, "GL_SUBPIXEL_BITS", "Number of bits of subpixel precision in x and y", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_TEXTURE_SIZE, "GL_MAX_TEXTURE_SIZE", "See discussion in Texture Proxy in Chapter 9", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_PIXEL_MAP_TABLE, "GL_MAX_PIXEL_MAP_TABLE", "Maximum size of a glPixelMap() translation table", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_NAME_STACK_DEPTH, "GL_MAX_NAME_STACK_DEPTH", "Maximum selection-name stack depth", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_LIST_NESTING, "GL_MAX_LIST_NESTING", "Maximum display-list call nesting", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_EVAL_ORDER, "GL_MAX_EVAL_ORDER", "Maximum evaluator polynomial order", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_VIEWPORT_DIMS, "GL_MAX_VIEWPORT_DIMS", "Maximum viewport dimensions", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_ATTRIB_STACK_DEPTH, "GL_MAX_ATTRIB_STACK_DEPTH", "Maximum depth of the attribute stack", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", "Maximum depth of the client attribute stack", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_AUX_BUFFERS, "GL_AUX_BUFFERS", "Number of auxiliary buffers", "capability", "glGetBooleanv()"), + new GLproperty(GL11.GL_RGBA_MODE, "GL_RGBA_MODE", "True if color buffers store RGBA", "capability", "glGetBooleanv()"), + new GLproperty(GL11.GL_INDEX_MODE, "GL_INDEX_MODE", "True if color buffers store indices", "capability", "glGetBooleanv()"), + new GLproperty(GL11.GL_DOUBLEBUFFER, "GL_DOUBLEBUFFER", "True if front and back buffers exist", "capability", "glGetBooleanv()"), + new GLproperty(GL11.GL_STEREO, "GL_STEREO", "True if left and right buffers exist", "capability", "glGetBooleanv()"), + new GLproperty(GL11.GL_POINT_SIZE_RANGE, "GL_POINT_SIZE_RANGE", "Range (low to high) of antialiased point sizes", "capability", "glGetFloatv()"), + new GLproperty(GL11.GL_POINT_SIZE_GRANULARITY, "GL_POINT_SIZE_GRANULARITY", "Antialiased point-size granularity", "capability", "glGetFloatv()"), + new GLproperty(GL11.GL_LINE_WIDTH_RANGE, "GL_LINE_WIDTH_RANGE", "Range (low to high) of antialiased line widths", "capability", "glGetFloatv()"), + new GLproperty(GL11.GL_LINE_WIDTH_GRANULARITY, "GL_LINE_WIDTH_GRANULARITY", "Antialiased line-width granularity", "capability", "glGetFloatv()"), + new GLproperty(GL11.GL_RED_BITS, "GL_RED_BITS", "Number of bits per red component in color buffers", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_GREEN_BITS, "GL_GREEN_BITS", "Number of bits per green component in color buffers", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_BLUE_BITS, "GL_BLUE_BITS", "Number of bits per blue component in color buffers", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_ALPHA_BITS, "GL_ALPHA_BITS", "Number of bits per alpha component in color buffers", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_INDEX_BITS, "GL_INDEX_BITS", "Number of bits per index in color buffers", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_DEPTH_BITS, "GL_DEPTH_BITS", "Number of depth-buffer bitplanes", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_BITS, "GL_STENCIL_BITS", "Number of stencil bitplanes", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_ACCUM_RED_BITS, "GL_ACCUM_RED_BITS", "Number of bits per red component in the accumulation buffer", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_ACCUM_GREEN_BITS, "GL_ACCUM_GREEN_BITS", "Number of bits per green component in the accumulation buffer", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_ACCUM_BLUE_BITS, "GL_ACCUM_BLUE_BITS", "Number of bits per blue component in the accumulation buffer", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_ACCUM_ALPHA_BITS, "GL_ACCUM_ALPHA_BITS", "Number of bits per alpha component in the accumulation buffer", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_LIST_BASE, "GL_LIST_BASE", "Setting of glListBase()", "list", "glGetIntegerv()"), + new GLproperty(GL11.GL_LIST_INDEX, "GL_LIST_INDEX", "Number of display list under construction; 0 if none", "current", "glGetIntegerv()"), + new GLproperty(GL11.GL_LIST_MODE, "GL_LIST_MODE", "Mode of display list under construction; undefined if none", "current", "glGetIntegerv()"), + new GLproperty(GL11.GL_ATTRIB_STACK_DEPTH, "GL_ATTRIB_STACK_DEPTH", "Attribute stack pointer", "current", "glGetIntegerv()"), + new GLproperty(GL11.GL_CLIENT_ATTRIB_STACK_DEPTH, "GL_CLIENT_ATTRIB_STACK_DEPTH", "Client attribute stack pointer", "current", "glGetIntegerv()"), + new GLproperty(GL11.GL_NAME_STACK_DEPTH, "GL_NAME_STACK_DEPTH", "Name stack depth", "current", "glGetIntegerv()"), + new GLproperty(GL11.GL_RENDER_MODE, "GL_RENDER_MODE", "glRenderMode() setting", "current", "glGetIntegerv()"), + new GLproperty(GL11.GL_SELECTION_BUFFER_POINTER, "GL_SELECTION_BUFFER_POINTER", "Pointer to selection buffer", "select", "glGetPointerv()"), + new GLproperty(GL11.GL_SELECTION_BUFFER_SIZE, "GL_SELECTION_BUFFER_SIZE", "Size of selection buffer", "select", "glGetIntegerv()"), + new GLproperty(GL11.GL_FEEDBACK_BUFFER_POINTER, "GL_FEEDBACK_BUFFER_POINTER", "Pointer to feedback buffer", "feedback", "glGetPointerv()"), + new GLproperty(GL11.GL_FEEDBACK_BUFFER_SIZE, "GL_FEEDBACK_BUFFER_SIZE", "Size of feedback buffer", "feedback", "glGetIntegerv()"), + new GLproperty(GL11.GL_FEEDBACK_BUFFER_TYPE, "GL_FEEDBACK_BUFFER_TYPE", "Type of feedback buffer", "feedback", "glGetIntegerv()"), + }; - public static void dumpOpenGLstate() - { - } + public static void dumpOpenGLstate() + { + } - public static void dumpAllIsEnabled() //Call This - { - for (int i = 0; i < instance.propertyList.length; ++i) + public static void dumpAllIsEnabled() //Call This + { + for (int i = 0; i < instance.propertyList.length; ++i) - { - if (instance.propertyList[i].fetchCommand == "glIsEnabled()") + { + if (instance.propertyList[i].fetchCommand == "glIsEnabled()") - { - System.out.print(instance.propertyList[i].name + ":"); - System.out.print(GL11.glIsEnabled(instance.propertyList[i].gLconstant)); - System.out.println(" (" + instance.propertyList[i].description + ")"); - } - } - } + { + System.out.print(instance.propertyList[i].name + ":"); + System.out.print(GL11.glIsEnabled(instance.propertyList[i].gLconstant)); + System.out.println(" (" + instance.propertyList[i].description + ")"); + } + } + } - public static void dumpAllType(String type) + public static void dumpAllType(final String type) - { - for (int i = 0; i < instance.propertyList.length; ++i) + { + for (int i = 0; i < instance.propertyList.length; ++i) - { - if (instance.propertyList[i].category.equals(type)) + { + if (instance.propertyList[i].category.equals(type)) - { - System.out.print(instance.propertyList[i].name + ":"); - System.out.println(getPropertyAsString(i)); - System.out.println(" (" + instance.propertyList[i].description + ")"); - } - } - } + { + System.out.print(instance.propertyList[i].name + ":"); + System.out.println(getPropertyAsString(i)); + System.out.println(" (" + instance.propertyList[i].description + ")"); + } + } + } - private static String getPropertyAsString(int propertyListIndex) - { - int gLconstant = instance.propertyList[propertyListIndex].gLconstant; - if (instance.propertyList[propertyListIndex].fetchCommand.equals("glIsEnabled()")) { - return "" + GL11.glIsEnabled(gLconstant); - } + private static String getPropertyAsString(final int propertyListIndex) + { + final int gLconstant = instance.propertyList[propertyListIndex].gLconstant; + if (instance.propertyList[propertyListIndex].fetchCommand.equals("glIsEnabled()")) { + return "" + GL11.glIsEnabled(gLconstant); + } - if (instance.propertyList[propertyListIndex].fetchCommand == "glGetBooleanv()") + if (instance.propertyList[propertyListIndex].fetchCommand == "glGetBooleanv()") - { - ByteBuffer params = BufferUtils.createByteBuffer(16); + { + final ByteBuffer params = BufferUtils.createByteBuffer(16); - GL11.glGetBoolean(gLconstant, params); - String out = ""; - for (int i = 0; i < params.capacity(); ++i) + GL11.glGetBoolean(gLconstant, params); + String out = ""; + for (int i = 0; i < params.capacity(); ++i) - { - out += (i == 0 ? "" : ", ") + params.get(i); - } - return out; - } + { + out += (i == 0 ? "" : ", ") + params.get(i); + } + return out; + } - return ""; - } + return ""; + } } diff --git a/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java b/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java index 4749a103d1..e5c52939ac 100644 --- a/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java +++ b/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.util.entity; +import cpw.mods.fml.common.registry.EntityRegistry; import ic2.core.IC2Potion; import ic2.core.item.armor.ItemArmorHazmat; import net.minecraft.block.Block; @@ -7,43 +8,42 @@ import net.minecraft.entity.*; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; -import cpw.mods.fml.common.registry.EntityRegistry; public class EntityUtils { - public static void setEntityOnFire(Entity entity, int length){ + public static void setEntityOnFire(final Entity entity, final int length){ entity.setFire(length); } - public static int getFacingDirection(Entity entity){ - int d = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360) + 0.50) & 3; + public static int getFacingDirection(final Entity entity){ + final int d = MathHelper.floor_double((entity.rotationYaw * 4.0F) / 360 + 0.50) & 3; return d; } @Deprecated - public static Block findBlockUnderEntityNonBoundingBox(Entity parEntity){ - int blockX = MathHelper.floor_double(parEntity.posX); - int blockY = MathHelper.floor_double(parEntity.posY-0.2D - (double)parEntity.yOffset); - int blockZ = MathHelper.floor_double(parEntity.posZ); + public static Block findBlockUnderEntityNonBoundingBox(final Entity parEntity){ + final int blockX = MathHelper.floor_double(parEntity.posX); + final int blockY = MathHelper.floor_double(parEntity.posY-0.2D - parEntity.yOffset); + final int blockZ = MathHelper.floor_double(parEntity.posZ); return parEntity.worldObj.getBlock(blockX, blockY, blockZ); } - public static Block findBlockUnderEntity(Entity parEntity){ - int blockX = MathHelper.floor_double(parEntity.posX); - int blockY = MathHelper.floor_double(parEntity.boundingBox.minY)-1; - int blockZ = MathHelper.floor_double(parEntity.posZ); + public static Block findBlockUnderEntity(final Entity parEntity){ + final int blockX = MathHelper.floor_double(parEntity.posX); + final int blockY = MathHelper.floor_double(parEntity.boundingBox.minY)-1; + final int blockZ = MathHelper.floor_double(parEntity.posZ); return parEntity.worldObj.getBlock(blockX, blockY, blockZ); } //TODO - public static void registerEntityToBiomeSpawns(Class<EntityLiving> classy, EnumCreatureType EntityType, BiomeGenBase baseBiomeGen){ - EntityRegistry.addSpawn(classy, 6, 1, 5, EntityType, baseBiomeGen); //change the values to vary the spawn rarity, biome, etc. + public static void registerEntityToBiomeSpawns(final Class<EntityLiving> classy, final EnumCreatureType EntityType, final BiomeGenBase baseBiomeGen){ + EntityRegistry.addSpawn(classy, 6, 1, 5, EntityType, baseBiomeGen); //change the values to vary the spawn rarity, biome, etc. } - public static boolean applyRadiationDamageToEntity(int damage, World world, Entity entityHolding){ - if (!world.isRemote){ - if (damage > 0 && (entityHolding instanceof EntityLivingBase)) { - EntityLivingBase entityLiving = (EntityLivingBase) entityHolding; + public static boolean applyRadiationDamageToEntity(final int damage, final World world, final Entity entityHolding){ + if (!world.isRemote){ + if ((damage > 0) && (entityHolding instanceof EntityLivingBase)) { + final EntityLivingBase entityLiving = (EntityLivingBase) entityHolding; if (!ItemArmorHazmat.hasCompleteHazmat(entityLiving)) { int duration; if (entityLiving.getActivePotionEffect(IC2Potion.radiation) != null){ @@ -53,13 +53,13 @@ public class EntityUtils { else { //Utils.LOG_INFO("f"); duration = damage*30; - } + } IC2Potion.radiation.applyTo(entityLiving, duration, damage * 15); } } return true; } - return false; + return false; } } diff --git a/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java b/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java index 5674082c4a..b09c9dd795 100644 --- a/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java +++ b/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java @@ -6,25 +6,25 @@ import net.minecraftforge.fluids.Fluid; public class FluidGT6 extends Fluid implements Runnable { - private final short[] mRGBa; - public final String mTextureName; - - public FluidGT6(final String aName, final String aTextureName, final short[] aRGBa) { - super(aName); - this.mRGBa = aRGBa; - this.mTextureName = aTextureName; - if (GregTech_API.sGTBlockIconload != null) { - GregTech_API.sGTBlockIconload.add(this); - } - } - - @Override + private final short[] mRGBa; + public final String mTextureName; + + public FluidGT6(final String aName, final String aTextureName, final short[] aRGBa) { + super(aName); + this.mRGBa = aRGBa; + this.mTextureName = aTextureName; + if (GregTech_API.sGTBlockIconload != null) { + GregTech_API.sGTBlockIconload.add(this); + } + } + + @Override public int getColor() { - return Math.max(0, Math.min(255, this.mRGBa[0])) << 16 | Math.max(0, Math.min(255, this.mRGBa[1])) << 8 | Math.max(0, Math.min(255, this.mRGBa[2])); - } - - @Override + return (Math.max(0, Math.min(255, this.mRGBa[0])) << 16) | (Math.max(0, Math.min(255, this.mRGBa[1])) << 8) | Math.max(0, Math.min(255, this.mRGBa[2])); + } + + @Override public void run() { - this.setIcons(GregTech_API.sBlockIcons.registerIcon(CORE.MODID+ ":" + "fluids/fluid." + mTextureName)); - } + this.setIcons(GregTech_API.sBlockIcons.registerIcon(CORE.MODID+ ":" + "fluids/fluid." + this.mTextureName)); + } } diff --git a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java index 8163648c41..882f3f1eb4 100644 --- a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java +++ b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java @@ -17,56 +17,56 @@ import net.minecraftforge.fluids.*; public class FluidUtils { - public static FluidStack getFluidStack(String fluidName, int amount){ + public static FluidStack getFluidStack(final String fluidName, final int amount){ Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName); try { return FluidRegistry.getFluidStack(fluidName, amount).copy(); - } - catch (Throwable e){ + } + catch (final Throwable e){ return null; } } - public static FluidStack getFluidStack(FluidStack vmoltenFluid, int fluidAmount) { + public static FluidStack getFluidStack(final FluidStack vmoltenFluid, final int fluidAmount) { Utils.LOG_WARNING("Trying to get a fluid stack of "+vmoltenFluid.getFluid().getName()); try { return FluidRegistry.getFluidStack(vmoltenFluid.getFluid().getName(), fluidAmount).copy(); - } - catch (Throwable e){ + } + catch (final Throwable e){ return null; } } - public static FluidStack getFluidStack(Fluid vFluid, int fluidAmount) { + public static FluidStack getFluidStack(final Fluid vFluid, final int fluidAmount) { Utils.LOG_WARNING("Trying to get a fluid stack of "+vFluid.getName()); try { return FluidRegistry.getFluidStack(vFluid.getName(), fluidAmount).copy(); - } - catch (Throwable e){ + } + catch (final Throwable e){ return null; } } - public static FluidStack[] getFluidStackArray(String fluidName, int amount){ + public static FluidStack[] getFluidStackArray(final String fluidName, final int amount){ Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName); try { - FluidStack[] singleFluid = {FluidRegistry.getFluidStack(fluidName, amount)}; + final FluidStack[] singleFluid = {FluidRegistry.getFluidStack(fluidName, amount)}; return singleFluid; - } - catch (Throwable e){ + } + catch (final Throwable e){ return null; } } - public static FluidStack[] getFluidStackArray(FluidStack fluidName, int amount){ + public static FluidStack[] getFluidStackArray(final FluidStack fluidName, final int amount){ Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName); try { - FluidStack[] singleFluid = {FluidRegistry.getFluidStack(fluidName.getLocalizedName(), amount)}; + final FluidStack[] singleFluid = {FluidRegistry.getFluidStack(fluidName.getLocalizedName(), amount)}; return singleFluid; - } - catch (Throwable e){ + } + catch (final Throwable e){ return null; } @@ -80,10 +80,10 @@ public class FluidUtils { * @param short[] rgba * @param byte state * States: 0 (Solid), 1 (Fluid), 2(Gas), 3(Plasma) 4(Fuel I think? Don't use.) - * + * * @return short[] */ - public static Fluid generateFluid(String displayName, String fluidName, int tempK, short[] rgba ,int aState){ + public static Fluid generateFluid(final String displayName, final String fluidName, final int tempK, final short[] rgba ,final int aState){ Fluid generatedFluid = null; switch (aState) { case 0: { @@ -108,17 +108,17 @@ public class FluidUtils { return generatedFluid; } /** - * + * * @param String fluidName * @param int meltingPointC Temp * @param short[] rgba * @param byte state * States: 0 (Solid), 1 (Fluid), 2(Gas), 3(Plasma) 4(Fuel I think? Don't use.) - * + * * @return short[] */ - public static Fluid generateFluid(Material material ,int aState){ - int tempK = material.getMeltingPointC(); + public static Fluid generateFluid(final Material material ,final int aState){ + final int tempK = material.getMeltingPointC(); Fluid generatedFluid = null; switch (aState) { case 0: { @@ -144,9 +144,9 @@ public class FluidUtils { } - public static Fluid addAutogeneratedMoltenFluid(String materialNameFormatted, short[] rgba, int MeltingPoint) { + public static Fluid addAutogeneratedMoltenFluid(final String materialNameFormatted, final short[] rgba, final int MeltingPoint) { return addFluid("molten." + materialNameFormatted.toLowerCase(), "molten.autogenerated", "Molten " + materialNameFormatted, null, rgba, 1, (MeltingPoint <= 0L) ? 1000L : MeltingPoint, null, null, 0); - } + } public static Fluid addAutogeneratedMoltenFluid(final GT_Materials aMaterial) { return addFluid("molten." + aMaterial.name().toLowerCase(), "molten.autogenerated", "Molten " + aMaterial.name(), aMaterial, aMaterial.mMoltenRGBa, 1, (aMaterial.mMeltingPoint <= 0L) ? 1000L : aMaterial.mMeltingPoint, null, null, 0); @@ -195,7 +195,7 @@ public class FluidUtils { else { rFluid = FluidRegistry.getFluid(aName); } - if (rFluid.getTemperature() == new Fluid("test").getTemperature() || rFluid.getTemperature() <= 0) { + if ((rFluid.getTemperature() == new Fluid("test").getTemperature()) || (rFluid.getTemperature() <= 0)) { rFluid.setTemperature((int) (aTemperatureK)); } if (aMaterial != null) { @@ -214,7 +214,7 @@ public class FluidUtils { } } } - if (aFullContainer != null && aEmptyContainer != null && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { + if ((aFullContainer != null) && (aEmptyContainer != null) && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { GT_Values.RA.addFluidCannerRecipe(aFullContainer, container(aFullContainer, false), null, new FluidStack(rFluid, aFluidAmount)); } return rFluid; @@ -223,48 +223,48 @@ public class FluidUtils { public static Fluid addGTFluid(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { return addGTFluid("molten."+aName, "molten.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount); } - + public static Fluid addGTFluidNonMolten(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { return addGTFluid("fluid."+aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount); } - - public static Fluid addGTPlasma(Material aMaterial) { - if (aMaterial.getLocalizedName().toLowerCase().contains("clay")){ - return null; - } - Utils.LOG_INFO("Generating a "+aMaterial.getLocalizedName()+" Plasma Cell"); - if (aMaterial.vComponentCount != 1){ - Utils.LOG_INFO("Compound made from: "); - for (MaterialStack x : aMaterial.getComposites()){ - Utils.LOG_INFO(x.getStackMaterial().getLocalizedName()); - } - Utils.LOG_INFO("Material is a composite, not generating plasma."); - return null; - } - - ItemStack temp = null; - //Generate a Cell if we need to - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+aMaterial.getUnlocalizedName(), 1) == null){ - Item temp2 = new BaseItemPlasmaCell(aMaterial); - temp = aMaterial.getPlasmaCell(1); - } - else { - temp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+aMaterial.getUnlocalizedName(), 1); - } - if (temp != null){ - return addGTFluid( - "plasma." + Utils.sanitizeString(aMaterial.getLocalizedName().toLowerCase()), - "plasma.autogenerated", - aMaterial.getLocalizedName() + " Plasma", - aMaterial.getRGBA(), - 3, - 10000, - temp, - ItemList.Cell_Empty.get(1L, new Object[0]), - 1000); + + public static Fluid addGTPlasma(final Material aMaterial) { + if (aMaterial.getLocalizedName().toLowerCase().contains("clay")){ + return null; + } + Utils.LOG_INFO("Generating a "+aMaterial.getLocalizedName()+" Plasma Cell"); + if (aMaterial.vComponentCount != 1){ + Utils.LOG_INFO("Compound made from: "); + for (final MaterialStack x : aMaterial.getComposites()){ + Utils.LOG_INFO(x.getStackMaterial().getLocalizedName()); } + Utils.LOG_INFO("Material is a composite, not generating plasma."); return null; - } + } + + ItemStack temp = null; + //Generate a Cell if we need to + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+aMaterial.getUnlocalizedName(), 1) == null){ + final Item temp2 = new BaseItemPlasmaCell(aMaterial); + temp = aMaterial.getPlasmaCell(1); + } + else { + temp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+aMaterial.getUnlocalizedName(), 1); + } + if (temp != null){ + return addGTFluid( + "plasma." + Utils.sanitizeString(aMaterial.getLocalizedName().toLowerCase()), + "plasma.autogenerated", + aMaterial.getLocalizedName() + " Plasma", + aMaterial.getRGBA(), + 3, + 10000, + temp, + ItemList.Cell_Empty.get(1L, new Object[0]), + 1000); + } + return null; + } public static Fluid addGTFluid(String aName, final String aTexture, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { aName = Utils.sanitizeString(aName.toLowerCase()); @@ -301,21 +301,21 @@ public class FluidUtils { else { rFluid = FluidRegistry.getFluid(aName); } - if (rFluid.getTemperature() == new Fluid("test").getTemperature() || rFluid.getTemperature() <= 0) { + if ((rFluid.getTemperature() == new Fluid("test").getTemperature()) || (rFluid.getTemperature() <= 0)) { rFluid.setTemperature((int) (aTemperatureK)); - } - if (aFullContainer != null && aEmptyContainer != null && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { + } + if ((aFullContainer != null) && (aEmptyContainer != null) && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { GT_Values.RA.addFluidCannerRecipe(aFullContainer, container(aFullContainer, false), null, new FluidStack(rFluid, aFluidAmount)); } return rFluid; } public static boolean valid(final Object aStack) { - return aStack != null && aStack instanceof ItemStack && ((ItemStack)aStack).getItem() != null && ((ItemStack)aStack).stackSize >= 0; + return (aStack != null) && (aStack instanceof ItemStack) && (((ItemStack)aStack).getItem() != null) && (((ItemStack)aStack).stackSize >= 0); } public static boolean invalid(final Object aStack) { - return aStack == null || !(aStack instanceof ItemStack) || ((ItemStack)aStack).getItem() == null || ((ItemStack)aStack).stackSize < 0; + return (aStack == null) || !(aStack instanceof ItemStack) || (((ItemStack)aStack).getItem() == null) || (((ItemStack)aStack).stackSize < 0); } public static boolean equal(final ItemStack aStack1, final ItemStack aStack2) { @@ -323,11 +323,11 @@ public class FluidUtils { } public static boolean equal(final ItemStack aStack1, final ItemStack aStack2, final boolean aIgnoreNBT) { - return aStack1 != null && aStack2 != null && equal_(aStack1, aStack2, aIgnoreNBT); + return (aStack1 != null) && (aStack2 != null) && equal_(aStack1, aStack2, aIgnoreNBT); } public static boolean equal_(final ItemStack aStack1, final ItemStack aStack2, final boolean aIgnoreNBT) { - return aStack1.getItem() == aStack2.getItem() && (aIgnoreNBT || (aStack1.getTagCompound() == null == (aStack2.getTagCompound() == null) && (aStack1.getTagCompound() == null || aStack1.getTagCompound().equals((Object)aStack2.getTagCompound())))) && (meta(aStack1) == meta(aStack2) || meta(aStack1) == 32767 || meta(aStack2) == 32767); + return (aStack1.getItem() == aStack2.getItem()) && (aIgnoreNBT || ((aStack1.getTagCompound() == null == (aStack2.getTagCompound() == null)) && ((aStack1.getTagCompound() == null) || aStack1.getTagCompound().equals(aStack2.getTagCompound())))) && ((meta(aStack1) == meta(aStack2)) || (meta(aStack1) == 32767) || (meta(aStack2) == 32767)); } public static ItemStack copy(final Object... aStacks) { @@ -352,7 +352,7 @@ public class FluidUtils { } public static ItemStack meta(final ItemStack aStack, final long aMeta) { - Items.feather.setDamage(aStack, (int)(short)aMeta); + Items.feather.setDamage(aStack, (short)aMeta); return aStack; } @@ -375,7 +375,7 @@ public class FluidUtils { if (equal(aStack, ItemList.Cell_Empty.get(1), true)) { return null; } - if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem)aStack.getItem()).getCapacity(aStack) > 0) { + if (aCheckIFluidContainerItems && (aStack.getItem() instanceof IFluidContainerItem) && (((IFluidContainerItem)aStack.getItem()).getCapacity(aStack) > 0)) { final ItemStack tStack = amount(1L, aStack); ((IFluidContainerItem)aStack.getItem()).drain(tStack, Integer.MAX_VALUE, true); if (!equal(aStack, tStack)) { @@ -391,21 +391,22 @@ public class FluidUtils { public static ItemStack container(final ItemStack aStack, final boolean aCheckIFluidContainerItems, final int aStacksize) { return amount(aStacksize, container(aStack, aCheckIFluidContainerItems)); - } + } - public final static Fluid generateFluid(String unlocalizedName, String localizedName, int MeltingPoint, short[] RGBA){ - if (FluidUtils.getFluidStack("molten"+"."+unlocalizedName.toLowerCase(), 1) == null && ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+Utils.sanitizeString(localizedName), 1) != null){ + public final static Fluid generateFluid(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA){ + if ((FluidUtils.getFluidStack("molten"+"."+unlocalizedName.toLowerCase(), 1) == null) && (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+Utils.sanitizeString(localizedName), 1) != null)){ Utils.LOG_WARNING("Generating our own fluid."); //Generate a Cell if we need to if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ @SuppressWarnings("unused") + final Item temp = new BaseItemComponent(unlocalizedName, localizedName, RGBA); } - Fluid gtFluid = FluidUtils.addGTFluid( + final Fluid gtFluid = FluidUtils.addGTFluid( unlocalizedName, - "Molten "+localizedName, + "Molten "+localizedName, RGBA, 4, MeltingPoint, @@ -427,22 +428,23 @@ public class FluidUtils { return null; } - public final static Fluid generateFluidNonMolten(String unlocalizedName, String localizedName, int MeltingPoint, short[] RGBA, ItemStack dustStack, ItemStack dustStack2){ + public final static Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, ItemStack dustStack, final ItemStack dustStack2){ if (dustStack == null){ dustStack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+Utils.sanitizeString(localizedName), 1); - } - if (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null && (dustStack != null || dustStack2 != null)){ + } + if ((FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null) && ((dustStack != null) || (dustStack2 != null))){ Utils.LOG_WARNING("Generating our own fluid."); //Generate a Cell if we need to if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ @SuppressWarnings("unused") + final Item temp = new BaseItemComponent(unlocalizedName, localizedName, RGBA); } - Fluid gtFluid = FluidUtils.addGTFluidNonMolten( + final Fluid gtFluid = FluidUtils.addGTFluidNonMolten( unlocalizedName, - localizedName, + localizedName, RGBA, 4, MeltingPoint, diff --git a/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java b/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java index b10e643831..0c98751398 100644 --- a/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java +++ b/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java @@ -1,11 +1,10 @@ package gtPlusPlus.core.util.gregtech.recipehandlers; +import java.lang.reflect.Method; + import gregtech.api.util.GT_ModHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; - -import java.lang.reflect.Method; - import net.minecraft.item.ItemStack; public final class GregtechRecipe { @@ -15,21 +14,21 @@ public final class GregtechRecipe { Utils.LOG_INFO("Initializing a recipe handler for different versions of Gregtech 5."); try { if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - this.ourProxy = new LibProxy1(); - Utils.LOG_INFO("Selecting GT 5.7/5.8 Recipe Set"); + this.ourProxy = new LibProxy1(); + Utils.LOG_INFO("Selecting GT 5.7/5.8 Recipe Set"); } if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - this.ourProxy = new LibProxy2(); - Utils.LOG_INFO("Selecting GT 5.9 Recipe Set"); + this.ourProxy = new LibProxy2(); + Utils.LOG_INFO("Selecting GT 5.9 Recipe Set"); } - } catch (NoSuchMethodException e) { + } catch (final NoSuchMethodException e) { this.ourProxy = null; } } - public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aInput, ItemStack aOutput) { + public boolean addSmeltingAndAlloySmeltingRecipe(final ItemStack aInput, final ItemStack aOutput) { Utils.LOG_WARNING("Adding a GT Furnace/Alloy Smelter Recipe"+"| Input:"+aInput.getDisplayName()+" | Output:"+aOutput.getDisplayName()+" |"); - return ourProxy.addSmeltingAndAlloySmeltingRecipe(aInput, aOutput); + return this.ourProxy.addSmeltingAndAlloySmeltingRecipe(aInput, aOutput); } } @@ -42,15 +41,15 @@ class LibProxy1 extends LibraryProxy { final Method m1; public LibProxy1() throws NoSuchMethodException { - m1 = GT_ModHandler.class.getDeclaredMethod("addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class); + this.m1 = GT_ModHandler.class.getDeclaredMethod("addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class); } @Override - public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aInput, ItemStack aOutput) { + public boolean addSmeltingAndAlloySmeltingRecipe(final ItemStack aInput, final ItemStack aOutput) { try { Utils.LOG_INFO("Trying with Gt 5.7/5.8 Method."); - return (boolean) m1.invoke(null, aInput, aOutput); - } catch (Exception e) { + return (boolean) this.m1.invoke(null, aInput, aOutput); + } catch (final Exception e) { throw new RuntimeException(e); } } @@ -60,15 +59,15 @@ class LibProxy2 extends LibraryProxy { final Method m2; public LibProxy2() throws NoSuchMethodException { - m2 = GT_ModHandler.class.getDeclaredMethod("addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class, boolean.class); + this.m2 = GT_ModHandler.class.getDeclaredMethod("addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class, boolean.class); } @Override - public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aInput, ItemStack aOutput) { + public boolean addSmeltingAndAlloySmeltingRecipe(final ItemStack aInput, final ItemStack aOutput) { try { Utils.LOG_INFO("Trying with Gt 5.9 Method."); - return (boolean) m2.invoke(null, aInput, aOutput, true); - } catch (Exception e) { + return (boolean) this.m2.invoke(null, aInput, aOutput, true); + } catch (final Exception e) { throw new RuntimeException(e); } } diff --git a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java index 83a8fff751..8fe80ff184 100644 --- a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java @@ -1,5 +1,9 @@ package gtPlusPlus.core.util.item; +import java.util.ArrayList; +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; @@ -10,6 +14,7 @@ import gtPlusPlus.core.item.base.dusts.BaseItemDust; import gtPlusPlus.core.item.base.dusts.BaseItemDustUnique; import gtPlusPlus.core.item.base.dusts.decimal.BaseItemCentidust; import gtPlusPlus.core.item.base.dusts.decimal.BaseItemDecidust; +import gtPlusPlus.core.item.base.plates.BaseItemPlate_OLD; import gtPlusPlus.core.item.tool.staballoy.MultiPickaxeBase; import gtPlusPlus.core.item.tool.staballoy.MultiSpadeBase; import gtPlusPlus.core.lib.CORE; @@ -20,179 +25,175 @@ import gtPlusPlus.core.util.array.Pair; import gtPlusPlus.core.util.materials.MaterialUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.core.util.wrapper.var; - -import java.util.ArrayList; -import java.util.List; - import net.minecraft.block.Block; -import net.minecraft.item.*; +import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; -import cpw.mods.fml.common.registry.GameRegistry; public class ItemUtils { - public static ItemStack getSimpleStack(Item x){ + public static ItemStack getSimpleStack(final Item x){ return getSimpleStack(x, 1); } - public static ItemStack getSimpleStack(Block x){ + public static ItemStack getSimpleStack(final Block x){ return getSimpleStack(Item.getItemFromBlock(x), 1); } - public static ItemStack getSimpleStack(Item x, int i){ + public static ItemStack getSimpleStack(final Item x, final int i){ try { - ItemStack r = new ItemStack(x, i); + final ItemStack r = new ItemStack(x, i); return r; - } catch(Throwable e){ + } catch(final Throwable e){ return null; } } - public static ItemStack getSimpleStack(ItemStack x, int i){ + public static ItemStack getSimpleStack(final ItemStack x, final int i){ try { - ItemStack r = x.copy(); + final ItemStack r = x.copy(); r.stackSize = i; return r; - } catch(Throwable e){ + } catch(final Throwable e){ return null; } } - public static ItemStack getIC2Cell(String S){ - ItemStack moreTemp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+S, 1); + public static ItemStack getIC2Cell(final String S){ + final ItemStack moreTemp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+S, 1); if (moreTemp == null){ - int cellID = 0; - ItemStack temp =GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, cellID); + final int cellID = 0; + final ItemStack temp =GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, cellID); return temp != null ? temp : null; } return moreTemp; } - public static ItemStack getIC2Cell(int meta){ - ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, meta); + public static ItemStack getIC2Cell(final int meta){ + final ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, meta); return temp != null ? temp : null; } - public static void getItemForOreDict(String FQRN, String oreDictName, String itemName, int meta){ + public static void getItemForOreDict(final String FQRN, final String oreDictName, final String itemName, final int meta){ try { - Item em = null; - Item em1 = getItem(FQRN); + Item em = null; + final Item em1 = getItem(FQRN); //Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); if (em1 != null){ em = em1; } if (em != null){ - ItemStack metaStack = new ItemStack(em,1,meta); + final ItemStack metaStack = new ItemStack(em,1,meta); GT_OreDictUnificator.registerOre(oreDictName, metaStack); /*ItemStack itemStackWithMeta = new ItemStack(em,1,meta); GT_OreDictUnificator.registerOre(oreDictName, new ItemStack(itemStackWithMeta.getItem()));*/ } - } catch (NullPointerException e) { + } catch (final NullPointerException e) { Utils.LOG_ERROR(itemName+" not found. [NULL]"); } } - public static void addItemToOreDictionary(ItemStack stack, String oreDictName){ + public static void addItemToOreDictionary(final ItemStack stack, final String oreDictName){ try { GT_OreDictUnificator.registerOre(oreDictName, stack); - } catch (NullPointerException e) { + } catch (final NullPointerException e) { Utils.LOG_ERROR(stack.getDisplayName()+" not registered. [NULL]"); } } - public static ItemStack getItemStackWithMeta(boolean MOD, String FQRN, String itemName, int meta, int itemstackSize){ + public static ItemStack getItemStackWithMeta(final boolean MOD, final String FQRN, final String itemName, final int meta, final int itemstackSize){ if (MOD){ try { - Item em = null; - Item em1 = getItem(FQRN); + Item em = null; + final Item em1 = getItem(FQRN); //Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); if (em1 != null){ if (null == em){ em = em1; } if (em != null){ - ItemStack metaStack = new ItemStack(em,itemstackSize,meta); + final ItemStack metaStack = new ItemStack(em,itemstackSize,meta); return metaStack; } } return null; - } catch (NullPointerException e) { + } catch (final NullPointerException e) { Utils.LOG_ERROR(itemName+" not found. [NULL]"); return null; - } + } } return null; } - public static ItemStack simpleMetaStack(String FQRN, int meta, int itemstackSize){ + public static ItemStack simpleMetaStack(final String FQRN, final int meta, final int itemstackSize){ try { - Item em = null; - Item em1 = getItem(FQRN); + Item em = null; + final Item em1 = getItem(FQRN); //Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); if (em1 != null){ if (null == em){ em = em1; } if (em != null){ - ItemStack metaStack = new ItemStack(em,itemstackSize,meta); + final ItemStack metaStack = new ItemStack(em,itemstackSize,meta); return metaStack; } } return null; - } catch (NullPointerException e) { + } catch (final NullPointerException e) { Utils.LOG_ERROR(FQRN+" not found. [NULL]"); return null; - } + } } @SuppressWarnings("unused") - public static ItemStack simpleMetaStack(Item item, int meta, int itemstackSize){ + public static ItemStack simpleMetaStack(final Item item, final int meta, final int itemstackSize){ try { if (item == null){ return null; - } - Item em = item; - Item em1 = item; + } + Item em = item; + final Item em1 = item; Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); if (em1 != null){ if (null == em){ em = em1; } if (em != null){ - ItemStack metaStack = new ItemStack(em,itemstackSize,meta); + final ItemStack metaStack = new ItemStack(em,itemstackSize,meta); return metaStack; } } return null; - } catch (NullPointerException e) { + } catch (final NullPointerException e) { //Utils.LOG_ERROR(item.getUnlocalizedName()+" not found. [NULL]"); return null; - } + } } - public static ItemStack getCorrectStacktype(String fqrn, int stackSize){ - String oreDict = "ore:"; + public static ItemStack getCorrectStacktype(final String fqrn, final int stackSize){ + final String oreDict = "ore:"; ItemStack temp; if (fqrn.toLowerCase().contains(oreDict.toLowerCase())){ - String sanitizedName = fqrn.replace(oreDict, ""); + final String sanitizedName = fqrn.replace(oreDict, ""); temp = ItemUtils.getItemStack(sanitizedName, stackSize); return temp; } - String[] fqrnSplit = fqrn.split(":"); + final String[] fqrnSplit = fqrn.split(":"); String temp1; String temp2; temp1 = fqrnSplit[1]; if (fqrnSplit.length < 3){temp2 = "0";} else {temp2 = fqrnSplit[2];} temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, temp1, Integer.parseInt(temp2), stackSize); - return temp; - } + return temp; + } - public static ItemStack getCorrectStacktype(Object item_Input, int stackSize) { + public static ItemStack getCorrectStacktype(final Object item_Input, final int stackSize) { if (item_Input instanceof String){ return getItemStackOfAmountFromOreDictNoBroken((String) item_Input, stackSize); } @@ -205,91 +206,95 @@ public class ItemUtils { return null; } - public static Item getItem(String fqrn) // fqrn = fully qualified resource name + public static Item getItem(final String fqrn) // fqrn = fully qualified resource name { - String[] fqrnSplit = fqrn.split(":"); + final String[] fqrnSplit = fqrn.split(":"); return GameRegistry.findItem(fqrnSplit[0], fqrnSplit[1]); } - public static ItemStack getItemStack(String fqrn, int Size) // fqrn = fully qualified resource name + public static ItemStack getItemStack(final String fqrn, final int Size) // fqrn = fully qualified resource name { - String[] fqrnSplit = fqrn.split(":"); + final String[] fqrnSplit = fqrn.split(":"); return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size); } - public static void generateSpawnEgg(String entityModID, String parSpawnName, int colourEgg, int colourOverlay){ - Item itemSpawnEgg = new BasicSpawnEgg(entityModID, parSpawnName, colourEgg, colourOverlay).setUnlocalizedName("spawn_egg_"+parSpawnName.toLowerCase()).setTextureName(CORE.MODID+":spawn_egg"); + public static void generateSpawnEgg(final String entityModID, final String parSpawnName, final int colourEgg, final int colourOverlay){ + final Item itemSpawnEgg = new BasicSpawnEgg(entityModID, parSpawnName, colourEgg, colourOverlay).setUnlocalizedName("spawn_egg_"+parSpawnName.toLowerCase()).setTextureName(CORE.MODID+":spawn_egg"); GameRegistry.registerItem(itemSpawnEgg, "spawnEgg"+parSpawnName); } - public static ItemStack[] validItemsForOreDict(String oredictName){ - List<?> validNames = MaterialUtils.oreDictValuesForEntry(oredictName); - ItemStack[] inputs = new ItemStack[validNames.size()]; + public static ItemStack[] validItemsForOreDict(final String oredictName){ + final List<?> validNames = MaterialUtils.oreDictValuesForEntry(oredictName); + final ItemStack[] inputs = new ItemStack[validNames.size()]; for (int i=0; i<validNames.size();i++){ inputs[i] = (ItemStack) validNames.get(i); } - return inputs; + return inputs; } - public static ItemStack getItemStackOfAmountFromOreDict(String oredictName, int amount){ - ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); + public static ItemStack getItemStackOfAmountFromOreDict(final String oredictName, final int amount){ + final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); if (!oreDictList.isEmpty()){ - ItemStack returnValue = oreDictList.get(0).copy(); + final ItemStack returnValue = oreDictList.get(0).copy(); returnValue.stackSize = amount; return returnValue; } return getSimpleStack(ModItems.AAA_Broken, amount); } - public static ItemStack getItemStackOfAmountFromOreDictNoBroken(String oredictName, int amount){ + public static ItemStack getItemStackOfAmountFromOreDictNoBroken(final String oredictName, final int amount){ if (CORE.DEBUG){ Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(1)); Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(2)); Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(3)); Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(4)); - Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(5)); + Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(5)); } - ItemStack returnValue = getItemStackOfAmountFromOreDict(oredictName, amount); - if (returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass() || returnValue.getItem() != ModItems.AAA_Broken){ - return returnValue; + final ItemStack returnValue = getItemStackOfAmountFromOreDict(oredictName, amount); + if ((returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass()) || (returnValue.getItem() != ModItems.AAA_Broken)){ + return returnValue.copy(); } - Utils.LOG_INFO(oredictName+" was not valid."); + Utils.LOG_INFO(oredictName+" was not valid."); return null; } - public static ItemStack getGregtechDust(Materials material, int amount){ - ItemStack returnValue = GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L); + public static ItemStack getGregtechDust(final Materials material, final int amount){ + final ItemStack returnValue = GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L); if (returnValue != null){ - if (returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass() || returnValue.getItem() != ModItems.AAA_Broken){ - return returnValue; + if ((returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass()) || (returnValue.getItem() != ModItems.AAA_Broken)){ + return returnValue.copy(); } } - Utils.LOG_INFO(material+" was not valid."); + Utils.LOG_INFO(material+" was not valid."); return null; } - public static Item[] generateDusts(String unlocalizedName, String materialName, int materialTier, Material matInfo, int Colour){ - int radioactive = getRadioactivityLevel(materialName); - Item[] output = { + 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)}; return output; } - public static Item[] generateSpecialUseDusts(String unlocalizedName, String materialName, int Colour){ - Item[] output = { + public static Item[] generateSpecialUseDusts(final String unlocalizedName, final String materialName, final int Colour){ + final Item[] output = { new BaseItemDustUnique("itemDust"+unlocalizedName, materialName, Colour, "Dust"), new BaseItemDustUnique("itemDustSmall"+unlocalizedName, materialName, Colour, "Small"), new BaseItemDustUnique("itemDustTiny"+unlocalizedName, materialName, Colour, "Tiny")}; return output; } + + public static Item generateSpecialUsePlate(String internalName, String displayName, short[] rgb, int radioactivity){ + return new BaseItemPlate_OLD(internalName, displayName, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), radioactivity); + } - public static Item[] generateSpecialUseDusts(Material material, boolean onlyLargeDust){ - String materialName = material.getLocalizedName(); - String unlocalizedName = Utils.sanitizeString(materialName); - int Colour = material.getRgbAsHex(); + public static Item[] generateSpecialUseDusts(final Material material, final boolean onlyLargeDust){ + final String materialName = material.getLocalizedName(); + final String unlocalizedName = Utils.sanitizeString(materialName); + final int Colour = material.getRgbAsHex(); Item[] output = null; if (onlyLargeDust == false){ output = new Item[]{ @@ -304,20 +309,20 @@ public class ItemUtils { return output; } - public static MultiPickaxeBase generateMultiPick(boolean GT_Durability, Materials material){ - ToolMaterial customMaterial = Utils.generateToolMaterialFromGT(material); - Object enchant = new Pair(material.mEnchantmentTools, material.mEnchantmentToolsLevel); + public static MultiPickaxeBase generateMultiPick(final boolean GT_Durability, final Materials material){ + final ToolMaterial customMaterial = Utils.generateToolMaterialFromGT(material); + final Object enchant = new Pair(material.mEnchantmentTools, material.mEnchantmentToolsLevel); return generateMultiPick(GT_Durability, customMaterial, material.mDefaultLocalName, material.mDurability, material.mRGBa, enchant); } - public static MultiPickaxeBase generateMultiPick(Material material){ - ToolMaterial customMaterial = Utils.generateToolMaterial(material); + public static MultiPickaxeBase generateMultiPick(final Material material){ + final ToolMaterial customMaterial = Utils.generateToolMaterial(material); return generateMultiPick(true, customMaterial, material.getLocalizedName(), (int) material.vDurability, material.getRGBA(), null); } - public static MultiPickaxeBase generateMultiPick(boolean GT_Durability, ToolMaterial customMaterial, String name, int durability, short[] rgba, Object enchantment){ + public static MultiPickaxeBase generateMultiPick(final boolean GT_Durability, final ToolMaterial customMaterial, final String name, final int durability, final short[] rgba, final Object enchantment){ Utils.LOG_INFO("Generating a Multi-Pick out of "+name); - short[] rgb = rgba; + final short[] rgb = rgba; int dur = customMaterial.getMaxUses(); Utils.LOG_WARNING("Determined durability for "+name+" is "+dur); if (GT_Durability){ @@ -342,8 +347,8 @@ public class ItemUtils { else { enchant = null; } - - MultiPickaxeBase MP_Redstone = new MultiPickaxeBase( + + final MultiPickaxeBase MP_Redstone = new MultiPickaxeBase( name+" Multipick", (customMaterial), dur, @@ -352,7 +357,7 @@ public class ItemUtils { if (MP_Redstone.isValid){ return MP_Redstone; - } + } Utils.LOG_INFO("Pickaxe was not valid."); return null; } @@ -362,19 +367,19 @@ public class ItemUtils { - public static MultiSpadeBase generateMultiShovel(boolean GT_Durability, Materials material){ - ToolMaterial customMaterial = Utils.generateToolMaterialFromGT(material); + public static MultiSpadeBase generateMultiShovel(final boolean GT_Durability, final Materials material){ + final ToolMaterial customMaterial = Utils.generateToolMaterialFromGT(material); return generateMultiShovel(GT_Durability, customMaterial, material.mDefaultLocalName, material.mDurability, material.mRGBa); } - public static MultiSpadeBase generateMultiShovel(Material material){ - ToolMaterial customMaterial = Utils.generateToolMaterial(material); + public static MultiSpadeBase generateMultiShovel(final Material material){ + final ToolMaterial customMaterial = Utils.generateToolMaterial(material); return generateMultiShovel(true, customMaterial, material.getLocalizedName(), (int) material.vDurability, material.getRGBA()); } - public static MultiSpadeBase generateMultiShovel(boolean GT_Durability, ToolMaterial customMaterial, String name, int durability, short[] rgba){ + public static MultiSpadeBase generateMultiShovel(final boolean GT_Durability, final ToolMaterial customMaterial, final String name, final int durability, final short[] rgba){ Utils.LOG_WARNING("Generating a Multi-Spade out of "+name); - short[] rgb = rgba; + final short[] rgb = rgba; int dur = customMaterial.getMaxUses(); Utils.LOG_WARNING("Determined durability for "+name+" is "+dur); if (GT_Durability){ @@ -389,7 +394,7 @@ public class ItemUtils { Utils.LOG_WARNING("Still too low, "+name+" will now go unused."); return null; } - MultiSpadeBase MP_Redstone = new MultiSpadeBase( + final MultiSpadeBase MP_Redstone = new MultiSpadeBase( name+" Multispade", (customMaterial), dur, @@ -398,7 +403,7 @@ public class ItemUtils { if (MP_Redstone.isValid){ return MP_Redstone; - } + } return null; } @@ -413,44 +418,44 @@ public class ItemUtils { - public static BaseItemDecidust generateDecidust(Materials material){ + public static BaseItemDecidust generateDecidust(final Materials material){ if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null){ - Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); + final Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); if (placeholder != null) { generateDecidust(placeholder); - } - } + } + } return null; } - public static BaseItemDecidust generateDecidust(Material material){ - if (material.getDust(1) != null && MaterialUtils.hasValidRGBA(material.getRGBA())){ - BaseItemDecidust Decidust = new BaseItemDecidust(material); - return Decidust; + public static BaseItemDecidust generateDecidust(final Material material){ + if ((material.getDust(1) != null) && MaterialUtils.hasValidRGBA(material.getRGBA())){ + final BaseItemDecidust Decidust = new BaseItemDecidust(material); + return Decidust; } return null; } - public static BaseItemCentidust generateCentidust(Materials material){ + public static BaseItemCentidust generateCentidust(final Materials material){ if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null){ - Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); + final Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); if (placeholder != null) { generateCentidust(placeholder); - } - } + } + } return null; } - public static BaseItemCentidust generateCentidust(Material material){ - if (material.getDust(1) != null && MaterialUtils.hasValidRGBA(material.getRGBA())){ - BaseItemCentidust Centidust = new BaseItemCentidust(material); - return Centidust; + public static BaseItemCentidust generateCentidust(final Material material){ + if ((material.getDust(1) != null) && MaterialUtils.hasValidRGBA(material.getRGBA())){ + final BaseItemCentidust Centidust = new BaseItemCentidust(material); + return Centidust; } return null; } - public static boolean isRadioactive(String materialName){ - int sRadiation = 0; + public static boolean isRadioactive(final String materialName){ + int sRadiation = 0; if (materialName.toLowerCase().contains("uranium")){ sRadiation = 2; } @@ -466,8 +471,8 @@ public class ItemUtils { return false; } - public static int getRadioactivityLevel(String materialName){ - int sRadiation = 0; + public static int getRadioactivityLevel(final String materialName){ + int sRadiation = 0; if (materialName.toLowerCase().contains("uranium")){ sRadiation = 2; } @@ -480,16 +485,16 @@ public class ItemUtils { return sRadiation; } - public static String getArrayStackNames(ItemStack[] aStack){ + public static String getArrayStackNames(final ItemStack[] aStack){ String itemNames = "Item Array: "; - for (ItemStack alph : aStack){ + for (final ItemStack alph : aStack){ if (alph != null){ - String temp = itemNames; - itemNames = temp + ", " + alph.getDisplayName() + " x" + alph.stackSize; + final String temp = itemNames; + itemNames = temp + ", " + alph.getDisplayName() + " x" + alph.stackSize; } else { - String temp = itemNames; + final String temp = itemNames; itemNames = temp + ", " + "null" + " x" + "0"; } } @@ -497,10 +502,10 @@ public class ItemUtils { } - public static String[] getArrayStackNamesAsArray(ItemStack[] aStack){ - String[] itemNames = {}; + public static String[] getArrayStackNamesAsArray(final ItemStack[] aStack){ + final String[] itemNames = {}; int arpos = 0; - for (ItemStack alph : aStack){ + for (final ItemStack alph : aStack){ itemNames[arpos] = alph.getDisplayName(); arpos++; } @@ -508,29 +513,29 @@ public class ItemUtils { } - public static String getFluidArrayStackNames(FluidStack[] aStack){ + public static String getFluidArrayStackNames(final FluidStack[] aStack){ String itemNames = "Fluid Array: "; - for (FluidStack alph : aStack){ - String temp = itemNames; + for (final FluidStack alph : aStack){ + final String temp = itemNames; itemNames = temp + ", " + alph.getFluid().getName() + " x" + alph.amount; } return itemNames; } - public static ItemStack getGregtechCircuit(int Meta){ + public static ItemStack getGregtechCircuit(final int Meta){ return ItemUtils.getItemStackWithMeta(LoadedMods.Gregtech, "gregtech:gt.integrated_circuit", "Gregtech Circuit", Meta, 0); } - public static ItemStack[] getBlockDrops(ArrayList<ItemStack> blockDrops) { + public static ItemStack[] getBlockDrops(final ArrayList<ItemStack> blockDrops) { if (blockDrops == null){ return null; } if (blockDrops.isEmpty()){ return null; } - ItemStack[] outputs = new ItemStack[blockDrops.size()]; - short forCounter = 0; - for (ItemStack I : blockDrops){ + final ItemStack[] outputs = new ItemStack[blockDrops.size()]; + final short forCounter = 0; + for (final ItemStack I : blockDrops){ outputs[forCounter] = I; } return outputs; diff --git a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java index 680ce004b9..da68bfaaae 100644 --- a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java @@ -1,15 +1,14 @@ package gtPlusPlus.core.util.materials; +import java.util.ArrayList; +import java.util.List; + import gregtech.api.enums.*; import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.objects.MaterialStack; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; - -import java.util.ArrayList; -import java.util.List; - import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.oredict.OreDictionary; @@ -25,7 +24,7 @@ public class MaterialUtils { boolean.class, int.class, int.class, int.class, Dyes.class, int.class, List.class , List.class}}; - public static Materials addGtMaterial(String enumNameForMaterial, TextureSet aIconSet, float aToolSpeed, int aToolDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, int aExtraData, List<MaterialStack> aMaterialList, List<TC_AspectStack> aAspects) + public static Materials addGtMaterial(final String enumNameForMaterial, final TextureSet aIconSet, final float aToolSpeed, final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, final int aDensityDivider, final Dyes aColor, final int aExtraData, final List<MaterialStack> aMaterialList, final List<TC_AspectStack> aAspects) { Utils.LOG_INFO("Attempting to add GT material: "+enumNameForMaterial); return EnumHelper.addEnum(Materials.class, enumNameForMaterial, commonTypes, firstID++, aIconSet, aToolSpeed, aToolDurability, aToolQuality, aTypes, aR, aG, aB, aA, aLocalName, @@ -33,32 +32,32 @@ public class MaterialUtils { aColor, aExtraData, aMaterialList, aAspects); } - public static List<?> oreDictValuesForEntry(String oredictName){ + public static List<?> oreDictValuesForEntry(final String oredictName){ List<?> oredictItemNames; if(OreDictionary.doesOreNameExist(oredictName)){ - ArrayList<ItemStack> oredictItems = OreDictionary.getOres(oredictName); + final ArrayList<ItemStack> oredictItems = OreDictionary.getOres(oredictName); oredictItemNames = Utils.convertArrayListToList(oredictItems); return oredictItemNames; - } + } return null; } - public static Material generateMaterialFromGtENUM(Materials material){ + public static Material generateMaterialFromGtENUM(final Materials material){ String name = material.name(); - short[] rgba = material.mRGBa; - int melting = material.mMeltingPoint; - int boiling = material.mBlastFurnaceTemp; - long protons = material.getProtons(); - long neutrons = material.getNeutrons(); - boolean blastFurnace = material.mBlastFurnaceRequired; - int durability = material.mDurability; + final short[] rgba = material.mRGBa; + final int melting = material.mMeltingPoint; + final int boiling = material.mBlastFurnaceTemp; + final long protons = material.getProtons(); + final long neutrons = material.getNeutrons(); + final boolean blastFurnace = material.mBlastFurnaceRequired; + final int durability = material.mDurability; MaterialState materialState; - String chemicalFormula = MaterialUtils.subscript(Utils.sanitizeString(material.mChemicalFormula)); - Element element = material.mElement; + final String chemicalFormula = MaterialUtils.subscript(Utils.sanitizeString(material.mChemicalFormula)); + final Element element = material.mElement; int radioactivity = 0; if (material.isRadioactive()){ radioactivity = 1; - } + } //Determine default state if (material.getMolten(1) != null){ @@ -79,10 +78,10 @@ public class MaterialUtils { if (name.toLowerCase().contains("infused")){ - String tempname = name.substring(7, name.length()); + final String tempname = name.substring(7, name.length()); name = "Infused " + tempname; } - if (hasValidRGBA(rgba) || element == Element.H || (material == Materials.InfusedAir || material == Materials.InfusedFire || material == Materials.InfusedEarth || material == Materials.InfusedWater)){ + if (hasValidRGBA(rgba) || (element == Element.H) || ((material == Materials.InfusedAir) || (material == Materials.InfusedFire) || (material == Materials.InfusedEarth) || (material == Materials.InfusedWater))){ //ModItems.itemBaseDecidust = UtilsItems.generateDecidust(material); //ModItems.itemBaseCentidust = UtilsItems.generateCentidust(material); return new Material(name, materialState, durability, rgba, melting, boiling, protons, neutrons, blastFurnace, chemicalFormula, radioactivity); @@ -91,8 +90,8 @@ public class MaterialUtils { } - public static Material generateQuickMaterial(String materialName, MaterialState defaultState, short[] colour, int sRadioactivity) { - Material temp = new Material( + public static Material generateQuickMaterial(final String materialName, final MaterialState defaultState, final short[] colour, final int sRadioactivity) { + final Material temp = new Material( materialName, defaultState, 0, //Durability @@ -107,23 +106,23 @@ public class MaterialUtils { return temp; } - public static boolean hasValidRGBA(short[] rgba){ + public static boolean hasValidRGBA(final short[] rgba){ boolean test1 = false; boolean test2 = false; - boolean test3 = false; + boolean test3 = false; for (int r=0;r<rgba.length;r++){ if (rgba[r] == 0){ if (r == 0){ test1 = true; } else if (r == 1){ - test2 = true; + test2 = true; } else if (r == 2){ - test3 = true; + test3 = true; } } - } + } if ((test1 && test2) || (test1 && test3) || (test3 && test2)){ return false; } @@ -140,7 +139,7 @@ public class MaterialUtils { str = str.replaceAll("6", "\u2076"); str = str.replaceAll("7", "\u2077"); str = str.replaceAll("8", "\u2078"); - str = str.replaceAll("9", "\u2079"); + str = str.replaceAll("9", "\u2079"); return str; } @@ -158,35 +157,35 @@ public class MaterialUtils { return str; } - public static int getTierOfMaterial(int M){ - if (M >= 0 && M <= 750){ + public static int getTierOfMaterial(final int M){ + if ((M >= 0) && (M <= 750)){ return 1; } - else if(M >= 751 && M <= 1250){ + else if((M >= 751) && (M <= 1250)){ return 2; } - else if(M >= 1251 && M <= 1750){ + else if((M >= 1251) && (M <= 1750)){ return 3; } - else if(M >= 1751 && M <= 2250){ + else if((M >= 1751) && (M <= 2250)){ return 4; } - else if(M >= 2251 && M <= 2750){ + else if((M >= 2251) && (M <= 2750)){ return 5; } - else if(M >= 2751 && M <= 3250){ + else if((M >= 2751) && (M <= 3250)){ return 6; } - else if(M >= 3251 && M <= 3750){ + else if((M >= 3251) && (M <= 3750)){ return 7; } - else if(M >= 3751 && M <= 4250){ + else if((M >= 3751) && (M <= 4250)){ return 8; } - else if(M >= 4251 && M <= 4750){ + else if((M >= 4251) && (M <= 4750)){ return 9; } - else if(M >= 4751 && M <= 9999){ + else if((M >= 4751) && (M <= 9999)){ return 10; } else { @@ -197,11 +196,11 @@ public class MaterialUtils { /* * That's shown, many times, in the EnumHelper code, all the add functions just wrap the addEnum function. - You need the target enum class, and 2 arrays, 1 holding the types for the constructor arguments, + You need the target enum class, and 2 arrays, 1 holding the types for the constructor arguments, and the other holding the constructor argument values (the things being passed to the constructor) - The 'decompiled' Boolean should be set to true if the class you're adding to has been decompiled/recompiled again. - (it adds a 2nd enum arguments that need to be accounted for, but isn't actually useful to you) + The 'decompiled' Boolean should be set to true if the class you're adding to has been decompiled/recompiled again. + (it adds a 2nd enum arguments that need to be accounted for, but isn't actually useful to you) * *new Class[{int.class, TextureSet.class, float.class, int.class, diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index 96231fb29c..3c04266f38 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -1,10 +1,10 @@ package gtPlusPlus.core.util.math; -import gtPlusPlus.core.util.Utils; - import java.util.Map; import java.util.Random; +import gtPlusPlus.core.util.Utils; + public class MathUtils { /** @@ -17,24 +17,24 @@ public class MathUtils { * @return Integer between min and max, inclusive. * @see java.util.Random#nextInt(int) */ - public static int randInt(int min, int max) { + public static int randInt(final int min, final int max) { // Usually this can be a field rather than a method variable - Random rand = new Random(); + final Random rand = new Random(); // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive - int randomNum = rand.nextInt((max - min) + 1) + min; + final int randomNum = rand.nextInt((max - min) + 1) + min; return randomNum; } - - public static double getChanceOfXOverYRuns(double x, double y){ - double z = (1-Math.pow((1-x), y)); - return z; + + public static double getChanceOfXOverYRuns(final double x, final double y){ + final double z = (1-Math.pow((1-x), y)); + return z; } - - + + /** * Returns a psuedo-random number between min and max, inclusive. * The difference between min and max can be at most @@ -45,27 +45,27 @@ public class MathUtils { * @return Long between min and max, inclusive. * @see java.util.Random#nextLong(long) */ - public static long randLong(long min, long max) { + public static long randLong(final long min, final long max) { // Usually this can be a field rather than a method variable - Random rand = new Random(); + final Random rand = new Random(); // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive - long randomNum = MathUtils.nextLong(rand,(max - min) + 1) + min; + final long randomNum = MathUtils.nextLong(rand,(max - min) + 1) + min; return randomNum; } - private static long nextLong(Random rng, long n) { + private static long nextLong(final Random rng, final long n) { // error checking and 2^x checking removed for simplicity. long bits, val; do { bits = (rng.nextLong() << 1) >>> 1; val = bits % n; - } while (bits-val+(n-1) < 0L); + } while (((bits-val)+(n-1)) < 0L); return val; } - - + + /** * Returns a psuedo-random number between min and max, inclusive. * The difference between min and max can be at most @@ -76,26 +76,26 @@ public class MathUtils { * @return Double between min and max, inclusive. * @see java.util.Random#nextDouble(double) */ - public static double randDouble(double min, double max) { + public static double randDouble(final double min, final double max) { // Usually this can be a field rather than a method variable - Random rand = new Random(); + final Random rand = new Random(); // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive - double randomNum = MathUtils.nextDouble(rand,(max - min) + 1) + min; + final double randomNum = MathUtils.nextDouble(rand,(max - min) + 1) + min; return randomNum; } - - private static double nextDouble(Random rng, double n) { + + private static double nextDouble(final Random rng, final double n) { // error checking and 2^x checking removed for simplicity. double bits, val; do { bits = (rng.nextLong() << 1) >>> 1; val = bits % n; - } while (bits-val+(n-1) < 0L); + } while (((bits-val)+(n-1)) < 0L); return val; } - + /** * Returns a percentage. @@ -104,14 +104,14 @@ public class MathUtils { * * @param current Current value. * @param max Maximim value. Must be greater than min. - * @return double between min and max, inclusive. + * @return double between min and max, inclusive. */ - public static double findPercentage(double current, double max){ - double c = ((double) current / max) * 100; - double roundOff = Math.round(c * 100.00) / 100.00; + public static double findPercentage(final double current, final double max){ + final double c = (current / max) * 100; + final double roundOff = Math.round(c * 100.00) / 100.00; return roundOff; } - + //Smooth Rounding Function /** @@ -120,12 +120,12 @@ public class MathUtils { * Supports Doubles. * * @param current Current value. - * @return double Rounded value. + * @return double Rounded value. */ - public static double decimalRounding(double d) { + public static double decimalRounding(final double d) { return Math.round(d * 2) / 2.0; } - + //Smooth Rounding Function (Nearest 5) /** @@ -134,39 +134,39 @@ public class MathUtils { * Supports Doubles. * * @param current Current value. - * @return double Rounded value. + * @return double Rounded value. */ - public static double decimalRoundingToWholes(double d) { + public static double decimalRoundingToWholes(final double d) { return 5*(Math.round(d/5)); } - + //Smooth Rounding Function - /** - * Returns a integer. - * The returned number is d rounded to the nearest flat integer. - * Supports Doubles as input. - * - * @param current Current value. - * @return integer Rounded value. - */ - public static int roundToClosestInt(double d) { - return (int) (Math.round(d * 2) / 2.0); + /** + * Returns a integer. + * The returned number is d rounded to the nearest flat integer. + * Supports Doubles as input. + * + * @param current Current value. + * @return integer Rounded value. + */ + public static int roundToClosestInt(final double d) { + return (int) (Math.round(d * 2) / 2.0); + } + + public static int roundToClosestMultiple(final double number, final int multiple) { + int result = multiple; + if ((number % multiple) == 0) { + return (int) number; + } + // If not already multiple of given number + if ((number % multiple) != 0) { + final int division = (int) ((number / multiple) + 1); + result = division * multiple; } - - public static int roundToClosestMultiple(double number, int multiple) { - int result = multiple; - if (number % multiple == 0) { - return (int) number; - } - // If not already multiple of given number - if (number % multiple != 0) { - int division = (int) ((number / multiple) + 1); - result = division * multiple; - } - return result; - } - - + return result; + } + + /** * Returns a boolean. * The returned boolean is wether or not X evenly fits in to Y. @@ -174,9 +174,9 @@ public class MathUtils { * * @param x Value A. * @param y Value B. Must be greater than min. - * @return boolean Whether or not it divides evenly. + * @return boolean Whether or not it divides evenly. */ - public static boolean divideXintoY(int x, int y){ + public static boolean divideXintoY(final int x, final int y){ if ((x % y) == 0) { return true; @@ -184,16 +184,16 @@ public class MathUtils { return false; } - + /** * Returns a boolean. * The returned boolean is based on the odd/eveness of the input. * Supports ints. * * @param x Value A. - * @return boolean Whether or not it divides evenly. + * @return boolean Whether or not it divides evenly. */ - public static boolean isNumberEven(int x){ + public static boolean isNumberEven(final int x){ if ((x % 2) == 0) { return true; @@ -201,7 +201,7 @@ public class MathUtils { return false; } - + /** * Returns an int. @@ -209,13 +209,13 @@ public class MathUtils { * Supports ints. * * @param i Temp in Celcius. - * @return int The celcius temp returned as Kelvin, rounded to the readest whole. + * @return int The celcius temp returned as Kelvin, rounded to the readest whole. */ - public static float celsiusToKelvin(int i){ - double f = i + 273.15F; + public static float celsiusToKelvin(final int i){ + final double f = i + 273.15F; return (int)decimalRoundingToWholes(f); } - + /** * Returns a hexInteger. @@ -223,14 +223,14 @@ public class MathUtils { * Supports ints. * * @param input Current value. - * @return hexInteger. + * @return hexInteger. */ - public static int getHexNumberFromInt(int input){ - String result = Integer.toHexString(input); - int resultINT = Integer.getInteger(result); + public static int getHexNumberFromInt(final int input){ + final String result = Integer.toHexString(input); + final int resultINT = Integer.getInteger(result); return resultINT; } - + /** * Returns a hexInteger. @@ -239,80 +239,84 @@ public class MathUtils { * * @param min Minimum value. * @param max Maximium value. Must be greater than min. - * @return hexInteger between min and max, inclusive. + * @return hexInteger between min and max, inclusive. */ - public static int generateRandomHexValue(int min, int max){ - int result = getHexNumberFromInt(randInt(min, max)); + public static int generateRandomHexValue(final int min, final int max){ + final int result = getHexNumberFromInt(randInt(min, max)); return result; } - + /** * Returns a random hex value. * The returned value is between 000000-ffffff. * - * @return hexInteger between min and max, inclusive. + * @return hexInteger between min and max, inclusive. */ public static int generateSingularRandomHexValue(){ String temp; - int randomInt = randInt(1, 5); + final int randomInt = randInt(1, 5); final Map<Integer, String> colours = Utils.hexColourGeneratorRandom(5); - if (colours.get(randomInt) != null && colours.size() > 0){ - temp = colours.get(randomInt); + if ((colours.get(randomInt) != null) && (colours.size() > 0)){ + temp = colours.get(randomInt); } else { - temp = "0F0F0F"; + temp = "0F0F0F"; } - Utils.LOG_WARNING("Operating with "+temp); + Utils.LOG_WARNING("Operating with "+temp); temp = Utils.appenedHexNotationToString(String.valueOf(temp)); Utils.LOG_WARNING("Made "+temp+" - Hopefully it's not a mess."); Utils.LOG_WARNING("It will decode into "+Integer.decode(temp)+"."); return Integer.decode(temp); } - - public static long[] simplifyNumbersToSmallestForm(long[] inputArray){ - long GCD = gcd(inputArray); - long[] outputArray = new long[inputArray.length]; + + public static long[] simplifyNumbersToSmallestForm(final long[] inputArray){ + final long GCD = gcd(inputArray); + final long[] outputArray = new long[inputArray.length]; for (int i=0;i<inputArray.length;i++){ - if (GCD != 0) - outputArray[i] = (inputArray[i]/GCD); - else + if (GCD != 0) { + outputArray[i] = (inputArray[i]/GCD); + } else { outputArray[i] = inputArray[i]; + } + } + if (outputArray.length > 0) { + return outputArray; } - if (outputArray.length > 0) - return outputArray; return null; } - + private static long gcd(long a, long b){ - while (b > 0) - { - long temp = b; - b = a % b; // % is remainder - a = temp; - } - return a; + while (b > 0) + { + final long temp = b; + b = a % b; // % is remainder + a = temp; + } + return a; } - - private static long gcd(long[] input){ - long result = input[0]; - for(int i = 1; i < input.length; i++) result = gcd(result, input[i]); - return result; + + private static long gcd(final long[] input){ + long result = input[0]; + for(int i = 1; i < input.length; i++) { + result = gcd(result, input[i]); + } + return result; } - - final public static int getRgbAsHex(short[] RGBA){ - int returnValue = Utils.rgbtoHexValue(RGBA[0], RGBA[1], RGBA[2]); + final public static int getRgbAsHex(final short[] RGBA){ + + final int returnValue = Utils.rgbtoHexValue(RGBA[0], RGBA[1], RGBA[2]); if (returnValue == 0){ - return (int) 0; - } + return 0; + } return Utils.rgbtoHexValue(RGBA[0], RGBA[1], RGBA[2]); } - - - public final static int returnLargestNumber(int a, int b){ + + + public final static int returnLargestNumber(final int a, final int b){ if (a > b){ return a; } diff --git a/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java b/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java index aa0f24f559..b02b50bbfd 100644 --- a/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java +++ b/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java @@ -6,7 +6,7 @@ import java.util.Enumeration; public class NetworkUtils { - public static String getContentFromURL(String args) { + public static String getContentFromURL(final String args) { try { if (hasValidNetworkInterface()){ if (netIsAvailableGithub() || netIsAvailableOther() || netIsAvailableBaidu() || netIsAvailableGoogle()){ @@ -14,9 +14,9 @@ public class NetworkUtils { URL url; // get URL content url = new URL(args); - URLConnection conn = url.openConnection(); + final URLConnection conn = url.openConnection(); // open the stream and put it into BufferedReader - BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())); + final BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())); String inputLine; String tempLine = null; while ((inputLine = br.readLine()) != null) { @@ -24,75 +24,77 @@ public class NetworkUtils { } br.close(); return tempLine; - } - catch (MalformedURLException e) {} - catch (IOException e) {} - } + } + catch (final MalformedURLException e) {} + catch (final IOException e) {} + } } - } catch (SocketException e) {} + } catch (final SocketException e) {} return "offline"; } - private static boolean netIsAvailableGoogle() { - try { - final URL url = new URL("http://www.google.com"); - final URLConnection conn = url.openConnection(); - conn.connect(); - return true; - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } catch (IOException e) { - return false; - } - } + private static boolean netIsAvailableGoogle() { + try { + final URL url = new URL("http://www.google.com"); + final URLConnection conn = url.openConnection(); + conn.connect(); + return true; + } catch (final MalformedURLException e) { + throw new RuntimeException(e); + } catch (final IOException e) { + return false; + } + } - private static boolean netIsAvailableBaidu() { - try { - final URL url = new URL("http://www.baidu.com"); - final URLConnection conn = url.openConnection(); - conn.connect(); - return true; - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } catch (IOException e) { - return false; - } + private static boolean netIsAvailableBaidu() { + try { + final URL url = new URL("http://www.baidu.com"); + final URLConnection conn = url.openConnection(); + conn.connect(); + return true; + } catch (final MalformedURLException e) { + throw new RuntimeException(e); + } catch (final IOException e) { + return false; + } } - private static boolean netIsAvailableGithub() { - try { - final URL url = new URL("https://github.com/draknyte1/GTplusplus"); - final URLConnection conn = url.openConnection(); - conn.connect(); - return true; - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } catch (IOException e) { - return false; - } - } + private static boolean netIsAvailableGithub() { + try { + final URL url = new URL("https://github.com/draknyte1/GTplusplus"); + final URLConnection conn = url.openConnection(); + conn.connect(); + return true; + } catch (final MalformedURLException e) { + throw new RuntimeException(e); + } catch (final IOException e) { + return false; + } + } - private static boolean netIsAvailableOther() { - try { - int timeout = 2000; - InetAddress[] addresses = InetAddress.getAllByName("www.yahoo.com"); - for (InetAddress address : addresses) { - if (address.isReachable(timeout)) - return true; + private static boolean netIsAvailableOther() { + try { + final int timeout = 2000; + final InetAddress[] addresses = InetAddress.getAllByName("www.yahoo.com"); + for (final InetAddress address : addresses) { + if (address.isReachable(timeout)) { + return true; + } + return false; + } + } catch (final Exception e) { return false; - } - } catch (Exception e) { - return false; - } - return false; + } + return false; } private static boolean hasValidNetworkInterface() throws SocketException{ - Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); + final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { - NetworkInterface interf = interfaces.nextElement(); - if (interf.isUp() && !interf.isLoopback()) + final NetworkInterface interf = interfaces.nextElement(); + if (interf.isUp() && !interf.isLoopback()) { return true; + } } return false; } diff --git a/src/Java/gtPlusPlus/core/util/particles/BlockBreakParticles.java b/src/Java/gtPlusPlus/core/util/particles/BlockBreakParticles.java index df0910da99..a1a46b39f4 100644 --- a/src/Java/gtPlusPlus/core/util/particles/BlockBreakParticles.java +++ b/src/Java/gtPlusPlus/core/util/particles/BlockBreakParticles.java @@ -6,12 +6,12 @@ import net.minecraft.world.World; public class BlockBreakParticles { - public BlockBreakParticles(World world, int x, int y, int z, Block block){ + public BlockBreakParticles(final World world, final int x, final int y, final int z, final Block block){ try { HANDLER_FR.createBlockBreakParticles(world, x, y, z, block); - } catch (Throwable T){ - + } catch (final Throwable T){ + } } - + } diff --git a/src/Java/gtPlusPlus/core/util/particles/EntityParticleFXMysterious.java b/src/Java/gtPlusPlus/core/util/particles/EntityParticleFXMysterious.java index 2c704e48a6..97103b636b 100644 --- a/src/Java/gtPlusPlus/core/util/particles/EntityParticleFXMysterious.java +++ b/src/Java/gtPlusPlus/core/util/particles/EntityParticleFXMysterious.java @@ -5,13 +5,13 @@ import net.minecraft.world.World; public class EntityParticleFXMysterious extends EntityAuraFX { - public EntityParticleFXMysterious(World parWorld, - double parX, double parY, double parZ, - double parMotionX, double parMotionY, double parMotionZ) - { - super(parWorld, parX, parY, parZ, parMotionX, parMotionY, parMotionZ); - setParticleTextureIndex(82); // same as happy villager - particleScale = 2.0F; - setRBGColorF(0x88, 0x00, 0x88); - } + public EntityParticleFXMysterious(final World parWorld, + final double parX, final double parY, final double parZ, + final double parMotionX, final double parMotionY, final double parMotionZ) + { + super(parWorld, parX, parY, parZ, parMotionX, parMotionY, parMotionZ); + this.setParticleTextureIndex(82); // same as happy villager + this.particleScale = 2.0F; + this.setRBGColorF(0x88, 0x00, 0x88); + } } diff --git a/src/Java/gtPlusPlus/core/util/player/PlayerCache.java b/src/Java/gtPlusPlus/core/util/player/PlayerCache.java index 85bba2470a..99635d8fe9 100644 --- a/src/Java/gtPlusPlus/core/util/player/PlayerCache.java +++ b/src/Java/gtPlusPlus/core/util/player/PlayerCache.java @@ -1,11 +1,10 @@ package gtPlusPlus.core.util.player; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; - import java.io.*; import java.util.*; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; @@ -19,11 +18,11 @@ public class PlayerCache { if (cache != null){ CORE.PlayerCache = PlayerCache.readPropertiesFileAsMap(); - Utils.LOG_INFO("Loaded PlayerCache.dat"); + Utils.LOG_INFO("Loaded PlayerCache.dat"); } - } catch (Exception e) { + } catch (final Exception e) { Utils.LOG_INFO("Failed to initialise PlayerCache.dat"); PlayerCache.createPropertiesFile("PLAYER_", "DATA"); //e.printStackTrace(); @@ -31,21 +30,21 @@ public class PlayerCache { } } - public static void createPropertiesFile(String playerName, String playerUUIDasString) { + public static void createPropertiesFile(final String playerName, final String playerUUIDasString) { try { - Properties props = new Properties(); + final Properties props = new Properties(); props.setProperty(playerName+" ", playerUUIDasString); - OutputStream out = new FileOutputStream(cache); + final OutputStream out = new FileOutputStream(cache); props.store(out, "Player Cache."); Utils.LOG_INFO("PlayerCache.dat created for future use."); } - catch (Exception e ) { + catch (final Exception e ) { e.printStackTrace(); } } - public static void appendParamChanges(String playerName, String playerUUIDasString) { - HashMap<String, UUID> playerInfo = new HashMap<String, UUID>(); + public static void appendParamChanges(final String playerName, final String playerUUIDasString) { + final HashMap<String, UUID> playerInfo = new HashMap<>(); playerInfo.put(playerName, UUID.fromString(playerUUIDasString)); /*try { @@ -66,49 +65,54 @@ public class PlayerCache { try { - FileOutputStream fos = new FileOutputStream("PlayerCache.dat"); - ObjectOutputStream oos = new ObjectOutputStream(fos); + final FileOutputStream fos = new FileOutputStream("PlayerCache.dat"); + final ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(playerInfo); oos.close(); fos.close(); Utils.LOG_INFO("Serialized Player data saved in PlayerCache.dat"); } - catch (IOException e) { + catch (final IOException e) { Utils.LOG_INFO("No PlayerCache file found, creating one."); createPropertiesFile(playerName, playerUUIDasString); - } + } } /** - * Reads a "properties" file, and returns it as a Map + * Reads a "properties" file, and returns it as a Map * (a collection of key/value pairs). - * + * * Credit due to Alvin Alexander - http://alvinalexander.com/java/java-properties-file-map-example?nocache=1#comment-8215 * Changed slightly as the filename and delimiter are constant in my case. - * + * * @param filename The properties filename to read. - * @param delimiter The string (or character) that separates the key + * @param delimiter The string (or character) that separates the key * from the value in the properties file. * @return The Map that contains the key/value pairs. * @throws Exception */ @Deprecated public static Map<String, String> readPropertiesFileAsMapOld() throws Exception { - String delimiter = "="; + final String delimiter = "="; @SuppressWarnings({ "rawtypes", "unchecked" }) - Map<String, String> map = new HashMap<String, String>(); - BufferedReader reader = new BufferedReader(new FileReader(cache)); + final + Map<String, String> map = new HashMap<>(); + final BufferedReader reader = new BufferedReader(new FileReader(cache)); String line; while ((line = reader.readLine()) != null) { - if (line.trim().length()==0) continue; - if (line.charAt(0)=='#') continue; + if (line.trim().length()==0) { + continue; + } + if (line.charAt(0)=='#') { + continue; + } // assumption here is that proper lines are like "String : <a href="http://xxx.yyy.zzz/foo/bar"" title="http://xxx.yyy.zzz/foo/bar"">http://xxx.yyy.zzz/foo/bar"</a>, // and the ":" is the delimiter - int delimPosition = line.indexOf(delimiter); - String key = line.substring(0, delimPosition-1).trim(); - String value = line.substring(delimPosition+1).trim(); + final int delimPosition = line.indexOf(delimiter); + final String key = line.substring(0, delimPosition-1).trim(); + final String value = line.substring(delimPosition+1).trim(); map.put(key, value); } reader.close(); @@ -120,16 +124,16 @@ public class PlayerCache { HashMap<String, UUID> map = null; try { - FileInputStream fis = new FileInputStream(cache); - ObjectInputStream ois = new ObjectInputStream(fis); + final FileInputStream fis = new FileInputStream(cache); + final ObjectInputStream ois = new ObjectInputStream(fis); map = (HashMap<String, UUID>) ois.readObject(); ois.close(); fis.close(); - }catch(IOException ioe) + }catch(final IOException ioe) { - ioe.printStackTrace(); + ioe.printStackTrace(); return null; - }catch(ClassNotFoundException c) + }catch(final ClassNotFoundException c) { Utils.LOG_INFO("Class not found"); c.printStackTrace(); @@ -139,15 +143,16 @@ public class PlayerCache { return map; } - public static String lookupPlayerByUUID(UUID UUID){ - if (UUID == null) + public static String lookupPlayerByUUID(final UUID UUID){ + if (UUID == null) { return null; - List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList; - for (EntityPlayerMP player : allPlayers) { + } + final List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList; + for (final EntityPlayerMP player : allPlayers) { if (player.getUniqueID().equals(UUID)) { return player.getDisplayName(); } - } + } return "Offline Player."; } } diff --git a/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java b/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java index f81ad561da..6a2253ab54 100644 --- a/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java +++ b/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java @@ -2,6 +2,8 @@ package gtPlusPlus.core.util.player; import java.util.*; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -9,41 +11,39 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class PlayerUtils { - public static void messagePlayer(EntityPlayer P, String S){ + public static void messagePlayer(final EntityPlayer P, final String S){ gregtech.api.util.GT_Utility.sendChatToPlayer(P, S); } - public static EntityPlayer getPlayer(String name){ - List<EntityPlayer> i = new ArrayList<EntityPlayer>(); - Iterator<EntityPlayer> crunchifyIterator = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator(); + public static EntityPlayer getPlayer(final String name){ + final List<EntityPlayer> i = new ArrayList<>(); + final Iterator<EntityPlayer> crunchifyIterator = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator(); while (crunchifyIterator.hasNext()) { i.add((crunchifyIterator.next())); - } + } try{ - for (EntityPlayer temp : i) { + for (final EntityPlayer temp : i) { if (temp.getDisplayName().toLowerCase().equals(name.toLowerCase())){ return temp; } } } - catch(NullPointerException e){} + catch(final NullPointerException e){} return null; } - - public static EntityPlayer getPlayerOnServerFromUUID(UUID parUUID){ - if (parUUID == null) + + public static EntityPlayer getPlayerOnServerFromUUID(final UUID parUUID){ + if (parUUID == null) { return null; } - List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList; - for (EntityPlayerMP player : allPlayers) + final List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList; + for (final EntityPlayerMP player : allPlayers) { - if (player.getUniqueID().equals(parUUID)) + if (player.getUniqueID().equals(parUUID)) { return player; } @@ -52,21 +52,21 @@ public class PlayerUtils { } //Not Clientside - public static EntityPlayer getPlayerInWorld(World world, String Name){ - List<EntityPlayer> i = world.playerEntities; - Minecraft mc = Minecraft.getMinecraft(); - try{ - for (EntityPlayer temp : i) { - if (temp.getDisplayName().toLowerCase().equals(Name.toLowerCase())){ - return temp; - } + public static EntityPlayer getPlayerInWorld(final World world, final String Name){ + final List<EntityPlayer> i = world.playerEntities; + final Minecraft mc = Minecraft.getMinecraft(); + try{ + for (final EntityPlayer temp : i) { + if (temp.getDisplayName().toLowerCase().equals(Name.toLowerCase())){ + return temp; } } - catch(NullPointerException e){} - return null; } + catch(final NullPointerException e){} + return null; + } - public static boolean isPlayerOP(EntityPlayer player){ + public static boolean isPlayerOP(final EntityPlayer player){ if (player.canCommandSenderUseCommand(2, "")){ return true; } @@ -74,11 +74,11 @@ public class PlayerUtils { } //Not Clientside - public static ItemStack getItemStackInPlayersHand(World world, String Name){ - EntityPlayer thePlayer = getPlayer(Name); + public static ItemStack getItemStackInPlayersHand(final World world, final String Name){ + final EntityPlayer thePlayer = getPlayer(Name); ItemStack heldItem = null; try{heldItem = thePlayer.getHeldItem(); - }catch(NullPointerException e){return null;} + }catch(final NullPointerException e){return null;} if (heldItem != null){ return heldItem; } @@ -87,21 +87,21 @@ public class PlayerUtils { @SideOnly(Side.CLIENT) public static ItemStack getItemStackInPlayersHand(){ - Minecraft mc = Minecraft.getMinecraft(); + final Minecraft mc = Minecraft.getMinecraft(); ItemStack heldItem = null; try{heldItem = mc.thePlayer.getHeldItem(); - }catch(NullPointerException e){return null;} + }catch(final NullPointerException e){return null;} if (heldItem != null){ return heldItem; } return null; } - + @SideOnly(Side.SERVER) - public static ItemStack getItemStackInPlayersHand(EntityPlayer player){ + public static ItemStack getItemStackInPlayersHand(final EntityPlayer player){ ItemStack heldItem = null; try{heldItem = player.getHeldItem(); - }catch(NullPointerException e){return null;} + }catch(final NullPointerException e){return null;} if (heldItem != null){ return heldItem; } @@ -110,16 +110,16 @@ public class PlayerUtils { @SideOnly(Side.CLIENT) public static Item getItemInPlayersHand(){ - Minecraft mc = Minecraft.getMinecraft(); + final Minecraft mc = Minecraft.getMinecraft(); Item heldItem = null; - + try{heldItem = mc.thePlayer.getHeldItem().getItem(); - }catch(NullPointerException e){return null;} - + }catch(final NullPointerException e){return null;} + if (heldItem != null){ return heldItem; } - + return null; } diff --git a/src/Java/gtPlusPlus/core/util/player/UtilsMining.java b/src/Java/gtPlusPlus/core/util/player/UtilsMining.java index 8468c4b3a2..d52dd7ee88 100644 --- a/src/Java/gtPlusPlus/core/util/player/UtilsMining.java +++ b/src/Java/gtPlusPlus/core/util/player/UtilsMining.java @@ -7,38 +7,38 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class UtilsMining { - + private static boolean durabilityDamage = false; private static ItemStack stack; - public static Boolean canPickaxeBlock(Block currentBlock, World currentWorld){ + public static Boolean canPickaxeBlock(final Block currentBlock, final World currentWorld){ String correctTool = ""; - if (!currentWorld.isRemote){ + if (!currentWorld.isRemote){ try { correctTool = currentBlock.getHarvestTool(0); //Utils.LOG_WARNING(correctTool); if (correctTool.equals("pickaxe")){ return true;} - } catch (NullPointerException e){ + } catch (final NullPointerException e){ return false;} } return false; } - - private static void removeBlockAndDropAsItem(World world, int X, int Y, int Z){ + + private static void removeBlockAndDropAsItem(final World world, final int X, final int Y, final int Z){ try { - Block block = world.getBlock(X, Y, Z); - if (canPickaxeBlock(block, world)){ - if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ - block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); - world.setBlockToAir(X, Y, Z); + final Block block = world.getBlock(X, Y, Z); + if (canPickaxeBlock(block, world)){ + if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ + block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); + world.setBlockToAir(X, Y, Z); } else { Utils.LOG_WARNING("Incorrect Tool for mining this block."); } } - } catch (NullPointerException e){ + } catch (final NullPointerException e){ } } @@ -71,7 +71,7 @@ public class UtilsMining { for(int j = -2; j < 3; j++) { for(int k = -2; k < 3; k++) { // float dur = calculateDurabilityLoss(world, X + i, Y + k, Z + j); -// DURABILITY_LOSS = (DURABILITY_LOSS + dur); +// DURABILITY_LOSS = (DURABILITY_LOSS + dur); // Utils.LOG_WARNING("Added Loss: "+dur); removeBlockAndDropAsItem(world, X + i, Y + k, Z + j); } @@ -88,7 +88,7 @@ public class UtilsMining { X = (int) aPlayer.posX + 1;} else { X = (int) aPlayer.posX - 1;} - + DURABILITY_LOSS = 0; for(int i = -1; i < 2; i++) { @@ -108,12 +108,12 @@ public class UtilsMining { //Set Player Facing X = (int) aPlayer.posX; Y = (int) aPlayer.posY; - + if (FACING.equals("facingNorth")){ Z = (int) aPlayer.posZ + 1;} else { Z = (int) aPlayer.posZ - 1;} - + DURABILITY_LOSS = 0; for(int i = -1; i < 2; i++) { for(int j = -1; j < 2; j++) { @@ -137,9 +137,9 @@ public class UtilsMining { DURABILITY_LOSS = 0; } }*/ - - - public static boolean getBlockType(Block block, World world, int[] xyz, int miningLevel){ + + + public static boolean getBlockType(final Block block, final World world, final int[] xyz, final int miningLevel){ final String LIQUID = "liquid"; final String BLOCK = "block"; final String ORE = "ore"; @@ -149,18 +149,34 @@ public class UtilsMining { if (world.isRemote){ return false; } - - if (block == Blocks.end_stone) return true; - if (block == Blocks.stone) return true; - if (block == Blocks.sandstone) return true; - if (block == Blocks.netherrack) return true; - if (block == Blocks.nether_brick) return true; - if (block == Blocks.nether_brick_stairs) return true; - if (block == Blocks.nether_brick_fence) return true; - if (block == Blocks.glowstone) return true; - - - + + if (block == Blocks.end_stone) { + return true; + } + if (block == Blocks.stone) { + return true; + } + if (block == Blocks.sandstone) { + return true; + } + if (block == Blocks.netherrack) { + return true; + } + if (block == Blocks.nether_brick) { + return true; + } + if (block == Blocks.nether_brick_stairs) { + return true; + } + if (block == Blocks.nether_brick_fence) { + return true; + } + if (block == Blocks.glowstone) { + return true; + } + + + try { blockClass = block.getClass().toString().toLowerCase(); Utils.LOG_WARNING(blockClass); @@ -189,10 +205,10 @@ public class UtilsMining { return false; } } - catch(NullPointerException e){ + catch(final NullPointerException e){ return false; } } - - + + } diff --git a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java index c1972f4cfd..f930935f40 100644 --- a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java +++ b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.util.recipe; +import java.util.*; + +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.core.handler.COMPAT_HANDLER; import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler; @@ -8,34 +11,30 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.shapeless.ShapelessUtils; - -import java.util.*; - import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.oredict.*; -import cpw.mods.fml.common.registry.GameRegistry; public class RecipeUtils { - public static boolean recipeBuilder(Object slot_1, Object slot_2, Object slot_3, Object slot_4, Object slot_5, Object slot_6, Object slot_7, Object slot_8, Object slot_9, ItemStack resultItem){ + public static boolean recipeBuilder(final Object slot_1, final Object slot_2, final Object slot_3, final Object slot_4, final Object slot_5, final Object slot_6, final Object slot_7, final Object slot_8, final Object slot_9, final ItemStack resultItem){ - ArrayList<Object> validSlots = new ArrayList<Object>(); + final ArrayList<Object> validSlots = new ArrayList<>(); if (resultItem == null){ Utils.LOG_INFO("Found a recipe with an invalid output, yet had a valid inputs. Skipping."); return false; } - - if (slot_1 == null && slot_2 == null && slot_3 == null && - slot_4 == null && slot_5 == null && slot_6 == null && - slot_7 == null && slot_8 == null && slot_9 == null){ + + if ((slot_1 == null) && (slot_2 == null) && (slot_3 == null) && + (slot_4 == null) && (slot_5 == null) && (slot_6 == null) && + (slot_7 == null) && (slot_8 == null) && (slot_9 == null)){ Utils.LOG_INFO("Found a recipe with 0 inputs, yet had a valid output."); Utils.LOG_INFO("Error found while adding a recipe for: "+resultItem.getDisplayName()+" | Please report this issue on Github."); return false; } - + //Utils.LOG_INFO("Trying to add a recipe for "+resultItem.toString()); String a,b,c,d,e,f,g,h,i; if (slot_1 == null){ a = " ";} else { a = "1";validSlots.add('1');validSlots.add(slot_1);} @@ -59,13 +58,13 @@ public class RecipeUtils { Utils.LOG_ERROR("_______"); - String lineOne = a+b+c; + final String lineOne = a+b+c; Utils.LOG_ERROR("|"+a+"|"+b+"|"+c+"|"); Utils.LOG_ERROR("_______"); - String lineTwo = d+e+f; + final String lineTwo = d+e+f; Utils.LOG_ERROR("|"+d+"|"+e+"|"+f+"|"); Utils.LOG_ERROR("_______"); - String lineThree = g+h+i; + final String lineThree = g+h+i; Utils.LOG_ERROR("|"+g+"|"+h+"|"+i+"|"); Utils.LOG_ERROR("_______"); @@ -75,10 +74,10 @@ public class RecipeUtils { boolean advancedLog = false; if (CORE.DEBUG){ advancedLog = true; - } + } if (advancedLog){ int j = 0; - int l = validSlots.size(); + final int l = validSlots.size(); Utils.LOG_WARNING("l:"+l); while (j <= l) { Utils.LOG_WARNING("j:"+j); @@ -102,14 +101,14 @@ public class RecipeUtils { break; } } - if (validSlots.get(j) instanceof String || validSlots.get(j) instanceof ItemStack){ + if ((validSlots.get(j) instanceof String) || (validSlots.get(j) instanceof ItemStack)){ //Utils.LOG_WARNING("Is Valid: "+validSlots.get(j)); } - } + } } try { - GameRegistry.addRecipe(new ShapedOreRecipe(resultItem.copy(), (Object[]) validSlots.toArray())); + GameRegistry.addRecipe(new ShapedOreRecipe(resultItem.copy(), validSlots.toArray())); //Utils.LOG_INFO("Success! Added a recipe for "+resultItem.getDisplayName()); if (!COMPAT_HANDLER.areInitItemsLoaded){ RegistrationHandler.recipesSuccess++; @@ -130,15 +129,15 @@ public class RecipeUtils { } else { LateRegistrationHandler.recipesFailed++; - } + } return false; } } - public static void shapelessBuilder(ItemStack Output, Object slot_1, Object slot_2, Object slot_3, Object slot_4, Object slot_5, Object slot_6, Object slot_7, Object slot_8, Object slot_9){ + public static void shapelessBuilder(final ItemStack Output, final Object slot_1, final Object slot_2, final Object slot_3, final Object slot_4, final Object slot_5, final Object slot_6, final Object slot_7, final Object slot_8, final Object slot_9){ //Item output_ITEM = Output.getItem(); - ArrayList<Object> validSlots = new ArrayList<Object>(); + final ArrayList<Object> validSlots = new ArrayList<>(); Utils.LOG_INFO("Trying to add a recipe for "+Output.toString()); String a,b,c,d,e,f,g,h,i; @@ -182,12 +181,12 @@ public class RecipeUtils { try { //GameRegistry.addRecipe(new ShapelessOreRecipe(Output, outputAmount), (Object[]) validSlots.toArray()); - GameRegistry.addRecipe(new ShapelessOreRecipe(Output, (Object[]) validSlots.toArray())); + GameRegistry.addRecipe(new ShapelessOreRecipe(Output, validSlots.toArray())); //GameRegistry.addShapelessRecipe(new ItemStack(output_ITEM, 1), new Object[] {slot_1, slot_2}); Utils.LOG_INFO("Success! Added a recipe for "+Output.getDisplayName()); - RegistrationHandler.recipesSuccess++; + RegistrationHandler.recipesSuccess++; } - catch(RuntimeException k){ + catch(final RuntimeException k){ k.getMessage(); k.getClass(); k.printStackTrace(); @@ -200,7 +199,7 @@ public class RecipeUtils { //GameRegistry.addShapelessRecipe(new ItemStack(output_ITEM, 1), new Object[] {slot_1, slot_2}); } - public static void recipeBuilder(Object[] array, ItemStack outPut) { + public static void recipeBuilder(final Object[] array, final ItemStack outPut) { Utils.LOG_SPECIFIC_WARNING("object Array - recipeBuilder", "Attempting to build a recipe using an object array as an input, splitting it, then running the normal recipeBuilder() method.", 396); Object a=null; Object b=null; @@ -251,8 +250,8 @@ public class RecipeUtils { public static boolean removeCraftingRecipe(Object x){ if (null == x){return false;} - if (x instanceof String){ - Item R = ItemUtils.getItem((String) x); + if (x instanceof String){ + final Item R = ItemUtils.getItem((String) x); if (R != null){ x = R; } @@ -260,16 +259,16 @@ public class RecipeUtils { return false; } } - if (x instanceof Item || x instanceof ItemStack){ + if ((x instanceof Item) || (x instanceof ItemStack)){ if (x instanceof Item){ - ItemStack r = new ItemStack((Item) x); + final ItemStack r = new ItemStack((Item) x); Utils.LOG_INFO("Removing Recipe for "+r.getUnlocalizedName()); } else { Utils.LOG_INFO("Removing Recipe for "+((ItemStack) x).getUnlocalizedName()); } if (x instanceof ItemStack){ - Item r = ((ItemStack) x).getItem(); + final Item r = ((ItemStack) x).getItem(); if (null != r){ x = r; } @@ -277,25 +276,25 @@ public class RecipeUtils { Utils.LOG_INFO("Recipe removal failed - Tell Alkalus."); return false; } - } + } if (RecipeUtils.attemptRecipeRemoval((Item) x)){ Utils.LOG_INFO("Recipe removal successful"); return true; } Utils.LOG_INFO("Recipe removal failed - Tell Alkalus."); - return false; + return false; } return false; } - private static boolean attemptRecipeRemoval(Item I){ + private static boolean attemptRecipeRemoval(final Item I){ Utils.LOG_WARNING("Create list of recipes."); - List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList(); - Iterator<IRecipe> items = recipes.iterator(); + final List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList(); + final Iterator<IRecipe> items = recipes.iterator(); Utils.LOG_WARNING("Begin list iteration."); while (items.hasNext()) { - ItemStack is = items.next().getRecipeOutput(); - if (is != null && is.getItem() == I){ + final ItemStack is = items.next().getRecipeOutput(); + if ((is != null) && (is.getItem() == I)){ items.remove(); Utils.LOG_INFO("Remove a recipe with "+I.getUnlocalizedName()+" as output."); continue; @@ -304,10 +303,10 @@ public class RecipeUtils { Utils.LOG_WARNING("All recipes should be gone?"); if (!items.hasNext()){ Utils.LOG_WARNING("We iterated once, let's try again to double check."); - Iterator<IRecipe> items2 = recipes.iterator(); + final Iterator<IRecipe> items2 = recipes.iterator(); while (items2.hasNext()) { - ItemStack is = items2.next().getRecipeOutput(); - if (is != null && is.getItem() == I){ + final ItemStack is = items2.next().getRecipeOutput(); + if ((is != null) && (is.getItem() == I)){ items.remove(); Utils.LOG_WARNING("REMOVING MISSED RECIPE - RECHECK CONSTRUCTORS"); return true; @@ -325,48 +324,48 @@ public class RecipeUtils { - public static boolean addShapedGregtechRecipe( - Object InputItem1, Object InputItem2, Object InputItem3, - Object InputItem4, Object InputItem5, Object InputItem6, - Object InputItem7, Object InputItem8, Object InputItem9, - ItemStack OutputItem){ + public static boolean addShapedGregtechRecipe( + final Object InputItem1, final Object InputItem2, final Object InputItem3, + final Object InputItem4, final Object InputItem5, final Object InputItem6, + final Object InputItem7, final Object InputItem8, final Object InputItem9, + final ItemStack OutputItem){ - if ((!(InputItem1 instanceof ItemStack) && !(InputItem1 instanceof String) && (InputItem1 != null)) || - (!(InputItem2 instanceof ItemStack) && !(InputItem2 instanceof String) && (InputItem2 != null)) || - (!(InputItem3 instanceof ItemStack) && !(InputItem3 instanceof String) && (InputItem3 != null)) || - (!(InputItem4 instanceof ItemStack) && !(InputItem4 instanceof String) && (InputItem4 != null)) || - (!(InputItem5 instanceof ItemStack) && !(InputItem5 instanceof String) && (InputItem5 != null)) || - (!(InputItem6 instanceof ItemStack) && !(InputItem6 instanceof String) && (InputItem6 != null)) || - (!(InputItem7 instanceof ItemStack) && !(InputItem7 instanceof String) && (InputItem7 != null)) || - (!(InputItem8 instanceof ItemStack) && !(InputItem8 instanceof String) && (InputItem8 != null)) || + if ((!(InputItem1 instanceof ItemStack) && !(InputItem1 instanceof String) && (InputItem1 != null)) || + (!(InputItem2 instanceof ItemStack) && !(InputItem2 instanceof String) && (InputItem2 != null)) || + (!(InputItem3 instanceof ItemStack) && !(InputItem3 instanceof String) && (InputItem3 != null)) || + (!(InputItem4 instanceof ItemStack) && !(InputItem4 instanceof String) && (InputItem4 != null)) || + (!(InputItem5 instanceof ItemStack) && !(InputItem5 instanceof String) && (InputItem5 != null)) || + (!(InputItem6 instanceof ItemStack) && !(InputItem6 instanceof String) && (InputItem6 != null)) || + (!(InputItem7 instanceof ItemStack) && !(InputItem7 instanceof String) && (InputItem7 != null)) || + (!(InputItem8 instanceof ItemStack) && !(InputItem8 instanceof String) && (InputItem8 != null)) || (!(InputItem9 instanceof ItemStack) && !(InputItem9 instanceof String) && (InputItem9 != null))){ Utils.LOG_INFO("One Input item was not an ItemStack of an OreDict String."); return false; } - if (GT_ModHandler.addCraftingRecipe(OutputItem, - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | + if (GT_ModHandler.addCraftingRecipe(OutputItem, + GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, - new Object[]{"ABC", "DEF", "GHI", - 'A', InputItem1, - 'B', InputItem2, - 'C', InputItem3, - 'D', InputItem4, - 'E', InputItem5, - 'F', InputItem6, - 'G', InputItem7, - 'H', InputItem8, - 'I', InputItem9})){ + new Object[]{"ABC", "DEF", "GHI", + 'A', InputItem1, + 'B', InputItem2, + 'C', InputItem3, + 'D', InputItem4, + 'E', InputItem5, + 'F', InputItem6, + 'G', InputItem7, + 'H', InputItem8, + 'I', InputItem9})){ Utils.LOG_INFO("Success! Added a recipe for "+OutputItem.getDisplayName()); - RegistrationHandler.recipesSuccess++; + RegistrationHandler.recipesSuccess++; return true; } return false; } - public static void addShapelessGregtechRecipe(ItemStack OutputItem, Object... inputItems){ + public static void addShapelessGregtechRecipe(final ItemStack OutputItem, final Object... inputItems){ - for(Object whatever : inputItems){ + for(final Object whatever : inputItems){ if (!(whatever instanceof ItemStack) && !(whatever instanceof String)){ Utils.LOG_INFO("One Input item was not an ItemStack of an OreDict String."); return; @@ -378,13 +377,13 @@ public class RecipeUtils { new Object[]{inputItems}); } - public static ItemStack getItemStackFromOreDict(String oredictName){ - ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); + public static ItemStack getItemStackFromOreDict(final String oredictName){ + final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); return oreDictList.get(0); } - public static boolean buildShapelessRecipe(ItemStack output, Object[] input){ - return ShapelessUtils.addShapelessRecipe(output, input); + public static boolean buildShapelessRecipe(final ItemStack output, final Object[] input){ + return ShapelessUtils.addShapelessRecipe(output, input); } } diff --git a/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java b/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java index bf9d4960d8..d0ad6d3361 100644 --- a/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java +++ b/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java @@ -1,9 +1,8 @@ package gtPlusPlus.core.util.recipe.shapeless; -import gtPlusPlus.core.util.Utils; - import java.util.ArrayList; +import gtPlusPlus.core.util.Utils; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -13,15 +12,15 @@ import net.minecraft.item.crafting.ShapelessRecipes; public class ShapelessUtils { - public static boolean addShapelessRecipe(ItemStack output, Object ... params) + public static boolean addShapelessRecipe(final ItemStack output, final Object ... params) { - ArrayList<ItemStack> arraylist = new ArrayList<ItemStack>(); - Object[] aobject = params; - int i = params.length; + final ArrayList<ItemStack> arraylist = new ArrayList<>(); + final Object[] aobject = params; + final int i = params.length; for (int j = 0; j < i; ++j) { - Object object1 = aobject[j]; + final Object object1 = aobject[j]; if (object1 instanceof ItemStack) { @@ -35,7 +34,7 @@ public class ShapelessUtils { { if ((object1 == null)) { - Utils.LOG_INFO(("Invalid shapeless input, ignoring!")); + Utils.LOG_INFO(("Invalid shapeless input, ignoring!")); } else if (!(object1 instanceof Block) && (object1 != null)) { diff --git a/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java b/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java index fbbe4ac076..c1d0279f72 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java @@ -6,27 +6,27 @@ import cpw.mods.fml.common.SidedProxy; public class ClientProxyFinder { - public static Object getInstance(Object modInstance) throws ReflectiveOperationException { - for(Field field : modInstance.getClass().getDeclaredFields()) { - if(field.isAnnotationPresent(SidedProxy.class)) { - SidedProxy sidedProxy = field.getAnnotation(SidedProxy.class); - Object fieldValue = field.get(modInstance); - try { - Class clientSideClass = Class.forName(sidedProxy.clientSide()); - if(clientSideClass.isAssignableFrom(fieldValue.getClass())) { - Object clientProxy = clientSideClass.cast(fieldValue); - //do what you want with client proxy instance - return clientProxy; - } + public static Object getInstance(final Object modInstance) throws ReflectiveOperationException { + for(final Field field : modInstance.getClass().getDeclaredFields()) { + if(field.isAnnotationPresent(SidedProxy.class)) { + final SidedProxy sidedProxy = field.getAnnotation(SidedProxy.class); + final Object fieldValue = field.get(modInstance); + try { + final Class clientSideClass = Class.forName(sidedProxy.clientSide()); + if(clientSideClass.isAssignableFrom(fieldValue.getClass())) { + final Object clientProxy = clientSideClass.cast(fieldValue); + //do what you want with client proxy instance + return clientProxy; + } - } catch (NoClassDefFoundError err) { - //its server side - return null; - } - break; - } - } - return null; - } + } catch (final NoClassDefFoundError err) { + //its server side + return null; + } + break; + } + } + return null; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 78e6b8ad47..5c02ccc3e7 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -1,8 +1,5 @@ package gtPlusPlus.core.util.reflect; -import gregtech.GT_Mod; -import gtPlusPlus.core.util.Utils; - import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.net.URL; @@ -11,13 +8,16 @@ import java.util.Scanner; import org.apache.commons.lang3.reflect.FieldUtils; +import gregtech.GT_Mod; +import gtPlusPlus.core.util.Utils; + public class ReflectionUtils { - public static Field getField(Class<?> clazz, String fieldName) throws NoSuchFieldException { + public static Field getField(final Class<?> clazz, final String fieldName) throws NoSuchFieldException { try { return clazz.getDeclaredField(fieldName); - } catch (NoSuchFieldException e) { - Class<?> superClass = clazz.getSuperclass(); + } catch (final NoSuchFieldException e) { + final Class<?> superClass = clazz.getSuperclass(); if (superClass == null) { throw e; } @@ -25,7 +25,7 @@ public class ReflectionUtils { } } - public static void makeAccessible(Field field) { + public static void makeAccessible(final Field field) { if (!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers())) { @@ -35,33 +35,33 @@ public class ReflectionUtils { //Some Reflection utils - http://stackoverflow.com/questions/14374878/using-reflection-to-set-an-object-property @SuppressWarnings("unchecked") - public static <V> V getField(Object object, String fieldName) { + public static <V> V getField(final Object object, final String fieldName) { Class<?> clazz = object.getClass(); while (clazz != null) { try { - Field field = clazz.getDeclaredField(fieldName); + final Field field = clazz.getDeclaredField(fieldName); field.setAccessible(true); return (V) field.get(object); - } catch (NoSuchFieldException e) { + } catch (final NoSuchFieldException e) { clazz = clazz.getSuperclass(); - } catch (Exception e) { + } catch (final Exception e) { throw new IllegalStateException(e); } } return null; } - public static boolean setField(Object object, String fieldName, Object fieldValue) { + public static boolean setField(final Object object, final String fieldName, final Object fieldValue) { Class<?> clazz = object.getClass(); while (clazz != null) { try { - Field field = clazz.getDeclaredField(fieldName); + final Field field = clazz.getDeclaredField(fieldName); makeAccessible(field); field.set(object, fieldValue); return true; - } catch (NoSuchFieldException e) { + } catch (final NoSuchFieldException e) { clazz = clazz.getSuperclass(); - } catch (Exception e) { + } catch (final Exception e) { throw new IllegalStateException(e); } } @@ -69,17 +69,17 @@ public class ReflectionUtils { } public static boolean becauseIWorkHard(){ - /* TODO: fix this stuff \u002a\u002f\u0048\u0061\u0073\u0068\u0053\u0065\u0074<String>\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074<String>\u0028\u0029\u003b\u000a\u0009\u0009\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u003b\u0009\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0009\u0009\u0009\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u0020\u003d\u0020\u0043\u006c\u0069\u0065\u006e\u0074\u0050\u0072\u006f\u0078\u0079\u0046\u0069\u006e\u0064\u0065\u0072\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0047\u0054\u005f\u004d\u006f\u0064\u002e\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0029\u003b\u0009\u0009\u0009\u0009\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0052\u0065\u0066\u006c\u0065\u0063\u0074\u0069\u0076\u0065\u004f\u0070\u0065\u0072\u0061\u0074\u0069\u006f\u006e\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0031\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u0020\u003d\u0020\u006e\u0075\u006c\u006c\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u006f\u0062\u0074\u0061\u0069\u006e\u0065\u0064\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0020\u006f\u0066\u0020\u0061\u0020\u0063\u006c\u0069\u0065\u006e\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u000a\u0009\u0009\u007d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0020\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0028\u006e\u0065\u0077\u0020\u0055\u0052\u004c\u0028\u0022\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0067\u0072\u0065\u0067\u0074\u0065\u0063\u0068\u002e\u006f\u0076\u0065\u0072\u006d\u0069\u006e\u0064\u0064\u006c\u0031\u002e\u0063\u006f\u006d\u002f\u0063\u006f\u006d\u002f\u0067\u0072\u0065\u0067\u006f\u0072\u0069\u0075\u0073\u0074\u002f\u0067\u0072\u0065\u0067\u0074\u0065\u0063\u0068\u002f\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0072\u006c\u0069\u0073\u0074\u002e\u0074\u0078\u0074\u0022\u0029\u002e\u006f\u0070\u0065\u006e\u0053\u0074\u0072\u0065\u0061\u006d\u0028\u0029\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0054\u0072\u0079\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0062\u0075\u0069\u006c\u0064\u0020\u0061\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0077\u0068\u0069\u006c\u0065\u0020\u0028\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u0068\u0061\u0073\u004e\u0065\u0078\u0074\u004c\u0069\u006e\u0065\u0028\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0074\u004e\u0061\u006d\u0065\u0020\u003d\u0020\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u006e\u0065\u0078\u0074\u004c\u0069\u006e\u0065\u0028\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0074\u004e\u0061\u006d\u0065\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0074\u004e\u0061\u006d\u0065\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0022\u0064\u0072\u0061\u006b\u006e\u0079\u0074\u0065\u0031\u0022\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0076\u0061\u006c\u0075\u0065\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0022\u0064\u0072\u0061\u006b\u006e\u0079\u0074\u0065\u0031\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0065\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0074\u0068\u0065\u0020\u0077\u0065\u0062\u0020\u006c\u0069\u0073\u0074\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u0020\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0009\u0009\u0009\u0046\u0069\u0065\u006c\u0064\u0055\u0074\u0069\u006c\u0073\u002e\u0077\u0072\u0069\u0074\u0065\u0046\u0069\u0065\u006c\u0064\u0028\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u002c\u0020\u0022\u006d\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u0022\u002c\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002c\u0020\u0074\u0072\u0075\u0065\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u006f\u0064\u0069\u0066\u0069\u0065\u0064\u0020\u0068\u0061\u0073\u0068\u0073\u0065\u0074\u0020\u0062\u0061\u0063\u006b\u0020\u0069\u006e\u0074\u006f\u0020\u0074\u0068\u0065\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u002e\u0022\u0029\u003b\u0020\u0020\u0009\u0009\u0009\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0074\u0072\u0075\u0065\u003b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0065\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0052\u0065\u0066\u006c\u0065\u0063\u0074\u0069\u006f\u006e\u0020\u0069\u006e\u0074\u006f\u0020\u0061\u0063\u0074\u0069\u0076\u0065\u0020\u0063\u006c\u0069\u0065\u006e\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u0020\u0020\u0020\u0020\u0020\u0020\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u0020\u0020\u0009\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u002f\u002a */ + /* TODO: fix this stuff \u002a\u002ffinal \u0048\u0061\u0073\u0068\u0053\u0065\u0074<String>\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074<>\u0028\u0029\u003b\u000a\u0009\u0009\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u003b\u0009\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0009\u0009\u0009\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u0020\u003d\u0020\u0043\u006c\u0069\u0065\u006e\u0074\u0050\u0072\u006f\u0078\u0079\u0046\u0069\u006e\u0064\u0065\u0072\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0047\u0054\u005f\u004d\u006f\u0064\u002e\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0029\u003b\u0009\u0009\u0009\u0009\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028final \u0052\u0065\u0066\u006c\u0065\u0063\u0074\u0069\u0076\u0065\u004f\u0070\u0065\u0072\u0061\u0074\u0069\u006f\u006e\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0031\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u0020\u003d\u0020\u006e\u0075\u006c\u006c\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u006f\u0062\u0074\u0061\u0069\u006e\u0065\u0064\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0020\u006f\u0066\u0020\u0061\u0020\u0063\u006c\u0069\u0065\u006e\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u000a\u0009\u0009\u007d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020final \u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0020\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0028\u006e\u0065\u0077\u0020\u0055\u0052\u004c\u0028\u0022\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0067\u0072\u0065\u0067\u0074\u0065\u0063\u0068\u002e\u006f\u0076\u0065\u0072\u006d\u0069\u006e\u0064\u0064\u006c\u0031\u002e\u0063\u006f\u006d\u002f\u0063\u006f\u006d\u002f\u0067\u0072\u0065\u0067\u006f\u0072\u0069\u0075\u0073\u0074\u002f\u0067\u0072\u0065\u0067\u0074\u0065\u0063\u0068\u002f\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0072\u006c\u0069\u0073\u0074\u002e\u0074\u0078\u0074\u0022\u0029\u002e\u006f\u0070\u0065\u006e\u0053\u0074\u0072\u0065\u0061\u006d\u0028\u0029\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0054\u0072\u0079\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0062\u0075\u0069\u006c\u0064\u0020\u0061\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0077\u0068\u0069\u006c\u0065\u0020\u0028\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u0068\u0061\u0073\u004e\u0065\u0078\u0074\u004c\u0069\u006e\u0065\u0028\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020final \u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0074\u004e\u0061\u006d\u0065\u0020\u003d\u0020\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u006e\u0065\u0078\u0074\u004c\u0069\u006e\u0065\u0028\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0074\u004e\u0061\u006d\u0065\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0074\u004e\u0061\u006d\u0065\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0022\u0064\u0072\u0061\u006b\u006e\u0079\u0074\u0065\u0031\u0022\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0076\u0061\u006c\u0075\u0065\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0022\u0064\u0072\u0061\u006b\u006e\u0079\u0074\u0065\u0031\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028final \u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0065\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0074\u0068\u0065\u0020\u0077\u0065\u0062\u0020\u006c\u0069\u0073\u0074\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u0020\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0009\u0009\u0009\u0046\u0069\u0065\u006c\u0064\u0055\u0074\u0069\u006c\u0073\u002e\u0077\u0072\u0069\u0074\u0065\u0046\u0069\u0065\u006c\u0064\u0028\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u002c\u0020\u0022\u006d\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u0022\u002c\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002c\u0020\u0074\u0072\u0075\u0065\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u006f\u0064\u0069\u0066\u0069\u0065\u0064\u0020\u0068\u0061\u0073\u0068\u0073\u0065\u0074\u0020\u0062\u0061\u0063\u006b\u0020\u0069\u006e\u0074\u006f\u0020\u0074\u0068\u0065\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u002e\u0022\u0029\u003b\u0020\u0020\u0009\u0009\u0009\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0074\u0072\u0075\u0065\u003b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028final \u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0065\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0052\u0065\u0066\u006c\u0065\u0063\u0074\u0069\u006f\u006e\u0020\u0069\u006e\u0074\u006f\u0020\u0061\u0063\u0074\u0069\u0076\u0065\u0020\u0063\u006c\u0069\u0065\u006e\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u0020\u0020\u0020\u0020\u0020\u0020\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u0020\u0020\u0009\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u002f\u002a */ } - public static boolean doesClassExist(String classname) { + public static boolean doesClassExist(final String classname) { boolean exists = true; try { // Load any class that should be present if driver's available Class.forName(classname); - } catch (ClassNotFoundException e) { + } catch (final ClassNotFoundException e) { // Driver is not available - exists = false; + exists = false; } return exists; } diff --git a/src/Java/gtPlusPlus/core/util/wrapper/var.java b/src/Java/gtPlusPlus/core/util/wrapper/var.java index 3e7413ed85..1b73d035bc 100644 --- a/src/Java/gtPlusPlus/core/util/wrapper/var.java +++ b/src/Java/gtPlusPlus/core/util/wrapper/var.java @@ -6,62 +6,62 @@ import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; public class var{ - - private ItemStack temp = null; - private String sanitizedName; - private String fqrn; - - public var(String o){ - String t = sanitize('<', o); - String t2 = sanitize('>', t); - sanitizedName = t2; - o = sanitize('"', t2); - fqrn = o; - } - - private String sanitize(char token, String input){ - for (int i=0;i<input.length();i++) { - if (input.charAt(i) == token) { - input = input.replace(input.charAt(i), ' '); - Utils.LOG_WARNING("MATCH FOUND"); - } - input = input.replaceAll(" ", ""); - } - String output = input; - return output; - } - - public String getFQRN(){ - String s = fqrn; - return s; - } - - public String getsanitizedName(){ - String s = sanitizedName; - return s; + + private ItemStack temp = null; + private final String sanitizedName; + private final String fqrn; + + public var(String o){ + final String t = this.sanitize('<', o); + final String t2 = this.sanitize('>', t); + this.sanitizedName = t2; + o = this.sanitize('"', t2); + this.fqrn = o; + } + + private String sanitize(final char token, String input){ + for (int i=0;i<input.length();i++) { + if (input.charAt(i) == token) { + input = input.replace(input.charAt(i), ' '); + Utils.LOG_WARNING("MATCH FOUND"); + } + input = input.replaceAll(" ", ""); } - - private ItemStack getOreDictStack(int stackSize){ - ItemStack v = ItemUtils.getItemStack(sanitizedName, stackSize); + final String output = input; + return output; + } + + public String getFQRN(){ + final String s = this.fqrn; + return s; + } + + public String getsanitizedName(){ + final String s = this.sanitizedName; + return s; + } + + private ItemStack getOreDictStack(final int stackSize){ + final ItemStack v = ItemUtils.getItemStack(this.sanitizedName, stackSize); + return v; + } + + public ItemStack getStack(final int stackSize){ + final String oreDict = "ore:"; + if (this.fqrn.toLowerCase().contains(oreDict.toLowerCase())){ + final ItemStack v = this.getOreDictStack(stackSize); return v; } - - public ItemStack getStack(int stackSize){ - String oreDict = "ore:"; - if (fqrn.toLowerCase().contains(oreDict.toLowerCase())){ - ItemStack v = getOreDictStack(stackSize); - return v; - } - String[] fqrnSplit = fqrn.split(":"); - String meta = "0"; - try { + final String[] fqrnSplit = this.fqrn.split(":"); + String meta = "0"; + try { if(fqrnSplit[2] != null){meta = fqrnSplit[2];} - temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(meta), stackSize); - } - catch (ArrayIndexOutOfBoundsException a){ - temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(meta), stackSize); - } - return temp; - } - - }
\ No newline at end of file + this.temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, this.fqrn, fqrnSplit[1], Integer.parseInt(meta), stackSize); + } + catch (final ArrayIndexOutOfBoundsException a){ + this.temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, this.fqrn, fqrnSplit[1], Integer.parseInt(meta), stackSize); + } + return this.temp; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_DefaultHandler.java b/src/Java/gtPlusPlus/nei/GT_NEI_DefaultHandler.java index a6821a7ed2..0f8dcb4649 100644 --- a/src/Java/gtPlusPlus/nei/GT_NEI_DefaultHandler.java +++ b/src/Java/gtPlusPlus/nei/GT_NEI_DefaultHandler.java @@ -1,22 +1,9 @@ package gtPlusPlus.nei; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.gui.GT_GUIContainer_BasicMachine; -import gregtech.api.objects.ItemData; -import gregtech.api.util.*; - import java.awt.Point; import java.awt.Rectangle; import java.util.*; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; - import org.lwjgl.opengl.GL11; import codechicken.lib.gui.GuiDraw; @@ -24,838 +11,849 @@ import codechicken.nei.PositionedStack; import codechicken.nei.guihook.*; import codechicken.nei.recipe.*; import cpw.mods.fml.common.event.FMLInterModComms; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.gui.GT_GUIContainer_BasicMachine; +import gregtech.api.objects.ItemData; +import gregtech.api.util.*; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; public class GT_NEI_DefaultHandler - extends TemplateRecipeHandler { - public static final int sOffsetX = 5; - public static final int sOffsetY = 11; - - static { - GuiContainerManager.addInputHandler(new GT_RectHandler()); - GuiContainerManager.addTooltipHandler(new GT_RectHandler()); - } - - protected final CustomRecipeMap mRecipeMap; - - public GT_NEI_DefaultHandler(CustomRecipeMap tMap) { - this.mRecipeMap = tMap; - this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier(), new Object[0])); - if (!NEI_GT_Config.sIsAdded) { - FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + getRecipeName() + "@" + getOverlayIdentifier()); - GuiCraftingRecipe.craftinghandlers.add(this); - GuiUsageRecipe.usagehandlers.add(this); - } - } - - public static void drawText(int aX, int aY, String aString, int aColor) { - Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); - } - - @Override +extends TemplateRecipeHandler { + public static final int sOffsetX = 5; + public static final int sOffsetY = 11; + + static { + GuiContainerManager.addInputHandler(new GT_RectHandler()); + GuiContainerManager.addTooltipHandler(new GT_RectHandler()); + } + + protected final CustomRecipeMap mRecipeMap; + + public GT_NEI_DefaultHandler(final CustomRecipeMap tMap) { + this.mRecipeMap = tMap; + this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getOverlayIdentifier(), new Object[0])); + if (!NEI_GT_Config.sIsAdded) { + FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getOverlayIdentifier()); + GuiCraftingRecipe.craftinghandlers.add(this); + GuiUsageRecipe.usagehandlers.add(this); + } + } + + public static void drawText(final int aX, final int aY, final String aString, final int aColor) { + Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); + } + + @Override public TemplateRecipeHandler newInstance() { - return new GT_NEI_DefaultHandler(this.mRecipeMap); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(getOverlayIdentifier())) { - for (GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { - if (!tRecipe.mHidden) { - this.arecipes.add(new CachedDefaultRecipe(tRecipe)); - } - } - } else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(ItemStack aResult) { - ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); - - ArrayList<ItemStack> tResults = new ArrayList(); - tResults.add(aResult); - tResults.add(GT_OreDictUnificator.get(true, aResult)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { - tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); - } - } - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); - if (tFluid != null) { - tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } - } - for (GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (ItemStack tStack : tResults) { - if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } - } - CachedDefaultRecipe tNEIRecipe; - } - - @Override - public void loadUsageRecipes(ItemStack aInput) { - ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); - - ArrayList<ItemStack> tInputs = new ArrayList(); - tInputs.add(aInput); - tInputs.add(GT_OreDictUnificator.get(false, aInput)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { - for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { - tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); - } - } - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); - if (tFluid != null) { - tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (tData.fluid.isFluidEqual(tFluid)) { - tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer})); - } - } - } - for (GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { - if (!tRecipe.mHidden) { - CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); - for (ItemStack tStack : tInputs) { - if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { - this.arecipes.add(tNEIRecipe); - break; - } - } - } - } - CachedDefaultRecipe tNEIRecipe; - } - - @Override + return new GT_NEI_DefaultHandler(this.mRecipeMap); + } + + @Override + public void loadCraftingRecipes(final String outputId, final Object... results) { + if (outputId.equals(this.getOverlayIdentifier())) { + for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + if (!tRecipe.mHidden) { + this.arecipes.add(new CachedDefaultRecipe(tRecipe)); + } + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(final ItemStack aResult) { + final ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); + + final ArrayList<ItemStack> tResults = new ArrayList(); + tResults.add(aResult); + tResults.add(GT_OreDictUnificator.get(true, aResult)); + if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + for (final OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); + } + } + final FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); + if (tFluid != null) { + tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); + for (final FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (tData.fluid.isFluidEqual(tFluid)) { + tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer})); + } + } + } + for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + if (!tRecipe.mHidden) { + final CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); + for (final ItemStack tStack : tResults) { + if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { + this.arecipes.add(tNEIRecipe); + break; + } + } + } + } + final CachedDefaultRecipe tNEIRecipe; + } + + @Override + public void loadUsageRecipes(final ItemStack aInput) { + final ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); + + final ArrayList<ItemStack> tInputs = new ArrayList(); + tInputs.add(aInput); + tInputs.add(GT_OreDictUnificator.get(false, aInput)); + if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + for (final OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); + } + } + final FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); + if (tFluid != null) { + tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); + for (final FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (tData.fluid.isFluidEqual(tFluid)) { + tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer})); + } + } + } + for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + if (!tRecipe.mHidden) { + final CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); + for (final ItemStack tStack : tInputs) { + if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { + this.arecipes.add(tNEIRecipe); + break; + } + } + } + } + final CachedDefaultRecipe tNEIRecipe; + } + + @Override public String getOverlayIdentifier() { - return this.mRecipeMap.mNEIName; - } + return this.mRecipeMap.mNEIName; + } - @Override - public void drawBackground(int recipe) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiDraw.changeTexture(getGuiTexture()); - GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); - } + @Override + public void drawBackground(final int recipe) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); + } - @Override + @Override public int recipiesPerPage() { - return 1; - } + return 1; + } - @Override + @Override public String getRecipeName() { - return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); - } + return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); + } - @Override + @Override public String getGuiTexture() { -// return "gregtech:textures/gui/" + this.mRecipeMap.mUnlocalizedName + ".png"; - return this.mRecipeMap.mNEIGUIPath; - } - - @Override - public List<String> handleItemTooltip(GuiRecipe gui, ItemStack aStack, List<String> currenttip, int aRecipeIndex) { - TemplateRecipeHandler.CachedRecipe tObject = (TemplateRecipeHandler.CachedRecipe) this.arecipes.get(aRecipeIndex); - if ((tObject instanceof CachedDefaultRecipe)) { - CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; - for (PositionedStack tStack : tRecipe.mOutputs) { - if (aStack == tStack.item) { - if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { - break; - } - currenttip.add("Chance: " + ((FixedPositionedStack) tStack).mChance / 100 + "." + (((FixedPositionedStack) tStack).mChance % 100 < 10 ? "0" + ((FixedPositionedStack) tStack).mChance % 100 : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%"); - break; - } - } - for (PositionedStack tStack : tRecipe.mInputs) { - if (aStack == tStack.item) { - if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || - (tStack.item.stackSize != 0)) { - break; - } - currenttip.add("Does not get consumed in the process"); - break; - } - } - } - return currenttip; - } - - @Override - public void drawExtras(int aRecipeIndex) { - int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; - int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - if (tEUt != 0) { - drawText(10, 73, "Total: " + tDuration * tEUt + " EU", -16777216); - drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); - if (this.mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 93, "Voltage: " + tEUt / this.mRecipeMap.mAmperage + " EU", -16777216); - drawText(10, 103, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); - } else { - drawText(10, 93, "Voltage: unspecified", -16777216); - drawText(10, 103, "Amperage: unspecified", -16777216); - } - } - if (tDuration > 0) { - drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); - } - if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { - drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier + this.mRecipeMap.mNEISpecialValuePost, -16777216); - } - } - - public static class GT_RectHandler - implements IContainerInputHandler, IContainerTooltipHandler { - @Override - public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) { - if (canHandle(gui)) { - if (button == 0) { - return transferRect(gui, false); - } - if (button == 1) { - return transferRect(gui, true); - } - } - return false; - } - - @Override - public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) { - return false; - } - - public boolean canHandle(GuiContainer gui) { - return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) /*|| ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))*/); - } - - @Override - public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) { - if ((canHandle(gui)) && (currenttip.isEmpty())) { - if (gui instanceof GT_GUIContainer_BasicMachine && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + // return "gregtech:textures/gui/" + this.mRecipeMap.mUnlocalizedName + ".png"; + return this.mRecipeMap.mNEIGUIPath; + } + + @Override + public List<String> handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { + final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); + if ((tObject instanceof CachedDefaultRecipe)) { + final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; + for (final PositionedStack tStack : tRecipe.mOutputs) { + if (aStack == tStack.item) { + if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { + break; + } + currenttip.add("Chance: " + (((FixedPositionedStack) tStack).mChance / 100) + "." + ((((FixedPositionedStack) tStack).mChance % 100) < 10 ? "0" + (((FixedPositionedStack) tStack).mChance % 100) : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%"); + break; + } + } + for (final PositionedStack tStack : tRecipe.mInputs) { + if (aStack == tStack.item) { + if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || + (tStack.item.stackSize != 0)) { + break; + } + currenttip.add("Does not get consumed in the process"); + break; + } + } + } + return currenttip; + } + + @Override + public void drawExtras(final int aRecipeIndex) { + final int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; + final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + if (tEUt != 0) { + drawText(10, 73, "Total: " + (tDuration * tEUt) + " EU", -16777216); + drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); + if (this.mRecipeMap.mShowVoltageAmperageInNEI) { + drawText(10, 93, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU", -16777216); + drawText(10, 103, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); + } else { + drawText(10, 93, "Voltage: unspecified", -16777216); + drawText(10, 103, "Amperage: unspecified", -16777216); + } + } + if (tDuration > 0) { + drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); + } + if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { + drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); + } + } + + public static class GT_RectHandler + implements IContainerInputHandler, IContainerTooltipHandler { + @Override + public boolean mouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { + if (this.canHandle(gui)) { + if (button == 0) { + return this.transferRect(gui, false); + } + if (button == 1) { + return this.transferRect(gui, true); + } + } + return false; + } + + @Override + public boolean lastKeyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { + return false; + } + + public boolean canHandle(final GuiContainer gui) { + return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) /*|| ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))*/); + } + + @Override + public List<String> handleTooltip(final GuiContainer gui, final int mousex, final int mousey, final List<String> currenttip) { + if ((this.canHandle(gui)) && (currenttip.isEmpty())) { + if ((gui instanceof GT_GUIContainer_BasicMachine) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + currenttip.add("Recipes"); + } /*else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { currenttip.add("Recipes"); }*/ - } - return currenttip; - } + } + return currenttip; + } - private boolean transferRect(GuiContainer gui, boolean usage) { - if (gui instanceof GT_GUIContainer_BasicMachine) { - return (canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0])); - } /*else if (gui instanceof GT_GUIContainer_FusionReactor) { + private boolean transferRect(final GuiContainer gui, final boolean usage) { + if (gui instanceof GT_GUIContainer_BasicMachine) { + return (this.canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0])); + } /*else if (gui instanceof GT_GUIContainer_FusionReactor) { return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0])); }*/ - return false; - } - - @Override - public List<String> handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List<String> currenttip) { - return currenttip; - } - - @Override - public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey, List<String> currenttip) { - return currenttip; - } - - @Override - public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) { - return false; - } - - @Override - public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) { - } - - @Override - public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) { - } - - @Override - public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) { - } - - @Override - public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { - return false; - } - - @Override - public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { - } - - @Override - public void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime) { - } - } - - public class FixedPositionedStack - extends PositionedStack { - public final int mChance; - public boolean permutated = false; - - public FixedPositionedStack(Object object, int x, int y) { - this(object, x, y, 0); - } - - public FixedPositionedStack(Object object, int x, int y, int aChance) { - super(object, x, y, true); - this.mChance = aChance; - } - - @Override + return false; + } + + @Override + public List<String> handleItemDisplayName(final GuiContainer gui, final ItemStack itemstack, final List<String> currenttip) { + return currenttip; + } + + @Override + public List<String> handleItemTooltip(final GuiContainer gui, final ItemStack itemstack, final int mousex, final int mousey, final List<String> currenttip) { + return currenttip; + } + + @Override + public boolean keyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { + return false; + } + + @Override + public void onKeyTyped(final GuiContainer gui, final char keyChar, final int keyID) { + } + + @Override + public void onMouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { + } + + @Override + public void onMouseUp(final GuiContainer gui, final int mousex, final int mousey, final int button) { + } + + @Override + public boolean mouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { + return false; + } + + @Override + public void onMouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { + } + + @Override + public void onMouseDragged(final GuiContainer gui, final int mousex, final int mousey, final int button, final long heldTime) { + } + } + + public class FixedPositionedStack + extends PositionedStack { + public final int mChance; + public boolean permutated = false; + + public FixedPositionedStack(final Object object, final int x, final int y) { + this(object, x, y, 0); + } + + public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) { + super(object, x, y, true); + this.mChance = aChance; + } + + @Override public void generatePermutations() { - if (this.permutated) { - return; - } - ArrayList<ItemStack> tDisplayStacks = new ArrayList(); - for (ItemStack tStack : this.items) { - if (GT_Utility.isStackValid(tStack)) { - if (tStack.getItemDamage() == 32767) { - List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); - if (!permutations.isEmpty()) { - ItemStack stack; - for (Iterator i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) { - stack = (ItemStack) i$.next(); - } - } else { - ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); - base.stackTagCompound = tStack.stackTagCompound; - tDisplayStacks.add(base); - } - } else { - tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack})); - } - } - } - this.items = ((ItemStack[]) tDisplayStacks.toArray(new ItemStack[0])); - if (this.items.length == 0) { - this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; - } - this.permutated = true; - setPermutationToRender(0); - } - } - - public class CachedDefaultRecipe - extends TemplateRecipeHandler.CachedRecipe { - public final GT_Recipe mRecipe; - public final List<PositionedStack> mOutputs = new ArrayList(); - public final List<PositionedStack> mInputs = new ArrayList(); - - public CachedDefaultRecipe(GT_Recipe aRecipe) { - super(); - this.mRecipe = aRecipe; - - int tStartIndex = 0; - switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualInputCount) { - case 0: - break; - case 1: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); - } - tStartIndex++; - break; - case 2: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); - } - tStartIndex++; - break; - case 3: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); - } - tStartIndex++; - break; - case 4: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); - } - tStartIndex++; - break; - case 5: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 5)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); - } - tStartIndex++; - break; - case 6: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 5)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 23)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); - } - tStartIndex++; - break; - case 7: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32)); - } - tStartIndex++; - break; - case 8: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 32)); - } - tStartIndex++; - break; - default: - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 32)); - } - tStartIndex++; - if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 32)); - } - tStartIndex++; - } - if (aRecipe.mSpecialItems != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); - } - tStartIndex = 0; - switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualOutputCount) { - case 0: - break; - case 1: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - break; - case 2: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - break; - case 3: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - break; - case 4: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - break; - case 5: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 5, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - break; - case 6: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 5, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 23, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - break; - case 7: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - break; - case 8: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 32, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - break; - default: - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 32, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 32, aRecipe.getOutputChance(tStartIndex))); - } - tStartIndex++; - } - - - //New fluid display behaviour when 3 fluid inputs are detected. (Basically a mix of the code below for outputs an the code above for 9 input slots.) - if (aRecipe.mFluidInputs.length > 2) { - if (aRecipe.mFluidInputs[0] != null && (aRecipe.mFluidInputs[0].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 12, 5)); - } - if (aRecipe.mFluidInputs[1] != null && (aRecipe.mFluidInputs[1].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 30, 5)); - } - if (aRecipe.mFluidInputs.length > 2 && aRecipe.mFluidInputs[2] != null && (aRecipe.mFluidInputs[2].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[2], true), 48, 5)); - } - if (aRecipe.mFluidInputs.length > 3 && aRecipe.mFluidInputs[3] != null && (aRecipe.mFluidInputs[3].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[3], true), 12, 23)); - } - if (aRecipe.mFluidInputs.length > 4 && aRecipe.mFluidInputs[4] != null && (aRecipe.mFluidInputs[4].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[4], true), 30, 23)); - } - if (aRecipe.mFluidInputs.length > 5 && aRecipe.mFluidInputs[5] != null && (aRecipe.mFluidInputs[5].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[5], true), 48, 23)); - } - if (aRecipe.mFluidInputs.length > 6 && aRecipe.mFluidInputs[6] != null && (aRecipe.mFluidInputs[6].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[6], true), 12, 41)); - } - if (aRecipe.mFluidInputs.length > 7 && aRecipe.mFluidInputs[7] != null && (aRecipe.mFluidInputs[7].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[7], true), 30, 41)); - } - if (aRecipe.mFluidInputs.length > 8 && aRecipe.mFluidInputs[8] != null && (aRecipe.mFluidInputs[8].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[8], true), 48, 41)); - } - } - //Returns to old behaviour if fluid inputs < 3 - else if ((aRecipe.mFluidInputs.length > 0) && (aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 48, 52)); - if ((aRecipe.mFluidInputs.length == 2) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 30, 52)); - } - } - - if (aRecipe.mFluidOutputs.length > 1) { - if (aRecipe.mFluidOutputs[0] != null && (aRecipe.mFluidOutputs[0].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 102, 5)); - } - if (aRecipe.mFluidOutputs[1] != null && (aRecipe.mFluidOutputs[1].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 120, 5)); - } - if (aRecipe.mFluidOutputs.length > 2 && aRecipe.mFluidOutputs[2] != null && (aRecipe.mFluidOutputs[2].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[2], true), 138, 5)); - } - if (aRecipe.mFluidOutputs.length > 3 && aRecipe.mFluidOutputs[3] != null && (aRecipe.mFluidOutputs[3].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[3], true), 102, 23)); - } - if (aRecipe.mFluidOutputs.length > 4 && aRecipe.mFluidOutputs[4] != null && (aRecipe.mFluidOutputs[4].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[4], true), 120, 23)); - } - if (aRecipe.mFluidOutputs.length > 5 && aRecipe.mFluidOutputs[5] != null && (aRecipe.mFluidOutputs[5].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[5], true), 138, 23)); - } - if (aRecipe.mFluidOutputs.length > 6 && aRecipe.mFluidOutputs[6] != null && (aRecipe.mFluidOutputs[6].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[6], true), 102, 41)); - } - if (aRecipe.mFluidOutputs.length > 7 && aRecipe.mFluidOutputs[7] != null && (aRecipe.mFluidOutputs[7].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[7], true), 120, 41)); - } - if (aRecipe.mFluidOutputs.length > 8 && aRecipe.mFluidOutputs[8] != null && (aRecipe.mFluidOutputs[8].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[8], true), 138, 41)); - } - } else if ((aRecipe.mFluidOutputs.length > 0) && (aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 102, 5)); - } - } - - @Override + if (this.permutated) { + return; + } + final ArrayList<ItemStack> tDisplayStacks = new ArrayList(); + for (final ItemStack tStack : this.items) { + if (GT_Utility.isStackValid(tStack)) { + if (tStack.getItemDamage() == 32767) { + final List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); + if (!permutations.isEmpty()) { + ItemStack stack; + for (final Iterator i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) { + stack = (ItemStack) i$.next(); + } + } else { + final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); + base.stackTagCompound = tStack.stackTagCompound; + tDisplayStacks.add(base); + } + } else { + tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack})); + } + } + } + this.items = (tDisplayStacks.toArray(new ItemStack[0])); + if (this.items.length == 0) { + this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; + } + this.permutated = true; + this.setPermutationToRender(0); + } + } + + public class CachedDefaultRecipe + extends TemplateRecipeHandler.CachedRecipe { + public final GT_Recipe mRecipe; + public final List<PositionedStack> mOutputs = new ArrayList(); + public final List<PositionedStack> mInputs = new ArrayList(); + + public CachedDefaultRecipe(final GT_Recipe aRecipe) { + super(); + this.mRecipe = aRecipe; + + int tStartIndex = 0; + switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualInputCount) { + case 0: + break; + case 1: + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + } + tStartIndex++; + break; + case 2: + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + } + tStartIndex++; + break; + case 3: + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + } + tStartIndex++; + break; + case 4: + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); + } + tStartIndex++; + break; + case 5: + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 5)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); + } + tStartIndex++; + break; + case 6: + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 5)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 23)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); + } + tStartIndex++; + break; + case 7: + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32)); + } + tStartIndex++; + break; + case 8: + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 32)); + } + tStartIndex++; + break; + default: + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 14)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 14)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 32)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 32)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 32)); + } + tStartIndex++; + } + if (aRecipe.mSpecialItems != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); + } + tStartIndex = 0; + switch (GT_NEI_DefaultHandler.this.mRecipeMap.mUsualOutputCount) { + case 0: + break; + case 1: + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + break; + case 2: + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + break; + case 3: + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + break; + case 4: + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + break; + case 5: + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + break; + case 6: + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + break; + case 7: + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + break; + case 8: + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 32, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + break; + default: + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, -4, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, -4, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, -4, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 14, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 32, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 32, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 138, 32, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + } + + + //New fluid display behaviour when 3 fluid inputs are detected. (Basically a mix of the code below for outputs an the code above for 9 input slots.) + if (aRecipe.mFluidInputs.length > 2) { + if ((aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 12, 5)); + } + if ((aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 30, 5)); + } + if ((aRecipe.mFluidInputs.length > 2) && (aRecipe.mFluidInputs[2] != null) && (aRecipe.mFluidInputs[2].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[2], true), 48, 5)); + } + if ((aRecipe.mFluidInputs.length > 3) && (aRecipe.mFluidInputs[3] != null) && (aRecipe.mFluidInputs[3].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[3], true), 12, 23)); + } + if ((aRecipe.mFluidInputs.length > 4) && (aRecipe.mFluidInputs[4] != null) && (aRecipe.mFluidInputs[4].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[4], true), 30, 23)); + } + if ((aRecipe.mFluidInputs.length > 5) && (aRecipe.mFluidInputs[5] != null) && (aRecipe.mFluidInputs[5].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[5], true), 48, 23)); + } + if ((aRecipe.mFluidInputs.length > 6) && (aRecipe.mFluidInputs[6] != null) && (aRecipe.mFluidInputs[6].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[6], true), 12, 41)); + } + if ((aRecipe.mFluidInputs.length > 7) && (aRecipe.mFluidInputs[7] != null) && (aRecipe.mFluidInputs[7].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[7], true), 30, 41)); + } + if ((aRecipe.mFluidInputs.length > 8) && (aRecipe.mFluidInputs[8] != null) && (aRecipe.mFluidInputs[8].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[8], true), 48, 41)); + } + } + //Returns to old behaviour if fluid inputs < 3 + else if ((aRecipe.mFluidInputs.length > 0) && (aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 48, 52)); + if ((aRecipe.mFluidInputs.length == 2) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 30, 52)); + } + } + + if (aRecipe.mFluidOutputs.length > 1) { + if ((aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 102, 5)); + } + if ((aRecipe.mFluidOutputs[1] != null) && (aRecipe.mFluidOutputs[1].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 120, 5)); + } + if ((aRecipe.mFluidOutputs.length > 2) && (aRecipe.mFluidOutputs[2] != null) && (aRecipe.mFluidOutputs[2].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[2], true), 138, 5)); + } + if ((aRecipe.mFluidOutputs.length > 3) && (aRecipe.mFluidOutputs[3] != null) && (aRecipe.mFluidOutputs[3].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[3], true), 102, 23)); + } + if ((aRecipe.mFluidOutputs.length > 4) && (aRecipe.mFluidOutputs[4] != null) && (aRecipe.mFluidOutputs[4].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[4], true), 120, 23)); + } + if ((aRecipe.mFluidOutputs.length > 5) && (aRecipe.mFluidOutputs[5] != null) && (aRecipe.mFluidOutputs[5].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[5], true), 138, 23)); + } + if ((aRecipe.mFluidOutputs.length > 6) && (aRecipe.mFluidOutputs[6] != null) && (aRecipe.mFluidOutputs[6].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[6], true), 102, 41)); + } + if ((aRecipe.mFluidOutputs.length > 7) && (aRecipe.mFluidOutputs[7] != null) && (aRecipe.mFluidOutputs[7].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[7], true), 120, 41)); + } + if ((aRecipe.mFluidOutputs.length > 8) && (aRecipe.mFluidOutputs[8] != null) && (aRecipe.mFluidOutputs[8].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[8], true), 138, 41)); + } + } else if ((aRecipe.mFluidOutputs.length > 0) && (aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 102, 5)); + } + } + + @Override public List<PositionedStack> getIngredients() { - return getCycledIngredients(GT_NEI_DefaultHandler.this.cycleticks / 10, this.mInputs); - } + return this.getCycledIngredients(GT_NEI_DefaultHandler.this.cycleticks / 10, this.mInputs); + } - @Override + @Override public PositionedStack getResult() { - return null; - } + return null; + } - @Override + @Override public List<PositionedStack> getOtherStacks() { - return this.mOutputs; - } - } + return this.mOutputs; + } + } } diff --git a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java index 700541a83a..7d695b10be 100644 --- a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java @@ -1,30 +1,30 @@ package gtPlusPlus.nei; -import gregtech.api.util.CustomRecipeMap; import codechicken.nei.api.IConfigureNEI; +import gregtech.api.util.CustomRecipeMap; public class NEI_GT_Config - implements IConfigureNEI { - public static boolean sIsAdded = true; +implements IConfigureNEI { + public static boolean sIsAdded = true; - @Override + @Override public void loadConfig() { - sIsAdded = false; - for (CustomRecipeMap tMap : gregtech.api.util.CustomRecipeMap.sMappings) { - if (tMap.mNEIAllowed) { - new GT_NEI_DefaultHandler(tMap); - } - } - sIsAdded = true; - } + sIsAdded = false; + for (final CustomRecipeMap tMap : gregtech.api.util.CustomRecipeMap.sMappings) { + if (tMap.mNEIAllowed) { + new GT_NEI_DefaultHandler(tMap); + } + } + sIsAdded = true; + } - @Override + @Override public String getName() { - return "GT++ NEI Plugin"; - } + return "GT++ NEI Plugin"; + } - @Override + @Override public String getVersion() { - return "(1.01)"; - } + return "(1.01)"; + } } diff --git a/src/Java/gtPlusPlus/xmod/forestry/Forestry.java b/src/Java/gtPlusPlus/xmod/forestry/Forestry.java index 698e6a8d01..8f5b36f6e3 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/Forestry.java +++ b/src/Java/gtPlusPlus/xmod/forestry/Forestry.java @@ -2,10 +2,6 @@ package gtPlusPlus.xmod.forestry; import static cpw.mods.fml.common.registry.GameRegistry.findBlock; import static cpw.mods.fml.common.registry.GameRegistry.findItem; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import net.minecraft.block.Block; -import net.minecraft.item.Item; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; @@ -16,6 +12,10 @@ import cpw.mods.fml.common.Mod.CustomProperty; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import net.minecraft.block.Block; +import net.minecraft.item.Item; @ChildMod(parent = CORE.MODID, mod = @Mod(modid = "Gregtech++|CompatForestry", name = "GT++ Compat: Forestry", @@ -27,12 +27,12 @@ public class Forestry { private static final String name = "Forestry"; @EventHandler - public void load(FMLInitializationEvent e) { + public void load(final FMLInitializationEvent e) { try { initForestry(); - } catch (Throwable $) { - ModContainer This = FMLCommonHandler.instance().findContainerFor(this); + } catch (final Throwable $) { + final ModContainer This = FMLCommonHandler.instance().findContainerFor(this); LogManager.getLogger(This.getModId()).log(Level.ERROR, "There was a problem loading " + This.getName(), $); } } @@ -43,47 +43,45 @@ public class Forestry { item = findItem(name, "sapling"); Block block = findBlock(name, "saplingGE"); - if (item != null && block != null) { + if ((item != null) && (block != null)) { //ForestrySapling sapling = new ForestrySapling(item, block); //MFRRegistry.registerPlantable(sapling); //MFRRegistry.registerFertilizable(sapling); - } else - //Utils.LOG_WARNING("Forestry sapling/block null!"); - - block = findBlock(name, "soil"); + } else { + block = findBlock(name, "soil"); + } if (block != null) { //ForestryBogEarth bog = new ForestryBogEarth(block); //MFRRegistry.registerPlantable(bog); //MFRRegistry.registerFertilizable(bog); //MFRRegistry.registerHarvestable(bog); //MFRRegistry.registerFruit(bog); - } else - //Utils.LOG_WARNING("Forestry bog earth null!"); - - for (int i = 1; true; ++i) { - block = findBlock(name, "log" + i); - l: if (block == null) { - if (i > 1) - Utils.LOG_WARNING("Forestry logs null at " + i + "."); - else { - block = findBlock(name, "logs"); - if (block != null) { - break l; + } else { + for (int i = 1; true; ++i) { + block = findBlock(name, "log" + i); + l: if (block == null) { + if (i > 1) { + Utils.LOG_WARNING("Forestry logs null at " + i + "."); + } else { + block = findBlock(name, "logs"); + if (block != null) { + break l; + } + Utils.LOG_WARNING("Forestry logs null!"); } - Utils.LOG_WARNING("Forestry logs null!"); + break; } - break; + //MFRRegistry.registerHarvestable(new HarvestableWood(block)); + //MFRRegistry.registerFruitLogBlock(block); } - //MFRRegistry.registerHarvestable(new HarvestableWood(block)); - //MFRRegistry.registerFruitLogBlock(block); } for (int i = 1; true; ++i) { block = findBlock(name, "fireproofLog" + i); l: if (block == null) { - if (i > 1) + if (i > 1) { Utils.LOG_WARNING("Forestry logs null at " + i + "."); - else { + } else { block = findBlock(name, "logsFireproof"); if (block != null) { break l; @@ -102,8 +100,9 @@ public class Forestry { //MFRRegistry.registerFertilizable(leaf); //MFRRegistry.registerHarvestable(leaf); //MFRRegistry.registerFruit(leaf); - } else + } else { Utils.LOG_WARNING("Forestry leaves null!"); + } block = findBlock(name, "pods"); item = findItem(name, "grafterProven"); @@ -112,12 +111,13 @@ public class Forestry { //MFRRegistry.registerFertilizable(pod); //MFRRegistry.registerHarvestable(pod); //MFRRegistry.registerFruit(pod); - } else + } else { Utils.LOG_WARNING("Forestry pods null!"); + } } @EventHandler - public static void postInit(FMLPostInitializationEvent e) { + public static void postInit(final FMLPostInitializationEvent e) { //MFRRegistry.registerLiquidDrinkHandler("bioethanol", new DrinkHandlerBiofuel()); //TileEntityUnifier.updateUnifierLiquids(); } diff --git a/src/Java/gtPlusPlus/xmod/forestry/HANDLER_FR.java b/src/Java/gtPlusPlus/xmod/forestry/HANDLER_FR.java index e92aa40ca2..9d19af17b8 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/HANDLER_FR.java +++ b/src/Java/gtPlusPlus/xmod/forestry/HANDLER_FR.java @@ -1,5 +1,6 @@ package gtPlusPlus.xmod.forestry; +import cpw.mods.fml.common.Optional; import forestry.core.proxy.Proxies; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; @@ -8,43 +9,42 @@ import gtPlusPlus.xmod.forestry.bees.items.FR_ItemRegistry; import gtPlusPlus.xmod.forestry.bees.recipe.FR_Gregtech_Recipes; import net.minecraft.block.Block; import net.minecraft.world.World; -import cpw.mods.fml.common.Optional; public class HANDLER_FR { - public static void preInit(){ + public static void preInit(){ if (LoadedMods.Forestry){ FR_ItemRegistry.Register(); if (CORE.configSwitches.enableCustomAlvearyBlocks){ AlvearyHandler.run(); } - } + } } public static void Init(){ if (LoadedMods.Forestry){ - - } + + } } public static void postInit(){ if (LoadedMods.Forestry){ - FR_Gregtech_Recipes.registerItems(); - } - } - - public static boolean createBlockBreakParticles(World world, int x, int y, int z, Block block){ + FR_Gregtech_Recipes.registerItems(); + } + } + + public static boolean createBlockBreakParticles(final World world, final int x, final int y, final int z, final Block block){ if (LoadedMods.Forestry){ createBlockBreakParticles_INTERNAL(world, x, y, z, block); } return false; } - + @Optional.Method(modid = "Forestry") - private static void createBlockBreakParticles_INTERNAL(World world, int x, int y, int z, Block block){ + private static void createBlockBreakParticles_INTERNAL(final World world, final int x, final int y, final int z, final Block block){ Proxies.common.addBlockDestroyEffects(world, x, y, z, block, 0); } - - + + } diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyBeeListener.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyBeeListener.java index 6736c54309..039c80fe00 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyBeeListener.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyBeeListener.java @@ -6,13 +6,13 @@ import gtPlusPlus.xmod.forestry.bees.alveary.gui.InventoryFrameHousing; public class AlvearyBeeListener extends DefaultBeeListener { private final IAlvearyFrameHousing apiary; - public AlvearyBeeListener(IAlvearyFrameHousing apiary) { + public AlvearyBeeListener(final IAlvearyFrameHousing apiary) { this.apiary = apiary; } @Override - public void wearOutEquipment(int amount) { - InventoryFrameHousing apiaryInventory = apiary.getAlvearyInventory(); - apiaryInventory.wearOutFrames(apiary, amount); + public void wearOutEquipment(final int amount) { + final InventoryFrameHousing apiaryInventory = this.apiary.getAlvearyInventory(); + apiaryInventory.wearOutFrames(this.apiary, amount); } } diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyHandler.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyHandler.java index fd18f069cf..ab093645b6 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyHandler.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyHandler.java @@ -1,28 +1,28 @@ package gtPlusPlus.xmod.forestry.bees.alveary; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; import forestry.core.items.ItemBlockForestry; import forestry.core.utils.StringUtil; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; public class AlvearyHandler { @Optional.Method(modid = "Forestry") public static void run(){ if (!LoadedMods.ExtraBees){ - if (CORE.configSwitches.enableCustomAlvearyBlocks){//Alveary Stuff - FR_BlockAlveary alveary; - alveary = registerBlock(new FR_BlockAlveary(), ItemBlockForestry.class, "alveary"); - GameRegistry.registerTileEntity(TileAlvearyFrameHousing.class, "FrameHousing"); - } + if (CORE.configSwitches.enableCustomAlvearyBlocks){//Alveary Stuff + FR_BlockAlveary alveary; + alveary = registerBlock(new FR_BlockAlveary(), ItemBlockForestry.class, "alveary"); + GameRegistry.registerTileEntity(TileAlvearyFrameHousing.class, "FrameHousing"); + } } - } + } - protected static <T extends Block> T registerBlock(T block, Class<? extends ItemBlock> itemClass, String name, Object... itemCtorArgs) { + protected static <T extends Block> T registerBlock(final T block, final Class<? extends ItemBlock> itemClass, final String name, final Object... itemCtorArgs) { block.setBlockName("for." + name); GameRegistry.registerBlock(block, itemClass, StringUtil.cleanBlockName(block), itemCtorArgs); return block; diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_AlvearyFrameBlock.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_AlvearyFrameBlock.java index a322311434..06162f7dc1 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_AlvearyFrameBlock.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_AlvearyFrameBlock.java @@ -1,10 +1,9 @@ package gtPlusPlus.xmod.forestry.bees.alveary; -import net.minecraft.util.ChunkCoordinates; - import com.mojang.authlib.GameProfile; import forestry.api.multiblock.*; +import net.minecraft.util.ChunkCoordinates; public class FR_AlvearyFrameBlock implements IAlvearyComponent, IMultiblockComponent{ @@ -21,16 +20,16 @@ public class FR_AlvearyFrameBlock implements IAlvearyComponent, IMultiblockCompo } @Override - public void onMachineAssembled(IMultiblockController arg0, - ChunkCoordinates arg1, ChunkCoordinates arg2) { + public void onMachineAssembled(final IMultiblockController arg0, + final ChunkCoordinates arg1, final ChunkCoordinates arg2) { // TODO Auto-generated method stub - + } @Override public void onMachineBroken() { // TODO Auto-generated method stub - + } @Override diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_BlockAlveary.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_BlockAlveary.java index bf632ef039..cd74ec0e81 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_BlockAlveary.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_BlockAlveary.java @@ -3,6 +3,15 @@ package gtPlusPlus.xmod.forestry.bees.alveary; import java.util.ArrayList; import java.util.List; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import forestry.apiculture.MaterialBeehive; +import forestry.apiculture.multiblock.TileAlvearyPlain; +import forestry.core.blocks.BlockForestry; +import forestry.core.render.TextureManager; +import gtPlusPlus.GTplusplus; +import gtPlusPlus.core.creative.AddToCreativeTab; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -13,15 +22,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import forestry.apiculture.MaterialBeehive; -import forestry.apiculture.multiblock.TileAlvearyPlain; -import forestry.core.blocks.BlockForestry; -import forestry.core.render.TextureManager; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.core.creative.AddToCreativeTab; public class FR_BlockAlveary extends BlockForestry { @@ -31,8 +31,8 @@ public class FR_BlockAlveary extends BlockForestry PLAIN, ERROR, FRAME, - MUTATOR, - + MUTATOR, + //Placeholder Values HEATER, HYGRO, STABILIZER, SIEVE; @@ -44,37 +44,39 @@ public class FR_BlockAlveary extends BlockForestry public FR_BlockAlveary() { super(new MaterialBeehive(false)); - setHardness(1.0F); - setCreativeTab(AddToCreativeTab.tabBlock); - setHarvestLevel("axe", 0); - + this.setHardness(1.0F); + this.setCreativeTab(AddToCreativeTab.tabBlock); + this.setHarvestLevel("axe", 0); + } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) - { - if (world.isRemote) return true; - - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileAlvearyFrameHousing) - { - player.openGui(GTplusplus.instance, 0, world, x, y, z); - return true; - } - /*else if (te != null && te instanceof TileAlvearyFrameHousing) + public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) + { + if (world.isRemote) { + return true; + } + + final TileEntity te = world.getTileEntity(x, y, z); + if ((te != null) && (te instanceof TileAlvearyFrameHousing)) + { + player.openGui(GTplusplus.instance, 0, world, x, y, z); + return true; + } + /*else if (te != null && te instanceof TileAlvearyFrameHousing) { player.openGui(GTplusplus.instance, 0, world, x, y, z); return true; }*/ - return false; - } + return false; + } @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tab, List list) + public void getSubBlocks(final Item item, final CreativeTabs tab, final List list) { for (int i = 0; i < 4; i++) { - if (i != 1 && i != 0) { + if ((i != 1) && (i != 0)) { list.add(new ItemStack(item, 1, i)); } } @@ -93,64 +95,64 @@ public class FR_BlockAlveary extends BlockForestry } @Override - public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) + public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int metadata, final int fortune) { - ArrayList<ItemStack> drop = new ArrayList<ItemStack>(); + final ArrayList<ItemStack> drop = new ArrayList<>(); drop.add(new ItemStack(this, 1, metadata != 1 ? metadata : 0)); return drop; } @Override - public int getDamageValue(World world, int x, int y, int z) + public int getDamageValue(final World world, final int x, final int y, final int z) { - int meta = world.getBlockMetadata(x, y, z); + final int meta = world.getBlockMetadata(x, y, z); return meta != 1 ? meta : 0; } @Override - public TileEntity createTileEntity(World world, int metadata) + public TileEntity createTileEntity(final World world, final int metadata) { if ((metadata < 0) || (metadata > Type.VALUES.length)) { return null; } - - - - Type type = Type.VALUES[metadata]; + + + + final Type type = Type.VALUES[metadata]; switch (type) { - case FRAME: + case FRAME: LanguageRegistry.addName(this, "Alveary Frame Housing"); - case MUTATOR: + case MUTATOR: LanguageRegistry.addName(this, "Alveary Mutator Block"); - case ERROR: + case ERROR: LanguageRegistry.addName(this, "Invalid Alveary Block"); default: - LanguageRegistry.addName(this, "Unnamed Alveary Block"); + LanguageRegistry.addName(this, "Unnamed Alveary Block"); } switch (type) { - case FRAME: + case FRAME: return new TileAlvearyFrameHousing(); - case MUTATOR: + case MUTATOR: return new TileAlvearyPlain(); - case ERROR: + case ERROR: return new TileAlvearyPlain(); default: - return new TileAlvearyPlain(); + return new TileAlvearyPlain(); } } @Override - public Block setBlockName(String name) { + public Block setBlockName(final String name) { //int meta = this. return super.setBlockName(name); } @Override - public TileEntity createNewTileEntity(World world, int meta) + public TileEntity createNewTileEntity(final World world, final int meta) { - return createTileEntity(world, meta); + return this.createTileEntity(world, meta); } /* ICONS */ @@ -167,108 +169,108 @@ public class FR_BlockAlveary extends BlockForestry private IIcon[] icons; @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons(IIconRegister register) { - icons = new IIcon[9]; - icons[0] = TextureManager.registerTex(register, "apiculture/alveary.plain"); - icons[1] = TextureManager.registerTex(register, "apiculture/alveary.entrance"); - icons[2] = TextureManager.registerTex(register, "apiculture/alveary.bottom"); - icons[3] = TextureManager.registerTex(register, "apiculture/alveary.left"); - icons[4] = TextureManager.registerTex(register, "apiculture/alveary.right"); - icons[5] = TextureManager.registerTex(register, "apiculture/alveary.framehousing.off"); - icons[6] = TextureManager.registerTex(register, "apiculture/alveary.framehousing.on"); - icons[7] = TextureManager.registerTex(register, "apiculture/alveary.mutator.off"); - icons[8] = TextureManager.registerTex(register, "apiculture/alveary.mutator.on"); + public void registerBlockIcons(final IIconRegister register) { + this.icons = new IIcon[9]; + this.icons[0] = TextureManager.registerTex(register, "apiculture/alveary.plain"); + this.icons[1] = TextureManager.registerTex(register, "apiculture/alveary.entrance"); + this.icons[2] = TextureManager.registerTex(register, "apiculture/alveary.bottom"); + this.icons[3] = TextureManager.registerTex(register, "apiculture/alveary.left"); + this.icons[4] = TextureManager.registerTex(register, "apiculture/alveary.right"); + this.icons[5] = TextureManager.registerTex(register, "apiculture/alveary.framehousing.off"); + this.icons[6] = TextureManager.registerTex(register, "apiculture/alveary.framehousing.on"); + this.icons[7] = TextureManager.registerTex(register, "apiculture/alveary.mutator.off"); + this.icons[8] = TextureManager.registerTex(register, "apiculture/alveary.mutator.on"); } @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(int side, int metadata) { - if ((metadata <= 1 - || metadata == Type.FRAME.ordinal() || metadata == Type.MUTATOR.ordinal()) - && (side == 1 || side == 0)) { - return icons[BOTTOM]; + public IIcon getIcon(final int side, final int metadata) { + if (((metadata <= 1) + || (metadata == Type.FRAME.ordinal()) || (metadata == Type.MUTATOR.ordinal())) + && ((side == 1) || (side == 0))) { + return this.icons[BOTTOM]; } - Type type = Type.VALUES[metadata]; + final Type type = Type.VALUES[metadata]; switch (type) { case ERROR: - return icons[PLAIN]; + return this.icons[PLAIN]; case FRAME: - return icons[ALVEARY_FRAME_OFF]; + return this.icons[ALVEARY_FRAME_OFF]; case MUTATOR: - return icons[ALVEARY_MUTATOR_OFF]; + return this.icons[ALVEARY_MUTATOR_OFF]; case HEATER: - return icons[ALVEARY_MUTATOR_OFF]; + return this.icons[ALVEARY_MUTATOR_OFF]; case HYGRO: - return icons[ALVEARY_MUTATOR_OFF]; + return this.icons[ALVEARY_MUTATOR_OFF]; case STABILIZER: - return icons[PLAIN]; + return this.icons[PLAIN]; case SIEVE: - return icons[PLAIN]; + return this.icons[PLAIN]; default: return null; } } @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - int meta = world.getBlockMetadata(x, y, z); + public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) { + final int meta = world.getBlockMetadata(x, y, z); if (meta == 1) { return this.getIcon(side, meta); } else if (meta > 1) { - return getBlockTextureFromSideAndTile(world, x, y, z, side); + return this.getBlockTextureFromSideAndTile(world, x, y, z, side); } - Block blockXP = world.getBlock(x + 1, y, z); - Block blockXM = world.getBlock(x - 1, y, z); - if (blockXP == this && blockXM != this) { + final Block blockXP = world.getBlock(x + 1, y, z); + final Block blockXM = world.getBlock(x - 1, y, z); + if ((blockXP == this) && (blockXM != this)) { if (world.getBlockMetadata(x + 1, y, z) == 1) { if (world.getBlock(x, y, z + 1) != this) { - return switchForSide(42, side); + return this.switchForSide(42, side); } - return switchForSide(41, side); + return this.switchForSide(41, side); } return this.getIcon(side, meta); - } else if (blockXP != this && blockXM == this) { + } else if ((blockXP != this) && (blockXM == this)) { if (world.getBlockMetadata(x - 1, y, z) == 1) { if (world.getBlock(x, y, z + 1) != this) { - return switchForSide(41, side); + return this.switchForSide(41, side); } - return switchForSide(42, side); + return this.switchForSide(42, side); } return this.getIcon(side, meta); } return this.getIcon(side, meta); } @SideOnly(Side.CLIENT) - private IIcon getBlockTextureFromSideAndTile(IBlockAccess world, int x, int y, int z, int side) { - TileEntity tile = world.getTileEntity(x, y, z); + private IIcon getBlockTextureFromSideAndTile(final IBlockAccess world, final int x, final int y, final int z, final int side) { + final TileEntity tile = world.getTileEntity(x, y, z); if (!(tile instanceof FR_TileAlveary)) { - return getIcon(side, 0); + return this.getIcon(side, 0); } - return icons[((FR_TileAlveary) tile).getIcon(side)]; + return this.icons[((FR_TileAlveary) tile).getIcon(side)]; } @SideOnly(Side.CLIENT) - private IIcon switchForSide(int textureId, int side) { - if (side == 4 || side == 5) { + private IIcon switchForSide(final int textureId, final int side) { + if ((side == 4) || (side == 5)) { if (textureId == 41) { - return icons[LEFT]; + return this.icons[LEFT]; } - return icons[RIGHT]; + return this.icons[RIGHT]; } else if (textureId == 41) { - return icons[RIGHT]; + return this.icons[RIGHT]; } else { - return icons[LEFT]; + return this.icons[LEFT]; } } @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { + public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block block) { super.onNeighborBlockChange(world, x, y, z, block); - TileEntity tileEntity = world.getTileEntity(x, y, z); + final TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof FR_TileAlveary) { - FR_TileAlveary tileAlveary = (FR_TileAlveary) tileEntity; + final FR_TileAlveary tileAlveary = (FR_TileAlveary) tileEntity; // We must check that the slabs on top were not removed tileAlveary.getMultiblockLogic().getController().reassemble(); } } - public ItemStack get(Type type) { + public ItemStack get(final Type type) { return new ItemStack(this, 1, type.ordinal()); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_TileAlveary.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_TileAlveary.java index 62b54ade3c..b5e7845dab 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_TileAlveary.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_TileAlveary.java @@ -3,9 +3,6 @@ package gtPlusPlus.xmod.forestry.bees.alveary; import java.io.IOException; import java.util.List; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.Vec3; -import net.minecraft.world.biome.BiomeGenBase; import forestry.api.apiculture.*; import forestry.api.core.*; import forestry.api.multiblock.IAlvearyComponent; @@ -20,6 +17,9 @@ import forestry.core.multiblock.MultiblockTileEntityForestry; import forestry.core.network.*; import forestry.core.tiles.IClimatised; import forestry.core.tiles.ITitled; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.Vec3; +import net.minecraft.world.biome.BiomeGenBase; public abstract class FR_TileAlveary extends MultiblockTileEntityForestry<MultiblockLogicAlveary> @@ -32,26 +32,26 @@ implements IBeeHousing, IAlvearyComponent, IRestrictedAccess, IStreamableGui, IT this(FR_BlockAlveary.Type.ERROR); } - protected FR_TileAlveary(FR_BlockAlveary.Type type) + protected FR_TileAlveary(final FR_BlockAlveary.Type type) { super(new MultiblockLogicAlveary()); this.unlocalizedTitle = ("advanced.tile.for.alveary." + type.ordinal() + ".name"); - + } - public int getIcon(int side) + public int getIcon(final int side) { return 0; } @Override - public void onMachineAssembled(IMultiblockController multiblockController, ChunkCoordinates minCoord, ChunkCoordinates maxCoord) + public void onMachineAssembled(final IMultiblockController multiblockController, final ChunkCoordinates minCoord, final ChunkCoordinates maxCoord) { if (this.worldObj.isRemote) { this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); } - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, getBlockType()); - markDirty(); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + this.markDirty(); } @Override @@ -60,92 +60,92 @@ implements IBeeHousing, IAlvearyComponent, IRestrictedAccess, IStreamableGui, IT if (this.worldObj.isRemote) { this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); } - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, getBlockType()); - markDirty(); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + this.markDirty(); } @Override public BiomeGenBase getBiome() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBiome(); + return this.getMultiblockLogic().getController().getBiome(); } @Override public Iterable<IBeeModifier> getBeeModifiers() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeModifiers(); + return this.getMultiblockLogic().getController().getBeeModifiers(); } @Override public Iterable<IBeeListener> getBeeListeners() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeListeners(); + return this.getMultiblockLogic().getController().getBeeListeners(); } @Override public IBeeHousingInventory getBeeInventory() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeInventory(); + return this.getMultiblockLogic().getController().getBeeInventory(); } @Override public IBeekeepingLogic getBeekeepingLogic() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeekeepingLogic(); + return this.getMultiblockLogic().getController().getBeekeepingLogic(); } @Override public Vec3 getBeeFXCoordinates() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeFXCoordinates(); + return this.getMultiblockLogic().getController().getBeeFXCoordinates(); } @Override public EnumTemperature getTemperature() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getTemperature(); + return this.getMultiblockLogic().getController().getTemperature(); } @Override public EnumHumidity getHumidity() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getHumidity(); + return this.getMultiblockLogic().getController().getHumidity(); } @Override public int getBlockLightValue() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBlockLightValue(); + return this.getMultiblockLogic().getController().getBlockLightValue(); } @Override public boolean canBlockSeeTheSky() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().canBlockSeeTheSky(); + return this.getMultiblockLogic().getController().canBlockSeeTheSky(); } @Override public IErrorLogic getErrorLogic() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getErrorLogic(); + return this.getMultiblockLogic().getController().getErrorLogic(); } @Override public IAccessHandler getAccessHandler() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getAccessHandler(); + return this.getMultiblockLogic().getController().getAccessHandler(); } @Override - public void onSwitchAccess(EnumAccess oldAccess, EnumAccess newAccess) + public void onSwitchAccess(final EnumAccess oldAccess, final EnumAccess newAccess) { - ((MultiblockLogicAlveary)getMultiblockLogic()).getController().onSwitchAccess(oldAccess, newAccess); + this.getMultiblockLogic().getController().onSwitchAccess(oldAccess, newAccess); } @Override public IInventoryAdapter getInternalInventory() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getInternalInventory(); + return this.getMultiblockLogic().getController().getInternalInventory(); } @Override @@ -163,27 +163,27 @@ implements IBeeHousing, IAlvearyComponent, IRestrictedAccess, IStreamableGui, IT @Override public float getExactTemperature() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getExactTemperature(); + return this.getMultiblockLogic().getController().getExactTemperature(); } @Override public float getExactHumidity() { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getExactHumidity(); + return this.getMultiblockLogic().getController().getExactHumidity(); } @Override - public void writeGuiData(DataOutputStreamForestry data) + public void writeGuiData(final DataOutputStreamForestry data) throws IOException { - ((MultiblockLogicAlveary)getMultiblockLogic()).getController().writeGuiData(data); + this.getMultiblockLogic().getController().writeGuiData(data); } @Override - public void readGuiData(DataInputStreamForestry data) + public void readGuiData(final DataInputStreamForestry data) throws IOException { - ((MultiblockLogicAlveary)getMultiblockLogic()).getController().readGuiData(data); + this.getMultiblockLogic().getController().readGuiData(data); } } diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyComponentAdvanced.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyComponentAdvanced.java index b55d2d37a6..a214263d0b 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyComponentAdvanced.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyComponentAdvanced.java @@ -11,14 +11,14 @@ extends IMultiblockComponent @Override public abstract T getMultiblockLogic(); - + public static abstract interface FrameHouse extends IAlvearyComponentAdvanced { public abstract void changeClimate(int paramInt, IClimateControlled paramIClimateControlled); } - + public static abstract interface BeeModifier extends IAlvearyComponentAdvanced { diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/ISidedFrameWearingInventory.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/ISidedFrameWearingInventory.java index 523c3e2434..2cc5e58ef7 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/ISidedFrameWearingInventory.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/ISidedFrameWearingInventory.java @@ -1,10 +1,10 @@ package gtPlusPlus.xmod.forestry.bees.alveary; -import net.minecraft.inventory.ISidedInventory; import forestry.api.apiculture.IBeeHousing; +import net.minecraft.inventory.ISidedInventory; public abstract interface ISidedFrameWearingInventory - extends ISidedInventory +extends ISidedInventory { - public abstract void wearOutFrames(IBeeHousing paramIBeeHousing, int paramInt); + public abstract void wearOutFrames(IBeeHousing paramIBeeHousing, int paramInt); }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/TileAlvearyFrameHousing.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/TileAlvearyFrameHousing.java index 3b09fc80e1..ff323632f5 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/TileAlvearyFrameHousing.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/TileAlvearyFrameHousing.java @@ -2,18 +2,11 @@ package gtPlusPlus.xmod.forestry.bees.alveary; import java.util.*; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; import forestry.api.apiculture.*; import forestry.api.arboriculture.EnumGermlingType; import forestry.api.genetics.*; import forestry.api.multiblock.IAlvearyComponent; import forestry.apiculture.AlvearyBeeModifier; -import forestry.apiculture.multiblock.MultiblockLogicAlveary; import forestry.apiculture.network.packets.PacketActiveUpdate; import forestry.apiculture.worldgen.*; import forestry.core.inventory.IInventoryAdapter; @@ -24,6 +17,12 @@ import forestry.core.tiles.IActivatable; import forestry.core.utils.ItemStackUtil; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.forestry.bees.alveary.gui.*; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; public class TileAlvearyFrameHousing extends FR_TileAlveary @@ -31,7 +30,7 @@ implements ISidedFrameWearingInventory, IActivatable, IAlvearyComponent.Active, { private final InventoryFrameHousing inventory; private final IBeeListener beeListener; - private final Stack<ItemStack> pendingSpawns = new Stack<ItemStack>(); + private final Stack<ItemStack> pendingSpawns = new Stack<>(); private boolean active; public TileAlvearyFrameHousing() @@ -55,19 +54,19 @@ implements ISidedFrameWearingInventory, IActivatable, IAlvearyComponent.Active, } @Override - public void updateServer(int tickCount) + public void updateServer(final int tickCount) { - if (getInternalInventory() == null) { + if (this.getInternalInventory() == null) { return; } if (this.inventory.getStackInSlot(0) != null) { - if (((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeekeepingLogic().canWork()){ - setActive(true); - if (tickCount % 1000 == 0) { - wearOutFrames(this, 1); + if (this.getMultiblockLogic().getController().getBeekeepingLogic().canWork()){ + this.setActive(true); + if ((tickCount % 1000) == 0) { + this.wearOutFrames(this, 1); } } else { @@ -77,20 +76,20 @@ implements ISidedFrameWearingInventory, IActivatable, IAlvearyComponent.Active, } else { - setActive(false); + this.setActive(false); } - if (tickCount % 500 != 0) { + if ((tickCount % 500) != 0) { return; } } @Override - public void updateClient(int tickCount) {} + public void updateClient(final int tickCount) {} private ItemStack getPrincessStack() { - ItemStack princessStack = ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeInventory().getQueen(); + final ItemStack princessStack = this.getMultiblockLogic().getController().getBeeInventory().getQueen(); if (BeeManager.beeRoot.isMated(princessStack)) { return princessStack; } @@ -99,55 +98,55 @@ implements ISidedFrameWearingInventory, IActivatable, IAlvearyComponent.Active, private int consumeInducerAndGetChance() { - if (getInternalInventory() == null) { + if (this.getInternalInventory() == null) { return 0; } - for (Iterator<?> i$ = InventoryIterator.getIterable(getInternalInventory()).iterator(); i$.hasNext();) + for (final Iterator<?> i$ = InventoryIterator.getIterable(this.getInternalInventory()).iterator(); i$.hasNext();) { - IInvSlot slot = (IInvSlot)i$.next(); - ItemStack stack = slot.getStackInSlot(); - for (Map.Entry<ItemStack, Integer> entry : BeeManager.inducers.entrySet()) { - if (ItemStackUtil.isIdenticalItem((ItemStack)entry.getKey(), stack)) + final IInvSlot slot = (IInvSlot)i$.next(); + final ItemStack stack = slot.getStackInSlot(); + for (final Map.Entry<ItemStack, Integer> entry : BeeManager.inducers.entrySet()) { + if (ItemStackUtil.isIdenticalItem(entry.getKey(), stack)) { slot.decreaseStackInSlot(); - return ((Integer)entry.getValue()).intValue(); + return entry.getValue().intValue(); } } } - IInvSlot slot; - ItemStack stack; + final IInvSlot slot; + final ItemStack stack; return 0; } private void trySpawnSwarm() { - ItemStack toSpawn = (ItemStack)this.pendingSpawns.peek(); - HiveDescriptionSwarmer hiveDescription = new HiveDescriptionSwarmer(new ItemStack[] { toSpawn }); - Hive hive = new Hive(hiveDescription); + final ItemStack toSpawn = this.pendingSpawns.peek(); + final HiveDescriptionSwarmer hiveDescription = new HiveDescriptionSwarmer(new ItemStack[] { toSpawn }); + final Hive hive = new Hive(hiveDescription); - int chunkX = (this.xCoord + this.worldObj.rand.nextInt(80) - 40) / 16; - int chunkZ = (this.zCoord + this.worldObj.rand.nextInt(80) - 40) / 16; + final int chunkX = ((this.xCoord + this.worldObj.rand.nextInt(80)) - 40) / 16; + final int chunkZ = ((this.zCoord + this.worldObj.rand.nextInt(80)) - 40) / 16; if (HiveDecorator.genHive(this.worldObj, this.worldObj.rand, chunkX, chunkZ, hive)) { this.pendingSpawns.pop(); } } @Override - protected void encodeDescriptionPacket(NBTTagCompound packetData) + protected void encodeDescriptionPacket(final NBTTagCompound packetData) { super.encodeDescriptionPacket(packetData); packetData.setBoolean("Active", this.active); } @Override - protected void decodeDescriptionPacket(NBTTagCompound packetData) + protected void decodeDescriptionPacket(final NBTTagCompound packetData) { super.decodeDescriptionPacket(packetData); - setActive(packetData.getBoolean("Active")); + this.setActive(packetData.getBoolean("Active")); } @Override - public int getIcon(int side) + public int getIcon(final int side) { if ((side == 0) || (side == 1)) { return 2; @@ -159,31 +158,31 @@ implements ISidedFrameWearingInventory, IActivatable, IAlvearyComponent.Active, } @Override - public void readFromNBT(NBTTagCompound nbttagcompound) + public void readFromNBT(final NBTTagCompound nbttagcompound) { super.readFromNBT(nbttagcompound); - setActive(nbttagcompound.getBoolean("Active")); + this.setActive(nbttagcompound.getBoolean("Active")); - NBTTagList nbttaglist = nbttagcompound.getTagList("PendingSpawns", 10); + final NBTTagList nbttaglist = nbttagcompound.getTagList("PendingSpawns", 10); for (int i = 0; i < nbttaglist.tagCount(); i++) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + final NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); this.pendingSpawns.add(ItemStack.loadItemStackFromNBT(nbttagcompound1)); } } @Override - public void writeToNBT(NBTTagCompound nbttagcompound) + public void writeToNBT(final NBTTagCompound nbttagcompound) { super.writeToNBT(nbttagcompound); nbttagcompound.setBoolean("Active", this.active); - NBTTagList nbttaglist = new NBTTagList(); - ItemStack[] offspring = (ItemStack[])this.pendingSpawns.toArray(new ItemStack[this.pendingSpawns.size()]); + final NBTTagList nbttaglist = new NBTTagList(); + final ItemStack[] offspring = this.pendingSpawns.toArray(new ItemStack[this.pendingSpawns.size()]); for (int i = 0; i < offspring.length; i++) { if (offspring[i] != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + final NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte)i); offspring[i].writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); @@ -199,7 +198,7 @@ implements ISidedFrameWearingInventory, IActivatable, IAlvearyComponent.Active, } @Override - public void setActive(boolean active) + public void setActive(final boolean active) { if (this.active == active) { return; @@ -211,42 +210,42 @@ implements ISidedFrameWearingInventory, IActivatable, IAlvearyComponent.Active, } @Override - public Object getGui(EntityPlayer player, int data) + public Object getGui(final EntityPlayer player, final int data) { return new GUI_FrameHousing(this, player); } @Override - public Object getContainer(EntityPlayer player, int data) + public Object getContainer(final EntityPlayer player, final int data) { return new CONTAINER_FrameHousing(this, player); } private final IBeeModifier beeModifier = new AlvearyBeeModifier(); - //private final IBeeListener beeListener = new AlvearyBeeListener(this); - private final Iterable<IBeeListener> beeListenerList = ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeListeners(); + //private final IBeeListener beeListener = new AlvearyBeeListener(this); + private final Iterable<IBeeListener> beeListenerList = this.getMultiblockLogic().getController().getBeeListeners(); @Override public Collection<IBeeModifier> getBeeModifiers() { - List<IBeeModifier> beeModifiers = new ArrayList<IBeeModifier>(); + final List<IBeeModifier> beeModifiers = new ArrayList<>(); beeModifiers.add(this.beeModifier); - for (IHiveFrame frame : getFrames(this.inventory)) { + for (final IHiveFrame frame : this.getFrames(this.inventory)) { beeModifiers.add(frame.getBeeModifier()); } return beeModifiers; } - public Collection<IHiveFrame> getFrames(IInventory inventory) + public Collection<IHiveFrame> getFrames(final IInventory inventory) { - Collection<IHiveFrame> hiveFrames = new ArrayList<IHiveFrame>(inventory.getSizeInventory()); + final Collection<IHiveFrame> hiveFrames = new ArrayList<>(inventory.getSizeInventory()); for (int i = 0; i < inventory.getSizeInventory(); i++) { - ItemStack stackInSlot = getStackInSlot(i); + final ItemStack stackInSlot = this.getStackInSlot(i); if (stackInSlot != null) { - Item itemInSlot = stackInSlot.getItem(); + final Item itemInSlot = stackInSlot.getItem(); if ((itemInSlot instanceof IHiveFrame)) { hiveFrames.add((IHiveFrame)itemInSlot); } @@ -257,10 +256,10 @@ implements ISidedFrameWearingInventory, IActivatable, IAlvearyComponent.Active, @Override public IBeeModifier getBeeModifier() { - List<IBeeModifier> beeModifiers = new ArrayList<IBeeModifier>(); + final List<IBeeModifier> beeModifiers = new ArrayList<>(); //beeModifiers.add(this.beeModifier); - for (IHiveFrame frame : getFrames(this.inventory)) { + for (final IHiveFrame frame : this.getFrames(this.inventory)) { beeModifiers.add(frame.getBeeModifier()); } return beeModifiers.get(0); @@ -268,32 +267,32 @@ implements ISidedFrameWearingInventory, IActivatable, IAlvearyComponent.Active, private ItemStack getQueenStack() { - ItemStack queenStack = ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeInventory().getQueen(); + final ItemStack queenStack = this.getMultiblockLogic().getController().getBeeInventory().getQueen(); return queenStack; } @Override - public void wearOutFrames(IBeeHousing beeHousing, int amount) + public void wearOutFrames(final IBeeHousing beeHousing, final int amount) { - IBeekeepingMode beekeepingMode = BeeManager.beeRoot.getBeekeepingMode(beeHousing.getWorld()); - int wear = Math.round(amount * beekeepingMode.getWearModifier()); + final IBeekeepingMode beekeepingMode = BeeManager.beeRoot.getBeekeepingMode(beeHousing.getWorld()); + final int wear = Math.round(amount * beekeepingMode.getWearModifier()); for (int i = 0; i < this.inventory.getSizeInventory(); i++) { - ItemStack hiveFrameStack = getStackInSlot(i); + final ItemStack hiveFrameStack = this.getStackInSlot(i); if (hiveFrameStack != null) { - Item hiveFrameItem = hiveFrameStack.getItem(); + final Item hiveFrameItem = hiveFrameStack.getItem(); if ((hiveFrameItem instanceof IHiveFrame)) { - IHiveFrame hiveFrame = (IHiveFrame)hiveFrameItem; + final IHiveFrame hiveFrame = (IHiveFrame)hiveFrameItem; Utils.LOG_INFO("Wearing out frame by "+amount); - ItemStack queenStack = getQueenStack(); - IBee queen = BeeManager.beeRoot.getMember(queenStack); - ItemStack usedFrame = hiveFrame.frameUsed(beeHousing, hiveFrameStack, queen, wear); + final ItemStack queenStack = this.getQueenStack(); + final IBee queen = BeeManager.beeRoot.getMember(queenStack); + final ItemStack usedFrame = hiveFrame.frameUsed(beeHousing, hiveFrameStack, queen, wear); //((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeListeners(). - - setInventorySlotContents(i, usedFrame); + + this.setInventorySlotContents(i, usedFrame); } } } @@ -301,42 +300,42 @@ implements ISidedFrameWearingInventory, IActivatable, IAlvearyComponent.Active, @Override public InventoryFrameHousing getAlvearyInventory() { - return inventory; + return this.inventory; } @Override public IBeeListener getBeeListener() { - return beeListener; + return this.beeListener; } - + static class AlvearyFrameHousingBeeListener - extends DefaultBeeListener - { - private final InventoryFrameHousing inventory; - - public AlvearyFrameHousingBeeListener(InventoryFrameHousing inventory) - { - this.inventory = inventory; - } - - @Override - public boolean onPollenRetrieved(IIndividual pollen) - { - /*if (!((Object) this.inventory).canStorePollen()) { + extends DefaultBeeListener + { + private final InventoryFrameHousing inventory; + + public AlvearyFrameHousingBeeListener(final InventoryFrameHousing inventory) + { + this.inventory = inventory; + } + + @Override + public boolean onPollenRetrieved(final IIndividual pollen) + { + /*if (!((Object) this.inventory).canStorePollen()) { return false; }*/ - ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(pollen.getClass()); - - ItemStack pollenStack = speciesRoot.getMemberStack(pollen, EnumGermlingType.POLLEN.ordinal()); - if (pollenStack != null) - { - // ((Object) this.inventory).storePollenStack(pollenStack); - return true; - } - return false; - } - } - - - + final ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(pollen.getClass()); + + final ItemStack pollenStack = speciesRoot.getMemberStack(pollen, EnumGermlingType.POLLEN.ordinal()); + if (pollenStack != null) + { + // ((Object) this.inventory).storePollenStack(pollenStack); + return true; + } + return false; + } + } + + + } diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/CONTAINER_FrameHousing.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/CONTAINER_FrameHousing.java index 5e218667f6..b1c94ddc47 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/CONTAINER_FrameHousing.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/CONTAINER_FrameHousing.java @@ -13,7 +13,7 @@ import net.minecraft.util.ResourceLocation; public class CONTAINER_FrameHousing extends Container { - private TileAlvearyFrameHousing te; + private final TileAlvearyFrameHousing te; public static final int INPUT_1 = 0; private final ResourceLocation beeFrameIcon = new ResourceLocation(CORE.MODID, "textures/items/machine_Charger.png"); @@ -22,58 +22,58 @@ public class CONTAINER_FrameHousing extends Container private int slotID = 0; - public CONTAINER_FrameHousing(TileAlvearyFrameHousing te, EntityPlayer player) + public CONTAINER_FrameHousing(final TileAlvearyFrameHousing te, final EntityPlayer player) { this.te = te; - this.beeFrameSlot = new SlotFrame(te, slotID++, 80, 35); + this.beeFrameSlot = new SlotFrame(te, this.slotID++, 80, 35); //Fuel Slot A - beeFrameSlot.setBackgroundIconTexture(beeFrameIcon); - - addSlotToContainer(beeFrameSlot); + this.beeFrameSlot.setBackgroundIconTexture(this.beeFrameIcon); + + this.addSlotToContainer(this.beeFrameSlot); //Inventory for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { - addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + this.addSlotToContainer(new Slot(player.inventory, j + (i * 9) + 9, 8 + (j * 18), 84 + (i * 18))); } } // Hotbar for (int i = 0; i < 9; i++) { - addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); + this.addSlotToContainer(new Slot(player.inventory, i, 8 + (i * 18), 142)); } } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) + public ItemStack transferStackInSlot(final EntityPlayer player, final int slotRaw) { ItemStack stack = null; - Slot slot = (Slot)inventorySlots.get(slotRaw); + final Slot slot = (Slot)this.inventorySlots.get(slotRaw); - if (slot != null && slot.getHasStack()) + if ((slot != null) && slot.getHasStack()) { - ItemStack stackInSlot = slot.getStack(); + final ItemStack stackInSlot = slot.getStack(); stack = stackInSlot.copy(); - - + + //If your inventory only stores certain instances of Items, //you can implement shift-clicking to your inventory like this: // Check that the item is the right type if (!(stack.getItem() instanceof IHiveFrame)){ - return null; + return null; } if (slotRaw < 1) { - if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) + if (!this.mergeItemStack(stackInSlot, 3 * 9, this.inventorySlots.size(), true)) { return null; } } - else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) + else if (!this.mergeItemStack(stackInSlot, 0, 3 * 9, false)) { return null; } @@ -91,8 +91,8 @@ public class CONTAINER_FrameHousing extends Container } @Override - public boolean canInteractWith(EntityPlayer player) + public boolean canInteractWith(final EntityPlayer player) { - return te.isUseableByPlayer(player); + return this.te.isUseableByPlayer(player); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/GUI_FrameHousing.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/GUI_FrameHousing.java index dcf8da3a1a..869a77f92d 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/GUI_FrameHousing.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/GUI_FrameHousing.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.forestry.bees.alveary.gui; +import org.lwjgl.opengl.GL11; + import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.forestry.bees.alveary.TileAlvearyFrameHousing; import net.minecraft.client.Minecraft; @@ -9,41 +11,39 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; - public class GUI_FrameHousing extends GuiContainer { - private ResourceLocation texture = new ResourceLocation(CORE.MODID, "textures/gui/machine_Charger.png"); - - private InventoryPlayer inventory; - private TileAlvearyFrameHousing te; - - public GUI_FrameHousing(TileAlvearyFrameHousing te, EntityPlayer player) - { - super(new CONTAINER_FrameHousing(te, player)); - inventory = player.inventory; - this.te = te; - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) - { - Minecraft.getMinecraft().renderEngine.bindTexture(texture); - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) - { - fontRendererObj.drawString(I18n.format("Alveary Frame Housing"), (xSize / 2) - (fontRendererObj.getStringWidth(I18n.format("Alveary Frame Housing")) / 2), 6, 4210752, false); - fontRendererObj.drawString(I18n.format(inventory.getInventoryName()), 8, ySize - 96 + 2, 4210752); - //fontRendererObj.drawString(I18n.format("Charge:"+te.getCharge()+"~"), 8, ySize - 96 + 2, 4210752); - //fontRendererObj.drawString(I18n.format("Progress:"+te.getProgress()+"ticks"), 80, ySize - 96 + 2, 4210752); - } + private final ResourceLocation texture = new ResourceLocation(CORE.MODID, "textures/gui/machine_Charger.png"); + + private final InventoryPlayer inventory; + private final TileAlvearyFrameHousing te; + + public GUI_FrameHousing(final TileAlvearyFrameHousing te, final EntityPlayer player) + { + super(new CONTAINER_FrameHousing(te, player)); + this.inventory = player.inventory; + this.te = te; + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) + { + Minecraft.getMinecraft().renderEngine.bindTexture(this.texture); + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } + + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) + { + this.fontRendererObj.drawString(I18n.format("Alveary Frame Housing"), (this.xSize / 2) - (this.fontRendererObj.getStringWidth(I18n.format("Alveary Frame Housing")) / 2), 6, 4210752, false); + this.fontRendererObj.drawString(I18n.format(this.inventory.getInventoryName()), 8, (this.ySize - 96) + 2, 4210752); + //fontRendererObj.drawString(I18n.format("Charge:"+te.getCharge()+"~"), 8, ySize - 96 + 2, 4210752); + //fontRendererObj.drawString(I18n.format("Progress:"+te.getProgress()+"ticks"), 80, ySize - 96 + 2, 4210752); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/InventoryFrameHousing.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/InventoryFrameHousing.java index 9139c52b37..cde673e952 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/InventoryFrameHousing.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/InventoryFrameHousing.java @@ -1,11 +1,5 @@ package gtPlusPlus.xmod.forestry.bees.alveary.gui; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; - import com.mojang.authlib.GameProfile; import forestry.api.apiculture.*; @@ -14,92 +8,97 @@ import forestry.core.inventory.InventoryAdapterTile; import forestry.core.utils.ItemStackUtil; import gtPlusPlus.xmod.forestry.bees.alveary.IAlvearyFrameHousing; import gtPlusPlus.xmod.forestry.bees.alveary.TileAlvearyFrameHousing; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; public class InventoryFrameHousing extends InventoryAdapterTile<TileAlvearyFrameHousing> implements IAlvearyFrameHousing { - + TileAlvearyFrameHousing alvearyFrame; - - public InventoryFrameHousing(TileAlvearyFrameHousing alvearyFrame) + + public InventoryFrameHousing(final TileAlvearyFrameHousing alvearyFrame) { super(alvearyFrame, 1, "FrameHousingInv"); this.alvearyFrame = alvearyFrame; } @Override - public boolean canSlotAccept(int slotIndex, ItemStack itemStack) + public boolean canSlotAccept(final int slotIndex, final ItemStack itemStack) { return ItemStackUtil.containsItemStack(BeeManager.inducers.keySet(), itemStack); } @Override public boolean canBlockSeeTheSky() { - return alvearyFrame.canBlockSeeTheSky(); + return this.alvearyFrame.canBlockSeeTheSky(); } @Override public Vec3 getBeeFXCoordinates() { - return alvearyFrame.getBeeFXCoordinates(); + return this.alvearyFrame.getBeeFXCoordinates(); } @Override public IBeeHousingInventory getBeeInventory() { - return alvearyFrame.getBeeInventory(); + return this.alvearyFrame.getBeeInventory(); } @Override public Iterable<IBeeListener> getBeeListeners() { - return alvearyFrame.getBeeListeners(); + return this.alvearyFrame.getBeeListeners(); } @Override public Iterable<IBeeModifier> getBeeModifiers() { - return alvearyFrame.getBeeModifiers(); + return this.alvearyFrame.getBeeModifiers(); } @Override public IBeekeepingLogic getBeekeepingLogic() { - return alvearyFrame.getBeekeepingLogic(); + return this.alvearyFrame.getBeekeepingLogic(); } @Override public BiomeGenBase getBiome() { - return alvearyFrame.getBiome(); + return this.alvearyFrame.getBiome(); } @Override public int getBlockLightValue() { - return alvearyFrame.getBlockLightValue(); + return this.alvearyFrame.getBlockLightValue(); } @Override public EnumHumidity getHumidity() { - return alvearyFrame.getHumidity(); + return this.alvearyFrame.getHumidity(); } @Override public GameProfile getOwner() { - return alvearyFrame.getOwner(); + return this.alvearyFrame.getOwner(); } @Override public EnumTemperature getTemperature() { - return alvearyFrame.getTemperature(); + return this.alvearyFrame.getTemperature(); } @Override public World getWorld() { - return alvearyFrame.getWorld(); + return this.alvearyFrame.getWorld(); } @Override public ChunkCoordinates getCoordinates() { - return alvearyFrame.getCoordinates(); + return this.alvearyFrame.getCoordinates(); } @Override public IErrorLogic getErrorLogic() { - return alvearyFrame.getErrorLogic(); + return this.alvearyFrame.getErrorLogic(); } @Override @@ -108,7 +107,7 @@ public class InventoryFrameHousing extends InventoryAdapterTile<TileAlvearyFrame } @Override - public void wearOutFrames(IBeeHousing beeHousing, int amount) { - alvearyFrame.wearOutFrames(beeHousing, amount); + public void wearOutFrames(final IBeeHousing beeHousing, final int amount) { + this.alvearyFrame.wearOutFrames(beeHousing, amount); } } diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java b/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java index a4d842edad..f3f4367b75 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java @@ -9,13 +9,13 @@ * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ package gtPlusPlus.xmod.forestry.bees.items; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; import forestry.core.utils.StringUtil; import gtPlusPlus.core.lib.LoadedMods; import net.minecraft.item.*; import net.minecraft.util.WeightedRandomChestContent; import net.minecraftforge.common.ChestGenHooks; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; public class FR_ItemRegistry { @@ -40,7 +40,7 @@ public class FR_ItemRegistry { @Optional.Method(modid = "Forestry") - public static void Register() { + public static void Register() { //Forestry Frames //frameUntreated = registerItem(new FR_ItemHiveFrame(80, 0.9f), "frameUntreated"); @@ -63,7 +63,7 @@ public class FR_ItemRegistry { hiveFrameCaged = new MB_ItemFrame(MB_FrameType.CAGE, EnumRarity.common, ""); hiveFrameSoul = new MB_ItemFrame(MB_FrameType.SOUL, EnumRarity.common, ""); hiveFrameClay = new MB_ItemFrame(MB_FrameType.CLAY, EnumRarity.common, ""); - hiveFrameNova = new MB_ItemFrame(MB_FrameType.NOVA, EnumRarity.epic, "A Creative Only Frame."); + hiveFrameNova = new MB_ItemFrame(MB_FrameType.NOVA, EnumRarity.epic, "A Creative Only Frame."); } @@ -71,7 +71,7 @@ public class FR_ItemRegistry { } - protected static <T extends Item> T registerItem(T item, String name) { + protected static <T extends Item> T registerItem(final T item, final String name) { item.setUnlocalizedName(name); GameRegistry.registerItem(item, StringUtil.cleanItemName(item)); return item; diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java b/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java index 69065bec24..e075bf1eda 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java @@ -4,7 +4,7 @@ import net.minecraft.util.StatCollector; public class FR_StringUtil { - public static String getLocalizedString(String key) + public static String getLocalizedString(final String key) { if(StatCollector.canTranslate(key)) { @@ -13,7 +13,7 @@ public class FR_StringUtil return StatCollector.translateToFallback(key); } - public static String getLocalizedString(String key, Object... objects) + public static String getLocalizedString(final String key, final Object... objects) { if(StatCollector.canTranslate(key)) { diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_FrameType.java b/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_FrameType.java index 5a61c94196..ef3e2f58c3 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_FrameType.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_FrameType.java @@ -6,15 +6,15 @@ import forestry.api.apiculture.IBeeModifier; public enum MB_FrameType implements IBeeModifier { //ExtraBees Clone Frames - //Name, FrameHP, territory (1f), Mutation rate, lifespan rate, production rate, genetic decay (1f) + //Name, FrameHP, territory (1f), Mutation rate, lifespan rate, production rate, genetic decay (1f) COCOA("Chocolate", 240, 1.0f, 1.0f, 0.50f, 1.50f, 1f), CAGE("Restraint", 240, 0.5f, 1.0f, 0.75f, 0.75f, 1f), SOUL("Soul", 80, 1.0f, 1.5f, 0.75f, 0.25f, 1f), CLAY("Healing", 240, 1.0f, 0.5f, 1.50f, 0.75f, 1f), NOVA("Nova", 240, 1.0f, 100.0f, 0.0001f, 1.00f, 1f), - - - //Name, FrameHP, territory (1f), Mutation rate, lifespan rate, production rate, genetic decay (1f) + + + //Name, FrameHP, territory (1f), Mutation rate, lifespan rate, production rate, genetic decay (1f) ACCELERATED("Accelerated", 175, 1f, 2.5f, 0.9f, 1.8f, 1f), VOID("Void", 20, 1f, 1f, 0.0001f, 10f, 1f), MUTAGENIC("Mutagenic", 3, 1f, 10f, 0.0001f, 10f, 1f), @@ -33,18 +33,18 @@ public enum MB_FrameType implements IBeeModifier private final boolean isLit; private final boolean isSunlit; private final boolean isHellish; - - MB_FrameType(String name, int damage, float territory, float mutation, float lifespan, float production, float geneticDecay) { + + MB_FrameType(final String name, final int damage, final float territory, final float mutation, final float lifespan, final float production, final float geneticDecay) { this(name, damage, territory, mutation, lifespan, production, 1f, geneticDecay, false, false, false, false); } - - MB_FrameType(String name, int damage, - float territory, float mutation, float lifespan, float production, float flowering, float geneticDecay, - boolean sealed, boolean lit, boolean sunlit, boolean hellish) + + MB_FrameType(final String name, final int damage, + final float territory, final float mutation, final float lifespan, final float production, final float flowering, final float geneticDecay, + final boolean sealed, final boolean lit, final boolean sunlit, final boolean hellish) { this.frameName = name; this.maxDamage = damage; - + this.territoryMod = territory; this.mutationMod = mutation; this.lifespanMod = lifespan; @@ -61,59 +61,59 @@ public enum MB_FrameType implements IBeeModifier { return this.frameName; } - + public String getLocalizedName() { return FR_StringUtil.getLocalizedString("frame." + this.frameName); } @Override - public float getTerritoryModifier(IBeeGenome genome, float currentModifier) { - return territoryMod; + public float getTerritoryModifier(final IBeeGenome genome, final float currentModifier) { + return this.territoryMod; } @Override - public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { - return mutationMod; + public float getMutationModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) { + return this.mutationMod; } @Override - public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { - return lifespanMod; + public float getLifespanModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) { + return this.lifespanMod; } @Override - public float getProductionModifier(IBeeGenome genome, float currentModifier) { - return productionMod; + public float getProductionModifier(final IBeeGenome genome, final float currentModifier) { + return this.productionMod; } @Override - public float getFloweringModifier(IBeeGenome genome, float currentModifier) { - return floweringMod; + public float getFloweringModifier(final IBeeGenome genome, final float currentModifier) { + return this.floweringMod; } @Override - public float getGeneticDecay(IBeeGenome genome, float currentModifier) { - return geneticDecayMod; + public float getGeneticDecay(final IBeeGenome genome, final float currentModifier) { + return this.geneticDecayMod; } @Override public boolean isSealed() { - return isSealed; + return this.isSealed; } @Override public boolean isSelfLighted() { - return isLit; + return this.isLit; } @Override public boolean isSunlightSimulated() { - return isSunlit; + return this.isSunlit; } @Override public boolean isHellish() { - return isHellish; + return this.isHellish; } } diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_ItemFrame.java b/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_ItemFrame.java index 1dc6f25d89..6e9a2006d0 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_ItemFrame.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_ItemFrame.java @@ -2,29 +2,29 @@ package gtPlusPlus.xmod.forestry.bees.items; import java.util.List; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.*; -import net.minecraft.util.EnumChatFormatting; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import forestry.api.apiculture.*; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.*; +import net.minecraft.util.EnumChatFormatting; public class MB_ItemFrame extends Item implements IHiveFrame { - private MB_FrameType type; + private final MB_FrameType type; private EnumRarity rarity_value = EnumRarity.uncommon; private final String toolTip; - public MB_ItemFrame(MB_FrameType frameType, String description) + public MB_ItemFrame(final MB_FrameType frameType, final String description) { this(frameType, EnumRarity.uncommon, description); } - - public MB_ItemFrame(MB_FrameType frameType, EnumRarity rarity, String description) + + public MB_ItemFrame(final MB_FrameType frameType, final EnumRarity rarity, final String description) { super(); this.type = frameType; @@ -36,26 +36,26 @@ public class MB_ItemFrame extends Item implements IHiveFrame this.toolTip = description; GameRegistry.registerItem(this, "frame" + frameType.getName()); } - + @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (toolTip != "" || !toolTip.equals("")){ - list.add(EnumChatFormatting.GRAY+toolTip); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if ((this.toolTip != "") || !this.toolTip.equals("")){ + list.add(EnumChatFormatting.GRAY+this.toolTip); } super.addInformation(stack, aPlayer, list, bool); - } - + } + @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) + public void registerIcons(final IIconRegister par1IconRegister) { - this.itemIcon = par1IconRegister.registerIcon(CORE.MODID + ":frame" + type.getName()); + this.itemIcon = par1IconRegister.registerIcon(CORE.MODID + ":frame" + this.type.getName()); } - + // --------- IHiveFrame functions ----------------------------------------- - + @Override - public ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear) { + public ItemStack frameUsed(final IBeeHousing housing, ItemStack frame, final IBee queen, final int wear) { frame.setItemDamage(frame.getItemDamage() + wear); if (frame.getItemDamage() >= frame.getMaxDamage()) { @@ -65,70 +65,71 @@ public class MB_ItemFrame extends Item implements IHiveFrame return frame; } - - + + @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ - return rarity_value; + public EnumRarity getRarity(final ItemStack par1ItemStack){ + return this.rarity_value; } - + @Override - public boolean hasEffect(ItemStack par1ItemStack){ - if (rarity_value == EnumRarity.uncommon || rarity_value == EnumRarity.common){ + public boolean hasEffect(final ItemStack par1ItemStack){ + if ((this.rarity_value == EnumRarity.uncommon) || (this.rarity_value == EnumRarity.common)){ return false; } return true; } + @Override public IBeeModifier getBeeModifier() { - return type; + return this.type; } - + @Override - public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) + public boolean isBookEnchantable(final ItemStack itemstack1, final ItemStack itemstack2) { return false; } - - public float getTerritoryModifier(IBeeGenome genome, float currentModifier) { - return type.getTerritoryModifier(genome, currentModifier); + + public float getTerritoryModifier(final IBeeGenome genome, final float currentModifier) { + return this.type.getTerritoryModifier(genome, currentModifier); } - public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { - return type.getMutationModifier(genome, mate, currentModifier); + public float getMutationModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) { + return this.type.getMutationModifier(genome, mate, currentModifier); } - public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { - return type.getLifespanModifier(genome, mate, currentModifier); + public float getLifespanModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) { + return this.type.getLifespanModifier(genome, mate, currentModifier); } - public float getProductionModifier(IBeeGenome genome, float currentModifier) { - return type.getProductionModifier(genome, currentModifier); + public float getProductionModifier(final IBeeGenome genome, final float currentModifier) { + return this.type.getProductionModifier(genome, currentModifier); } - public float getFloweringModifier(IBeeGenome genome, float currentModifier) { - return type.getFloweringModifier(genome, currentModifier); + public float getFloweringModifier(final IBeeGenome genome, final float currentModifier) { + return this.type.getFloweringModifier(genome, currentModifier); } - public float getGeneticDecay(IBeeGenome genome, float currentModifier) { - return type.getGeneticDecay(genome, currentModifier); + public float getGeneticDecay(final IBeeGenome genome, final float currentModifier) { + return this.type.getGeneticDecay(genome, currentModifier); } public boolean isSealed() { - return type.isSealed(); + return this.type.isSealed(); } public boolean isSelfLighted() { - return type.isSelfLighted(); + return this.type.isSelfLighted(); } public boolean isSunlightSimulated() { - return type.isSunlightSimulated(); + return this.type.isSunlightSimulated(); } - + public boolean isHellish(){ - return type.isHellish(); + return this.type.isHellish(); } } diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/recipe/FR_Gregtech_Recipes.java b/src/Java/gtPlusPlus/xmod/forestry/bees/recipe/FR_Gregtech_Recipes.java index ced6dd1d27..32dbaa50c9 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/recipe/FR_Gregtech_Recipes.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/recipe/FR_Gregtech_Recipes.java @@ -9,7 +9,7 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; public class FR_Gregtech_Recipes { - + private static String rod_ElectrumFlux = "stickElectrumFlux"; private static String rod_LongElectrumFlux = "stickLongElectrumFlux"; private static String foil_Electrum = "foilElectrum"; @@ -18,14 +18,14 @@ public class FR_Gregtech_Recipes { private static String foil_Uranium235 = "foilUranium235"; private static ItemStack hiveFrameAccelerated = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameAccelerated); private static ItemStack hiveFrameMutagenic = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameMutagenic); - + private static ItemStack hiveFrameCocoa = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameCocoa); private static ItemStack hiveFrameCaged = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameCaged); private static ItemStack hiveFrameSoul = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameSoul); private static ItemStack hiveFrameClay = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameClay); private static ItemStack hiveFrameNova = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameNova); - + private static ItemStack hiveFrameImpregnated = ItemUtils.getItemStack("Forestry:frameImpregnated", 1); private static ItemStack blockSoulSand = new ItemStack(Blocks.soul_sand, 1); private static ItemStack blockIronBars = new ItemStack (Blocks.iron_bars, 1); @@ -34,49 +34,49 @@ public class FR_Gregtech_Recipes { public static void registerItems(){ - + //Magic Bee Like Frames RecipeUtils.recipeBuilder( rod_LongElectrumFlux, rod_ElectrumFlux, rod_LongElectrumFlux, rod_LongElectrumFlux, foil_Electrum, rod_LongElectrumFlux, rod_ElectrumFlux, rod_ElectrumFlux, rod_ElectrumFlux, hiveFrameAccelerated); - + RecipeUtils.recipeBuilder( rod_LongUranium, rod_Uranium, rod_LongUranium, rod_LongUranium, foil_Uranium235, rod_LongUranium, rod_Uranium, rod_Uranium, rod_Uranium, hiveFrameMutagenic); - + if (!LoadedMods.ExtraBees){ - //Extra Bee Like Frames - RecipeUtils.recipeBuilder( - null, itemCocoaBeans, null, - itemCocoaBeans, hiveFrameImpregnated, itemCocoaBeans, - null, itemCocoaBeans, null, - hiveFrameCocoa); - - RecipeUtils.recipeBuilder( - hiveFrameImpregnated, blockIronBars, null, - null, null, null, - null, null, null, - hiveFrameCaged); - - RecipeUtils.recipeBuilder( - hiveFrameImpregnated, blockSoulSand, null, - null, null, null, - null, null, null, - hiveFrameSoul); - - RecipeUtils.recipeBuilder( - null, itemClayDust, null, - itemClayDust, hiveFrameImpregnated, itemClayDust, - null, itemClayDust, null, - hiveFrameClay); + //Extra Bee Like Frames + RecipeUtils.recipeBuilder( + null, itemCocoaBeans, null, + itemCocoaBeans, hiveFrameImpregnated, itemCocoaBeans, + null, itemCocoaBeans, null, + hiveFrameCocoa); + + RecipeUtils.recipeBuilder( + hiveFrameImpregnated, blockIronBars, null, + null, null, null, + null, null, null, + hiveFrameCaged); + + RecipeUtils.recipeBuilder( + hiveFrameImpregnated, blockSoulSand, null, + null, null, null, + null, null, null, + hiveFrameSoul); + + RecipeUtils.recipeBuilder( + null, itemClayDust, null, + itemClayDust, hiveFrameImpregnated, itemClayDust, + null, itemClayDust, null, + hiveFrameClay); } - - - + + + } - + } diff --git a/src/Java/gtPlusPlus/xmod/forestry/trees/TreefarmManager.java b/src/Java/gtPlusPlus/xmod/forestry/trees/TreefarmManager.java index 5617d820d0..74a627b2c5 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/trees/TreefarmManager.java +++ b/src/Java/gtPlusPlus/xmod/forestry/trees/TreefarmManager.java @@ -1,5 +1,6 @@ package gtPlusPlus.xmod.forestry.trees; +import cpw.mods.fml.common.Optional; import gregtech.api.enums.OrePrefixes; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; @@ -10,7 +11,6 @@ import net.minecraft.block.BlockAir; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.Optional; public class TreefarmManager { @@ -44,30 +44,30 @@ public class TreefarmManager { } @Optional.Method(modid = "Forestry") - public static Block getHumus(){ + public static Block getHumus(){ if(blockHumus != null){ return blockHumus; } else if (ReflectionUtils.doesClassExist("forestry.core.blocks.BlockSoil")){ - try { - Class<?> humusClass = Class.forName("forestry.core.blocks.BlockSoil"); - ItemStack humusStack = ItemUtils.getCorrectStacktype("Forestry:soil", 1); + try { + final Class<?> humusClass = Class.forName("forestry.core.blocks.BlockSoil"); + final ItemStack humusStack = ItemUtils.getCorrectStacktype("Forestry:soil", 1); if (humusClass != null){ blockHumus = Block.getBlockFromItem(humusStack.getItem()); return Block.getBlockFromItem(humusStack.getItem()); } - } catch (ClassNotFoundException e) {} + } catch (final ClassNotFoundException e) {} } return null; } - public static boolean isWoodLog(Block log){ - String tTool = log.getHarvestTool(0); + public static boolean isWoodLog(final Block log){ + final String tTool = log.getHarvestTool(0); - if (log == Blocks.log || log == Blocks.log2){ + if ((log == Blocks.log) || (log == Blocks.log2)){ return true; } - + //Forestry/General Compat if (log.getClass().getName().toLowerCase().contains("blocklog")){ return true; @@ -78,10 +78,10 @@ public class TreefarmManager { return true; } - return OrePrefixes.log.contains(new ItemStack(log, 1))&& ((tTool != null) && (tTool.equals("axe"))) || (log.getMaterial() != Material.wood) ? false : (OrePrefixes.fence.contains(new ItemStack(log, 1)) ? false : true); + return (OrePrefixes.log.contains(new ItemStack(log, 1))&& ((tTool != null) && (tTool.equals("axe")))) || (log.getMaterial() != Material.wood) ? false : (OrePrefixes.fence.contains(new ItemStack(log, 1)) ? false : true); } - public static boolean isLeaves(Block log){ + public static boolean isLeaves(final Block log){ if (log.getUnlocalizedName().toLowerCase().contains("leaf")){ return true; } @@ -93,11 +93,11 @@ public class TreefarmManager { } if (log.getLocalizedName().toLowerCase().contains("leaves")){ return true; - } + } return OrePrefixes.leaves.contains(new ItemStack(log, 1)) || (log.getMaterial() == Material.leaves); } - public static boolean isSapling(Block log){ + public static boolean isSapling(final Block log){ if (log != null){ if (OrePrefixes.sapling.contains(new ItemStack(log, 1))){ Utils.LOG_INFO(""+log.getLocalizedName()); @@ -110,15 +110,15 @@ public class TreefarmManager { return OrePrefixes.sapling.contains(new ItemStack(log, 1)); } - public static boolean isDirtBlock(Block dirt){ + public static boolean isDirtBlock(final Block dirt){ return (dirt == Blocks.dirt ? true : (dirt == Blocks.grass ? true : (getHumus() == null ? false : (dirt == blockHumus ? true : false)))); } - public static boolean isFenceBlock(Block fence){ - return (fence == Blocks.fence ? true : (fence == Blocks.fence_gate ? true : (fence == Blocks.nether_brick_fence ? true : (OrePrefixes.fence.contains(new ItemStack(fence, 1)) ? true : false)))); + public static boolean isFenceBlock(final Block fence){ + return (fence == Blocks.fence ? true : (fence == Blocks.fence_gate ? true : (fence == Blocks.nether_brick_fence ? true : (OrePrefixes.fence.contains(new ItemStack(fence, 1)) ? true : false)))); } - public static boolean isAirBlock(Block air){ + public static boolean isAirBlock(final Block air){ if (air.getLocalizedName().toLowerCase().contains("air")){ return true; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 1d6c97b24c..37c9e90fc5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -28,26 +28,26 @@ public class HANDLER_GT { //Load General Blocks and set up some Basic Meta Tile Entitie states Gregtech_Blocks.run(); - + //Register Tile Entities COMPAT_HANDLER.registerGregtechMachines(); - + //Add Custom Pipes, Wires and Cables. GregtechConduits.run(); - + //Only loads if the config option is true (default: true) if (CORE.configSwitches.enableSkookumChoochers){ new MetaGeneratedGregtechTools(); - new ProcessingToolHeadChoocher().run(); + new ProcessingToolHeadChoocher().run(); } - + //Generates recipes for all gregtech smelting and alloy smelting combinations. RecipeGen_BlastSmelterGT.generateRecipes(); - + } public static void postInit(){ - + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItemManager.java b/src/Java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItemManager.java index 311947e5e6..8bf42578cc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItemManager.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItemManager.java @@ -11,7 +11,7 @@ import net.minecraft.item.ItemStack; * - handle charging, taking amount, tier, transfer limit, canProvideEnergy and simulate into account * - replace item IDs if appropriate (getChargedItemId() and getEmptyItemId()) * - update and manage the damage value for the visual charge indicator - * + * * @note If you're implementing your own variant (ISpecialElectricItem), you can delegate to the * default implementations through ElectricItem.rawManager. The default implementation is designed * to minimize its dependency on its own constraints/structure and delegates most work back to the @@ -45,7 +45,7 @@ public interface IC2ElectricItemManager { /** * Determine the charge level for the specified item. - * + * * @param itemStack ItemStack containing the electric item * @return charge level in EU */ @@ -85,7 +85,7 @@ public interface IC2ElectricItemManager { /** * Get the tool tip to display for electric items. - * + * * @param itemStack ItemStack to determine the tooltip for * @return tool tip string or null for none */ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java index e2af820c16..f62db49f48 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java @@ -10,82 +10,82 @@ import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; public class CustomGtTextures { - public enum ItemIcons implements IIconContainer, Runnable { - VOID // The Empty Texture - , RENDERING_ERROR, WRENCH, MORTAR, CROWBAR, - JACKHAMMER, WIRE_CUTTER, KNIFE, BUTCHERYKNIFE, - SICKLE, SCOOP, GRAFTER, PLUNGER, ROLLING_PIN, - HANDLE_SWORD, HANDLE_FILE, HANDLE_SAW, - HANDLE_SCREWDRIVER, HANDLE_BUZZSAW, - HANDLE_ELECTRIC_SCREWDRIVER, HANDLE_SOLDERING, - POWER_UNIT_LV, POWER_UNIT_MV, POWER_UNIT_HV, - DURABILITY_BAR_0, DURABILITY_BAR_1, DURABILITY_BAR_2, - DURABILITY_BAR_3, DURABILITY_BAR_4, DURABILITY_BAR_5, - DURABILITY_BAR_6, DURABILITY_BAR_7, DURABILITY_BAR_8, - ENERGY_BAR_0, ENERGY_BAR_1, ENERGY_BAR_2, ENERGY_BAR_3, - ENERGY_BAR_4, ENERGY_BAR_5, ENERGY_BAR_6, ENERGY_BAR_7, - ENERGY_BAR_8, - - SKOOKUMCHOOCHER, TURBINE_SMALL, TURBINE_LARGE, TURBINE_HUGE; - - public static final ITexture[] ERROR_RENDERING = new ITexture[]{new GT_RenderedTexture(RENDERING_ERROR)}; - - protected IIcon mIcon, mOverlay; - - private ItemIcons() { - GregTech_API.sGTItemIconload.add(this); - } - - @Override - public IIcon getIcon() { - return mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return mOverlay; - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationItemsTexture; - } - - @Override - public void run() { - mIcon = GregTech_API.sItemIcons.registerIcon(CORE.RES_PATH_ITEM + "iconsets/" + this); - mOverlay = GregTech_API.sItemIcons.registerIcon(CORE.RES_PATH_ITEM + "iconsets/" + this + "_OVERLAY"); - } - - public static class CustomIcon implements IIconContainer, Runnable { - protected IIcon mIcon, mOverlay; - protected String mIconName; - - public CustomIcon(String aIconName) { - mIconName = aIconName; - GregTech_API.sGTItemIconload.add(this); - } - - @Override - public IIcon getIcon() { - return mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return mOverlay; - } - - @Override - public void run() { - mIcon = GregTech_API.sItemIcons.registerIcon(CORE.RES_PATH_ITEM + mIconName); - mOverlay = GregTech_API.sItemIcons.registerIcon(CORE.RES_PATH_ITEM + mIconName + "_OVERLAY"); - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationItemsTexture; - } - } - } + public enum ItemIcons implements IIconContainer, Runnable { + VOID // The Empty Texture + , RENDERING_ERROR, WRENCH, MORTAR, CROWBAR, + JACKHAMMER, WIRE_CUTTER, KNIFE, BUTCHERYKNIFE, + SICKLE, SCOOP, GRAFTER, PLUNGER, ROLLING_PIN, + HANDLE_SWORD, HANDLE_FILE, HANDLE_SAW, + HANDLE_SCREWDRIVER, HANDLE_BUZZSAW, + HANDLE_ELECTRIC_SCREWDRIVER, HANDLE_SOLDERING, + POWER_UNIT_LV, POWER_UNIT_MV, POWER_UNIT_HV, + DURABILITY_BAR_0, DURABILITY_BAR_1, DURABILITY_BAR_2, + DURABILITY_BAR_3, DURABILITY_BAR_4, DURABILITY_BAR_5, + DURABILITY_BAR_6, DURABILITY_BAR_7, DURABILITY_BAR_8, + ENERGY_BAR_0, ENERGY_BAR_1, ENERGY_BAR_2, ENERGY_BAR_3, + ENERGY_BAR_4, ENERGY_BAR_5, ENERGY_BAR_6, ENERGY_BAR_7, + ENERGY_BAR_8, + + SKOOKUMCHOOCHER, TURBINE_SMALL, TURBINE_LARGE, TURBINE_HUGE; + + public static final ITexture[] ERROR_RENDERING = new ITexture[]{new GT_RenderedTexture(RENDERING_ERROR)}; + + protected IIcon mIcon, mOverlay; + + private ItemIcons() { + GregTech_API.sGTItemIconload.add(this); + } + + @Override + public IIcon getIcon() { + return this.mIcon; + } + + @Override + public IIcon getOverlayIcon() { + return this.mOverlay; + } + + @Override + public ResourceLocation getTextureFile() { + return TextureMap.locationItemsTexture; + } + + @Override + public void run() { + this.mIcon = GregTech_API.sItemIcons.registerIcon(CORE.RES_PATH_ITEM + "iconsets/" + this); + this.mOverlay = GregTech_API.sItemIcons.registerIcon(CORE.RES_PATH_ITEM + "iconsets/" + this + "_OVERLAY"); + } + + public static class CustomIcon implements IIconContainer, Runnable { + protected IIcon mIcon, mOverlay; + protected String mIconName; + + public CustomIcon(final String aIconName) { + this.mIconName = aIconName; + GregTech_API.sGTItemIconload.add(this); + } + + @Override + public IIcon getIcon() { + return this.mIcon; + } + + @Override + public IIcon getOverlayIcon() { + return this.mOverlay; + } + + @Override + public void run() { + this.mIcon = GregTech_API.sItemIcons.registerIcon(CORE.RES_PATH_ITEM + this.mIconName); + this.mOverlay = GregTech_API.sItemIcons.registerIcon(CORE.RES_PATH_ITEM + this.mIconName + "_OVERLAY"); + } + + @Override + public ResourceLocation getTextureFile() { + return TextureMap.locationItemsTexture; + } + } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index c50d4a2b80..ce77cb0f79 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.enums; import static gregtech.api.enums.GT_Values.W; + import gregtech.api.util.*; import gtPlusPlus.xmod.gregtech.api.interfaces.GregtechItemContainer; import net.minecraft.block.Block; @@ -14,256 +15,298 @@ import net.minecraftforge.fluids.Fluid; public enum GregtechItemList implements GregtechItemContainer { Energy_Buffer_CREATIVE, - + //Energy Buffers Energy_Buffer_1by1_ULV, Energy_Buffer_1by1_LV, Energy_Buffer_1by1_MV, Energy_Buffer_1by1_HV, Energy_Buffer_1by1_EV, Energy_Buffer_1by1_IV, Energy_Buffer_1by1_LuV, Energy_Buffer_1by1_ZPM, Energy_Buffer_1by1_UV, Energy_Buffer_1by1_MAX, - + //Cobble Generators Cobble_Generator_ULV, Cobble_Generator_LV, Cobble_Generator_MV, Cobble_Generator_HV, Cobble_Generator_EV, Cobble_Generator_IV, Cobble_Generator_LuV, Cobble_Generator_ZPM, Cobble_Generator_UV, Cobble_Generator_MAX, - + //The max Steam condenser - Condensor_MAX, - + Condensor_MAX, + //Player owned Safes GT_Safe_ULV, GT_Safe_LV, GT_Safe_MV, GT_Safe_HV, GT_Safe_EV, GT_Safe_IV, GT_Safe_LuV, GT_Safe_ZPM, GT_Safe_UV, GT_Safe_MAX, - + //Rocket Engines Rocket_Engine_EV, Rocket_Engine_IV, Rocket_Engine_LuV, - + //IronBlastFurnace Machine_Bronze_BlastFurnace Machine_Iron_BlastFurnace, Casing_IronPlatedBricks, - + //Machine Casings - Casing_Shielding, - + Casing_Shielding, + //Large Centrifuge Industrial_Centrifuge, Casing_Centrifuge1, - + //Coke Oven - Industrial_CokeOven, Casing_CokeOven, Casing_CokeOven_Coil1, Casing_CokeOven_Coil2, - + Industrial_CokeOven, Casing_CokeOven, Casing_CokeOven_Coil1, Casing_CokeOven_Coil2, + //Bending Maching // Plate Press // Press - Casing_MaterialPress, Industrial_PlatePress, - + Casing_MaterialPress, Industrial_PlatePress, + //Gregtech Machine Parts - Electric_Motor_LuV, Electric_Motor_ZPM, Electric_Motor_UV, Electric_Motor_MAX, + Electric_Motor_LuV, Electric_Motor_ZPM, Electric_Motor_UV, Electric_Motor_MAX, Electric_Pump_LuV, Electric_Pump_ZPM, Electric_Pump_UV, Electric_Pump_MAX, - Conveyor_Module_LuV, Conveyor_Module_ZPM, Conveyor_Module_UV, Conveyor_Module_MAX, + Conveyor_Module_LuV, Conveyor_Module_ZPM, Conveyor_Module_UV, Conveyor_Module_MAX, Electric_Piston_LuV, Electric_Piston_ZPM, Electric_Piston_UV, Electric_Piston_MAX, - Robot_Arm_LuV, Robot_Arm_ZPM, Robot_Arm_UV, Robot_Arm_MAX, - Field_Generator_LuV, Field_Generator_ZPM, Field_Generator_UV, Field_Generator_MAX, - Emitter_LuV, Emitter_ZPM, Emitter_UV, Emitter_MAX, - Sensor_LuV, Sensor_ZPM, Sensor_UV, Sensor_MAX, - + Robot_Arm_LuV, Robot_Arm_ZPM, Robot_Arm_UV, Robot_Arm_MAX, + Field_Generator_LuV, Field_Generator_ZPM, Field_Generator_UV, Field_Generator_MAX, + Emitter_LuV, Emitter_ZPM, Emitter_UV, Emitter_MAX, + Sensor_LuV, Sensor_ZPM, Sensor_UV, Sensor_MAX, + //Circuits - Circuit_Primitive, Circuit_Basic, Circuit_Good, Circuit_Advanced, - Circuit_Data, Circuit_Elite, Circuit_Master, Tool_DataOrb, Circuit_Ultimate, Tool_DataStick, + Circuit_Primitive, Circuit_Basic, Circuit_Good, Circuit_Advanced, + Circuit_Data, Circuit_Elite, Circuit_Master, Tool_DataOrb, Circuit_Ultimate, Tool_DataStick, Circuit_IV, Circuit_LuV, Circuit_ZPM, //Circuit Parts - Circuit_Board_IV, Circuit_Board_LuV, Circuit_Board_ZPM, + Circuit_Board_IV, Circuit_Board_LuV, Circuit_Board_ZPM, Circuit_Parts_Crystal_Chip_IV, Circuit_Parts_Crystal_Chip_LuV, Circuit_Parts_Crystal_Chip_ZPM, Circuit_Parts_IV, Circuit_Parts_LuV, Circuit_Parts_ZPM, - Circuit_Parts_Wiring_IV, Circuit_Parts_Wiring_LuV, Circuit_Parts_Wiring_ZPM, - + Circuit_Parts_Wiring_IV, Circuit_Parts_Wiring_LuV, Circuit_Parts_Wiring_ZPM, + //Unused Machine Casings - Casing_MacerationStack, Casing_MatterGen, Casing_MatterFab, Casing_U7, + Casing_MacerationStack, Casing_MatterGen, Casing_MatterFab, Casing_U7, //Unused Machine Coils Casing_Coil_U1, Casing_Coil_U2, Casing_Coil_BlastSmelter, Casing_BlastSmelter, - + //Windmill Shaft Shape for Extruder - Shape_Extruder_WindmillShaft, - + Shape_Extruder_WindmillShaft, + //Batteries Battery_RE_EV_Sodium, Battery_RE_EV_Cadmium, Battery_RE_EV_Lithium, - + //Industrial Electrolyzer - Casing_Electrolyzer, Industrial_Electrolyzer, - + Casing_Electrolyzer, Industrial_Electrolyzer, + //Industrial Maceration Stack - Casing_WireFactory, Industrial_MacerationStack, - + Casing_WireFactory, Industrial_MacerationStack, + //Industrial Wire Factory - Industrial_WireFactory, - - Industrial_MassFab, - + Industrial_WireFactory, + + Industrial_MassFab, + //Solar Generators GT_Solar_ULV, GT_Solar_LV, GT_Solar_MV, GT_Solar_HV, GT_Solar_EV, GT_Solar_IV, - GT_Solar_LuV, GT_Solar_ZPM, GT_Solar_UV, GT_Solar_MAX, - - - + GT_Solar_LuV, GT_Solar_ZPM, GT_Solar_UV, GT_Solar_MAX, + + + //Cooked Raisin Toast for ImQ009 - Food_Baked_Raisin_Bread, - + Food_Baked_Raisin_Bread, + //For sintering TODO - Industrial_AlloyBlastSmelter, - + Industrial_AlloyBlastSmelter, + //Block that enables uplink to a superconductor network - SuperConductorInputNode, - + SuperConductorInputNode, + //The two tiers of reactor casings - Casing_Reactor_I, Casing_Reactor_II, - + Casing_Reactor_I, Casing_Reactor_II, + //Power sub-station for mass storage. 3 hatches for input and output, whatever voltages you desire. - PowerSubStation, - + PowerSubStation, + //Chemical Dehydrators for nuclear fuels GT_Dehydrator_EV, GT_Dehydrator_IV, GT_Dehydrator_LuV, GT_Dehydrator_ZPM, - + //Fluid Storage Tanks GT_FluidTank_ULV, GT_FluidTank_LV, GT_FluidTank_MV, GT_FluidTank_HV, GT_FluidTank_EV, - GT_FluidTank_IV, GT_FluidTank_LuV, GT_FluidTank_ZPM, GT_FluidTank_UV, GT_FluidTank_MAX, - + GT_FluidTank_IV, GT_FluidTank_LuV, GT_FluidTank_ZPM, GT_FluidTank_UV, GT_FluidTank_MAX, + //Fluid Cells to regulate flows. - Fluid_Cell_1L, Fluid_Cell_16L, Fluid_Cell_36L, Fluid_Cell_144L, - + Fluid_Cell_1L, Fluid_Cell_16L, Fluid_Cell_36L, Fluid_Cell_144L, + //Multitank - Industrial_MultiTank, Industrial_MultiTankDense, Casing_MultitankExterior, - + Industrial_MultiTank, Industrial_MultiTankDense, Casing_MultitankExterior, + //Gt4 Workbenches - GT4_Workbench_Bronze, GT4_Workbench_Advanced, - + GT4_Workbench_Bronze, GT4_Workbench_Advanced, + //Geothermal Engines - Geothermal_Engine_EV, Geothermal_Engine_IV, Geothermal_Engine_LuV, - + Geothermal_Engine_EV, Geothermal_Engine_IV, Geothermal_Engine_LuV, + //Tesseracts - GT4_Tesseract_Generator, GT4_Tesseract_Terminal, - + GT4_Tesseract_Generator, GT4_Tesseract_Terminal, + //Casings Tier 2 [17-32] - Casing_StructuralGlass, + Casing_StructuralGlass, Casing_Refinery_External, Casing_Refinery_Structural, Casing_Refinery_Internal, Casing_PlaceHolder4, Casing_PlaceHolder5, Casing_PlaceHolder6, Casing_PlaceHolder7, Casing_PlaceHolder8, Casing_PlaceHolder9, Casing_PlaceHolder10, Casing_PlaceHolder11, Casing_PlaceHolder12, - Casing_PlaceHolder13, Casing_PlaceHolder14, Casing_PlaceHolder15, - + Casing_PlaceHolder13, Casing_PlaceHolder14, Casing_PlaceHolder15, + //LFTR - ThoriumReactor, - + ThoriumReactor, + //Nuclear Fuel Processor - Industrial_FuelRefinery, - + Industrial_FuelRefinery, + //Tree Farm Industrial_TreeFarm, TreeFarmer_Structural, ; public static final GregtechItemList[] DYE_ONLY_ITEMS = { - Energy_Buffer_1by1_EV, Energy_Buffer_1by1_EV }; + Energy_Buffer_1by1_EV, Energy_Buffer_1by1_EV }; private ItemStack mStack; private boolean mHasNotBeenSet = true; public static Fluid sOilExtraHeavy, sOilHeavy, sOilMedium, sOilLight, sNaturalGas; @Override - public GregtechItemList set(Item aItem) { - mHasNotBeenSet = false; - if (aItem == null) return this; - ItemStack aStack = new ItemStack(aItem, 1, 0); - mStack = GT_Utility.copyAmount(1, aStack); + public GregtechItemList set(final Item aItem) { + this.mHasNotBeenSet = false; + if (aItem == null) { + return this; + } + final ItemStack aStack = new ItemStack(aItem, 1, 0); + this.mStack = GT_Utility.copyAmount(1, aStack); return this; } @Override - public GregtechItemList set(ItemStack aStack) { - mHasNotBeenSet = false; - mStack = GT_Utility.copyAmount(1, aStack); + public GregtechItemList set(final ItemStack aStack) { + this.mHasNotBeenSet = false; + this.mStack = GT_Utility.copyAmount(1, aStack); return this; } @Override public Item getItem() { - if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) return null; - return mStack.getItem(); + if (this.mHasNotBeenSet) { + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + } + if (GT_Utility.isStackInvalid(this.mStack)) { + return null; + } + return this.mStack.getItem(); } @Override public Block getBlock() { - if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - return GT_Utility.getBlockFromStack(getItem()); + if (this.mHasNotBeenSet) { + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + } + return GT_Utility.getBlockFromStack(this.getItem()); } @Override public final boolean hasBeenSet() { - return !mHasNotBeenSet; + return !this.mHasNotBeenSet; } @Override - public boolean isStackEqual(Object aStack) { - return isStackEqual(aStack, false, false); + public boolean isStackEqual(final Object aStack) { + return this.isStackEqual(aStack, false, false); } @Override - public boolean isStackEqual(Object aStack, boolean aWildcard, boolean aIgnoreNBT) { - if (GT_Utility.isStackInvalid(aStack)) return false; - return GT_Utility.areUnificationsEqual((ItemStack)aStack, aWildcard?getWildcard(1):get(1), aIgnoreNBT); + public boolean isStackEqual(final Object aStack, final boolean aWildcard, final boolean aIgnoreNBT) { + if (GT_Utility.isStackInvalid(aStack)) { + return false; + } + return GT_Utility.areUnificationsEqual((ItemStack)aStack, aWildcard?this.getWildcard(1):this.get(1), aIgnoreNBT); } @Override - public ItemStack get(long aAmount, Object... aReplacements) { - if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); - return GT_Utility.copyAmount(aAmount, GT_OreDictUnificator.get(mStack)); + public ItemStack get(final long aAmount, final Object... aReplacements) { + if (this.mHasNotBeenSet) { + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + } + if (GT_Utility.isStackInvalid(this.mStack)) { + return GT_Utility.copyAmount(aAmount, aReplacements); + } + return GT_Utility.copyAmount(aAmount, GT_OreDictUnificator.get(this.mStack)); } @Override - public ItemStack getWildcard(long aAmount, Object... aReplacements) { - if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); - return GT_Utility.copyAmountAndMetaData(aAmount, W, GT_OreDictUnificator.get(mStack)); + public ItemStack getWildcard(final long aAmount, final Object... aReplacements) { + if (this.mHasNotBeenSet) { + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + } + if (GT_Utility.isStackInvalid(this.mStack)) { + return GT_Utility.copyAmount(aAmount, aReplacements); + } + return GT_Utility.copyAmountAndMetaData(aAmount, W, GT_OreDictUnificator.get(this.mStack)); } @Override - public ItemStack getUndamaged(long aAmount, Object... aReplacements) { - if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); - return GT_Utility.copyAmountAndMetaData(aAmount, 0, GT_OreDictUnificator.get(mStack)); + public ItemStack getUndamaged(final long aAmount, final Object... aReplacements) { + if (this.mHasNotBeenSet) { + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + } + if (GT_Utility.isStackInvalid(this.mStack)) { + return GT_Utility.copyAmount(aAmount, aReplacements); + } + return GT_Utility.copyAmountAndMetaData(aAmount, 0, GT_OreDictUnificator.get(this.mStack)); } @Override - public ItemStack getAlmostBroken(long aAmount, Object... aReplacements) { - if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); - return GT_Utility.copyAmountAndMetaData(aAmount, mStack.getMaxDamage()-1, GT_OreDictUnificator.get(mStack)); + public ItemStack getAlmostBroken(final long aAmount, final Object... aReplacements) { + if (this.mHasNotBeenSet) { + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + } + if (GT_Utility.isStackInvalid(this.mStack)) { + return GT_Utility.copyAmount(aAmount, aReplacements); + } + return GT_Utility.copyAmountAndMetaData(aAmount, this.mStack.getMaxDamage()-1, GT_OreDictUnificator.get(this.mStack)); } @Override - public ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements) { - ItemStack rStack = get(1, aReplacements); - if (GT_Utility.isStackInvalid(rStack)) return null; + public ItemStack getWithName(final long aAmount, final String aDisplayName, final Object... aReplacements) { + final ItemStack rStack = this.get(1, aReplacements); + if (GT_Utility.isStackInvalid(rStack)) { + return null; + } rStack.setStackDisplayName(aDisplayName); return GT_Utility.copyAmount(aAmount, rStack); } @Override - public ItemStack getWithCharge(long aAmount, int aEnergy, Object... aReplacements) { - ItemStack rStack = get(1, aReplacements); - if (GT_Utility.isStackInvalid(rStack)) return null; + public ItemStack getWithCharge(final long aAmount, final int aEnergy, final Object... aReplacements) { + final ItemStack rStack = this.get(1, aReplacements); + if (GT_Utility.isStackInvalid(rStack)) { + return null; + } GT_ModHandler.chargeElectricItem(rStack, aEnergy, Integer.MAX_VALUE, true, false); return GT_Utility.copyAmount(aAmount, rStack); } @Override - public ItemStack getWithDamage(long aAmount, long aMetaValue, Object... aReplacements) { - if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - if (GT_Utility.isStackInvalid(mStack)) return GT_Utility.copyAmount(aAmount, aReplacements); - return GT_Utility.copyAmountAndMetaData(aAmount, aMetaValue, GT_OreDictUnificator.get(mStack)); + public ItemStack getWithDamage(final long aAmount, final long aMetaValue, final Object... aReplacements) { + if (this.mHasNotBeenSet) { + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + } + if (GT_Utility.isStackInvalid(this.mStack)) { + return GT_Utility.copyAmount(aAmount, aReplacements); + } + return GT_Utility.copyAmountAndMetaData(aAmount, aMetaValue, GT_OreDictUnificator.get(this.mStack)); } @Override - public GregtechItemList registerOre(Object... aOreNames) { - if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - for (Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, get(1)); + public GregtechItemList registerOre(final Object... aOreNames) { + if (this.mHasNotBeenSet) { + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + } + for (final Object tOreName : aOreNames) { + GT_OreDictUnificator.registerOre(tOreName, this.get(1)); + } return this; } @Override - public GregtechItemList registerWildcardAsOre(Object... aOreNames) { - if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - for (Object tOreName : aOreNames) GT_OreDictUnificator.registerOre(tOreName, getWildcard(1)); + public GregtechItemList registerWildcardAsOre(final Object... aOreNames) { + if (this.mHasNotBeenSet) { + throw new IllegalAccessError("The Enum '" + this.name() + "' has not been set to an Item at this time!"); + } + for (final Object tOreName : aOreNames) { + GT_OreDictUnificator.registerOre(tOreName, this.getWildcard(1)); + } return this; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOreDictNames.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOreDictNames.java index dcb075349d..7ef6b5701e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOreDictNames.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOreDictNames.java @@ -1,31 +1,31 @@ package gtPlusPlus.xmod.gregtech.api.enums; /* Electric Components. -* -* usual Materials for this are: -* Primitive (Tier 1) -* Basic (Tier 2) as used by UE as well : IC2 Circuit and RE-Battery -* Good (Tier 3) -* Advanced (Tier 4) as used by UE as well : Advanced Circuit, Advanced Battery and Lithium Battery -* Data (Tier 5) : Data Storage Circuit -* Elite (Tier 6) as used by UE as well : Energy Crystal and Data Control Circuit -* Master (Tier 7) : Energy Flow Circuit and Lapotron Crystal -* Ultimate (Tier 8) : Data Orb and Lapotronic Energy Orb -* Infinite (Cheaty) -* + * + * usual Materials for this are: + * Primitive (Tier 1) + * Basic (Tier 2) as used by UE as well : IC2 Circuit and RE-Battery + * Good (Tier 3) + * Advanced (Tier 4) as used by UE as well : Advanced Circuit, Advanced Battery and Lithium Battery + * Data (Tier 5) : Data Storage Circuit + * Elite (Tier 6) as used by UE as well : Energy Crystal and Data Control Circuit + * Master (Tier 7) : Energy Flow Circuit and Lapotron Crystal + * Ultimate (Tier 8) : Data Orb and Lapotronic Energy Orb + * Infinite (Cheaty) + * Circuits - Circuit_Primitive, Circuit_Basic, Circuit_Good, Circuit_Advanced, - Circuit_Data, Circuit_Elite, Circuit_Master, Tool_DataOrb, Circuit_Ultimate, Tool_DataStick, + Circuit_Primitive, Circuit_Basic, Circuit_Good, Circuit_Advanced, + Circuit_Data, Circuit_Elite, Circuit_Master, Tool_DataOrb, Circuit_Ultimate, Tool_DataStick, Circuit_IV, Circuit_LuV, Circuit_ZPM, Circuit Parts - Circuit_Board_IV, Circuit_Board_LuV, Circuit_Board_ZPM, + Circuit_Board_IV, Circuit_Board_LuV, Circuit_Board_ZPM, Circuit_Parts_Crystal_Chip_IV, Circuit_Parts_Crystal_Chip_LuV, Circuit_Parts_Crystal_Chip_ZPM, Circuit_Parts_IV, Circuit_Parts_LuV, Circuit_Parts_ZPM, Circuit_Parts_Wiring_IV, Circuit_Parts_Wiring_LuV, Circuit_Parts_Wiring_ZPM; -*/ + */ public enum GregtechOreDictNames { buffer_core, itemGregConduit, Circuit_IV, Circuit_LuV, Circuit_ZPM, - Circuit_Board_IV, Circuit_Board_LuV, Circuit_Board_ZPM, + Circuit_Board_IV, Circuit_Board_LuV, Circuit_Board_ZPM, Circuit_Parts_Crystal_Chip_IV, Circuit_Parts_Crystal_Chip_LuV, Circuit_Parts_Crystal_Chip_ZPM, Circuit_Parts_IV, Circuit_Parts_LuV, Circuit_Parts_ZPM, Circuit_Parts_Wiring_IV, Circuit_Parts_Wiring_LuV, Circuit_Parts_Wiring_ZPM; @@ -33,7 +33,7 @@ public enum GregtechOreDictNames { public String unlocalisedName; private void ModObject() { - unlocalisedName = name(); + this.unlocalisedName = this.name(); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java index b830f9fd5a..de49832d43 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java @@ -2,6 +2,9 @@ package gtPlusPlus.xmod.gregtech.api.enums; import static gregtech.api.enums.GT_Values.*; import static gtPlusPlus.core.util.Utils.getTcAspectStack; + +import java.util.*; + import gregtech.api.enums.*; import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.interfaces.*; @@ -12,9 +15,6 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegistrator; import gtPlusPlus.xmod.gregtech.api.objects.GregtechItemData; import gtPlusPlus.xmod.gregtech.api.objects.GregtechMaterialStack; - -import java.util.*; - import net.minecraft.enchantment.Enchantment; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; @@ -52,10 +52,10 @@ public enum GregtechOrePrefixes { gemExquisite("Exquisite Gemstones", "Exquisite ", "", true, true, true, false, false, false, true, true, false, false, B[2], M * 4, 16, 62), // A regular Gem worth four Dusts. Introduced by TerraFirmaCraft stick("Sticks/Rods", "", " Rod", true, true, false, false, false, false, true, true, false, false, B[1] | B[2], M / 2, 64, 23), // Stick made of half an Ingot. Introduced by Eloraam type2("16x Wires", "16x ", " Wire", true, true, false, false, false, false, true, false, false, false, 0, M * 8, 64, -1), - - toolSkookumChoocher("Skookum Choocher", "", " Skookum Choocher", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. - + toolSkookumChoocher("Skookum Choocher", "", " Skookum Choocher", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. + + batterySingleuse("Single Use Batteries", "", "", false, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), battery("Reusable Batteries", "", "", false, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Introduced by Calclavia @@ -65,18 +65,18 @@ public enum GregtechOrePrefixes { public static volatile int VERSION = 508; - static { - - ingotHot.mHeatDamage = 3.0F; - - } + static { + + ingotHot.mHeatDamage = 3.0F; + + } - public final ArrayList<ItemStack> mPrefixedItems = new ArrayList<ItemStack>(); + public final ArrayList<ItemStack> mPrefixedItems = new ArrayList<>(); public final short mTextureIndex; public final String mRegularLocalName, mLocalizedMaterialPre, mLocalizedMaterialPost; public final boolean mIsUsedForOreProcessing, mIsEnchantable, mIsUnificatable, mIsMaterialBased, mIsSelfReferencing, mIsContainer, mDontUnificateActively, mIsUsedForBlocks, mAllowNormalRecycling, mGenerateDefaultItem; - public final List<TC_AspectStack> mAspects = new ArrayList<TC_AspectStack>(); - public final Collection<GregtechOrePrefixes> mFamiliarPrefixes = new HashSet<GregtechOrePrefixes>(); + public final List<TC_AspectStack> mAspects = new ArrayList<>(); + public final Collection<GregtechOrePrefixes> mFamiliarPrefixes = new HashSet<>(); /** * Used to determine the amount of Material this Prefix contains. * Multiply or Divide GregTech_API.MATERIAL_UNIT to get the Amounts in comparision to one Ingot. @@ -84,9 +84,9 @@ public enum GregtechOrePrefixes { * Negative = Undefined Amount */ public final long mMaterialAmount; - private final Collection<Materials> mNotGeneratedItems = new HashSet<Materials>(), mIgnoredMaterials = new HashSet<Materials>(), mGeneratedItems = new HashSet<Materials>(); - private final ArrayList<Interface_OreRecipeRegistrator> mOreProcessing = new ArrayList<Interface_OreRecipeRegistrator>(); - private final ArrayList<Interface_OreRecipeRegistrator> mOreProcessingFake = new ArrayList<Interface_OreRecipeRegistrator>(); + private final Collection<Materials> mNotGeneratedItems = new HashSet<>(), mIgnoredMaterials = new HashSet<>(), mGeneratedItems = new HashSet<>(); + private final ArrayList<Interface_OreRecipeRegistrator> mOreProcessing = new ArrayList<>(); + private final ArrayList<Interface_OreRecipeRegistrator> mOreProcessingFake = new ArrayList<>(); public ItemStack mContainerItem = null; public ICondition<ISubTagContainer> mCondition = null; public byte mDefaultStackSize = 64; @@ -97,73 +97,74 @@ public enum GregtechOrePrefixes { * Yes this Value can be changed to add Bits for the MetaGenerated-Item-Check. */ public int mMaterialGenerationBits = 0; - private GregtechOrePrefixes(String aRegularLocalName, String aLocalizedMaterialPre, String aLocalizedMaterialPost, boolean aIsUnificatable, boolean aIsMaterialBased, boolean aIsSelfReferencing, boolean aIsContainer, boolean aDontUnificateActively, boolean aIsUsedForBlocks, boolean aAllowNormalRecycling, boolean aGenerateDefaultItem, boolean aIsEnchantable, boolean aIsUsedForOreProcessing, int aMaterialGenerationBits, long aMaterialAmount, int aDefaultStackSize, int aTextureindex) { - mIsUnificatable = aIsUnificatable; - mIsMaterialBased = aIsMaterialBased; - mIsSelfReferencing = aIsSelfReferencing; - mIsContainer = aIsContainer; - mDontUnificateActively = aDontUnificateActively; - mIsUsedForBlocks = aIsUsedForBlocks; - mAllowNormalRecycling = aAllowNormalRecycling; - mGenerateDefaultItem = aGenerateDefaultItem; - mIsEnchantable = aIsEnchantable; - mIsUsedForOreProcessing = aIsUsedForOreProcessing; - mMaterialGenerationBits = aMaterialGenerationBits; - mMaterialAmount = aMaterialAmount; - mRegularLocalName = aRegularLocalName; - mLocalizedMaterialPre = aLocalizedMaterialPre; - mLocalizedMaterialPost = aLocalizedMaterialPost; - mDefaultStackSize = (byte) aDefaultStackSize; - mTextureIndex = (short) aTextureindex; - - + private GregtechOrePrefixes(final String aRegularLocalName, final String aLocalizedMaterialPre, final String aLocalizedMaterialPost, final boolean aIsUnificatable, final boolean aIsMaterialBased, final boolean aIsSelfReferencing, final boolean aIsContainer, final boolean aDontUnificateActively, final boolean aIsUsedForBlocks, final boolean aAllowNormalRecycling, final boolean aGenerateDefaultItem, final boolean aIsEnchantable, final boolean aIsUsedForOreProcessing, final int aMaterialGenerationBits, final long aMaterialAmount, final int aDefaultStackSize, final int aTextureindex) { + this.mIsUnificatable = aIsUnificatable; + this.mIsMaterialBased = aIsMaterialBased; + this.mIsSelfReferencing = aIsSelfReferencing; + this.mIsContainer = aIsContainer; + this.mDontUnificateActively = aDontUnificateActively; + this.mIsUsedForBlocks = aIsUsedForBlocks; + this.mAllowNormalRecycling = aAllowNormalRecycling; + this.mGenerateDefaultItem = aGenerateDefaultItem; + this.mIsEnchantable = aIsEnchantable; + this.mIsUsedForOreProcessing = aIsUsedForOreProcessing; + this.mMaterialGenerationBits = aMaterialGenerationBits; + this.mMaterialAmount = aMaterialAmount; + this.mRegularLocalName = aRegularLocalName; + this.mLocalizedMaterialPre = aLocalizedMaterialPre; + this.mLocalizedMaterialPost = aLocalizedMaterialPost; + this.mDefaultStackSize = (byte) aDefaultStackSize; + this.mTextureIndex = (short) aTextureindex; + + //TODO - Utilise some form of way to check if it's gt 5.9 if so, use string switch. - if (name().startsWith("ore")) { - getTcAspectStack(TC_Aspects.TERRA.name(), 1).addToAspectList(mAspects); - } else if (name().startsWith("wire") || name().startsWith("cable")) { - getTcAspectStack(TC_Aspects.ELECTRUM.name(), 1).addToAspectList(mAspects); - } else if (name().startsWith("dust")) { - getTcAspectStack(TC_Aspects.PERDITIO.name(), 1).addToAspectList(mAspects); - } else if (name().startsWith("crushed")) { - getTcAspectStack(TC_Aspects.PERFODIO.name(), 1).addToAspectList(mAspects); - } else if (name().startsWith("ingot") || name().startsWith("nugget")) { - getTcAspectStack(TC_Aspects.METALLUM.name(), 1).addToAspectList(mAspects); - } else if (name().startsWith("armor")) { - getTcAspectStack(TC_Aspects.TUTAMEN.name(), 1).addToAspectList(mAspects); - } else if (name().startsWith("stone")) { - getTcAspectStack(TC_Aspects.TERRA.name(), 1).addToAspectList(mAspects); - } else if (name().startsWith("pipe")) { - getTcAspectStack(TC_Aspects.ITER.name(), 1).addToAspectList(mAspects); - } else if (name().startsWith("gear")) { - getTcAspectStack(TC_Aspects.MOTUS.name(), 1).addToAspectList(mAspects); - getTcAspectStack(TC_Aspects.MACHINA.name(), 1).addToAspectList(mAspects); - } else if (name().startsWith("frame") || name().startsWith("plate")) { - getTcAspectStack(TC_Aspects.FABRICO.name(), 1).addToAspectList(mAspects); - } else if (name().startsWith("tool")) { - getTcAspectStack(TC_Aspects.INSTRUMENTUM.name(), 2).addToAspectList(mAspects); - } else if (name().startsWith("gem") || name().startsWith("crystal") || name().startsWith("lens")) { - getTcAspectStack(TC_Aspects.VITREUS.name(), 1).addToAspectList(mAspects); - } else if (name().startsWith("crate")) { - getTcAspectStack(TC_Aspects.ITER.name(), 2).addToAspectList(mAspects); - } else if (name().startsWith("circuit")) { - getTcAspectStack("COGNITIO", 1); - } else if (name().startsWith("computer")) { - getTcAspectStack("COGNITIO", 4).addToAspectList(mAspects); - } else if (name().startsWith("battery")) { - getTcAspectStack(TC_Aspects.ELECTRUM.name(), 1).addToAspectList(mAspects); + if (this.name().startsWith("ore")) { + getTcAspectStack(TC_Aspects.TERRA.name(), 1).addToAspectList(this.mAspects); + } else if (this.name().startsWith("wire") || this.name().startsWith("cable")) { + getTcAspectStack(TC_Aspects.ELECTRUM.name(), 1).addToAspectList(this.mAspects); + } else if (this.name().startsWith("dust")) { + getTcAspectStack(TC_Aspects.PERDITIO.name(), 1).addToAspectList(this.mAspects); + } else if (this.name().startsWith("crushed")) { + getTcAspectStack(TC_Aspects.PERFODIO.name(), 1).addToAspectList(this.mAspects); + } else if (this.name().startsWith("ingot") || this.name().startsWith("nugget")) { + getTcAspectStack(TC_Aspects.METALLUM.name(), 1).addToAspectList(this.mAspects); + } else if (this.name().startsWith("armor")) { + getTcAspectStack(TC_Aspects.TUTAMEN.name(), 1).addToAspectList(this.mAspects); + } else if (this.name().startsWith("stone")) { + getTcAspectStack(TC_Aspects.TERRA.name(), 1).addToAspectList(this.mAspects); + } else if (this.name().startsWith("pipe")) { + getTcAspectStack(TC_Aspects.ITER.name(), 1).addToAspectList(this.mAspects); + } else if (this.name().startsWith("gear")) { + getTcAspectStack(TC_Aspects.MOTUS.name(), 1).addToAspectList(this.mAspects); + getTcAspectStack(TC_Aspects.MACHINA.name(), 1).addToAspectList(this.mAspects); + } else if (this.name().startsWith("frame") || this.name().startsWith("plate")) { + getTcAspectStack(TC_Aspects.FABRICO.name(), 1).addToAspectList(this.mAspects); + } else if (this.name().startsWith("tool")) { + getTcAspectStack(TC_Aspects.INSTRUMENTUM.name(), 2).addToAspectList(this.mAspects); + } else if (this.name().startsWith("gem") || this.name().startsWith("crystal") || this.name().startsWith("lens")) { + getTcAspectStack(TC_Aspects.VITREUS.name(), 1).addToAspectList(this.mAspects); + } else if (this.name().startsWith("crate")) { + getTcAspectStack(TC_Aspects.ITER.name(), 2).addToAspectList(this.mAspects); + } else if (this.name().startsWith("circuit")) { + getTcAspectStack("COGNITIO", 1); + } else if (this.name().startsWith("computer")) { + getTcAspectStack("COGNITIO", 4).addToAspectList(this.mAspects); + } else if (this.name().startsWith("battery")) { + getTcAspectStack(TC_Aspects.ELECTRUM.name(), 1).addToAspectList(this.mAspects); } } - public static GregtechOrePrefixes getOrePrefix(String aOre) { - for (GregtechOrePrefixes tPrefix : values()) - if (aOre.startsWith(tPrefix.toString())) { + public static GregtechOrePrefixes getOrePrefix(final String aOre) { + for (final GregtechOrePrefixes tPrefix : values()) { + if (aOre.startsWith(tPrefix.toString())) { return tPrefix; } + } return null; } - public static String stripPrefix(String aOre) { - for (GregtechOrePrefixes tPrefix : values()) { + public static String stripPrefix(final String aOre) { + for (final GregtechOrePrefixes tPrefix : values()) { if (aOre.startsWith(tPrefix.toString())) { return aOre.replaceFirst(tPrefix.toString(), ""); } @@ -171,8 +172,8 @@ public enum GregtechOrePrefixes { return aOre; } - public static String replacePrefix(String aOre, GregtechOrePrefixes aPrefix) { - for (GregtechOrePrefixes tPrefix : values()) { + public static String replacePrefix(final String aOre, final GregtechOrePrefixes aPrefix) { + for (final GregtechOrePrefixes tPrefix : values()) { if (aOre.startsWith(tPrefix.toString())) { return aOre.replaceFirst(tPrefix.toString(), aPrefix.toString()); } @@ -180,95 +181,122 @@ public enum GregtechOrePrefixes { return ""; } - public static GregtechOrePrefixes getPrefix(String aPrefixName) { + public static GregtechOrePrefixes getPrefix(final String aPrefixName) { return getPrefix(aPrefixName, null); } - public static GregtechOrePrefixes getPrefix(String aPrefixName, GregtechOrePrefixes aReplacement) { - Object tObject = GT_Utility.getFieldContent(GregtechOrePrefixes.class, aPrefixName, false, false); - if (tObject != null && tObject instanceof GregtechOrePrefixes) return (GregtechOrePrefixes) tObject; + public static GregtechOrePrefixes getPrefix(final String aPrefixName, final GregtechOrePrefixes aReplacement) { + final Object tObject = GT_Utility.getFieldContent(GregtechOrePrefixes.class, aPrefixName, false, false); + if ((tObject != null) && (tObject instanceof GregtechOrePrefixes)) { + return (GregtechOrePrefixes) tObject; + } return aReplacement; } - public static Materials getMaterial(String aOre) { + public static Materials getMaterial(final String aOre) { return Materials.get(stripPrefix(aOre)); } - public static Materials getMaterial(String aOre, GregtechOrePrefixes aPrefix) { + public static Materials getMaterial(final String aOre, final GregtechOrePrefixes aPrefix) { return Materials.get(aOre.replaceFirst(aPrefix.toString(), "")); } - public static Materials getRealMaterial(String aOre, GregtechOrePrefixes aPrefix) { + public static Materials getRealMaterial(final String aOre, final GregtechOrePrefixes aPrefix) { return Materials.getRealMaterial(aOre.replaceFirst(aPrefix.toString(), "")); } - public static boolean isInstanceOf(String aName, GregtechOrePrefixes aPrefix) { + public static boolean isInstanceOf(final String aName, final GregtechOrePrefixes aPrefix) { return aName == null ? false : aName.startsWith(aPrefix.toString()); } - public boolean add(ItemStack aStack) { - if (aStack == null) return false; - if (!contains(aStack)) mPrefixedItems.add(aStack); - while (mPrefixedItems.contains(null)) mPrefixedItems.remove(null); + public boolean add(final ItemStack aStack) { + if (aStack == null) { + return false; + } + if (!this.contains(aStack)) { + this.mPrefixedItems.add(aStack); + } + while (this.mPrefixedItems.contains(null)) { + this.mPrefixedItems.remove(null); + } return true; } - public boolean contains(ItemStack aStack) { - if (aStack == null) return false; - for (ItemStack tStack : mPrefixedItems) - if (GT_Utility.areStacksEqual(aStack, tStack, !tStack.hasTagCompound())) return true; + public boolean contains(final ItemStack aStack) { + if (aStack == null) { + return false; + } + for (final ItemStack tStack : this.mPrefixedItems) { + if (GT_Utility.areStacksEqual(aStack, tStack, !tStack.hasTagCompound())) { + return true; + } + } return false; } - public boolean doGenerateItem(Materials aMaterial) { - return aMaterial != null && aMaterial != Materials._NULL && ((aMaterial.mTypes & mMaterialGenerationBits) != 0 || mGeneratedItems.contains(aMaterial)) && !mNotGeneratedItems.contains(aMaterial) && (mCondition == null || mCondition.isTrue(aMaterial)); + public boolean doGenerateItem(final Materials aMaterial) { + return (aMaterial != null) && (aMaterial != Materials._NULL) && (((aMaterial.mTypes & this.mMaterialGenerationBits) != 0) || this.mGeneratedItems.contains(aMaterial)) && !this.mNotGeneratedItems.contains(aMaterial) && ((this.mCondition == null) || this.mCondition.isTrue(aMaterial)); } - public boolean ignoreMaterials(Materials... aMaterials) { - for (Materials tMaterial : aMaterials) if (tMaterial != null) mIgnoredMaterials.add(tMaterial); + public boolean ignoreMaterials(final Materials... aMaterials) { + for (final Materials tMaterial : aMaterials) { + if (tMaterial != null) { + this.mIgnoredMaterials.add(tMaterial); + } + } return true; } - public boolean addFamiliarPrefix(GregtechOrePrefixes aPrefix) { - if (aPrefix == null || mFamiliarPrefixes.contains(aPrefix) || aPrefix == this) return false; - return mFamiliarPrefixes.add(aPrefix); + public boolean addFamiliarPrefix(final GregtechOrePrefixes aPrefix) { + if ((aPrefix == null) || this.mFamiliarPrefixes.contains(aPrefix) || (aPrefix == this)) { + return false; + } + return this.mFamiliarPrefixes.add(aPrefix); } - public boolean add(Interface_OreRecipeRegistrator aRegistrator) { - if (aRegistrator == null) return false; - return mOreProcessing.add(aRegistrator); + public boolean add(final Interface_OreRecipeRegistrator aRegistrator) { + if (aRegistrator == null) { + return false; + } + return this.mOreProcessing.add(aRegistrator); } - public void processOre(GT_Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { - if (aMaterial != null && (aMaterial != GT_Materials._NULL || mIsSelfReferencing || !mIsMaterialBased) && GT_Utility.isStackValid(aStack)) - for (Interface_OreRecipeRegistrator tRegistrator : mOreProcessing) { - if (D2) - GT_Log.ore.println("Processing '" + aOreDictName + "' with the Prefix '" + name() + "' and the Material '" + aMaterial.name() + "' at " + GT_Utility.getClassName(tRegistrator)); + public void processOre(final GT_Materials aMaterial, final String aOreDictName, final String aModName, final ItemStack aStack) { + if ((aMaterial != null) && ((aMaterial != GT_Materials._NULL) || this.mIsSelfReferencing || !this.mIsMaterialBased) && GT_Utility.isStackValid(aStack)) { + for (final Interface_OreRecipeRegistrator tRegistrator : this.mOreProcessing) { + if (D2) { + GT_Log.ore.println("Processing '" + aOreDictName + "' with the Prefix '" + this.name() + "' and the Material '" + aMaterial.name() + "' at " + GT_Utility.getClassName(tRegistrator)); + } tRegistrator.registerOre(this, aMaterial, aOreDictName, aModName, GT_Utility.copyAmount(1, aStack)); } + } } - + //TODO - public void processOre(Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { - if (aMaterial != null && (aMaterial != Materials._NULL || mIsSelfReferencing || !mIsMaterialBased) && GT_Utility.isStackValid(aStack)) - for (Interface_OreRecipeRegistrator tRegistrator : mOreProcessingFake) { - if (D2) - GT_Log.ore.println("Processing '" + aOreDictName + "' with the Prefix '" + name() + "' and the Material '" + aMaterial.name() + "' at " + GT_Utility.getClassName(tRegistrator)); - tRegistrator.registerOre(this, aMaterial, aOreDictName, aModName, GT_Utility.copyAmount(1, aStack)); - } - } - - public Object get(Object aMaterial) { - if (aMaterial instanceof GT_Materials) return new GregtechItemData(this, (GT_Materials) aMaterial); - return name() + aMaterial; + public void processOre(final Materials aMaterial, final String aOreDictName, final String aModName, final ItemStack aStack) { + if ((aMaterial != null) && ((aMaterial != Materials._NULL) || this.mIsSelfReferencing || !this.mIsMaterialBased) && GT_Utility.isStackValid(aStack)) { + for (final Interface_OreRecipeRegistrator tRegistrator : this.mOreProcessingFake) { + if (D2) { + GT_Log.ore.println("Processing '" + aOreDictName + "' with the Prefix '" + this.name() + "' and the Material '" + aMaterial.name() + "' at " + GT_Utility.getClassName(tRegistrator)); + } + tRegistrator.registerOre(this, aMaterial, aOreDictName, aModName, GT_Utility.copyAmount(1, aStack)); + } + } } - public String getDefaultLocalNameForItem(Materials aMaterial) { + public Object get(final Object aMaterial) { + if (aMaterial instanceof GT_Materials) { + return new GregtechItemData(this, (GT_Materials) aMaterial); + } + return this.name() + aMaterial; + } + + public String getDefaultLocalNameForItem(final Materials aMaterial) { // Use Standard Localization - return mLocalizedMaterialPre + aMaterial.mDefaultLocalName + mLocalizedMaterialPost; + return this.mLocalizedMaterialPre + aMaterial.mDefaultLocalName + this.mLocalizedMaterialPost; } public enum GT_Materials implements IColorModulationContainer, ISubTagContainer { @@ -281,9 +309,9 @@ public enum GregtechOrePrefixes { * Mainly for preventing NullPointer Exceptions and providing Default Values. * * Unknown Material Components. Dead End Section. - * + * * Alkalus Range 730-799 & 970-998 - * (aMetaItemSubID, TextureSet, aToolSpeed, aToolDurability, aToolQuality, aTypes, R, G, B, Alpha, aLocalName, + * (aMetaItemSubID, TextureSet, aToolSpeed, aToolDurability, aToolQuality, aTypes, R, G, B, Alpha, aLocalName, * aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor * this(aMetaItemSubID, aIconSet, aToolSpeed, aToolDurability, aToolQuality, true); * @@ -303,7 +331,7 @@ public enum GregtechOrePrefixes { Quantum(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 255, 255, 255, 0, "ZPM Tier", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray, Arrays.asList(getTcAspectStack(TC_Aspects.ELECTRUM, 8), getTcAspectStack(TC_Aspects.MACHINA, 8))), Superconductor(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 190, 240, 190, 0, "Superconductor", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeGreen, Arrays.asList(getTcAspectStack(TC_Aspects.ELECTRUM, 8))), - + Staballoy(30, TextureSet.SET_ROUGH, 10.0F, 5120, 4, 1 | 2 | 16 | 32 | 64 | 128, 68, 75, 66, 0, "Staballoy", 0, 0, 1500, 2800, true, false, 1, 3, 1, Dyes.dyeGreen, 2, Arrays.asList(new MaterialStack(Materials.Titanium, 1), new MaterialStack(Materials.Uranium, 9)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), Bedrockium(31, TextureSet.SET_FINE, 8.0F, 8196, 3, 1 | 2 | 16 | 32 | 64 | 128, 39, 39, 39, 0, "Bedrockium", 0, 0, -1, 0, false, false, 1, 5, 1, Dyes.dyeLightGray, 2, Arrays.asList(new MaterialStack(Materials.Carbon, 63), new MaterialStack(Materials.Carbon, 56)), Arrays.asList(getTcAspectStack(TC_Aspects.VACUOS, 8), getTcAspectStack(TC_Aspects.TUTAMEN, 3))), BloodSteel(32, TextureSet.SET_METALLIC, 11.0F, 768, 4, 1 | 2 | 16 | 32 | 64 | 128, 142, 28, 0, 0, "Blood Steel", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed, 2, Arrays.asList(new MaterialStack(Materials.Steel, 3)), Arrays.asList(getTcAspectStack(TC_Aspects.VICTUS, 8), getTcAspectStack(TC_Aspects.IGNIS, 3))), @@ -315,7 +343,7 @@ public enum GregtechOrePrefixes { PulsatingIron(38, TextureSet.SET_SHINY, 5.0F, 256, 2, 1 | 2 | 64 | 128, 50, 91, 21, 0, "Pulsating Iron", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen, 2, Arrays.asList(new MaterialStack(Materials.Iron, 2), new MaterialStack(Materials.EnderPearl, 2)), Arrays.asList(getTcAspectStack(TC_Aspects.ALIENIS, 3), getTcAspectStack(TC_Aspects.METALLUM, 3))), /* TODO*/ RedstoneAlloy(39, TextureSet.SET_METALLIC, 1.0F, 256, 2, 1|2|16|32|64, 178,34,34, 0, "Redstone Alloy", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed, 2, Arrays.asList(new MaterialStack(Materials.Iron, 2), new MaterialStack(Materials.Redstone, 4))), - //Needs more Use, I think. + //Needs more Use, I think. Tantalloy60(40, TextureSet.SET_DULL, 8.0F, 5120, 3, 1 | 2 | 16 | 32 | 64 | 128, 68, 75, 166, 0, "Tantalloy-60", 0, 0, 3035, 2200, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, Arrays.asList(new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), Tantalloy61(41, TextureSet.SET_DULL, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 122, 135, 196, 0, "Tantalloy-61", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, Arrays.asList(new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9), new MaterialStack(Materials.Titanium, 1)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), @@ -327,30 +355,30 @@ public enum GregtechOrePrefixes { HastelloyX(47, TextureSet.SET_SHINY, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 255, 193, 37, 0, "Hastelloy-X", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightBlue, 2, Arrays.asList(new MaterialStack(Materials.Tungsten, 1), new MaterialStack(Materials.Tantalum, 9), new MaterialStack(Materials.Titanium, 1)), Arrays.asList(getTcAspectStack(TC_Aspects.METALLUM, 8), getTcAspectStack(TC_Aspects.STRONTIO, 3))), - + //Radioactive Materials HydrofluoricAcid(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 200, 200, 200, 0, "Hydrofluoric Acid", 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList(new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), UraniumHexaFluoride(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 73, 220, 83, 0, "Uranium Hexafluoride", 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeLime, 2, Arrays.asList(new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), UraniumTetraFluoride(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 73, 220, 83, 0, "Uranium Tetrafluoride", 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeLime, 2, Arrays.asList(new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - ThoriumTetraFluoride(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 15, 120, 15, 0, "Thorium Tetrafluoride", 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeGreen, 2, Arrays.asList(new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - + ThoriumTetraFluoride(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 15, 120, 15, 0, "Thorium Tetrafluoride", 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeGreen, 2, Arrays.asList(new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), + SulfurousAcid(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 110, 220, 30, 0, "Sulfurous Acid", 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList(new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), SulfurDioxide(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 150, 200, 50, 0, "Sulfur Dioxide", 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList(new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), HydrogenChloride(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 150, 240, 90, 0, "Hydrogen Chloride", 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList(new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - SulfuricApatite(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 0, 105, 105, 0, "Sulfuric Apatite Solution", 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList(new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - - SulfuricLithium(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 0, 105, 105, 0, "Sulfuric Lithium Solution", 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList(new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - LithiumHydroxide(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 0, 105, 105, 0, "Lithium Hydroxide", 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList(new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), - + SulfuricApatite(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 0, 105, 105, 0, "Sulfuric Apatite Solution", 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList(new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), + + SulfuricLithium(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 0, 105, 105, 0, "Sulfuric Lithium Solution", 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList(new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), + LithiumHydroxide(-1, TextureSet.SET_FLUID, 1.0F, 0, 1, 2 | 16 | 32, 0, 105, 105, 0, "Lithium Hydroxide", 0, 0, -1, 0, false, false, 2, 3, 1, Dyes.dyeWhite, 2, Arrays.asList(new MaterialStack(Materials.Coal, 1), new MaterialStack(Materials.Redstone, 1), new MaterialStack(Materials.Blaze, 1), new MaterialStack(Materials.Sulfur, 1))), + ; - - - - + + + + /** * List of all Materials. */ - public static final Collection<GT_Materials> VALUES = new HashSet<GT_Materials>(Arrays.asList(values())); + public static final Collection<GT_Materials> VALUES = new HashSet<>(Arrays.asList(values())); static { @@ -378,11 +406,11 @@ public enum GregtechOrePrefixes { public final int mMetaItemSubID; public final boolean mUnificatable; public final GT_Materials mMaterialInto; - public final List<MaterialStack> mMaterialList = new ArrayList<MaterialStack>(); - public final List<GT_Materials> mOreByProducts = new ArrayList<GT_Materials>(), mOreReRegistrations = new ArrayList<GT_Materials>(); - public final List<TC_AspectStack> mAspects = new ArrayList<TC_AspectStack>(); - private final ArrayList<ItemStack> mMaterialItems = new ArrayList<ItemStack>(); - private final Collection<SubTag> mSubTags = new HashSet<SubTag>(); + public final List<MaterialStack> mMaterialList = new ArrayList<>(); + public final List<GT_Materials> mOreByProducts = new ArrayList<>(), mOreReRegistrations = new ArrayList<>(); + public final List<TC_AspectStack> mAspects = new ArrayList<>(); + private final ArrayList<ItemStack> mMaterialItems = new ArrayList<>(); + private final Collection<SubTag> mSubTags = new HashSet<>(); public Enchantment mEnchantmentTools = null, mEnchantmentArmors = null; public byte mEnchantmentToolsLevel = 0, mEnchantmentArmorsLevel = 0; public boolean mBlastFurnaceRequired = false; @@ -401,14 +429,14 @@ public enum GregtechOrePrefixes { */ public Fluid mStandardMoltenFluid = null; - private GT_Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aToolDurability, int aToolQuality, boolean aUnificatable) { - mUnificatable = aUnificatable; - mMaterialInto = this; - mMetaItemSubID = aMetaItemSubID; - mToolQuality = (byte) aToolQuality; - mDurability = aToolDurability; - mToolSpeed = aToolSpeed; - mIconSet = aIconSet; + private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, final int aToolDurability, final int aToolQuality, final boolean aUnificatable) { + this.mUnificatable = aUnificatable; + this.mMaterialInto = this; + this.mMetaItemSubID = aMetaItemSubID; + this.mToolQuality = (byte) aToolQuality; + this.mDurability = aToolDurability; + this.mToolSpeed = aToolSpeed; + this.mIconSet = aIconSet; if (aMetaItemSubID >= 0) { if (CORE.sMU_GeneratedMaterials[aMetaItemSubID] == null) { CORE.sMU_GeneratedMaterials[aMetaItemSubID] = this; @@ -418,14 +446,16 @@ public enum GregtechOrePrefixes { } } - private GT_Materials(GT_Materials aMaterialInto, boolean aReRegisterIntoThis) { - mUnificatable = false; - mDefaultLocalName = aMaterialInto.mDefaultLocalName; - mMaterialInto = aMaterialInto.mMaterialInto; - if (aReRegisterIntoThis) mMaterialInto.mOreReRegistrations.add(this); - mChemicalFormula = aMaterialInto.mChemicalFormula; - mMetaItemSubID = -1; - mIconSet = TextureSet.SET_NONE; + private GT_Materials(final GT_Materials aMaterialInto, final boolean aReRegisterIntoThis) { + this.mUnificatable = false; + this.mDefaultLocalName = aMaterialInto.mDefaultLocalName; + this.mMaterialInto = aMaterialInto.mMaterialInto; + if (aReRegisterIntoThis) { + this.mMaterialInto.mOreReRegistrations.add(this); + } + this.mChemicalFormula = aMaterialInto.mChemicalFormula; + this.mMetaItemSubID = -1; + this.mIconSet = TextureSet.SET_NONE; } /** @@ -451,85 +481,105 @@ public enum GregtechOrePrefixes { * @param aBlastFurnaceRequired If this requires a Blast Furnace. * @param aColor Vanilla MC Wool Color which comes the closest to this. */ - private GT_Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aToolDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor) { + private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, final int aDensityDivider, final Dyes aColor) { this(aMetaItemSubID, aIconSet, aToolSpeed, aToolDurability, aToolQuality, true); - mDefaultLocalName = aLocalName; - mMeltingPoint = (short) aMeltingPoint; - mBlastFurnaceTemp = (short) aBlastFurnaceTemp; - mBlastFurnaceRequired = aBlastFurnaceRequired; - if (aTransparent) add(SubTag.TRANSPARENT); - mFuelPower = aFuelPower; - mFuelType = aFuelType; - mOreValue = aOreValue; - mDensity = (M * aDensityMultiplier) / aDensityDivider; - mColor = aColor == null ? Dyes._NULL : aColor; - if (mColor != null) add(SubTag.HAS_COLOR); - mRGBa[0] = mMoltenRGBa[0] = (short) aR; - mRGBa[1] = mMoltenRGBa[1] = (short) aG; - mRGBa[2] = mMoltenRGBa[2] = (short) aB; - mRGBa[3] = mMoltenRGBa[3] = (short) aA; - mTypes = aTypes; - if ((mTypes & 2) != 0) add(SubTag.SMELTING_TO_FLUID); - } - - private GT_Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aToolDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, List<TC_AspectStack> aAspects) { + this.mDefaultLocalName = aLocalName; + this.mMeltingPoint = (short) aMeltingPoint; + this.mBlastFurnaceTemp = (short) aBlastFurnaceTemp; + this.mBlastFurnaceRequired = aBlastFurnaceRequired; + if (aTransparent) { + this.add(SubTag.TRANSPARENT); + } + this.mFuelPower = aFuelPower; + this.mFuelType = aFuelType; + this.mOreValue = aOreValue; + this.mDensity = (M * aDensityMultiplier) / aDensityDivider; + this.mColor = aColor == null ? Dyes._NULL : aColor; + if (this.mColor != null) { + this.add(SubTag.HAS_COLOR); + } + this.mRGBa[0] = this.mMoltenRGBa[0] = (short) aR; + this.mRGBa[1] = this.mMoltenRGBa[1] = (short) aG; + this.mRGBa[2] = this.mMoltenRGBa[2] = (short) aB; + this.mRGBa[3] = this.mMoltenRGBa[3] = (short) aA; + this.mTypes = aTypes; + if ((this.mTypes & 2) != 0) { + this.add(SubTag.SMELTING_TO_FLUID); + } + } + + private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, final int aDensityDivider, final Dyes aColor, final List<TC_AspectStack> aAspects) { this(aMetaItemSubID, aIconSet, aToolSpeed, aToolDurability, aToolQuality, aTypes, aR, aG, aB, aA, aLocalName, aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor); - mAspects.addAll(aAspects); + this.mAspects.addAll(aAspects); } /** * @param aElement The Element Enum represented by this Material */ - private GT_Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aToolDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, Element aElement, List<TC_AspectStack> aAspects) { + private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, final int aDensityDivider, final Dyes aColor, final Element aElement, final List<TC_AspectStack> aAspects) { this(aMetaItemSubID, aIconSet, aToolSpeed, aToolDurability, aToolQuality, aTypes, aR, aG, aB, aA, aLocalName, aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor); - mElement = aElement; + this.mElement = aElement; //mElement.mLinkedMaterials.add(this); if (aElement == Element._NULL) { - mChemicalFormula = "Empty"; + this.mChemicalFormula = "Empty"; } else { - mChemicalFormula = aElement.toString(); - mChemicalFormula = mChemicalFormula.replaceAll("_", "-"); + this.mChemicalFormula = aElement.toString(); + this.mChemicalFormula = this.mChemicalFormula.replaceAll("_", "-"); } - mAspects.addAll(aAspects); + this.mAspects.addAll(aAspects); } - private GT_Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aToolDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, int aExtraData, List<MaterialStack> aMaterialList) { + private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, final int aDensityDivider, final Dyes aColor, final int aExtraData, final List<MaterialStack> aMaterialList) { this(aMetaItemSubID, aIconSet, aToolSpeed, aToolDurability, aToolQuality, aTypes, aR, aG, aB, aA, aLocalName, aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor, aExtraData, aMaterialList, null); } - private GT_Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aToolDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, int aExtraData, List<MaterialStack> aMaterialList, List<TC_AspectStack> aAspects) { + private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, final int aDensityDivider, final Dyes aColor, final int aExtraData, final List<MaterialStack> aMaterialList, final List<TC_AspectStack> aAspects) { this(aMetaItemSubID, aIconSet, aToolSpeed, aToolDurability, aToolQuality, aTypes, aR, aG, aB, aA, aLocalName, aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor); - mExtraData = aExtraData; - mMaterialList.addAll(aMaterialList); - mChemicalFormula = ""; - for (MaterialStack tMaterial : mMaterialList) mChemicalFormula += tMaterial.toString(); - mChemicalFormula = mChemicalFormula.replaceAll("_", "-"); + this.mExtraData = aExtraData; + this.mMaterialList.addAll(aMaterialList); + this.mChemicalFormula = ""; + for (final MaterialStack tMaterial : this.mMaterialList) { + this.mChemicalFormula += tMaterial.toString(); + } + this.mChemicalFormula = this.mChemicalFormula.replaceAll("_", "-"); int tAmountOfComponents = 0, tMeltingPoint = 0; - for (MaterialStack tMaterial : mMaterialList) { + for (final MaterialStack tMaterial : this.mMaterialList) { tAmountOfComponents += tMaterial.mAmount; - if (tMaterial.mMaterial.mMeltingPoint > 0) + if (tMaterial.mMaterial.mMeltingPoint > 0) { tMeltingPoint += tMaterial.mMaterial.mMeltingPoint * tMaterial.mAmount; - if (aAspects == null) - for (TC_AspectStack tAspect : tMaterial.mMaterial.mAspects) tAspect.addToAspectList(mAspects); + } + if (aAspects == null) { + for (final TC_AspectStack tAspect : tMaterial.mMaterial.mAspects) { + tAspect.addToAspectList(this.mAspects); + } + } } - if (mMeltingPoint < 0) mMeltingPoint = (short) (tMeltingPoint / tAmountOfComponents); + if (this.mMeltingPoint < 0) { + this.mMeltingPoint = (short) (tMeltingPoint / tAmountOfComponents); + } tAmountOfComponents *= aDensityMultiplier; tAmountOfComponents /= aDensityDivider; - if (aAspects == null) for (TC_AspectStack tAspect : mAspects) - tAspect.mAmount = Math.max(1, tAspect.mAmount / Math.max(1, tAmountOfComponents)); - else mAspects.addAll(aAspects); + if (aAspects == null) { + for (final TC_AspectStack tAspect : this.mAspects) { + tAspect.mAmount = Math.max(1, tAspect.mAmount / Math.max(1, tAmountOfComponents)); + } + } else { + this.mAspects.addAll(aAspects); + } } - public static GT_Materials get(String aMaterialName) { - Object tObject = GT_Utility.getFieldContent(GT_Materials.class, aMaterialName, false, false); - if (tObject != null && tObject instanceof GT_Materials) return (GT_Materials) tObject; + public static GT_Materials get(final String aMaterialName) { + final Object tObject = GT_Utility.getFieldContent(GT_Materials.class, aMaterialName, false, false); + if ((tObject != null) && (tObject instanceof GT_Materials)) { + return (GT_Materials) tObject; + } return _NULL; } - public static GT_Materials getRealMaterial(String aMaterialName) { + public static GT_Materials getRealMaterial(final String aMaterialName) { return get(aMaterialName).mMaterialInto; } @@ -538,12 +588,13 @@ public enum GregtechOrePrefixes { * * @param aConfiguration */ - public static void init(GT_Config aConfiguration) { - for (GT_Materials tMaterial : VALUES) { - String tString = tMaterial.toString().toLowerCase(); + public static void init(final GT_Config aConfiguration) { + for (final GT_Materials tMaterial : VALUES) { + final String tString = tMaterial.toString().toLowerCase(); tMaterial.mHeatDamage = (float) aConfiguration.get(ConfigCategories.Materials.heatdamage, tString, tMaterial.mHeatDamage); - if (tMaterial.mBlastFurnaceRequired) + if (tMaterial.mBlastFurnaceRequired) { tMaterial.mBlastFurnaceRequired = aConfiguration.get(ConfigCategories.Materials.blastfurnacerequirements, tString, true); + } if (tMaterial.mBlastFurnaceRequired && aConfiguration.get(ConfigCategories.Materials.blastinductionsmelter, tString, tMaterial.mBlastFurnaceTemp < 1500)){} //GT_ModHandler.ThermalExpansion.addSmelterBlastOre(tMaterial); //tMaterial.mHandleMaterial = (tMaterial == Desh ? tMaterial.mHandleMaterial : tMaterial == Diamond || tMaterial == Thaumium ? Wood : tMaterial.contains(SubTag.BURNING) ? Blaze : tMaterial.contains(SubTag.MAGICAL) && tMaterial.contains(SubTag.CRYSTAL) && Loader.isModLoaded(MOD_ID_TC) ? Thaumium : tMaterial.getMass() > Element.Tc.getMass() * 2 ? TungstenSteel : tMaterial.getMass() > Element.Tc.getMass() ? Steel : Wood); @@ -551,98 +602,129 @@ public enum GregtechOrePrefixes { } public boolean isRadioactive() { - if (mElement != null) return mElement.mHalfLifeSeconds >= 0; - for (MaterialStack tMaterial : mMaterialList) if (tMaterial.mMaterial.isRadioactive()) return true; + if (this.mElement != null) { + return this.mElement.mHalfLifeSeconds >= 0; + } + for (final MaterialStack tMaterial : this.mMaterialList) { + if (tMaterial.mMaterial.isRadioactive()) { + return true; + } + } return false; } public long getProtons() { - if (mElement != null) return mElement.getProtons(); - if (mMaterialList.size() <= 0) return Element.Tc.getProtons(); + if (this.mElement != null) { + return this.mElement.getProtons(); + } + if (this.mMaterialList.size() <= 0) { + return Element.Tc.getProtons(); + } long rAmount = 0, tAmount = 0; - for (MaterialStack tMaterial : mMaterialList) { + for (final MaterialStack tMaterial : this.mMaterialList) { tAmount += tMaterial.mAmount; rAmount += tMaterial.mAmount * tMaterial.mMaterial.getProtons(); } - return (getDensity() * rAmount) / (tAmount * M); + return (this.getDensity() * rAmount) / (tAmount * M); } public long getNeutrons() { - if (mElement != null) return mElement.getNeutrons(); - if (mMaterialList.size() <= 0) return Element.Tc.getNeutrons(); + if (this.mElement != null) { + return this.mElement.getNeutrons(); + } + if (this.mMaterialList.size() <= 0) { + return Element.Tc.getNeutrons(); + } long rAmount = 0, tAmount = 0; - for (MaterialStack tMaterial : mMaterialList) { + for (final MaterialStack tMaterial : this.mMaterialList) { tAmount += tMaterial.mAmount; rAmount += tMaterial.mAmount * tMaterial.mMaterial.getNeutrons(); } - return (getDensity() * rAmount) / (tAmount * M); + return (this.getDensity() * rAmount) / (tAmount * M); } public long getMass() { - if (mElement != null) return mElement.getMass(); - if (mMaterialList.size() <= 0) return Element.Tc.getMass(); + if (this.mElement != null) { + return this.mElement.getMass(); + } + if (this.mMaterialList.size() <= 0) { + return Element.Tc.getMass(); + } long rAmount = 0, tAmount = 0; - for (MaterialStack tMaterial : mMaterialList) { + for (final MaterialStack tMaterial : this.mMaterialList) { tAmount += tMaterial.mAmount; rAmount += tMaterial.mAmount * tMaterial.mMaterial.getMass(); } - return (getDensity() * rAmount) / (tAmount * M); + return (this.getDensity() * rAmount) / (tAmount * M); } public long getDensity() { - return mDensity; + return this.mDensity; } public String getToolTip() { - return getToolTip(1, false); + return this.getToolTip(1, false); } - public String getToolTip(boolean aShowQuestionMarks) { - return getToolTip(1, aShowQuestionMarks); + public String getToolTip(final boolean aShowQuestionMarks) { + return this.getToolTip(1, aShowQuestionMarks); } - public String getToolTip(long aMultiplier) { - return getToolTip(aMultiplier, false); + public String getToolTip(final long aMultiplier) { + return this.getToolTip(aMultiplier, false); } - public String getToolTip(long aMultiplier, boolean aShowQuestionMarks) { - if (!aShowQuestionMarks && mChemicalFormula.equals("?")) return ""; - if (aMultiplier >= M * 2 && !mMaterialList.isEmpty()) { - return ((mElement != null || (mMaterialList.size() < 2 && mMaterialList.get(0).mAmount == 1)) ? mChemicalFormula : "(" + mChemicalFormula + ")") + aMultiplier; + public String getToolTip(final long aMultiplier, final boolean aShowQuestionMarks) { + if (!aShowQuestionMarks && this.mChemicalFormula.equals("?")) { + return ""; + } + if ((aMultiplier >= (M * 2)) && !this.mMaterialList.isEmpty()) { + return (((this.mElement != null) || ((this.mMaterialList.size() < 2) && (this.mMaterialList.get(0).mAmount == 1))) ? this.mChemicalFormula : "(" + this.mChemicalFormula + ")") + aMultiplier; } - return mChemicalFormula; + return this.mChemicalFormula; } /** * Adds an ItemStack to this Material. */ - public GT_Materials add(ItemStack aStack) { - if (aStack != null && !contains(aStack)) mMaterialItems.add(aStack); + public GT_Materials add(final ItemStack aStack) { + if ((aStack != null) && !this.contains(aStack)) { + this.mMaterialItems.add(aStack); + } return this; } /** * This is used to determine if any of the ItemStacks belongs to this Material. */ - public boolean contains(ItemStack... aStacks) { - if (aStacks == null || aStacks.length <= 0) return false; - for (ItemStack tStack : mMaterialItems) - for (ItemStack aStack : aStacks) - if (GT_Utility.areStacksEqual(aStack, tStack, !tStack.hasTagCompound())) return true; + public boolean contains(final ItemStack... aStacks) { + if ((aStacks == null) || (aStacks.length <= 0)) { + return false; + } + for (final ItemStack tStack : this.mMaterialItems) { + for (final ItemStack aStack : aStacks) { + if (GT_Utility.areStacksEqual(aStack, tStack, !tStack.hasTagCompound())) { + return true; + } + } + } return false; } /** * This is used to determine if an ItemStack belongs to this Material. */ - public boolean remove(ItemStack aStack) { - if (aStack == null) return false; + public boolean remove(final ItemStack aStack) { + if (aStack == null) { + return false; + } boolean temp = false; - for (int i = 0; i < mMaterialItems.size(); i++) - if (GT_Utility.areStacksEqual(aStack, mMaterialItems.get(i))) { - mMaterialItems.remove(i--); + for (int i = 0; i < this.mMaterialItems.size(); i++) { + if (GT_Utility.areStacksEqual(aStack, this.mMaterialItems.get(i))) { + this.mMaterialItems.remove(i--); temp = true; } + } return temp; } @@ -650,12 +732,15 @@ public enum GregtechOrePrefixes { * Adds a SubTag to this Material */ @Override - public ISubTagContainer add(SubTag... aTags) { - if (aTags != null) for (SubTag aTag : aTags) - if (aTag != null && !contains(aTag)) { - aTag.addContainerToList(this); - mSubTags.add(aTag); + public ISubTagContainer add(final SubTag... aTags) { + if (aTags != null) { + for (final SubTag aTag : aTags) { + if ((aTag != null) && !this.contains(aTag)) { + aTag.addContainerToList(this); + this.mSubTags.add(aTag); + } } + } return this; } @@ -663,23 +748,23 @@ public enum GregtechOrePrefixes { * If this Material has this exact SubTag */ @Override - public boolean contains(SubTag aTag) { - return mSubTags.contains(aTag); + public boolean contains(final SubTag aTag) { + return this.mSubTags.contains(aTag); } /** * Removes a SubTag from this Material */ @Override - public boolean remove(SubTag aTag) { - return mSubTags.remove(aTag); + public boolean remove(final SubTag aTag) { + return this.mSubTags.remove(aTag); } /** * Sets the Heat Damage for this Material (negative = frost) */ - public GT_Materials setHeatDamage(float aHeatDamage) { - mHeatDamage = aHeatDamage; + public GT_Materials setHeatDamage(final float aHeatDamage) { + this.mHeatDamage = aHeatDamage; return this; } @@ -687,8 +772,10 @@ public enum GregtechOrePrefixes { * Adds a Material to the List of Byproducts when grinding this Ore. * Is used for more precise Ore grinding, so that it is possible to choose between certain kinds of Materials. */ - public GT_Materials addOreByProduct(GT_Materials aMaterial) { - if (!mOreByProducts.contains(aMaterial.mMaterialInto)) mOreByProducts.add(aMaterial.mMaterialInto); + public GT_Materials addOreByProduct(final GT_Materials aMaterial) { + if (!this.mOreByProducts.contains(aMaterial.mMaterialInto)) { + this.mOreByProducts.add(aMaterial.mMaterialInto); + } return this; } @@ -696,8 +783,12 @@ public enum GregtechOrePrefixes { * Adds multiple Materials to the List of Byproducts when grinding this Ore. * Is used for more precise Ore grinding, so that it is possible to choose between certain kinds of Materials. */ - public GT_Materials addOreByProducts(GT_Materials... aMaterials) { - for (GT_Materials tMaterial : aMaterials) if (tMaterial != null) addOreByProduct(tMaterial); + public GT_Materials addOreByProducts(final GT_Materials... aMaterials) { + for (final GT_Materials tMaterial : aMaterials) { + if (tMaterial != null) { + this.addOreByProduct(tMaterial); + } + } return this; } @@ -705,16 +796,20 @@ public enum GregtechOrePrefixes { * If this Ore gives multiple drops of its Main Material. * Lapis Ore for example gives about 6 drops. */ - public GT_Materials setOreMultiplier(int aOreMultiplier) { - if (aOreMultiplier > 0) mOreMultiplier = aOreMultiplier; + public GT_Materials setOreMultiplier(final int aOreMultiplier) { + if (aOreMultiplier > 0) { + this.mOreMultiplier = aOreMultiplier; + } return this; } /** * If this Ore gives multiple drops of its Byproduct Material. */ - public GT_Materials setByProductMultiplier(int aByProductMultiplier) { - if (aByProductMultiplier > 0) mByProductMultiplier = aByProductMultiplier; + public GT_Materials setByProductMultiplier(final int aByProductMultiplier) { + if (aByProductMultiplier > 0) { + this.mByProductMultiplier = aByProductMultiplier; + } return this; } @@ -722,16 +817,20 @@ public enum GregtechOrePrefixes { * If this Ore gives multiple drops of its Main Material. * Lapis Ore for example gives about 6 drops. */ - public GT_Materials setSmeltingMultiplier(int aSmeltingMultiplier) { - if (aSmeltingMultiplier > 0) mSmeltingMultiplier = aSmeltingMultiplier; + public GT_Materials setSmeltingMultiplier(final int aSmeltingMultiplier) { + if (aSmeltingMultiplier > 0) { + this.mSmeltingMultiplier = aSmeltingMultiplier; + } return this; } /** * This Ore should be smolten directly into an Ingot of this Material instead of an Ingot of itself. */ - public GT_Materials setDirectSmelting(GT_Materials aMaterial) { - if (aMaterial != null) mDirectSmelting = aMaterial.mMaterialInto.mDirectSmelting; + public GT_Materials setDirectSmelting(final GT_Materials aMaterial) { + if (aMaterial != null) { + this.mDirectSmelting = aMaterial.mMaterialInto.mDirectSmelting; + } return this; } @@ -739,80 +838,98 @@ public enum GregtechOrePrefixes { * This Material should be the Main Material this Ore gets ground into. * Example, Chromite giving Chrome or Tungstate giving Tungsten. */ - public GT_Materials setOreReplacement(GT_Materials aMaterial) { - if (aMaterial != null) mOreReplacement = aMaterial.mMaterialInto.mOreReplacement; + public GT_Materials setOreReplacement(final GT_Materials aMaterial) { + if (aMaterial != null) { + this.mOreReplacement = aMaterial.mMaterialInto.mOreReplacement; + } return this; } /** * This Material smelts always into an instance of aMaterial. Used for Magnets. */ - public GT_Materials setSmeltingInto(GT_Materials aMaterial) { - if (aMaterial != null) mSmeltInto = aMaterial.mMaterialInto.mSmeltInto; + public GT_Materials setSmeltingInto(final GT_Materials aMaterial) { + if (aMaterial != null) { + this.mSmeltInto = aMaterial.mMaterialInto.mSmeltInto; + } return this; } /** * This Material arc smelts always into an instance of aMaterial. Used for Wrought Iron. */ - public GT_Materials setArcSmeltingInto(GT_Materials aMaterial) { - if (aMaterial != null) mArcSmeltInto = aMaterial.mMaterialInto.mArcSmeltInto; + public GT_Materials setArcSmeltingInto(final GT_Materials aMaterial) { + if (aMaterial != null) { + this.mArcSmeltInto = aMaterial.mMaterialInto.mArcSmeltInto; + } return this; } /** * This Material macerates always into an instance of aMaterial. */ - public GT_Materials setMaceratingInto(GT_Materials aMaterial) { - if (aMaterial != null) mMacerateInto = aMaterial.mMaterialInto.mMacerateInto; + public GT_Materials setMaceratingInto(final GT_Materials aMaterial) { + if (aMaterial != null) { + this.mMacerateInto = aMaterial.mMaterialInto.mMacerateInto; + } return this; } - public GT_Materials setEnchantmentForTools(Enchantment aEnchantment, int aEnchantmentLevel) { - mEnchantmentTools = aEnchantment; - mEnchantmentToolsLevel = (byte) aEnchantmentLevel; + public GT_Materials setEnchantmentForTools(final Enchantment aEnchantment, final int aEnchantmentLevel) { + this.mEnchantmentTools = aEnchantment; + this.mEnchantmentToolsLevel = (byte) aEnchantmentLevel; return this; } - public GT_Materials setEnchantmentForArmors(Enchantment aEnchantment, int aEnchantmentLevel) { - mEnchantmentArmors = aEnchantment; - mEnchantmentArmorsLevel = (byte) aEnchantmentLevel; + public GT_Materials setEnchantmentForArmors(final Enchantment aEnchantment, final int aEnchantmentLevel) { + this.mEnchantmentArmors = aEnchantment; + this.mEnchantmentArmorsLevel = (byte) aEnchantmentLevel; return this; } - public FluidStack getSolid(long aAmount) { - if (mSolid == null) return null; - return new GT_FluidStack(mSolid, (int) aAmount); + public FluidStack getSolid(final long aAmount) { + if (this.mSolid == null) { + return null; + } + return new GT_FluidStack(this.mSolid, (int) aAmount); } - public FluidStack getFluid(long aAmount) { - if (mFluid == null) return null; - return new GT_FluidStack(mFluid, (int) aAmount); + public FluidStack getFluid(final long aAmount) { + if (this.mFluid == null) { + return null; + } + return new GT_FluidStack(this.mFluid, (int) aAmount); } - public FluidStack getGas(long aAmount) { - if (mGas == null) return null; - return new GT_FluidStack(mGas, (int) aAmount); + public FluidStack getGas(final long aAmount) { + if (this.mGas == null) { + return null; + } + return new GT_FluidStack(this.mGas, (int) aAmount); } - public FluidStack getPlasma(long aAmount) { - if (mPlasma == null) return null; - return new GT_FluidStack(mPlasma, (int) aAmount); + public FluidStack getPlasma(final long aAmount) { + if (this.mPlasma == null) { + return null; + } + return new GT_FluidStack(this.mPlasma, (int) aAmount); } - public FluidStack getMolten(long aAmount) { - if (mStandardMoltenFluid == null) return null; - return new GT_FluidStack(mStandardMoltenFluid, (int) aAmount); + public FluidStack getMolten(final long aAmount) { + if (this.mStandardMoltenFluid == null) { + return null; + } + return new GT_FluidStack(this.mStandardMoltenFluid, (int) aAmount); } @Override public short[] getRGBA() { - return mRGBa; + return this.mRGBa; } public static volatile int VERSION = 508; } - + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextureSet.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextureSet.java index 0b8c605e42..26ee2bd401 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextureSet.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextureSet.java @@ -4,141 +4,141 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.IIconContainer; public class GregtechTextureSet { - public static final GregtechTextureSet - SET_NONE = new GregtechTextureSet("NONE"), SET_DULL = new GregtechTextureSet("DULL"), SET_RUBY = new GregtechTextureSet("RUBY"), SET_OPAL = new GregtechTextureSet("OPAL"), SET_LEAF = new GregtechTextureSet("LEAF"), SET_WOOD = new GregtechTextureSet("WOOD"), SET_SAND = new GregtechTextureSet("SAND"), SET_FINE = new GregtechTextureSet("FINE"), SET_FIERY = new GregtechTextureSet("FIERY"), SET_FLUID = new GregtechTextureSet("FLUID"), SET_ROUGH = new GregtechTextureSet("ROUGH"), SET_PAPER = new GregtechTextureSet("PAPER"), SET_GLASS = new GregtechTextureSet("GLASS"), SET_FLINT = new GregtechTextureSet("FLINT"), SET_LAPIS = new GregtechTextureSet("LAPIS"), SET_SHINY = new GregtechTextureSet("SHINY"), SET_SHARDS = new GregtechTextureSet("SHARDS"), SET_POWDER = new GregtechTextureSet("POWDER"), SET_QUARTZ = new GregtechTextureSet("QUARTZ"), SET_EMERALD = new GregtechTextureSet("EMERALD"), SET_DIAMOND = new GregtechTextureSet("DIAMOND"), SET_LIGNITE = new GregtechTextureSet("LIGNITE"), SET_MAGNETIC = new GregtechTextureSet("MAGNETIC"), SET_METALLIC = new GregtechTextureSet("METALLIC"), SET_NETHERSTAR = new GregtechTextureSet("NETHERSTAR"), SET_GEM_VERTICAL = new GregtechTextureSet("GEM_VERTICAL"), SET_GEM_HORIZONTAL = new GregtechTextureSet("GEM_HORIZONTAL"); + public static final GregtechTextureSet + SET_NONE = new GregtechTextureSet("NONE"), SET_DULL = new GregtechTextureSet("DULL"), SET_RUBY = new GregtechTextureSet("RUBY"), SET_OPAL = new GregtechTextureSet("OPAL"), SET_LEAF = new GregtechTextureSet("LEAF"), SET_WOOD = new GregtechTextureSet("WOOD"), SET_SAND = new GregtechTextureSet("SAND"), SET_FINE = new GregtechTextureSet("FINE"), SET_FIERY = new GregtechTextureSet("FIERY"), SET_FLUID = new GregtechTextureSet("FLUID"), SET_ROUGH = new GregtechTextureSet("ROUGH"), SET_PAPER = new GregtechTextureSet("PAPER"), SET_GLASS = new GregtechTextureSet("GLASS"), SET_FLINT = new GregtechTextureSet("FLINT"), SET_LAPIS = new GregtechTextureSet("LAPIS"), SET_SHINY = new GregtechTextureSet("SHINY"), SET_SHARDS = new GregtechTextureSet("SHARDS"), SET_POWDER = new GregtechTextureSet("POWDER"), SET_QUARTZ = new GregtechTextureSet("QUARTZ"), SET_EMERALD = new GregtechTextureSet("EMERALD"), SET_DIAMOND = new GregtechTextureSet("DIAMOND"), SET_LIGNITE = new GregtechTextureSet("LIGNITE"), SET_MAGNETIC = new GregtechTextureSet("MAGNETIC"), SET_METALLIC = new GregtechTextureSet("METALLIC"), SET_NETHERSTAR = new GregtechTextureSet("NETHERSTAR"), SET_GEM_VERTICAL = new GregtechTextureSet("GEM_VERTICAL"), SET_GEM_HORIZONTAL = new GregtechTextureSet("GEM_HORIZONTAL"); - public final IIconContainer[] mTextures = new IIconContainer[128]; - public final String mSetName; + public final IIconContainer[] mTextures = new IIconContainer[128]; + public final String mSetName; - public GregtechTextureSet(String aSetName) { - mSetName = aSetName; - mTextures[0] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/turbineBlade"); - mTextures[1] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/toolHeadSkookumChoocher"); - mTextures[2] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[3] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[4] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[5] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[6] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[7] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[8] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[9] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[10] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[11] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[12] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[13] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[14] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[15] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[16] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[17] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[18] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[19] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[20] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[21] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[22] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[23] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[24] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[25] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[26] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[27] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[28] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[29] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[30] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[31] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[32] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[33] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[34] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[35] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[36] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[37] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[38] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[39] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[40] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[41] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[42] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[43] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[44] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[45] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[46] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[47] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[48] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[49] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[50] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[51] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[52] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[53] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[54] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[55] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[56] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[57] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[58] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[59] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[60] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[61] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[62] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[63] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[64] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[65] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[66] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[67] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[68] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[69] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[70] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[71] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[72] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[73] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[74] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[75] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[76] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[77] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[78] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[79] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[80] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[81] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[82] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[83] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[84] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[85] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[86] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[87] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[88] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[89] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[90] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[91] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[92] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[93] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[94] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[95] = new Textures.BlockIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[96] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[97] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[98] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[99] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[100] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[101] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[102] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[103] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[104] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[105] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[106] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[107] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[108] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[109] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[110] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[111] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[112] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[113] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[114] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[115] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[116] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[117] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[118] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[119] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[120] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[121] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[122] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[123] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[124] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[125] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[126] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - mTextures[127] = new Textures.ItemIcons.CustomIcon("materialicons/" + mSetName + "/void"); - } + public GregtechTextureSet(final String aSetName) { + this.mSetName = aSetName; + this.mTextures[0] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/turbineBlade"); + this.mTextures[1] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/toolHeadSkookumChoocher"); + this.mTextures[2] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[3] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[4] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[5] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[6] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[7] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[8] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[9] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[10] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[11] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[12] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[13] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[14] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[15] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[16] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[17] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[18] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[19] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[20] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[21] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[22] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[23] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[24] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[25] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[26] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[27] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[28] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[29] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[30] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[31] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[32] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[33] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[34] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[35] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[36] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[37] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[38] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[39] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[40] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[41] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[42] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[43] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[44] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[45] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[46] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[47] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[48] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[49] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[50] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[51] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[52] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[53] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[54] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[55] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[56] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[57] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[58] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[59] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[60] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[61] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[62] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[63] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[64] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[65] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[66] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[67] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[68] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[69] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[70] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[71] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[72] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[73] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[74] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[75] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[76] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[77] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[78] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[79] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[80] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[81] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[82] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[83] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[84] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[85] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[86] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[87] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[88] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[89] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[90] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[91] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[92] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[93] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[94] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[95] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[96] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[97] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[98] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[99] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[100] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[101] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[102] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[103] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[104] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[105] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[106] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[107] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[108] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[109] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[110] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[111] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[112] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[113] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[114] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[115] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[116] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[117] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[118] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[119] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[120] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[121] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[122] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[123] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[124] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[125] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[126] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + this.mTextures[127] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java index dca5d7301c..1fc8f6bb69 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java @@ -9,110 +9,110 @@ import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; public class GregtechTextures { - public enum BlockIcons implements Interface_IconContainer, Runnable { + public enum BlockIcons implements Interface_IconContainer, Runnable { VOID, - LARGECENTRIFUGE1, LARGECENTRIFUGE2, LARGECENTRIFUGE3, - LARGECENTRIFUGE4, LARGECENTRIFUGE5, LARGECENTRIFUGE6, - LARGECENTRIFUGE7, LARGECENTRIFUGE8, LARGECENTRIFUGE9, - LARGECENTRIFUGE_ACTIVE1, LARGECENTRIFUGE_ACTIVE2, LARGECENTRIFUGE_ACTIVE3, - LARGECENTRIFUGE_ACTIVE4, LARGECENTRIFUGE_ACTIVE5, LARGECENTRIFUGE_ACTIVE6, + LARGECENTRIFUGE1, LARGECENTRIFUGE2, LARGECENTRIFUGE3, + LARGECENTRIFUGE4, LARGECENTRIFUGE5, LARGECENTRIFUGE6, + LARGECENTRIFUGE7, LARGECENTRIFUGE8, LARGECENTRIFUGE9, + LARGECENTRIFUGE_ACTIVE1, LARGECENTRIFUGE_ACTIVE2, LARGECENTRIFUGE_ACTIVE3, + LARGECENTRIFUGE_ACTIVE4, LARGECENTRIFUGE_ACTIVE5, LARGECENTRIFUGE_ACTIVE6, LARGECENTRIFUGE_ACTIVE7, LARGECENTRIFUGE_ACTIVE8, LARGECENTRIFUGE_ACTIVE9; public static final Interface_IconContainer[] CENTRIFUGE = new Interface_IconContainer[]{ - LARGECENTRIFUGE1, - LARGECENTRIFUGE2, - LARGECENTRIFUGE3, - LARGECENTRIFUGE4, - LARGECENTRIFUGE5, - LARGECENTRIFUGE6, - LARGECENTRIFUGE7, - LARGECENTRIFUGE8, - LARGECENTRIFUGE9 + LARGECENTRIFUGE1, + LARGECENTRIFUGE2, + LARGECENTRIFUGE3, + LARGECENTRIFUGE4, + LARGECENTRIFUGE5, + LARGECENTRIFUGE6, + LARGECENTRIFUGE7, + LARGECENTRIFUGE8, + LARGECENTRIFUGE9 }, - CENTRIFUGE_ACTIVE = new Interface_IconContainer[]{ - LARGECENTRIFUGE_ACTIVE1, - LARGECENTRIFUGE_ACTIVE2, - LARGECENTRIFUGE_ACTIVE3, - LARGECENTRIFUGE_ACTIVE4, - LARGECENTRIFUGE_ACTIVE5, - LARGECENTRIFUGE_ACTIVE6, - LARGECENTRIFUGE_ACTIVE7, - LARGECENTRIFUGE_ACTIVE8, - LARGECENTRIFUGE_ACTIVE9 + CENTRIFUGE_ACTIVE = new Interface_IconContainer[]{ + LARGECENTRIFUGE_ACTIVE1, + LARGECENTRIFUGE_ACTIVE2, + LARGECENTRIFUGE_ACTIVE3, + LARGECENTRIFUGE_ACTIVE4, + LARGECENTRIFUGE_ACTIVE5, + LARGECENTRIFUGE_ACTIVE6, + LARGECENTRIFUGE_ACTIVE7, + LARGECENTRIFUGE_ACTIVE8, + LARGECENTRIFUGE_ACTIVE9 }; - public static Interface_Texture[] + public static Interface_Texture[] GT_CASING_BLOCKS = new Interface_Texture[64]; protected IIcon mIcon; - private BlockIcons() { - Meta_GT_Proxy.GT_BlockIconload.add(this); - } - - @Override - public IIcon getIcon() { - return mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return null; - } - - @Override - public void run() { - mIcon = Meta_GT_Proxy.sBlockIcons.registerIcon(CORE.MODID + ":" + "iconsets/" + this); - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationBlocksTexture; - } - - public static class CustomIcon implements Interface_IconContainer, Runnable { - protected IIcon mIcon; - protected String mIconName; - - public CustomIcon(String aIconName) { - mIconName = aIconName; - Meta_GT_Proxy.GT_BlockIconload.add(this); - } - - @Override - public IIcon getIcon() { - return mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return null; - } - - @Override - public void run() { - mIcon = Meta_GT_Proxy.sBlockIcons.registerIcon(CORE.MODID + ":" + mIconName); - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationBlocksTexture; - } - } + private BlockIcons() { + Meta_GT_Proxy.GT_BlockIconload.add(this); + } + + @Override + public IIcon getIcon() { + return this.mIcon; + } + + @Override + public IIcon getOverlayIcon() { + return null; + } + + @Override + public void run() { + this.mIcon = Meta_GT_Proxy.sBlockIcons.registerIcon(CORE.MODID + ":" + "iconsets/" + this); + } + + @Override + public ResourceLocation getTextureFile() { + return TextureMap.locationBlocksTexture; + } + + public static class CustomIcon implements Interface_IconContainer, Runnable { + protected IIcon mIcon; + protected String mIconName; + + public CustomIcon(final String aIconName) { + this.mIconName = aIconName; + Meta_GT_Proxy.GT_BlockIconload.add(this); + } + + @Override + public IIcon getIcon() { + return this.mIcon; + } + + @Override + public IIcon getOverlayIcon() { + return null; + } + + @Override + public void run() { + this.mIcon = Meta_GT_Proxy.sBlockIcons.registerIcon(CORE.MODID + ":" + this.mIconName); + } + + @Override + public ResourceLocation getTextureFile() { + return TextureMap.locationBlocksTexture; + } + } } - - + + public enum ItemIcons implements Interface_IconContainer, Runnable { - VOID, // The Empty Texture - RENDERING_ERROR, //The Purple/Black Texture - SKOOKUMCHOOCHER, //The Skookum Tool Texture - TURBINE_SMALL, TURBINE_LARGE, TURBINE_HUGE; + VOID, // The Empty Texture + RENDERING_ERROR, //The Purple/Black Texture + SKOOKUMCHOOCHER, //The Skookum Tool Texture + TURBINE_SMALL, TURBINE_LARGE, TURBINE_HUGE; - /* public static final Interface_IconContainer[] + /* public static final Interface_IconContainer[] DURABILITY_BAR = new Interface_IconContainer[]{ DURABILITY_BAR_0, DURABILITY_BAR_1, @@ -136,66 +136,66 @@ public class GregtechTextures { ENERGY_BAR_8, };*/ - //public static final Interface_Texture[] ERROR_RENDERING = new Interface_Texture[]{new GregtechRenderedTexture(RENDERING_ERROR)}; - - protected IIcon mIcon, mOverlay; - - private ItemIcons() { - Meta_GT_Proxy.GT_ItemIconload.add(this); - } - - @Override - public IIcon getIcon() { - return mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return mOverlay; - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationItemsTexture; - } - - @Override - public void run() { - mIcon = Meta_GT_Proxy.sItemIcons.registerIcon(CORE.MODID+ ":" + "iconsets/" + this); - mOverlay = Meta_GT_Proxy.sItemIcons.registerIcon(CORE.MODID+ ":" + "iconsets/" + this + "_OVERLAY"); - } - - public static class CustomIcon implements Interface_IconContainer, Runnable { - protected IIcon mIcon, mOverlay; - protected String mIconName; - - public CustomIcon(String aIconName) { - mIconName = aIconName; - Meta_GT_Proxy.GT_ItemIconload.add(this); - } - - @Override - public IIcon getIcon() { - return mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return mOverlay; - } - - @Override - public void run() { - mIcon = Meta_GT_Proxy.sItemIcons.registerIcon(CORE.MODID+ ":" + mIconName); - mOverlay = Meta_GT_Proxy.sItemIcons.registerIcon(CORE.MODID+ ":" + mIconName + "_OVERLAY"); - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationItemsTexture; - } - } - } - + //public static final Interface_Texture[] ERROR_RENDERING = new Interface_Texture[]{new GregtechRenderedTexture(RENDERING_ERROR)}; + + protected IIcon mIcon, mOverlay; + + private ItemIcons() { + Meta_GT_Proxy.GT_ItemIconload.add(this); + } + + @Override + public IIcon getIcon() { + return this.mIcon; + } + + @Override + public IIcon getOverlayIcon() { + return this.mOverlay; + } + + @Override + public ResourceLocation getTextureFile() { + return TextureMap.locationItemsTexture; + } + + @Override + public void run() { + this.mIcon = Meta_GT_Proxy.sItemIcons.registerIcon(CORE.MODID+ ":" + "iconsets/" + this); + this.mOverlay = Meta_GT_Proxy.sItemIcons.registerIcon(CORE.MODID+ ":" + "iconsets/" + this + "_OVERLAY"); + } + + public static class CustomIcon implements Interface_IconContainer, Runnable { + protected IIcon mIcon, mOverlay; + protected String mIconName; + + public CustomIcon(final String aIconName) { + this.mIconName = aIconName; + Meta_GT_Proxy.GT_ItemIconload.add(this); + } + + @Override + public IIcon getIcon() { + return this.mIcon; + } + + @Override + public IIcon getOverlayIcon() { + return this.mOverlay; + } + + @Override + public void run() { + this.mIcon = Meta_GT_Proxy.sItemIcons.registerIcon(CORE.MODID+ ":" + this.mIconName); + this.mOverlay = Meta_GT_Proxy.sItemIcons.registerIcon(CORE.MODID+ ":" + this.mIconName + "_OVERLAY"); + } + + @Override + public ResourceLocation getTextureFile() { + return TextureMap.locationItemsTexture; + } + } + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java index aa0e347ca9..2471e84f54 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java @@ -1,7 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.enums; public enum GregtechToolDictNames { - - craftingToolSkookumChoocher; - + + craftingToolSkookumChoocher; + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DeluxeTank.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DeluxeTank.java index 2620f9b275..50eaad7d0e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DeluxeTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DeluxeTank.java @@ -1,16 +1,15 @@ package gtPlusPlus.xmod.gregtech.api.gui; +import java.util.Iterator; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.*; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_DeluxeTank; - -import java.util.Iterator; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -19,55 +18,58 @@ import cpw.mods.fml.relauncher.SideOnly; */ public class CONTAINER_DeluxeTank extends GT_Container_BasicTank { - public CONTAINER_DeluxeTank(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } + public CONTAINER_DeluxeTank(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mTileEntity, 0, 80, 17)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, 1, 80, 53)); - addSlotToContainer(new GT_Slot_Render(mTileEntity, 2, 41, 42)); - addSlotToContainer(new GT_Slot_Render(mTileEntity, 3, 59, 42)); - } + @Override + public void addSlots(final InventoryPlayer aInventoryPlayer) { + this.addSlotToContainer(new Slot(this.mTileEntity, 0, 80, 17)); + this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 1, 80, 53)); + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 2, 41, 42)); + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 3, 59, 42)); + } - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; - if (((GT_MetaTileEntity_DeluxeTank) mTileEntity.getMetaTileEntity()).mFluid != null) - mContent = ((GT_MetaTileEntity_DeluxeTank) mTileEntity.getMetaTileEntity()).mFluid.amount; - else - mContent = 0; - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, mContent & 65535); - var1.sendProgressBarUpdate(this, 101, mContent >>> 16); - } - } + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (this.mTileEntity.isClientSide() || (this.mTileEntity.getMetaTileEntity() == null)) { + return; + } + if (((GT_MetaTileEntity_DeluxeTank) this.mTileEntity.getMetaTileEntity()).mFluid != null) { + this.mContent = ((GT_MetaTileEntity_DeluxeTank) this.mTileEntity.getMetaTileEntity()).mFluid.amount; + } else { + this.mContent = 0; + } + final Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + final ICrafting var1 = (ICrafting) var2.next(); + var1.sendProgressBarUpdate(this, 100, this.mContent & 65535); + var1.sendProgressBarUpdate(this, 101, this.mContent >>> 16); + } + } - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - mContent = mContent & -65536 | par2; - break; - case 101: - mContent = mContent & 65535 | par2 << 16; - break; - } - } + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(final int par1, final int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 100: + this.mContent = (this.mContent & -65536) | par2; + break; + case 101: + this.mContent = (this.mContent & 65535) | (par2 << 16); + break; + } + } - @Override - public int getSlotCount() { - return 2; - } + @Override + public int getSlotCount() { + return 2; + } - @Override - public int getShiftClickSlotCount() { - return 1; - } + @Override + public int getShiftClickSlotCount() { + return 1; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IndustrialCentrifuge.java index 4083875fdb..efacb9f30e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IndustrialCentrifuge.java @@ -11,28 +11,28 @@ import net.minecraft.inventory.Slot; * The Container I use for all my Basic Machines */ public class CONTAINER_IndustrialCentrifuge extends GT_ContainerMetaTile_Machine { - - public CONTAINER_IndustrialCentrifuge(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - - super(aInventoryPlayer, aTileEntity); - } - - public CONTAINER_IndustrialCentrifuge(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mTileEntity, 1, 154, 42)); - } - - @Override - public int getSlotCount() { - return 1; - } - - @Override - public int getShiftClickSlotCount() { - return 1; - } + + public CONTAINER_IndustrialCentrifuge(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + + super(aInventoryPlayer, aTileEntity); + } + + public CONTAINER_IndustrialCentrifuge(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } + + @Override + public void addSlots(final InventoryPlayer aInventoryPlayer) { + this.addSlotToContainer(new Slot(this.mTileEntity, 1, 154, 42)); + } + + @Override + public int getSlotCount() { + return 1; + } + + @Override + public int getShiftClickSlotCount() { + return 1; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IronBlastFurnace.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IronBlastFurnace.java index 0a19c62d0c..89cc70c61a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IronBlastFurnace.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IronBlastFurnace.java @@ -7,25 +7,25 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; public class CONTAINER_IronBlastFurnace extends GT_ContainerMetaTile_Machine { - public CONTAINER_IronBlastFurnace(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } + public CONTAINER_IronBlastFurnace(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(this.mTileEntity, 0, 34, 16)); - addSlotToContainer(new Slot(this.mTileEntity, 1, 34, 34)); - addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 2, 86, 25)); - addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 3, 104, 25)); - } + @Override + public void addSlots(final InventoryPlayer aInventoryPlayer) { + this.addSlotToContainer(new Slot(this.mTileEntity, 0, 34, 16)); + this.addSlotToContainer(new Slot(this.mTileEntity, 1, 34, 34)); + this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 2, 86, 25)); + this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 3, 104, 25)); + } - @Override + @Override public int getSlotCount() { - return 4; - } + return 4; + } - @Override + @Override public int getShiftClickSlotCount() { - return 2; - } + return 2; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java index 1c94298e09..c38485a7ee 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java @@ -11,20 +11,20 @@ import net.minecraft.entity.player.InventoryPlayer; * The Container I use for all my Basic Machines */ public class CONTAINER_MatterFab extends GT_ContainerMetaTile_Machine { - + public int mUUA_USED = ((GregtechMetaTileEntity_MassFabricator)this.mTileEntity.getMetaTileEntity()).getAmplifierUsed(); public int mUUM_MADE = ((GregtechMetaTileEntity_MassFabricator)this.mTileEntity.getMetaTileEntity()).getMatterProduced(); - - public CONTAINER_MatterFab(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - public CONTAINER_MatterFab(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } + public CONTAINER_MatterFab(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public CONTAINER_MatterFab(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } } - /*@Override +/*@Override public void addSlots(InventoryPlayer aInventoryPlayer) { addSlotToContainer(new Slot(mTileEntity, 1, 152, 5)); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java index 9e0a7869e5..bac513d304 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java @@ -10,16 +10,16 @@ import net.minecraft.entity.player.InventoryPlayer; * The Container I use for all my Basic Machines */ public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine { - public CONTAINER_MultiMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } + public CONTAINER_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } - public CONTAINER_MultiMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } + public CONTAINER_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } } - /*@Override +/*@Override public void addSlots(InventoryPlayer aInventoryPlayer) { addSlotToContainer(new Slot(mTileEntity, 1, 152, 5)); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SafeBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SafeBlock.java index 4a10923760..0c0757b857 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SafeBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SafeBlock.java @@ -1,13 +1,12 @@ package gtPlusPlus.xmod.gregtech.api.gui; +import java.util.UUID; + import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.gui.GT_Slot_Holo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gtPlusPlus.core.util.player.PlayerCache; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GregtechMetaSafeBlock; - -import java.util.UUID; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; @@ -15,59 +14,59 @@ import net.minecraft.item.ItemStack; public class CONTAINER_SafeBlock extends GT_ContainerMetaTile_Machine { - public CONTAINER_SafeBlock(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + public CONTAINER_SafeBlock(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); } //public String UUID = ((BaseMetaTileEntity)mTileEntity).getMetaTileEntity().getBaseMetaTileEntity().getOwnerName(); public UUID ownerUUID = ((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).ownerUUID; - public String tempPlayer = PlayerCache.lookupPlayerByUUID(ownerUUID); + public String tempPlayer = PlayerCache.lookupPlayerByUUID(this.ownerUUID); public boolean blockStatus = ((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).bUnbreakable; @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { + public void addSlots(final InventoryPlayer aInventoryPlayer) { for (int y = 0; y < 3; y++) { for (int x = 0; x < 9; x++) { - addSlotToContainer(new Slot(this.mTileEntity, x + y * 9, 8 + x * 18, 5 + y * 18)); + this.addSlotToContainer(new Slot(this.mTileEntity, x + (y * 9), 8 + (x * 18), 5 + (y * 18))); } } - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 8, 63, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 26, 63, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 44, 63, false, true, 1)); + this.addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 8, 63, false, true, 1)); + this.addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 26, 63, false, true, 1)); + this.addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 44, 63, false, true, 1)); } @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - int runs = 0; + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { + final int runs = 0; if (aSlotIndex < 27) { return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); + final Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); if (tSlot != null) { if (this.mTileEntity.getMetaTileEntity() == null) { return null; } - if (aSlotIndex == 27) { - - - /*((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bOutput = (!((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bOutput); + if (aSlotIndex == 27) { + + + /*((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bOutput = (!((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bOutput); if (((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bOutput) { if (aPlayer != null && aPlayer instanceof EntityPlayerMP && (((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).bOutput != false)) { - + Utils.LOG_INFO(String.valueOf(Sys.is64Bit())); - Utils.messagePlayer(aPlayer, "Salmon"); + Utils.messagePlayer(aPlayer, "Salmon"); } - + GT_Utility.sendChatToPlayer(aPlayer, "Emit Energy to Outputside"); } else { GT_Utility.sendChatToPlayer(aPlayer, "Don't emit Energy"); } return null;*/ - - - } - if (aSlotIndex == 28) {} - /* ((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull = (!((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull); + + + } + if (aSlotIndex == 28) {} + /* ((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull = (!((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull); if (((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull) { GT_Utility.sendChatToPlayer(aPlayer, "Emit Redstone if no Slot is free"); } else { @@ -79,7 +78,7 @@ extends GT_ContainerMetaTile_Machine { if (((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable) { if (((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable) { makeIndestructible(aPlayer); - } + } else { } @@ -91,8 +90,8 @@ extends GT_ContainerMetaTile_Machine { { ((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable = (!((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable); - blockStatus = ((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).bUnbreakable; - ownerUUID = ((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).ownerUUID; + this.blockStatus = ((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).bUnbreakable; + this.ownerUUID = ((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).ownerUUID; //Utils.messagePlayer(aPlayer, "Is the safe locked? "+String.valueOf(((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable).toUpperCase()); /*if (aPlayer != null && aPlayer instanceof EntityPlayerMP && (((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).bUnbreakable != false)) { UnbreakableBlockManager Xasda = new UnbreakableBlockManager(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SolarGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SolarGenerator.java index 46c8720651..27825b7d80 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SolarGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SolarGenerator.java @@ -1,80 +1,84 @@ package gtPlusPlus.xmod.gregtech.api.gui; +import java.util.Iterator; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntitySolarGenerator; - -import java.util.Iterator; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class CONTAINER_SolarGenerator - extends GT_ContainerMetaTile_Machine { - private final int mSteamCapacity; - public int mWaterAmount = 0; - public int mSteamAmount = 0; - public int mProcessingEnergy = 0; - public int mTemperature = 2; - public CONTAINER_SolarGenerator(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, int aSteamCapacity) { - super(aInventoryPlayer, aTileEntity); - this.mSteamCapacity = aSteamCapacity; - } +extends GT_ContainerMetaTile_Machine { + private final int mSteamCapacity; + public int mWaterAmount = 0; + public int mSteamAmount = 0; + public int mProcessingEnergy = 0; + public int mTemperature = 2; + public CONTAINER_SolarGenerator(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final int aSteamCapacity) { + super(aInventoryPlayer, aTileEntity); + this.mSteamCapacity = aSteamCapacity; + } + + @Override + public void addSlots(final InventoryPlayer aInventoryPlayer) { + //addSlotToContainer(new Slot(this.mTileEntity, 2, 116, 62)); + //addSlotToContainer(new Slot(this.mTileEntity, 0, 44, 26)); + //addSlotToContainer(new Slot(this.mTileEntity, 1, 44, 62)); + //addSlotToContainer(new Slot(this.mTileEntity, 3, 116, 26)); + } - public void addSlots(InventoryPlayer aInventoryPlayer) { - //addSlotToContainer(new Slot(this.mTileEntity, 2, 116, 62)); - //addSlotToContainer(new Slot(this.mTileEntity, 0, 44, 26)); - //addSlotToContainer(new Slot(this.mTileEntity, 1, 44, 62)); - //addSlotToContainer(new Slot(this.mTileEntity, 3, 116, 26)); - } + @Override + public int getSlotCount() { + return 0; + } - public int getSlotCount() { - return 0; - } + @Override + public int getShiftClickSlotCount() { + return 0; + } - public int getShiftClickSlotCount() { - return 0; - } + @Override + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { + return; + } + this.mTemperature = ((GregtechMetaTileEntitySolarGenerator) this.mTileEntity.getMetaTileEntity()).mSolarCharge; + this.mProcessingEnergy = ((GregtechMetaTileEntitySolarGenerator) this.mTileEntity.getMetaTileEntity()).mProcessingEnergy; - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { - return; - } - this.mTemperature = ((GregtechMetaTileEntitySolarGenerator) this.mTileEntity.getMetaTileEntity()).mSolarCharge; - this.mProcessingEnergy = ((GregtechMetaTileEntitySolarGenerator) this.mTileEntity.getMetaTileEntity()).mProcessingEnergy; - - this.mTemperature = Math.min(54, Math.max(0, this.mTemperature * 54 / (((GregtechMetaTileEntitySolarGenerator) this.mTileEntity.getMetaTileEntity()).maxProgresstime() - 10))); - this.mEnergy = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getStoredEU()); - this.mProcessingEnergy = Math.min(14, Math.max(this.mProcessingEnergy > 0 ? 1 : 0, this.mProcessingEnergy * 14 / 1000)); + this.mTemperature = Math.min(54, Math.max(0, (this.mTemperature * 54) / (((GregtechMetaTileEntitySolarGenerator) this.mTileEntity.getMetaTileEntity()).maxProgresstime() - 10))); + this.mEnergy = (int) Math.min(Integer.MAX_VALUE, this.mTileEntity.getStoredEU()); + this.mProcessingEnergy = Math.min(14, Math.max(this.mProcessingEnergy > 0 ? 1 : 0, (this.mProcessingEnergy * 14) / 1000)); - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, this.mTemperature); - var1.sendProgressBarUpdate(this, 101, this.mProcessingEnergy); - var1.sendProgressBarUpdate(this, 102, this.mSteamAmount); - var1.sendProgressBarUpdate(this, 103, this.mWaterAmount); - } - } + final Iterator var2 = this.crafters.iterator(); + while (var2.hasNext()) { + final ICrafting var1 = (ICrafting) var2.next(); + var1.sendProgressBarUpdate(this, 100, this.mTemperature); + var1.sendProgressBarUpdate(this, 101, this.mProcessingEnergy); + var1.sendProgressBarUpdate(this, 102, this.mSteamAmount); + var1.sendProgressBarUpdate(this, 103, this.mWaterAmount); + } + } - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - this.mTemperature = par2; - break; - case 101: - this.mProcessingEnergy = par2; - break; - case 102: - this.mSteamAmount = par2; - break; - case 103: - this.mWaterAmount = par2; - } - } + @Override + @SideOnly(Side.CLIENT) + public void updateProgressBar(final int par1, final int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 100: + this.mTemperature = par2; + break; + case 101: + this.mProcessingEnergy = par2; + break; + case 102: + this.mSteamAmount = par2; + break; + case 103: + this.mWaterAmount = par2; + } + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SteamCondenser.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SteamCondenser.java index 8d15fa030a..87316c1203 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SteamCondenser.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SteamCondenser.java @@ -1,32 +1,31 @@ package gtPlusPlus.xmod.gregtech.api.gui; +import java.util.Iterator; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechMetaBoilerBase; - -import java.util.Iterator; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class CONTAINER_SteamCondenser extends GT_ContainerMetaTile_Machine { - public CONTAINER_SteamCondenser(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, int aSteamCapacity) + public CONTAINER_SteamCondenser(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final int aSteamCapacity) { super(aInventoryPlayer, aTileEntity); this.mSteamCapacity = aSteamCapacity; } @Override - public void addSlots(InventoryPlayer aInventoryPlayer) + public void addSlots(final InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(this.mTileEntity, 2, 116, 62)); - addSlotToContainer(new Slot(this.mTileEntity, 0, 44, 26)); - addSlotToContainer(new Slot(this.mTileEntity, 1, 44, 62)); - addSlotToContainer(new Slot(this.mTileEntity, 3, 116, 26)); + this.addSlotToContainer(new Slot(this.mTileEntity, 2, 116, 62)); + this.addSlotToContainer(new Slot(this.mTileEntity, 0, 44, 26)); + this.addSlotToContainer(new Slot(this.mTileEntity, 1, 44, 62)); + this.addSlotToContainer(new Slot(this.mTileEntity, 3, 116, 26)); } @Override @@ -61,15 +60,15 @@ public class CONTAINER_SteamCondenser extends GT_ContainerMetaTile_Machine this.mWaterAmount = (((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).mFluid == null ? 0 : ((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).mFluid.amount); this.mTickingTime = ((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).RI; - this.mTemperature = Math.min(54, Math.max(0, this.mTemperature * 54 / (((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).maxProgresstime() - 10))); - this.mSteamAmount = Math.min(54, Math.max(0, this.mSteamAmount * 54 / (this.mSteamCapacity - 100))); - this.mWaterAmount = Math.min(54, Math.max(0, this.mWaterAmount * 54 / 15900)); - this.mProcessingEnergy = Math.min(14, Math.max(this.mProcessingEnergy > 0 ? 1 : 0, this.mProcessingEnergy * 14 / 1000)); + this.mTemperature = Math.min(54, Math.max(0, (this.mTemperature * 54) / (((GregtechMetaBoilerBase)this.mTileEntity.getMetaTileEntity()).maxProgresstime() - 10))); + this.mSteamAmount = Math.min(54, Math.max(0, (this.mSteamAmount * 54) / (this.mSteamCapacity - 100))); + this.mWaterAmount = Math.min(54, Math.max(0, (this.mWaterAmount * 54) / 15900)); + this.mProcessingEnergy = Math.min(14, Math.max(this.mProcessingEnergy > 0 ? 1 : 0, (this.mProcessingEnergy * 14) / 1000)); - Iterator var2 = this.crafters.iterator(); + final Iterator var2 = this.crafters.iterator(); while (var2.hasNext()) { - ICrafting var1 = (ICrafting)var2.next(); + final ICrafting var1 = (ICrafting)var2.next(); var1.sendProgressBarUpdate(this, 100, this.mTemperature); var1.sendProgressBarUpdate(this, 101, this.mProcessingEnergy); var1.sendProgressBarUpdate(this, 102, this.mSteamAmount); @@ -79,18 +78,18 @@ public class CONTAINER_SteamCondenser extends GT_ContainerMetaTile_Machine @Override @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) + public void updateProgressBar(final int par1, final int par2) { super.updateProgressBar(par1, par2); switch (par1) { - case 100: + case 100: this.mTemperature = par2; break; - case 101: + case 101: this.mProcessingEnergy = par2; break; - case 102: + case 102: this.mSteamAmount = par2; break; - case 103: + case 103: this.mWaterAmount = par2; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_TreeFarmer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_TreeFarmer.java index 4f94b661d8..3c6b0ac2d7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_TreeFarmer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_TreeFarmer.java @@ -1,66 +1,65 @@ package gtPlusPlus.xmod.gregtech.api.gui; +import java.util.List; + import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gtPlusPlus.core.slots.SlotBuzzSaw; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntityTreeFarm; - -import java.util.List; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; public class CONTAINER_TreeFarmer extends GT_ContainerMetaTile_Machine { - public long maxEU = 0; - public long storedEU = 0; + public long maxEU = 0; + public long storedEU = 0; - public CONTAINER_TreeFarmer(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } + public CONTAINER_TreeFarmer(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } - public CONTAINER_TreeFarmer(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } + public CONTAINER_TreeFarmer(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new SlotBuzzSaw(mTileEntity, 1, 80, 17)); - } + @Override + public void addSlots(final InventoryPlayer aInventoryPlayer) { + this.addSlotToContainer(new SlotBuzzSaw(this.mTileEntity, 1, 80, 17)); + } - @Override - public int getSlotCount() { - return 1; - } + @Override + public int getSlotCount() { + return 1; + } - @Override - public int getShiftClickSlotCount() { - return 0; - } + @Override + public int getShiftClickSlotCount() { + return 0; + } - @Override - public void updateProgressBar(int id, int value) { - super.updateProgressBar(id, value); - switch (id) { - case 100: - this.maxEU = value; - return; - case 101: - this.storedEU = value; - break; - default: - break; - } - } + @Override + public void updateProgressBar(final int id, final int value) { + super.updateProgressBar(id, value); + switch (id) { + case 100: + this.maxEU = value; + return; + case 101: + this.storedEU = value; + break; + default: + break; + } + } - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - for(ICrafting crafting : (List<ICrafting>)crafters) { - crafting.sendProgressBarUpdate(this, 100, (int) ((GregtechMetaTileEntityTreeFarm) this.mTileEntity.getMetaTileEntity()).maxEUStore()); - crafting.sendProgressBarUpdate(this, 101, (int) ((GregtechMetaTileEntityTreeFarm) this.mTileEntity.getMetaTileEntity()).getStoredInternalPower()); - } - } - + public void detectAndSendChanges() { + super.detectAndSendChanges(); + for(final ICrafting crafting : (List<ICrafting>)this.crafters) { + crafting.sendProgressBarUpdate(this, 100, (int) ((GregtechMetaTileEntityTreeFarm) this.mTileEntity.getMetaTileEntity()).maxEUStore()); + crafting.sendProgressBarUpdate(this, 101, (int) ((GregtechMetaTileEntityTreeFarm) this.mTileEntity.getMetaTileEntity()).getStoredInternalPower()); + } + } + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DeluxeTank.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DeluxeTank.java index 758aa55294..99faba0e2b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DeluxeTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DeluxeTank.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.gui; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; @@ -8,28 +9,28 @@ import net.minecraft.util.StatCollector; public class GUI_DeluxeTank extends GT_GUIContainerMetaTile_Machine { - private final String mName; + private final String mName; - public GUI_DeluxeTank(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { - super(new CONTAINER_DeluxeTank(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "BasicTank.png"); - mName = aName; - } + public GUI_DeluxeTank(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName) { + super(new CONTAINER_DeluxeTank(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "BasicTank.png"); + this.mName = aName; + } - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 4210752); - fontRendererObj.drawString(mName, 8, 6, 4210752); - if (mContainer != null) { - fontRendererObj.drawString("Fuel | A | B |", 10, 20, 16448255); - //fontRendererObj.drawString(GT_Utility.parseNumberToString(((CONTAINER_DeluxeTank) mContainer).mContent), 10, 30, 16448255); - } - } + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, (this.ySize - 96) + 2, 4210752); + this.fontRendererObj.drawString(this.mName, 8, 6, 4210752); + if (this.mContainer != null) { + this.fontRendererObj.drawString("Fuel | A | B |", 10, 20, 16448255); + //fontRendererObj.drawString(GT_Utility.parseNumberToString(((CONTAINER_DeluxeTank) mContainer).mContent), 10, 30, 16448255); + } + } - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_IndustrialCentrifuge.java index 38726f12d8..fcb53db533 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_IndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_IndustrialCentrifuge.java @@ -12,54 +12,60 @@ public class GUI_IndustrialCentrifuge extends GT_GUIContainerMetaTile_Machine { String mName = ""; private short counter = 0; - public GUI_IndustrialCentrifuge(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { + public GUI_IndustrialCentrifuge(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aTextureFile) { super(new CONTAINER_IndustrialCentrifuge(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - mName = aName; + this.mName = aName; } @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - fontRendererObj.drawString(mName, 10, 8, 16448255); - if (counter >= 100){ - counter = 0; + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + this.fontRendererObj.drawString(this.mName, 10, 8, 16448255); + if (this.counter >= 100){ + this.counter = 0; } else { - counter++; + this.counter++; } - if (mContainer != null) { - if ((((CONTAINER_IndustrialCentrifuge) mContainer).mDisplayErrorCode & 1) != 0) - fontRendererObj.drawString("Pipe is loose.", 10, 16, 16448255); - if ((((CONTAINER_IndustrialCentrifuge) mContainer).mDisplayErrorCode & 2) != 0) - fontRendererObj.drawString("Screws are missing.", 10, 24, 16448255); - if ((((CONTAINER_IndustrialCentrifuge) mContainer).mDisplayErrorCode & 4) != 0) - fontRendererObj.drawString("Something is stuck.", 10, 32, 16448255); - if ((((CONTAINER_IndustrialCentrifuge) mContainer).mDisplayErrorCode & 8) != 0) - fontRendererObj.drawString("Platings are dented.", 10, 40, 16448255); - if ((((CONTAINER_IndustrialCentrifuge) mContainer).mDisplayErrorCode & 32) != 0) - fontRendererObj.drawString("That doesn't belong there.", 10, 56, 16448255); - if ((((CONTAINER_IndustrialCentrifuge) mContainer).mDisplayErrorCode & 64) != 0) - fontRendererObj.drawString("Incomplete Structure.", 10, 64, 16448255); + if (this.mContainer != null) { + if ((((CONTAINER_IndustrialCentrifuge) this.mContainer).mDisplayErrorCode & 1) != 0) { + this.fontRendererObj.drawString("Pipe is loose.", 10, 16, 16448255); + } + if ((((CONTAINER_IndustrialCentrifuge) this.mContainer).mDisplayErrorCode & 2) != 0) { + this.fontRendererObj.drawString("Screws are missing.", 10, 24, 16448255); + } + if ((((CONTAINER_IndustrialCentrifuge) this.mContainer).mDisplayErrorCode & 4) != 0) { + this.fontRendererObj.drawString("Something is stuck.", 10, 32, 16448255); + } + if ((((CONTAINER_IndustrialCentrifuge) this.mContainer).mDisplayErrorCode & 8) != 0) { + this.fontRendererObj.drawString("Platings are dented.", 10, 40, 16448255); + } + if ((((CONTAINER_IndustrialCentrifuge) this.mContainer).mDisplayErrorCode & 32) != 0) { + this.fontRendererObj.drawString("That doesn't belong there.", 10, 56, 16448255); + } + if ((((CONTAINER_IndustrialCentrifuge) this.mContainer).mDisplayErrorCode & 64) != 0) { + this.fontRendererObj.drawString("Incomplete Structure.", 10, 64, 16448255); + } - if (((CONTAINER_IndustrialCentrifuge) mContainer).mDisplayErrorCode == 0) { - if (((CONTAINER_IndustrialCentrifuge) mContainer).mActive == 0) { - fontRendererObj.drawString("Hit with Soft Hammer", 10, 16, 16448255); - fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255); - fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255); + if (((CONTAINER_IndustrialCentrifuge) this.mContainer).mDisplayErrorCode == 0) { + if (((CONTAINER_IndustrialCentrifuge) this.mContainer).mActive == 0) { + this.fontRendererObj.drawString("Hit with Soft Hammer", 10, 16, 16448255); + this.fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255); + this.fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255); } else { - fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255); + this.fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255); /*if (CORE.DEBUG){ fontRendererObj.drawString("Debug Counter: "+counter, 10, 56, 16448255); }*/ } } - } + } } @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_IronBlastFurnace.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_IronBlastFurnace.java index 9d1a05e68d..a93d9ecf5f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_IronBlastFurnace.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_IronBlastFurnace.java @@ -6,25 +6,25 @@ import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.player.InventoryPlayer; public class GUI_IronBlastFurnace - extends GT_GUIContainerMetaTile_Machine { - public GUI_IronBlastFurnace(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(new CONTAINER_IronBlastFurnace(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI+"IronBlastFurnace.png"); - } +extends GT_GUIContainerMetaTile_Machine { + public GUI_IronBlastFurnace(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(new CONTAINER_IronBlastFurnace(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI+"IronBlastFurnace.png"); + } - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - this.fontRendererObj.drawString("Iron Blast Furnace", 8, 4, 4210752); - } + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + this.fontRendererObj.drawString("Iron Blast Furnace", 8, 4, 4210752); + } - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if ((this.mContainer != null) && - (this.mContainer.mProgressTime > 0)) { - drawTexturedModalRect(x + 58, y + 28, 176, 0, Math.max(0, Math.min(20, 1 + this.mContainer.mProgressTime * 20 / (this.mContainer.mMaxProgressTime < 1 ? 1 : this.mContainer.mMaxProgressTime))), 11); - } - } + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + if ((this.mContainer != null) && + (this.mContainer.mProgressTime > 0)) { + this.drawTexturedModalRect(x + 58, y + 28, 176, 0, Math.max(0, Math.min(20, 1 + ((this.mContainer.mProgressTime * 20) / (this.mContainer.mMaxProgressTime < 1 ? 1 : this.mContainer.mMaxProgressTime)))), 11); + } + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java index f7101e5ae4..952f8978f6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java @@ -15,58 +15,65 @@ import net.minecraft.entity.player.InventoryPlayer; */ public class GUI_MatterFab extends GT_GUIContainerMetaTile_Machine { - String mName = ""; - int uuaUsed = 0; - int uumMade = 0; + String mName = ""; + int uuaUsed = 0; + int uumMade = 0; - public GUI_MatterFab(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { - super(new CONTAINER_MatterFab(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - mName = aName; - } + public GUI_MatterFab(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aTextureFile) { + super(new CONTAINER_MatterFab(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + this.mName = aName; + } - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - fontRendererObj.drawString(mName, 10, 8, 16448255); - - + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + this.fontRendererObj.drawString(this.mName, 10, 8, 16448255); - if (mContainer != null) { - if ((((CONTAINER_MatterFab) mContainer).mDisplayErrorCode & 1) != 0) - fontRendererObj.drawString("Pipe is loose.", 10, 16, 16448255); - if ((((CONTAINER_MatterFab) mContainer).mDisplayErrorCode & 2) != 0) - fontRendererObj.drawString("Screws are missing.", 10, 24, 16448255); - if ((((CONTAINER_MatterFab) mContainer).mDisplayErrorCode & 4) != 0) - fontRendererObj.drawString("Something is stuck.", 10, 32, 16448255); - if ((((CONTAINER_MatterFab) mContainer).mDisplayErrorCode & 8) != 0) - fontRendererObj.drawString("Platings are dented.", 10, 40, 16448255); - if ((((CONTAINER_MatterFab) mContainer).mDisplayErrorCode & 16) != 0) - fontRendererObj.drawString("Circuitry burned out.", 10, 48, 16448255); - if ((((CONTAINER_MatterFab) mContainer).mDisplayErrorCode & 32) != 0) - fontRendererObj.drawString("That doesn't belong there.", 10, 56, 16448255); - if ((((CONTAINER_MatterFab) mContainer).mDisplayErrorCode & 64) != 0) - fontRendererObj.drawString("Incomplete Structure.", 10, 64, 16448255); - if (((CONTAINER_MatterFab) mContainer).mDisplayErrorCode == 0) { - if (((CONTAINER_MatterFab) mContainer).mActive == 0) { - fontRendererObj.drawString("Hit with Soft Hammer", 10, 16, 16448255); - fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255); - fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255); - } else { - uuaUsed = ((CONTAINER_MatterFab) mContainer).mUUA_USED; - uumMade = ((CONTAINER_MatterFab) mContainer).mUUM_MADE; - fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255); - fontRendererObj.drawString("UU-Amplifier Used: "+uuaUsed, 10, 24, 16448255); - fontRendererObj.drawString("UU-Matter Fabricated: "+uumMade, 10, 32, 16448255); - } - } - } - } - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } + if (this.mContainer != null) { + if ((((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode & 1) != 0) { + this.fontRendererObj.drawString("Pipe is loose.", 10, 16, 16448255); + } + if ((((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode & 2) != 0) { + this.fontRendererObj.drawString("Screws are missing.", 10, 24, 16448255); + } + if ((((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode & 4) != 0) { + this.fontRendererObj.drawString("Something is stuck.", 10, 32, 16448255); + } + if ((((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode & 8) != 0) { + this.fontRendererObj.drawString("Platings are dented.", 10, 40, 16448255); + } + if ((((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode & 16) != 0) { + this.fontRendererObj.drawString("Circuitry burned out.", 10, 48, 16448255); + } + if ((((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode & 32) != 0) { + this.fontRendererObj.drawString("That doesn't belong there.", 10, 56, 16448255); + } + if ((((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode & 64) != 0) { + this.fontRendererObj.drawString("Incomplete Structure.", 10, 64, 16448255); + } + + if (((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode == 0) { + if (((CONTAINER_MatterFab) this.mContainer).mActive == 0) { + this.fontRendererObj.drawString("Hit with Soft Hammer", 10, 16, 16448255); + this.fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255); + this.fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255); + } else { + this.uuaUsed = ((CONTAINER_MatterFab) this.mContainer).mUUA_USED; + this.uumMade = ((CONTAINER_MatterFab) this.mContainer).mUUM_MADE; + this.fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255); + this.fontRendererObj.drawString("UU-Amplifier Used: "+this.uuaUsed, 10, 24, 16448255); + this.fontRendererObj.drawString("UU-Matter Fabricated: "+this.uumMade, 10, 32, 16448255); + } + } + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java index c4114e70e1..c927d814f8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java @@ -15,50 +15,57 @@ import net.minecraft.entity.player.InventoryPlayer; */ public class GUI_MultiMachine extends GT_GUIContainerMetaTile_Machine { - String mName = ""; + String mName = ""; - public GUI_MultiMachine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { - super(new CONTAINER_MultiMachine(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - mName = aName; - } + public GUI_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aTextureFile) { + super(new CONTAINER_MultiMachine(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + this.mName = aName; + } - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - fontRendererObj.drawString(mName, 10, 8, 16448255); + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + this.fontRendererObj.drawString(this.mName, 10, 8, 16448255); - if (mContainer != null) { - if ((((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode & 1) != 0) - fontRendererObj.drawString("Pipe is loose.", 10, 16, 16448255); - if ((((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode & 2) != 0) - fontRendererObj.drawString("Screws are missing.", 10, 24, 16448255); - if ((((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode & 4) != 0) - fontRendererObj.drawString("Something is stuck.", 10, 32, 16448255); - if ((((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode & 8) != 0) - fontRendererObj.drawString("Platings are dented.", 10, 40, 16448255); - if ((((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode & 16) != 0) - fontRendererObj.drawString("Circuitry burned out.", 10, 48, 16448255); - if ((((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode & 32) != 0) - fontRendererObj.drawString("That doesn't belong there.", 10, 56, 16448255); - if ((((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode & 64) != 0) - fontRendererObj.drawString("Incomplete Structure.", 10, 64, 16448255); + if (this.mContainer != null) { + if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 1) != 0) { + this.fontRendererObj.drawString("Pipe is loose.", 10, 16, 16448255); + } + if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 2) != 0) { + this.fontRendererObj.drawString("Screws are missing.", 10, 24, 16448255); + } + if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 4) != 0) { + this.fontRendererObj.drawString("Something is stuck.", 10, 32, 16448255); + } + if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 8) != 0) { + this.fontRendererObj.drawString("Platings are dented.", 10, 40, 16448255); + } + if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 16) != 0) { + this.fontRendererObj.drawString("Circuitry burned out.", 10, 48, 16448255); + } + if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 32) != 0) { + this.fontRendererObj.drawString("That doesn't belong there.", 10, 56, 16448255); + } + if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 64) != 0) { + this.fontRendererObj.drawString("Incomplete Structure.", 10, 64, 16448255); + } - if (((CONTAINER_MultiMachine) mContainer).mDisplayErrorCode == 0) { - if (((CONTAINER_MultiMachine) mContainer).mActive == 0) { - fontRendererObj.drawString("Hit with Soft Hammer", 10, 16, 16448255); - fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255); - fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255); - } else { - fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255); - } - } - } - } + if (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode == 0) { + if (((CONTAINER_MultiMachine) this.mContainer).mActive == 0) { + this.fontRendererObj.drawString("Hit with Soft Hammer", 10, 16, 16448255); + this.fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255); + this.fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255); + } else { + this.fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255); + } + } + } + } - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SafeBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SafeBlock.java index d5f970870b..77d0656f60 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SafeBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SafeBlock.java @@ -6,44 +6,44 @@ import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.player.InventoryPlayer; public class GUI_SafeBlock - extends GT_GUIContainerMetaTile_Machine { - public GUI_SafeBlock(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(new CONTAINER_SafeBlock(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "SafeBlock.png"); - } - - //String UUID = ((CONTAINER_SafeBlock)this.mContainer).ownerUUID.toString(); - boolean blockStatus = ((CONTAINER_SafeBlock)this.mContainer).blockStatus; - //String tempPlayer; - - private void updateVars(){ - //UUID = ((CONTAINER_SafeBlock)this.mContainer).ownerUUID; - blockStatus = ((CONTAINER_SafeBlock)this.mContainer).blockStatus; - // tempPlayer = PlayerCache.lookupPlayerByUUID(UUID); - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) - { - updateVars(); - //this.fontRendererObj.drawString("Owner: "+ tempPlayer, 64, 72, 4210752); - //this.fontRendererObj.drawString(": "+ UUID.toLowerCase(), 44, 82, 4210752); - this.fontRendererObj.drawString("Safe Status", 76, 61, 4210752); - if (blockStatus){ - this.fontRendererObj.drawString("Locked", 88, 73, 4210752); - } - else { - this.fontRendererObj.drawString("Unlocked", 82, 73, 4210752); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - /*String UUID = ((CONTAINER_SafeBlock)this.mContainer).UUID; +extends GT_GUIContainerMetaTile_Machine { + public GUI_SafeBlock(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(new CONTAINER_SafeBlock(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "SafeBlock.png"); + } + + //String UUID = ((CONTAINER_SafeBlock)this.mContainer).ownerUUID.toString(); + boolean blockStatus = ((CONTAINER_SafeBlock)this.mContainer).blockStatus; + //String tempPlayer; + + private void updateVars(){ + //UUID = ((CONTAINER_SafeBlock)this.mContainer).ownerUUID; + this.blockStatus = ((CONTAINER_SafeBlock)this.mContainer).blockStatus; + // tempPlayer = PlayerCache.lookupPlayerByUUID(UUID); + } + + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) + { + this.updateVars(); + //this.fontRendererObj.drawString("Owner: "+ tempPlayer, 64, 72, 4210752); + //this.fontRendererObj.drawString(": "+ UUID.toLowerCase(), 44, 82, 4210752); + this.fontRendererObj.drawString("Safe Status", 76, 61, 4210752); + if (this.blockStatus){ + this.fontRendererObj.drawString("Locked", 88, 73, 4210752); + } + else { + this.fontRendererObj.drawString("Unlocked", 82, 73, 4210752); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + /*String UUID = ((CONTAINER_SafeBlock)this.mContainer).UUID; this.fontRendererObj.drawString("Owner UUID: "+ UUID, 8, 12, 4210752);*/ - - } + + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SolarGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SolarGenerator.java index 7c185ebb94..419c86da7d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SolarGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SolarGenerator.java @@ -5,37 +5,39 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; public class GUI_SolarGenerator - extends GT_GUIContainerMetaTile_Machine { - public GUI_SolarGenerator(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aTextureName, int aSteamCapacity) { - super(new CONTAINER_SolarGenerator(aInventoryPlayer, aTileEntity, aSteamCapacity), "gregtech:textures/gui/" + aTextureName); - } +extends GT_GUIContainerMetaTile_Machine { + public GUI_SolarGenerator(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aTextureName, final int aSteamCapacity) { + super(new CONTAINER_SolarGenerator(aInventoryPlayer, aTileEntity, aSteamCapacity), "gregtech:textures/gui/" + aTextureName); + } - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - this.fontRendererObj.drawString("Solar Generator", 8, 4, 4210752); - } + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + this.fontRendererObj.drawString("Solar Generator", 8, 4, 4210752); + } - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null) { - int tScale = ((CONTAINER_SolarGenerator) this.mContainer).mProcessingEnergy; - if (tScale > 0) { - drawTexturedModalRect(x + 70, y + 25 + 54 - tScale, 194, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_SolarGenerator) this.mContainer).mEnergy; - if (tScale > 0) { - drawTexturedModalRect(x + 83, y + 25 + 54 - tScale, 204, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_SolarGenerator) this.mContainer).mTemperature; - if (tScale > 0) { - drawTexturedModalRect(x + 96, y + 25 + 54 - tScale, 214, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_SolarGenerator) this.mContainer).mProcessingEnergy; - if (tScale > 0) { - drawTexturedModalRect(x + 117, y + 44 + 14 - tScale, 177, 14 - tScale, 15, tScale + 1); - } - } - } + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + if (this.mContainer != null) { + int tScale = ((CONTAINER_SolarGenerator) this.mContainer).mProcessingEnergy; + if (tScale > 0) { + this.drawTexturedModalRect(x + 70, (y + 25 + 54) - tScale, 194, 54 - tScale, 10, tScale); + } + tScale = ((CONTAINER_SolarGenerator) this.mContainer).mEnergy; + if (tScale > 0) { + this.drawTexturedModalRect(x + 83, (y + 25 + 54) - tScale, 204, 54 - tScale, 10, tScale); + } + tScale = ((CONTAINER_SolarGenerator) this.mContainer).mTemperature; + if (tScale > 0) { + this.drawTexturedModalRect(x + 96, (y + 25 + 54) - tScale, 214, 54 - tScale, 10, tScale); + } + tScale = ((CONTAINER_SolarGenerator) this.mContainer).mProcessingEnergy; + if (tScale > 0) { + this.drawTexturedModalRect(x + 117, (y + 44 + 14) - tScale, 177, 14 - tScale, 15, tScale + 1); + } + } + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java index 9c4e14f0dc..a4a98a0644 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java @@ -8,48 +8,48 @@ import net.minecraft.entity.player.InventoryPlayer; public class GUI_SteamCondenser extends GT_GUIContainerMetaTile_Machine { long tickTime = 0; - - public GUI_SteamCondenser(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aTextureName, int aSteamCapacity) - { - super(new CONTAINER_SteamCondenser(aInventoryPlayer, aTileEntity, aSteamCapacity), CORE.RES_PATH_GUI + aTextureName); - } - - @Override -protected void drawGuiContainerForegroundLayer(int par1, int par2) - { - this.fontRendererObj.drawString("Condenser", 8, 4, 4210752); - if (CORE.DEBUG){ - tickTime = ((CONTAINER_SteamCondenser)this.mContainer).mTickingTime; - this.fontRendererObj.drawString("Tick Time: "+tickTime, 8, 12, 4210752); - } - } - - @Override -protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) - { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null) - { - - int tScale = ((CONTAINER_SteamCondenser)this.mContainer).mSteamAmount; - if (tScale > 0) { - drawTexturedModalRect(x + 70, y + 25 + 54 - tScale, 194, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_SteamCondenser)this.mContainer).mWaterAmount; - if (tScale > 0) { - drawTexturedModalRect(x + 83, y + 25 + 54 - tScale, 204, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_SteamCondenser)this.mContainer).mTemperature; - if (tScale > 0) { - drawTexturedModalRect(x + 96, y + 25 + 54 - tScale, 214, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_SteamCondenser)this.mContainer).mProcessingEnergy; - if (tScale > 0) { - drawTexturedModalRect(x + 115, y + 44 + 2/* - tScale*/, 177, 14 - tScale, 15, 1+tScale); - } - } - } + + public GUI_SteamCondenser(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aTextureName, final int aSteamCapacity) + { + super(new CONTAINER_SteamCondenser(aInventoryPlayer, aTileEntity, aSteamCapacity), CORE.RES_PATH_GUI + aTextureName); + } + + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) + { + this.fontRendererObj.drawString("Condenser", 8, 4, 4210752); + if (CORE.DEBUG){ + this.tickTime = ((CONTAINER_SteamCondenser)this.mContainer).mTickingTime; + this.fontRendererObj.drawString("Tick Time: "+this.tickTime, 8, 12, 4210752); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) + { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + if (this.mContainer != null) + { + + int tScale = ((CONTAINER_SteamCondenser)this.mContainer).mSteamAmount; + if (tScale > 0) { + this.drawTexturedModalRect(x + 70, (y + 25 + 54) - tScale, 194, 54 - tScale, 10, tScale); + } + tScale = ((CONTAINER_SteamCondenser)this.mContainer).mWaterAmount; + if (tScale > 0) { + this.drawTexturedModalRect(x + 83, (y + 25 + 54) - tScale, 204, 54 - tScale, 10, tScale); + } + tScale = ((CONTAINER_SteamCondenser)this.mContainer).mTemperature; + if (tScale > 0) { + this.drawTexturedModalRect(x + 96, (y + 25 + 54) - tScale, 214, 54 - tScale, 10, tScale); + } + tScale = ((CONTAINER_SteamCondenser)this.mContainer).mProcessingEnergy; + if (tScale > 0) { + this.drawTexturedModalRect(x + 115, y + 44 + 2/* - tScale*/, 177, 14 - tScale, 15, 1+tScale); + } + } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_TreeFarmer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_TreeFarmer.java index 25cd4863a8..565c378179 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_TreeFarmer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_TreeFarmer.java @@ -12,32 +12,32 @@ public class GUI_TreeFarmer extends GT_GUIContainerMetaTile_Machine { long maxPower = 0; long storedPower = 0; - public GUI_TreeFarmer(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { + public GUI_TreeFarmer(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aTextureFile) { super(new CONTAINER_TreeFarmer(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - mName = aName; + this.mName = aName; } @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - fontRendererObj.drawString(mName, 64, 6, 16448255); - if (mContainer != null) { - maxPower = ((CONTAINER_TreeFarmer)this.mContainer).maxEU; - storedPower = ((CONTAINER_TreeFarmer)this.mContainer).storedEU; - if (((CONTAINER_TreeFarmer) mContainer).mDisplayErrorCode == 0) { - fontRendererObj.drawString("Current Power Stored: "+storedPower+"EU", 10, 52, 16448255); - fontRendererObj.drawString("Max Power Storage: "+maxPower+"EU", 10, 60, 16448255); - fontRendererObj.drawString("Current operations left: "+(storedPower/32), 10, 68, 16448255); + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + this.fontRendererObj.drawString(this.mName, 64, 6, 16448255); + if (this.mContainer != null) { + this.maxPower = ((CONTAINER_TreeFarmer)this.mContainer).maxEU; + this.storedPower = ((CONTAINER_TreeFarmer)this.mContainer).storedEU; + if (((CONTAINER_TreeFarmer) this.mContainer).mDisplayErrorCode == 0) { + this.fontRendererObj.drawString("Current Power Stored: "+this.storedPower+"EU", 10, 52, 16448255); + this.fontRendererObj.drawString("Max Power Storage: "+this.maxPower+"EU", 10, 60, 16448255); + this.fontRendererObj.drawString("Current operations left: "+(this.storedPower/32), 10, 68, 16448255); } } } @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { super.drawGuiContainerBackgroundLayer(par1, par2, par3); - maxPower = ((CONTAINER_TreeFarmer)this.mContainer).maxEU; - storedPower = ((CONTAINER_TreeFarmer)this.mContainer).storedEU; - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + this.maxPower = ((CONTAINER_TreeFarmer)this.mContainer).maxEU; + this.storedPower = ((CONTAINER_TreeFarmer)this.mContainer).storedEU; + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index 59426aae36..8159519016 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -90,18 +90,18 @@ public interface IGregtech_RecipeAdder { * @return true if the Recipe got added, otherwise false. */ public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aOutput, int aChance, int aDuration, int aEUt); - - + + public boolean addLFTRRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt); public boolean addLFTRRecipe(ItemStack aInput1, FluidStack aInput2, ItemStack aOutput1, FluidStack aOutput2, int aDuration, int aEUt); - public boolean addLFTRRecipe(FluidStack aInput1, FluidStack aInput2, FluidStack aOutput1, int aDuration, int aEUt); - - - public boolean addFissionFuel( - FluidStack aInput1, FluidStack aInput2, FluidStack aInput3, - FluidStack aInput4, FluidStack aInput5, FluidStack aInput6, - FluidStack aInput7, FluidStack aInput8, FluidStack aInput9, - FluidStack aOutput1, FluidStack aOutput2, - int aDuration, int aEUt); + public boolean addLFTRRecipe(FluidStack aInput1, FluidStack aInput2, FluidStack aOutput1, int aDuration, int aEUt); + + + public boolean addFissionFuel( + FluidStack aInput1, FluidStack aInput2, FluidStack aInput3, + FluidStack aInput4, FluidStack aInput5, FluidStack aInput6, + FluidStack aInput7, FluidStack aInput8, FluidStack aInput9, + FluidStack aOutput1, FluidStack aOutput2, + int aDuration, int aEUt); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_IconContainer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_IconContainer.java index 8e1715caf5..b6c36483af 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_IconContainer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_IconContainer.java @@ -4,18 +4,18 @@ import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; public interface Interface_IconContainer { - /** - * @return A regular Icon. - */ - public IIcon getIcon(); + /** + * @return A regular Icon. + */ + public IIcon getIcon(); - /** - * @return Icon of the Overlay (or null if there is no Icon) - */ - public IIcon getOverlayIcon(); + /** + * @return Icon of the Overlay (or null if there is no Icon) + */ + public IIcon getOverlayIcon(); - /** - * @return the Default Texture File for this Icon. - */ - public ResourceLocation getTextureFile(); + /** + * @return the Default Texture File for this Icon. + */ + public ResourceLocation getTextureFile(); }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java index 03f7b1bd1e..def74a30c5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java @@ -1,10 +1,9 @@ package gtPlusPlus.xmod.gregtech.api.interfaces.internal; -import gregtech.api.enums.SubTag; -import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_Base; - import java.util.List; +import gregtech.api.enums.SubTag; +import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_Base; import net.minecraft.dispenser.IBlockSource; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -15,27 +14,27 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; public interface Interface_ItemBehaviour<E extends Item> { - public boolean onLeftClickEntity(E aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity); + public boolean onLeftClickEntity(E aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity); - public boolean onItemUse(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); + public boolean onItemUse(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); - public boolean onItemUseFirst(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); + public boolean onItemUseFirst(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); - public ItemStack onItemRightClick(E aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer); + public ItemStack onItemRightClick(E aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer); - public List<String> getAdditionalToolTips(E aItem, List<String> aList, ItemStack aStack); + public List<String> getAdditionalToolTips(E aItem, List<String> aList, ItemStack aStack); - public void onUpdate(E aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand); + public void onUpdate(E aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand); - public boolean isItemStackUsable(E aItem, ItemStack aStack); + public boolean isItemStackUsable(E aItem, ItemStack aStack); - public boolean canDispense(E aItem, IBlockSource aSource, ItemStack aStack); + public boolean canDispense(E aItem, IBlockSource aSource, ItemStack aStack); - public ItemStack onDispense(E aItem, IBlockSource aSource, ItemStack aStack); + public ItemStack onDispense(E aItem, IBlockSource aSource, ItemStack aStack); - public boolean hasProjectile(Gregtech_MetaItem_Base aItem, SubTag aProjectileType, ItemStack aStack); + public boolean hasProjectile(Gregtech_MetaItem_Base aItem, SubTag aProjectileType, ItemStack aStack); - public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ); + public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ); - public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed); + public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed); }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator.java index d4e37ee476..0aa93e9f21 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator.java @@ -6,14 +6,14 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import net.minecraft.item.ItemStack; public interface Interface_OreRecipeRegistrator { - /** - * Contains a Code Fragment, used in the OrePrefix to register Recipes. Better than using a switch/case, like I did before. - * - * @param aPrefix always != null - * @param aMaterial always != null, and can be == _NULL if the Prefix is Self Referencing or not Material based! - * @param aStack always != null - */ - public void registerOre(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack); + /** + * Contains a Code Fragment, used in the OrePrefix to register Recipes. Better than using a switch/case, like I did before. + * + * @param aPrefix always != null + * @param aMaterial always != null, and can be == _NULL if the Prefix is Self Referencing or not Material based! + * @param aStack always != null + */ + public void registerOre(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack); public void registerOre(GregtechOrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack copyAmount); }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator_GT.java index ed276ad3f9..9fd2ca580c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator_GT.java @@ -5,12 +5,12 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import net.minecraft.item.ItemStack; public interface Interface_OreRecipeRegistrator_GT { - /** - * Contains a Code Fragment, used in the OrePrefix to register Recipes. Better than using a switch/case, like I did before. - * - * @param aPrefix always != null - * @param aMaterial always != null, and can be == _NULL if the Prefix is Self Referencing or not Material based! - * @param aStack always != null - */ - public void registerOre(OrePrefixes aPrefix, GT_Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack); + /** + * Contains a Code Fragment, used in the OrePrefix to register Recipes. Better than using a switch/case, like I did before. + * + * @param aPrefix always != null + * @param aMaterial always != null, and can be == _NULL if the Prefix is Self Referencing or not Material based! + * @param aStack always != null + */ + public void registerOre(OrePrefixes aPrefix, GT_Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack); }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_Texture.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_Texture.java index 76c5113186..74c996d116 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_Texture.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_Texture.java @@ -4,17 +4,17 @@ import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; public interface Interface_Texture { - public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); + public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - public boolean isValidTexture(); + public boolean isValidTexture(); }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java index 26b8dc1d3d..fa5ff66310 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_ToolStats.java @@ -1,12 +1,11 @@ package gtPlusPlus.xmod.gregtech.api.interfaces.internal; +import java.util.List; + import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.IToolStats; import gregtech.api.items.GT_MetaGenerated_Tool; import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool; - -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.Entity; @@ -25,6 +24,7 @@ public interface Interface_ToolStats extends IToolStats{ /** * Called when aPlayer crafts this Tool */ + @Override public void onToolCrafted(ItemStack aStack, EntityPlayer aPlayer); /** @@ -35,70 +35,88 @@ public interface Interface_ToolStats extends IToolStats{ /** * @return Damage the Tool receives when breaking a Block. 100 is one Damage Point (or 100 EU). */ + @Override public int getToolDamagePerBlockBreak(); /** * @return Damage the Tool receives when converting the drops of a Block. 100 is one Damage Point (or 100 EU). */ + @Override public int getToolDamagePerDropConversion(); /** * @return Damage the Tool receives when being used as Container Item. 100 is one use, however it is usually 8 times more than normal. */ + @Override public int getToolDamagePerContainerCraft(); /** * @return Damage the Tool receives when being used as Weapon, 200 is the normal Value, 100 for actual Weapons. */ + @Override public int getToolDamagePerEntityAttack(); /** * @return Basic Quality of the Tool, 0 is normal. If increased, it will increase the general quality of all Tools of this Type. Decreasing is also possible. */ + @Override public int getBaseQuality(); /** * @return The Damage Bonus for this Type of Tool against Mobs. 1.0F is normal punch. */ + @Override public float getBaseDamage(); /** * @return This gets the Hurt Resistance time for Entities getting hit. (always does 1 as minimum) */ + @Override public int getHurtResistanceTime(int aOriginalHurtResistance, Entity aEntity); /** * @return This is a multiplier for the Tool Speed. 1.0F = no special Speed. */ + @Override public float getSpeedMultiplier(); /** * @return This is a multiplier for the Tool Speed. 1.0F = no special Durability. */ + @Override public float getMaxDurabilityMultiplier(); + @Override public DamageSource getDamageSource(EntityLivingBase aPlayer, Entity aEntity); + @Override public String getMiningSound(); + @Override public String getCraftingSound(); + @Override public String getEntityHitSound(); + @Override public String getBreakingSound(); + @Override public Enchantment[] getEnchantments(ItemStack aStack); + @Override public int[] getEnchantmentLevels(ItemStack aStack); /** * @return If this Tool can be used for blocking Damage like a Sword. */ + @Override public boolean canBlock(); /** * @return If this Tool can be used as an RC Crowbar. */ + @Override public boolean isCrowbar(); /** @@ -109,16 +127,19 @@ public interface Interface_ToolStats extends IToolStats{ /** * @return If this Tool can be used as Weapon i.e. if that is the main purpose. */ + @Override public boolean isWeapon(); /** * @return If this Tool is a Ranged Weapon. Return false at isWeapon unless you have a Blade attached to your Bow/Gun or something */ + @Override public boolean isRangedWeapon(); /** * @return If this Tool can be used as Weapon i.e. if that is the main purpose. */ + @Override public boolean isMiningTool(); /** @@ -127,6 +148,7 @@ public interface Interface_ToolStats extends IToolStats{ * * @return If this is a minable Block. Tool Quality checks (like Diamond Tier or something) are separate from this check. */ + @Override public boolean isMinableBlock(Block aBlock, byte aMetaData); /** @@ -134,29 +156,36 @@ public interface Interface_ToolStats extends IToolStats{ * * @return the Amount of modified Items. */ + @Override public int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent); /** * @return Returns a broken Version of the Item. */ + @Override public ItemStack getBrokenItem(ItemStack aStack); /** * @return the Damage actually done to the Mob. */ + @Override public float getNormalDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer); /** * @return the Damage actually done to the Mob. */ + @Override public float getMagicDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer); + @Override public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack); + @Override public short[] getRGBa(boolean aIsToolHead, ItemStack aStack); - + /** * Called when this gets added to a Tool Item */ + @Override public void onStatsAddedToTool(GT_MetaGenerated_Tool aItem, int aID); }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java index 14caa65a55..b0b0cd953d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java @@ -1,14 +1,16 @@ package gtPlusPlus.xmod.gregtech.api.items; +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.SubTag; import gregtech.api.interfaces.IProjectileItem; import gregtech.api.util.*; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; - -import java.util.List; - import net.minecraft.block.BlockDispenser; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.dispenser.*; @@ -21,140 +23,144 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; /** * Extended by most Items, also used as a fallback Item, to prevent the accidental deletion when Errors occur. */ public class Gregtech_Generic_Item extends Item implements IProjectileItem { - private final String mName, mTooltip; - protected IIcon mIcon; - - public Gregtech_Generic_Item(String aUnlocalized, String aEnglish, String aEnglishTooltip) { - this(aUnlocalized, aEnglish, aEnglishTooltip, true); - } - - public Gregtech_Generic_Item(String aUnlocalized, String aEnglish, String aEnglishTooltip, boolean aWriteToolTipIntoLangFile) { - super(); - mName = aUnlocalized; - GT_LanguageManager.addStringLocalization(mName + ".name", aEnglish); - if (GT_Utility.isStringValid(aEnglishTooltip)) - GT_LanguageManager.addStringLocalization(mTooltip = mName + ".tooltip_main", aEnglishTooltip, aWriteToolTipIntoLangFile); - else mTooltip = null; - setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerItem(this, mName, CORE.MODID); - BlockDispenser.dispenseBehaviorRegistry.putObject(this, new GT_Item_Dispense()); - } - - @Override - public final Item setUnlocalizedName(String aName) { - return this; - } - - @Override - public final String getUnlocalizedName() { - return mName; - } - - @Override - public String getUnlocalizedName(ItemStack aStack) { - return getHasSubtypes() ? mName + "." + getDamage(aStack) : mName; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aIconRegister) { - mIcon = aIconRegister.registerIcon(CORE.MODID+":"+mName); - } - - @Override - public boolean doesSneakBypassUse(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { - return true; - } - - @Override - public IIcon getIconFromDamage(int par1) { - return mIcon; - } - - public int getTier(ItemStack aStack) { - return 0; - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - if (getMaxDamage() > 0 && !getHasSubtypes()) - aList.add((aStack.getMaxDamage() - getDamage(aStack)) + " / " + aStack.getMaxDamage()); - if (mTooltip != null) aList.add(GT_LanguageManager.getTranslation(mTooltip)); - if (GT_ModHandler.isElectricItem(aStack)) aList.add("Tier: " + getTier(aStack)); - addAdditionalToolTips(aList, aStack); - } - - protected void addAdditionalToolTips(List aList, ItemStack aStack) { - // - } - - @Override - public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - isItemStackUsable(aStack); - } - - public boolean isItemStackUsable(ItemStack aStack) { - return true; - } - - public ItemStack onDispense(IBlockSource aSource, ItemStack aStack) { - EnumFacing enumfacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata()); - IPosition iposition = BlockDispenser.func_149939_a(aSource); - ItemStack itemstack1 = aStack.splitStack(1); - BehaviorDefaultDispenseItem.doDispense(aSource.getWorld(), itemstack1, 6, enumfacing, iposition); - return aStack; - } - - @Override - public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ) { - return null; - } - - @Override - public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed) { - return null; - } - - @Override - public boolean hasProjectile(SubTag aProjectileType, ItemStack aStack) { - return false; - } - - @Override - public ItemStack getContainerItem(ItemStack aStack) { - return null; - } - - @Override - public boolean hasContainerItem(ItemStack aStack) { - return getContainerItem(aStack) != null; - } - - public static class GT_Item_Dispense extends BehaviorProjectileDispense { - @Override - public ItemStack dispenseStack(IBlockSource aSource, ItemStack aStack) { - return ((Gregtech_Generic_Item) aStack.getItem()).onDispense(aSource, aStack); - } - - @Override - protected IProjectile getProjectileEntity(World aWorld, IPosition aPosition) { - return null; - } - } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (stack.getDisplayName().contains("LuV")){ - HEX_OxFFFFFF = 0xffffcc; - } + private final String mName, mTooltip; + protected IIcon mIcon; + + public Gregtech_Generic_Item(final String aUnlocalized, final String aEnglish, final String aEnglishTooltip) { + this(aUnlocalized, aEnglish, aEnglishTooltip, true); + } + + public Gregtech_Generic_Item(final String aUnlocalized, final String aEnglish, final String aEnglishTooltip, final boolean aWriteToolTipIntoLangFile) { + super(); + this.mName = aUnlocalized; + GT_LanguageManager.addStringLocalization(this.mName + ".name", aEnglish); + if (GT_Utility.isStringValid(aEnglishTooltip)) { + GT_LanguageManager.addStringLocalization(this.mTooltip = this.mName + ".tooltip_main", aEnglishTooltip, aWriteToolTipIntoLangFile); + } else { + this.mTooltip = null; + } + this.setCreativeTab(AddToCreativeTab.tabMachines); + GameRegistry.registerItem(this, this.mName, CORE.MODID); + BlockDispenser.dispenseBehaviorRegistry.putObject(this, new GT_Item_Dispense()); + } + + @Override + public final Item setUnlocalizedName(final String aName) { + return this; + } + + @Override + public final String getUnlocalizedName() { + return this.mName; + } + + @Override + public String getUnlocalizedName(final ItemStack aStack) { + return this.getHasSubtypes() ? this.mName + "." + this.getDamage(aStack) : this.mName; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(final IIconRegister aIconRegister) { + this.mIcon = aIconRegister.registerIcon(CORE.MODID+":"+this.mName); + } + + @Override + public boolean doesSneakBypassUse(final World aWorld, final int aX, final int aY, final int aZ, final EntityPlayer aPlayer) { + return true; + } + + @Override + public IIcon getIconFromDamage(final int par1) { + return this.mIcon; + } + + public int getTier(final ItemStack aStack) { + return 0; + } + + @Override + public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList, final boolean aF3_H) { + if ((this.getMaxDamage() > 0) && !this.getHasSubtypes()) { + aList.add((aStack.getMaxDamage() - this.getDamage(aStack)) + " / " + aStack.getMaxDamage()); + } + if (this.mTooltip != null) { + aList.add(GT_LanguageManager.getTranslation(this.mTooltip)); + } + if (GT_ModHandler.isElectricItem(aStack)) { + aList.add("Tier: " + this.getTier(aStack)); + } + this.addAdditionalToolTips(aList, aStack); + } + + protected void addAdditionalToolTips(final List aList, final ItemStack aStack) { + // + } + + @Override + public void onCreated(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { + this.isItemStackUsable(aStack); + } + + public boolean isItemStackUsable(final ItemStack aStack) { + return true; + } + + public ItemStack onDispense(final IBlockSource aSource, final ItemStack aStack) { + final EnumFacing enumfacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata()); + final IPosition iposition = BlockDispenser.func_149939_a(aSource); + final ItemStack itemstack1 = aStack.splitStack(1); + BehaviorDefaultDispenseItem.doDispense(aSource.getWorld(), itemstack1, 6, enumfacing, iposition); + return aStack; + } + + @Override + public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld, final double aX, final double aY, final double aZ) { + return null; + } + + @Override + public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld, final EntityLivingBase aEntity, final float aSpeed) { + return null; + } + + @Override + public boolean hasProjectile(final SubTag aProjectileType, final ItemStack aStack) { + return false; + } + + @Override + public ItemStack getContainerItem(final ItemStack aStack) { + return null; + } + + @Override + public boolean hasContainerItem(final ItemStack aStack) { + return this.getContainerItem(aStack) != null; + } + + public static class GT_Item_Dispense extends BehaviorProjectileDispense { + @Override + public ItemStack dispenseStack(final IBlockSource aSource, final ItemStack aStack) { + return ((Gregtech_Generic_Item) aStack.getItem()).onDispense(aSource, aStack); + } + + @Override + protected IProjectile getProjectileEntity(final World aWorld, final IPosition aPosition) { + return null; + } + } + + @Override + public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { + if (stack.getDisplayName().contains("LuV")){ + HEX_OxFFFFFF = 0xffffcc; + } else if (stack.getDisplayName().contains("ZPM")){ HEX_OxFFFFFF = 0xace600; } @@ -175,7 +181,7 @@ public class Gregtech_Generic_Item extends Item implements IProjectileItem { } else { HEX_OxFFFFFF = 0xffffff; - } + } return HEX_OxFFFFFF; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java index 5b4b32bbfa..0fdcd27638 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java @@ -1,8 +1,14 @@ package gtPlusPlus.xmod.gregtech.api.items; import static gregtech.api.enums.GT_Values.D1; + +import java.util.*; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.Materials; +import gregtech.api.enums.SubTag; import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.interfaces.*; import gregtech.api.objects.ItemData; @@ -10,291 +16,309 @@ import gregtech.api.util.*; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour; - -import java.util.*; - import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.*; import net.minecraft.util.IIcon; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base { - /** - * All instances of this Item Class are listed here. - * This gets used to register the Renderer to all Items of this Type, if useStandardMetaItemRenderer() returns true. - * <p/> - * You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item. - */ - public static final HashMap<String, Gregtech_MetaItem> sInstances = new HashMap<String, Gregtech_MetaItem>(); + /** + * All instances of this Item Class are listed here. + * This gets used to register the Renderer to all Items of this Type, if useStandardMetaItemRenderer() returns true. + * <p/> + * You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item. + */ + public static final HashMap<String, Gregtech_MetaItem> sInstances = new HashMap<>(); /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - public final short mOffset, mItemAmount; - public final BitSet mEnabledItems; - public final BitSet mVisibleItems; - public final IIcon[][] mIconList; - - public final HashMap<Short, IFoodStat> mFoodStats = new HashMap<Short, IFoodStat>(); - public final HashMap<Short, Long[]> mElectricStats = new HashMap<Short, Long[]>(); - public final HashMap<Short, Long[]> mFluidContainerStats = new HashMap<Short, Long[]>(); - public final HashMap<Short, Short> mBurnValues = new HashMap<Short, Short>(); - - /** - * Creates the Item using these Parameters. - * - * @param aUnlocalized The Unlocalized Name of this Item. - */ - public Gregtech_MetaItem(String aUnlocalized, short aOffset, short aItemAmount) { - super(aUnlocalized); - setCreativeTab(AddToCreativeTab.tabMachines); - setHasSubtypes(true); - setMaxDamage(0); - mEnabledItems = new BitSet(aItemAmount); - mVisibleItems = new BitSet(aItemAmount); - - mOffset = (short) Math.min(32766, aOffset); - mItemAmount = (short) Math.min(aItemAmount, 32766 - mOffset); - mIconList = new IIcon[aItemAmount][1]; - - sInstances.put(getUnlocalizedName(), this); - } - - /** - * This adds a Custom Item to the ending Range. - * - * @param aID The Id of the assigned Item [0 - mItemAmount] (The MetaData gets auto-shifted by +mOffset) - * @param aEnglish The Default Localized Name of the created Item - * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip - * @param aFoodBehavior The Food Value of this Item. Can be null aswell. Just a convenience thing. - * @param aRandomData The OreDict Names you want to give the Item. Also used for TC Aspects and some other things. - * @return An ItemStack containing the newly created Item. - */ - public final ItemStack addItem(int aID, String aEnglish, String aToolTip, Object... aRandomData) { - if (aToolTip == null) aToolTip = ""; - if (aID >= 0 && aID < mItemAmount) { - ItemStack rStack = new ItemStack(this, 1, mOffset + aID); - mEnabledItems.set(aID); - mVisibleItems.set(aID); - GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".name", aEnglish); - GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".tooltip", aToolTip); - List<TC_AspectStack> tAspects = new ArrayList<TC_AspectStack>(); - // Important Stuff to do first - for (Object tRandomData : aRandomData) - if (tRandomData instanceof SubTag) { - if (tRandomData == SubTag.INVISIBLE) { - mVisibleItems.set(aID, false); - continue; - } - if (tRandomData == SubTag.NO_UNIFICATION) { - GT_OreDictUnificator.addToBlacklist(rStack); - continue; - } - } - // now check for the rest - for (Object tRandomData : aRandomData) - if (tRandomData != null) { - boolean tUseOreDict = true; - - if (tRandomData instanceof Interface_ItemBehaviour) { - addItemBehavior(mOffset + aID, (Interface_ItemBehaviour<Gregtech_MetaItem_Base>) tRandomData); - tUseOreDict = false; - } - if (tRandomData instanceof IItemContainer) { - ((IItemContainer) tRandomData).set(rStack); - tUseOreDict = false; - } - if (tRandomData instanceof SubTag) { - continue; - } - if (tRandomData instanceof TC_AspectStack) { - ((TC_AspectStack) tRandomData).addToAspectList(tAspects); - continue; - } - if (tRandomData instanceof ItemData) { - if (GT_Utility.isStringValid(tRandomData)) - GT_OreDictUnificator.registerOre(tRandomData, rStack); - else GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData); - continue; - } - if (tUseOreDict) { - GT_OreDictUnificator.registerOre(tRandomData, rStack); - continue; - } - } - if (GregTech_API.sThaumcraftCompat != null) - GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); - return rStack; - } - return null; - } - - /** - * Sets the Furnace Burn Value for the Item. - * - * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] - * @param aValue 200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 EU) - * @return the Item itself for convenience in constructing. - */ - public final Gregtech_MetaItem setBurnValue(int aMetaValue, int aValue) { - if (aMetaValue < 0 || aMetaValue >= mOffset + mEnabledItems.length() || aValue < 0) return this; - if (aValue == 0) mBurnValues.remove((short) aMetaValue); - else mBurnValues.put((short) aMetaValue, aValue > Short.MAX_VALUE ? Short.MAX_VALUE : (short) aValue); - return this; - } - - /** - * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] - * @param aMaxCharge Maximum Charge. (if this is == 0 it will remove the Electric Behavior) - * @param aTransferLimit Transfer Limit. - * @param aTier The electric Tier. - * @param aSpecialData If this Item has a Fixed Charge, like a SingleUse Battery (if > 0). - * Use -1 if you want to make this Battery chargeable (the use and canUse Functions will still discharge if you just use this) - * Use -2 if you want to make this Battery dischargeable. - * Use -3 if you want to make this Battery charge/discharge-able. - * @return the Item itself for convenience in constructing. - */ - public final Gregtech_MetaItem setElectricStats(int aMetaValue, long aMaxCharge, long aTransferLimit, long aTier, long aSpecialData, boolean aUseAnimations) { - if (aMetaValue < 0 || aMetaValue >= mOffset + mEnabledItems.length()) return this; - if (aMaxCharge == 0) mElectricStats.remove((short) aMetaValue); - else { - mElectricStats.put((short) aMetaValue, new Long[]{aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData}); - if (aMetaValue >= mOffset && aUseAnimations) - mIconList[aMetaValue - mOffset] = Arrays.copyOf(mIconList[aMetaValue - mOffset], Math.max(9, mIconList[aMetaValue - mOffset].length)); - } - return this; - } - - /** - * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] - * @param aMaxCharge Maximum Charge. (if this is == 0 it will remove the Electric Behavior) - * @param aTransferLimit Transfer Limit. - * @param aTier The electric Tier. - * @param aSpecialData If this Item has a Fixed Charge, like a SingleUse Battery (if > 0). - * Use -1 if you want to make this Battery chargeable (the use and canUse Functions will still discharge if you just use this) - * Use -2 if you want to make this Battery dischargeable. - * Use -3 if you want to make this Battery charge/discharge-able. - * @return the Item itself for convenience in constructing. - */ - public final Gregtech_MetaItem setFluidContainerStats(int aMetaValue, long aCapacity, long aStacksize) { - if (aMetaValue < 0 || aMetaValue >= mOffset + mEnabledItems.length()) return this; - if (aCapacity < 0) mElectricStats.remove((short) aMetaValue); - else mFluidContainerStats.put((short) aMetaValue, new Long[]{aCapacity, Math.max(1, aStacksize)}); - return this; - } - - /** - * @return if this MetaGenerated Item should use my Default Renderer System. - */ - public boolean useStandardMetaItemRenderer() { - return true; - } - - /** - * @return the Color Modulation the Material is going to be rendered with. - */ - public short[] getRGBa(ItemStack aStack) { - return Materials._NULL.getRGBA(); - } - - /** - * @return the Icon the Material is going to be rendered with. - */ - public IIconContainer getIconContainer(int aMetaData) { - return null; - } - + public final short mOffset, mItemAmount; + public final BitSet mEnabledItems; + public final BitSet mVisibleItems; + public final IIcon[][] mIconList; + + public final HashMap<Short, IFoodStat> mFoodStats = new HashMap<>(); + public final HashMap<Short, Long[]> mElectricStats = new HashMap<>(); + public final HashMap<Short, Long[]> mFluidContainerStats = new HashMap<>(); + public final HashMap<Short, Short> mBurnValues = new HashMap<>(); + + /** + * Creates the Item using these Parameters. + * + * @param aUnlocalized The Unlocalized Name of this Item. + */ + public Gregtech_MetaItem(final String aUnlocalized, final short aOffset, final short aItemAmount) { + super(aUnlocalized); + this.setCreativeTab(AddToCreativeTab.tabMachines); + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.mEnabledItems = new BitSet(aItemAmount); + this.mVisibleItems = new BitSet(aItemAmount); + + this.mOffset = (short) Math.min(32766, aOffset); + this.mItemAmount = (short) Math.min(aItemAmount, 32766 - this.mOffset); + this.mIconList = new IIcon[aItemAmount][1]; + + sInstances.put(this.getUnlocalizedName(), this); + } + + /** + * This adds a Custom Item to the ending Range. + * + * @param aID The Id of the assigned Item [0 - mItemAmount] (The MetaData gets auto-shifted by +mOffset) + * @param aEnglish The Default Localized Name of the created Item + * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip + * @param aFoodBehavior The Food Value of this Item. Can be null aswell. Just a convenience thing. + * @param aRandomData The OreDict Names you want to give the Item. Also used for TC Aspects and some other things. + * @return An ItemStack containing the newly created Item. + */ + public final ItemStack addItem(final int aID, final String aEnglish, String aToolTip, final Object... aRandomData) { + if (aToolTip == null) { + aToolTip = ""; + } + if ((aID >= 0) && (aID < this.mItemAmount)) { + final ItemStack rStack = new ItemStack(this, 1, this.mOffset + aID); + this.mEnabledItems.set(aID); + this.mVisibleItems.set(aID); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".name", aEnglish); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".tooltip", aToolTip); + final List<TC_AspectStack> tAspects = new ArrayList<>(); + // Important Stuff to do first + for (final Object tRandomData : aRandomData) { + if (tRandomData instanceof SubTag) { + if (tRandomData == SubTag.INVISIBLE) { + this.mVisibleItems.set(aID, false); + continue; + } + if (tRandomData == SubTag.NO_UNIFICATION) { + GT_OreDictUnificator.addToBlacklist(rStack); + continue; + } + } + } + // now check for the rest + for (final Object tRandomData : aRandomData) { + if (tRandomData != null) { + boolean tUseOreDict = true; + + if (tRandomData instanceof Interface_ItemBehaviour) { + this.addItemBehavior(this.mOffset + aID, (Interface_ItemBehaviour<Gregtech_MetaItem_Base>) tRandomData); + tUseOreDict = false; + } + if (tRandomData instanceof IItemContainer) { + ((IItemContainer) tRandomData).set(rStack); + tUseOreDict = false; + } + if (tRandomData instanceof SubTag) { + continue; + } + if (tRandomData instanceof TC_AspectStack) { + ((TC_AspectStack) tRandomData).addToAspectList(tAspects); + continue; + } + if (tRandomData instanceof ItemData) { + if (GT_Utility.isStringValid(tRandomData)) { + GT_OreDictUnificator.registerOre(tRandomData, rStack); + } else { + GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData); + } + continue; + } + if (tUseOreDict) { + GT_OreDictUnificator.registerOre(tRandomData, rStack); + continue; + } + } + } + if (GregTech_API.sThaumcraftCompat != null) { + GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); + } + return rStack; + } + return null; + } + + /** + * Sets the Furnace Burn Value for the Item. + * + * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] + * @param aValue 200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 EU) + * @return the Item itself for convenience in constructing. + */ + public final Gregtech_MetaItem setBurnValue(final int aMetaValue, final int aValue) { + if ((aMetaValue < 0) || (aMetaValue >= (this.mOffset + this.mEnabledItems.length())) || (aValue < 0)) { + return this; + } + if (aValue == 0) { + this.mBurnValues.remove((short) aMetaValue); + } else { + this.mBurnValues.put((short) aMetaValue, aValue > Short.MAX_VALUE ? Short.MAX_VALUE : (short) aValue); + } + return this; + } + + /** + * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] + * @param aMaxCharge Maximum Charge. (if this is == 0 it will remove the Electric Behavior) + * @param aTransferLimit Transfer Limit. + * @param aTier The electric Tier. + * @param aSpecialData If this Item has a Fixed Charge, like a SingleUse Battery (if > 0). + * Use -1 if you want to make this Battery chargeable (the use and canUse Functions will still discharge if you just use this) + * Use -2 if you want to make this Battery dischargeable. + * Use -3 if you want to make this Battery charge/discharge-able. + * @return the Item itself for convenience in constructing. + */ + public final Gregtech_MetaItem setElectricStats(final int aMetaValue, final long aMaxCharge, final long aTransferLimit, final long aTier, final long aSpecialData, final boolean aUseAnimations) { + if ((aMetaValue < 0) || (aMetaValue >= (this.mOffset + this.mEnabledItems.length()))) { + return this; + } + if (aMaxCharge == 0) { + this.mElectricStats.remove((short) aMetaValue); + } else { + this.mElectricStats.put((short) aMetaValue, new Long[]{aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData}); + if ((aMetaValue >= this.mOffset) && aUseAnimations) { + this.mIconList[aMetaValue - this.mOffset] = Arrays.copyOf(this.mIconList[aMetaValue - this.mOffset], Math.max(9, this.mIconList[aMetaValue - this.mOffset].length)); + } + } + return this; + } + + /** + * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] + * @param aMaxCharge Maximum Charge. (if this is == 0 it will remove the Electric Behavior) + * @param aTransferLimit Transfer Limit. + * @param aTier The electric Tier. + * @param aSpecialData If this Item has a Fixed Charge, like a SingleUse Battery (if > 0). + * Use -1 if you want to make this Battery chargeable (the use and canUse Functions will still discharge if you just use this) + * Use -2 if you want to make this Battery dischargeable. + * Use -3 if you want to make this Battery charge/discharge-able. + * @return the Item itself for convenience in constructing. + */ + public final Gregtech_MetaItem setFluidContainerStats(final int aMetaValue, final long aCapacity, final long aStacksize) { + if ((aMetaValue < 0) || (aMetaValue >= (this.mOffset + this.mEnabledItems.length()))) { + return this; + } + if (aCapacity < 0) { + this.mElectricStats.remove((short) aMetaValue); + } else { + this.mFluidContainerStats.put((short) aMetaValue, new Long[]{aCapacity, Math.max(1, aStacksize)}); + } + return this; + } + + /** + * @return if this MetaGenerated Item should use my Default Renderer System. + */ + public boolean useStandardMetaItemRenderer() { + return true; + } + + /** + * @return the Color Modulation the Material is going to be rendered with. + */ + public short[] getRGBa(final ItemStack aStack) { + return Materials._NULL.getRGBA(); + } + + /** + * @return the Icon the Material is going to be rendered with. + */ + public IIconContainer getIconContainer(final int aMetaData) { + return null; + } + /* ---------- INTERNAL OVERRIDES ---------- */ - @Override - public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - return super.onItemRightClick(aStack, aWorld, aPlayer); - } + @Override + public ItemStack onItemRightClick(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { + return super.onItemRightClick(aStack, aWorld, aPlayer); + } - @Override - public int getMaxItemUseDuration(ItemStack aStack) { - return mFoodStats.get((short) getDamage(aStack)) == null ? 0 : 32; - } + @Override + public int getMaxItemUseDuration(final ItemStack aStack) { + return this.mFoodStats.get((short) this.getDamage(aStack)) == null ? 0 : 32; + } - @Override - public EnumAction getItemUseAction(ItemStack aStack) { + @Override + public EnumAction getItemUseAction(final ItemStack aStack) { return EnumAction.none; - } - - @Override - public final ItemStack onEaten(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - IFoodStat tStat = mFoodStats.get((short) getDamage(aStack)); - if (tStat != null) { - - } - return aStack; - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) { - for (int i = 0, j = mEnabledItems.length(); i < j; i++) - if (mVisibleItems.get(i) || (D1 && mEnabledItems.get(i))) { - Long[] tStats = mElectricStats.get((short) (mOffset + i)); - if (tStats != null && tStats[3] < 0) { - ItemStack tStack = new ItemStack(this, 1, mOffset + i); - setCharge(tStack, Math.abs(tStats[0])); - isItemStackUsable(tStack); - aList.add(tStack); - } - if (tStats == null || tStats[3] != -2) { - ItemStack tStack = new ItemStack(this, 1, mOffset + i); - isItemStackUsable(tStack); - aList.add(tStack); - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public final void registerIcons(IIconRegister aIconRegister) { - for (short i = 0, j = (short) mEnabledItems.length(); i < j; i++) - if (mEnabledItems.get(i)) { - for (byte k = 1; k < mIconList[i].length; k++) { - mIconList[i][k] = aIconRegister.registerIcon(CORE.MODID+":"+getUnlocalizedName() + "/" + i + "/" + k); - } - mIconList[i][0] = aIconRegister.registerIcon(CORE.MODID+":"+getUnlocalizedName() + "/" + i); - } - } - - @Override - public final Long[] getElectricStats(ItemStack aStack) { - return mElectricStats.get((short) aStack.getItemDamage()); - } - - @Override - public final Long[] getFluidContainerStats(ItemStack aStack) { - return mFluidContainerStats.get((short) aStack.getItemDamage()); - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public boolean isBookEnchantable(ItemStack aStack, ItemStack aBook) { - return false; - } - - @Override - public boolean getIsRepairable(ItemStack aStack, ItemStack aMaterial) { - return false; - } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (stack.getDisplayName().contains("LuV")){ - HEX_OxFFFFFF = 0xffffcc; - } + } + + @Override + public final ItemStack onEaten(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { + final IFoodStat tStat = this.mFoodStats.get((short) this.getDamage(aStack)); + if (tStat != null) { + + } + return aStack; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) { + for (int i = 0, j = this.mEnabledItems.length(); i < j; i++) { + if (this.mVisibleItems.get(i) || (D1 && this.mEnabledItems.get(i))) { + final Long[] tStats = this.mElectricStats.get((short) (this.mOffset + i)); + if ((tStats != null) && (tStats[3] < 0)) { + final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); + this.setCharge(tStack, Math.abs(tStats[0])); + this.isItemStackUsable(tStack); + aList.add(tStack); + } + if ((tStats == null) || (tStats[3] != -2)) { + final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); + this.isItemStackUsable(tStack); + aList.add(tStack); + } + } + } + } + + @Override + @SideOnly(Side.CLIENT) + public final void registerIcons(final IIconRegister aIconRegister) { + for (short i = 0, j = (short) this.mEnabledItems.length(); i < j; i++) { + if (this.mEnabledItems.get(i)) { + for (byte k = 1; k < this.mIconList[i].length; k++) { + this.mIconList[i][k] = aIconRegister.registerIcon(CORE.MODID+":"+this.getUnlocalizedName() + "/" + i + "/" + k); + } + this.mIconList[i][0] = aIconRegister.registerIcon(CORE.MODID+":"+this.getUnlocalizedName() + "/" + i); + } + } + } + + @Override + public final Long[] getElectricStats(final ItemStack aStack) { + return this.mElectricStats.get((short) aStack.getItemDamage()); + } + + @Override + public final Long[] getFluidContainerStats(final ItemStack aStack) { + return this.mFluidContainerStats.get((short) aStack.getItemDamage()); + } + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) { + return false; + } + + @Override + public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) { + return false; + } + + @Override + public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { + if (stack.getDisplayName().contains("LuV")){ + HEX_OxFFFFFF = 0xffffcc; + } else if (stack.getDisplayName().contains("ZPM")){ HEX_OxFFFFFF = 0xace600; } @@ -306,7 +330,7 @@ public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base { } else { HEX_OxFFFFFF = 0xffffff; - } + } return HEX_OxFFFFFF; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java index bb3e7a9515..e71e7c3b5c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java @@ -2,14 +2,14 @@ package gtPlusPlus.xmod.gregtech.api.items; import static gregtech.api.enums.GT_Values.D1; import static gregtech.api.enums.GT_Values.V; + +import java.util.*; + import gregtech.api.enums.SubTag; import gregtech.api.util.*; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour; import ic2.api.item.*; - -import java.util.*; - import net.minecraft.dispenser.IBlockSource; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -25,506 +25,627 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item implements ISpecialElectricItem, IElectricItemManager, IFluidContainerItem { - /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - private final HashMap<Short, ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>>> mItemBehaviors = new HashMap<Short, ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>>>(); - - /** - * Creates the Item using these Parameters. - * - * @param aUnlocalized The Unlocalized Name of this Item. - * @param aGeneratedPrefixList The OreDict Prefixes you want to have generated. - */ - public Gregtech_MetaItem_Base(String aUnlocalized) { - super(aUnlocalized, "Generated Item", null, false); - setHasSubtypes(true); - setMaxDamage(0); - } - - /** - * Adds a special Item Behaviour to the Item. - * <p/> - * Note: the boolean Behaviours sometimes won't be executed if another boolean Behaviour returned true before. - * - * @param aMetaValue the Meta Value of the Item you want to add it to. [0 - 32765] - * @param aBehavior the Click Behavior you want to add. - * @return the Item itself for convenience in constructing. - */ - public final Gregtech_MetaItem_Base addItemBehavior(int aMetaValue, Interface_ItemBehaviour<Gregtech_MetaItem_Base> aBehavior) { - if (aMetaValue < 0 || aMetaValue >= 32766 || aBehavior == null) return this; - ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = mItemBehaviors.get((short) aMetaValue); - if (tList == null) { - tList = new ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>>(1); - mItemBehaviors.put((short) aMetaValue, tList); - } - tList.add(aBehavior); - return this; - } - - public abstract Long[] getElectricStats(ItemStack aStack); - - public abstract Long[] getFluidContainerStats(ItemStack aStack); - - @Override - public boolean hasProjectile(SubTag aProjectileType, ItemStack aStack) { - ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) - if (tBehavior.hasProjectile(this, aProjectileType, aStack)) return true; - return super.hasProjectile(aProjectileType, aStack); - } - - @Override - public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ) { - ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { - EntityArrow rArrow = tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aX, aY, aZ); - if (rArrow != null) return rArrow; - } - return super.getProjectile(aProjectileType, aStack, aWorld, aX, aY, aZ); - } - - @Override - public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed) { - ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { - EntityArrow rArrow = tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aEntity, aSpeed); - if (rArrow != null) return rArrow; - } - return super.getProjectile(aProjectileType, aStack, aWorld, aEntity, aSpeed); - } - - @Override - public ItemStack onDispense(IBlockSource aSource, ItemStack aStack) { - ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) - if (tBehavior.canDispense(this, aSource, aStack)) return tBehavior.onDispense(this, aSource, aStack); - return super.onDispense(aSource, aStack); - } - - @Override - public boolean isItemStackUsable(ItemStack aStack) { - ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) - if (!tBehavior.isItemStackUsable(this, aStack)) return false; - return super.isItemStackUsable(aStack); - } - - @Override - public boolean onLeftClickEntity(ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) { - use(aStack, 0, aPlayer); - isItemStackUsable(aStack); - ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) - try { - if (tBehavior.onLeftClickEntity(this, aStack, aPlayer, aEntity)) { - if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); - return true; - } - if (aStack.stackSize <= 0) { - aPlayer.destroyCurrentEquippedItem(); - return false; - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - return false; - } - - @Override - public boolean onItemUse(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - use(aStack, 0, aPlayer); - isItemStackUsable(aStack); - ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) - try { - if (tBehavior.onItemUse(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) { - if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); - return true; - } - if (aStack.stackSize <= 0) { - aPlayer.destroyCurrentEquippedItem(); - return false; - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - return false; - } - - @Override - public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - use(aStack, 0, aPlayer); - isItemStackUsable(aStack); - ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) - try { - if (tBehavior.onItemUseFirst(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) { - if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); - return true; - } - if (aStack.stackSize <= 0) { - aPlayer.destroyCurrentEquippedItem(); - return false; - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - return false; - } - - @Override - public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - use(aStack, 0, aPlayer); - isItemStackUsable(aStack); - ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) - try { - aStack = tBehavior.onItemRightClick(this, aStack, aWorld, aPlayer); - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - return aStack; - } - - @Override - public final void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - String tKey = getUnlocalizedName(aStack) + ".tooltip", tString = GT_LanguageManager.getTranslation(tKey); - if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) aList.add(tString); - - Long[] - tStats = getElectricStats(aStack); - if (tStats != null) { - if (tStats[3] > 0) { - aList.add(EnumChatFormatting.AQUA + "Contains " + GT_Utility.formatNumbers(tStats[3]) + " EU Tier: " + (tStats[2] >= 0 ? tStats[2] : 0) + EnumChatFormatting.GRAY); - } else { - long tCharge = getRealCharge(aStack); - if (tStats[3] == -2 && tCharge <= 0) { - aList.add(EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + EnumChatFormatting.GRAY); - } else { - aList.add(EnumChatFormatting.AQUA + "" + GT_Utility.formatNumbers(tCharge) + " / " + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + EnumChatFormatting.GRAY); - } - } - } - - tStats = getFluidContainerStats(aStack); - if (tStats != null && tStats[0] > 0) { - FluidStack tFluid = getFluidContent(aStack); - aList.add(EnumChatFormatting.BLUE + ((tFluid == null ? "No Fluids Contained" : GT_Utility.getFluidName(tFluid, true))) + EnumChatFormatting.GRAY); - aList.add(EnumChatFormatting.BLUE + ((tFluid == null ? 0 : tFluid.amount) + "L / " + tStats[0] + "L") + EnumChatFormatting.GRAY); - } - - ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) - aList = tBehavior.getAdditionalToolTips(this, aList, aStack); - - addAdditionalToolTips(aList, aStack); - } - - @Override - public void onUpdate(ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand) { - ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) - tBehavior.onUpdate(this, aStack, aWorld, aPlayer, aTimer, aIsInHand); - } - - @Override - public final boolean canProvideEnergy(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return false; - return tStats[3] > 0 || (aStack.stackSize == 1 && (tStats[3] == -2 || tStats[3] == -3)); - } - - @Override - public final double getMaxCharge(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return 0; - return Math.abs(tStats[0]); - } - - @Override - public final double getTransferLimit(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return 0; - return Math.max(tStats[1], tStats[3]); - } - - @Override - public final double charge(ItemStack aStack, double aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aSimulate) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null || tStats[2] > aTier || !(tStats[3] == -1 || tStats[3] == -3 || (tStats[3] < 0 && aCharge == Integer.MAX_VALUE)) || aStack.stackSize != 1) - return 0; - long tChargeBefore = getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE ? Long.MAX_VALUE : Math.min(Math.abs(tStats[0]), tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); - if (!aSimulate) setCharge(aStack, tNewCharge); - return tNewCharge - tChargeBefore; - } - - @Override - public final double discharge(ItemStack aStack, double aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aBatteryAlike, boolean aSimulate) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null || tStats[2] > aTier) return 0; - if (aBatteryAlike && !canProvideEnergy(aStack)) return 0; - if (tStats[3] > 0) { - if (aCharge < tStats[3] || aStack.stackSize < 1) return 0; - if (!aSimulate) aStack.stackSize--; - return tStats[3]; - } - long tChargeBefore = getRealCharge(aStack), tNewCharge = Math.max(0, tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); - if (!aSimulate) setCharge(aStack, tNewCharge); - return tChargeBefore - tNewCharge; - } - - @Override - public final double getCharge(ItemStack aStack) { - return getRealCharge(aStack); - } - - @Override - public final boolean canUse(ItemStack aStack, double aAmount) { - return getRealCharge(aStack) >= aAmount; - } - - @Override - public final boolean use(ItemStack aStack, double aAmount, EntityLivingBase aPlayer) { - chargeFromArmor(aStack, aPlayer); - if (aPlayer instanceof EntityPlayer && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) return true; - double tTransfer = discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, true); - if (tTransfer == aAmount) { - discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); - chargeFromArmor(aStack, aPlayer); - return true; - } - discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); - chargeFromArmor(aStack, aPlayer); - return false; - } - - @Override - public final void chargeFromArmor(ItemStack aStack, EntityLivingBase aPlayer) { - if (aPlayer == null || aPlayer.worldObj.isRemote) return; - for (int i = 1; i < 5; i++) { - ItemStack tArmor = aPlayer.getEquipmentInSlot(i); - if (GT_ModHandler.isElectricItem(tArmor)) { - IElectricItem tArmorItem = (IElectricItem) tArmor.getItem(); - if (tArmorItem.canProvideEnergy(tArmor) && tArmorItem.getTier(tArmor) >= getTier(aStack)) { - double tCharge = ElectricItem.manager.discharge(tArmor, charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true), Integer.MAX_VALUE, true, true, false); - if (tCharge > 0) { - charge(aStack, tCharge, Integer.MAX_VALUE, true, false); - if (aPlayer instanceof EntityPlayer) { - Container tContainer = ((EntityPlayer) aPlayer).openContainer; - if (tContainer != null) tContainer.detectAndSendChanges(); - } - } - } - } - } - } - - public final long getRealCharge(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return 0; - if (tStats[3] > 0) return (int) (long) tStats[3]; - NBTTagCompound tNBT = aStack.getTagCompound(); - return tNBT == null ? 0 : tNBT.getLong("GT.ItemCharge"); - } - - public final boolean setCharge(ItemStack aStack, long aCharge) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null || tStats[3] > 0) return false; - NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT == null) tNBT = new NBTTagCompound(); - tNBT.removeTag("GT.ItemCharge"); - aCharge = Math.min(tStats[0] < 0 ? Math.abs(tStats[0] / 2) : aCharge, Math.abs(tStats[0])); - if (aCharge > 0) { - aStack.setItemDamage(getChargedMetaData(aStack)); - tNBT.setLong("GT.ItemCharge", aCharge); - } else { - aStack.setItemDamage(getEmptyMetaData(aStack)); - } - if (tNBT.hasNoTags()) aStack.setTagCompound(null); - else aStack.setTagCompound(tNBT); - isItemStackUsable(aStack); - return true; - } - - public short getChargedMetaData(ItemStack aStack) { - return (short) aStack.getItemDamage(); - } - - public short getEmptyMetaData(ItemStack aStack) { - return (short) aStack.getItemDamage(); - } - - @Override - public FluidStack getFluid(ItemStack aStack) { - return getFluidContent(aStack); - } - - @Override - public int getCapacity(ItemStack aStack) { - Long[] tStats = getFluidContainerStats(aStack); - return tStats == null ? 0 : (int) Math.max(0, tStats[0]); - } - - @Override - public int fill(ItemStack aStack, FluidStack aFluid, boolean doFill) { - if (aStack == null || aStack.stackSize != 1) return 0; - - ItemStack tStack = GT_Utility.fillFluidContainer(aFluid, aStack, false, false); - if (tStack != null) { - aStack.setItemDamage(tStack.getItemDamage()); - aStack.func_150996_a(tStack.getItem()); - return GT_Utility.getFluidForFilledItem(tStack, false).amount; - } - - Long[] tStats = getFluidContainerStats(aStack); - if (tStats == null || tStats[0] <= 0 || aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0) - return 0; - - FluidStack tFluid = getFluidContent(aStack); - - if (tFluid == null || tFluid.getFluid().getID() <= 0) { - if (aFluid.amount <= tStats[0]) { - if (doFill) { - setFluidContent(aStack, aFluid); - } - return aFluid.amount; - } - if (doFill) { - tFluid = aFluid.copy(); - tFluid.amount = (int) (long) tStats[0]; - setFluidContent(aStack, tFluid); - } - return (int) (long) tStats[0]; - } - - if (!tFluid.isFluidEqual(aFluid)) return 0; - - int space = (int) (long) tStats[0] - tFluid.amount; - if (aFluid.amount <= space) { - if (doFill) { - tFluid.amount += aFluid.amount; - setFluidContent(aStack, tFluid); - } - return aFluid.amount; - } - if (doFill) { - tFluid.amount = (int) (long) tStats[0]; - setFluidContent(aStack, tFluid); - } - return space; - } - - @Override - public FluidStack drain(ItemStack aStack, int maxDrain, boolean doDrain) { - if (aStack == null || aStack.stackSize != 1) return null; - - FluidStack tFluid = GT_Utility.getFluidForFilledItem(aStack, false); - if (tFluid != null && maxDrain >= tFluid.amount) { - ItemStack tStack = GT_Utility.getContainerItem(aStack, false); - if (tStack == null) { - aStack.stackSize = 0; - return tFluid; - } - aStack.setItemDamage(tStack.getItemDamage()); - aStack.func_150996_a(tStack.getItem()); - return tFluid; - } - - Long[] tStats = getFluidContainerStats(aStack); - if (tStats == null || tStats[0] <= 0) return null; - - tFluid = getFluidContent(aStack); - if (tFluid == null) return null; - - int used = maxDrain; - if (tFluid.amount < used) used = tFluid.amount; - if (doDrain) { - tFluid.amount -= used; - setFluidContent(aStack, tFluid); - } - - FluidStack drained = tFluid.copy(); - drained.amount = used; - return drained; - } - - public FluidStack getFluidContent(ItemStack aStack) { - Long[] tStats = getFluidContainerStats(aStack); - if (tStats == null || tStats[0] <= 0) return GT_Utility.getFluidForFilledItem(aStack, false); - NBTTagCompound tNBT = aStack.getTagCompound(); - return tNBT == null ? null : FluidStack.loadFluidStackFromNBT(tNBT.getCompoundTag("GT.FluidContent")); - } - - public void setFluidContent(ItemStack aStack, FluidStack aFluid) { - NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT == null) tNBT = new NBTTagCompound(); - else tNBT.removeTag("GT.FluidContent"); - if (aFluid != null && aFluid.amount > 0) - tNBT.setTag("GT.FluidContent", aFluid.writeToNBT(new NBTTagCompound())); - if (tNBT.hasNoTags()) aStack.setTagCompound(null); - else aStack.setTagCompound(tNBT); - isItemStackUsable(aStack); - } - - @Override - public int getItemStackLimit(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats != null && (tStats[3] == -1 || tStats[3] == -3) && getRealCharge(aStack) > 0) return 1; - tStats = getFluidContainerStats(aStack); - if (tStats != null) return (int) (long) tStats[1]; - return 64; - } - - @Override - public final Item getChargedItem(ItemStack itemStack) { - return this; - } - - @Override - public final Item getEmptyItem(ItemStack itemStack) { - return this; - } - - @Override - public final int getTier(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]); - } - - @Override - public final String getToolTip(ItemStack aStack) { - return null; - } // This has its own ToolTip Handler, no need to let the IC2 Handler screw us up at this Point - - @Override - public final IElectricItemManager getManager(ItemStack aStack) { - return this; - } // We are our own Manager - - @Override - public final boolean getShareTag() { - return true; - } // just to be sure. - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public boolean isBookEnchantable(ItemStack aStack, ItemStack aBook) { - return false; - } - - @Override - public boolean getIsRepairable(ItemStack aStack, ItemStack aMaterial) { - return false; - } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (stack.getDisplayName().contains("LuV")){ - HEX_OxFFFFFF = 0xffffcc; - } + /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ + private final HashMap<Short, ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>>> mItemBehaviors = new HashMap<>(); + + /** + * Creates the Item using these Parameters. + * + * @param aUnlocalized The Unlocalized Name of this Item. + * @param aGeneratedPrefixList The OreDict Prefixes you want to have generated. + */ + public Gregtech_MetaItem_Base(final String aUnlocalized) { + super(aUnlocalized, "Generated Item", null, false); + this.setHasSubtypes(true); + this.setMaxDamage(0); + } + + /** + * Adds a special Item Behaviour to the Item. + * <p/> + * Note: the boolean Behaviours sometimes won't be executed if another boolean Behaviour returned true before. + * + * @param aMetaValue the Meta Value of the Item you want to add it to. [0 - 32765] + * @param aBehavior the Click Behavior you want to add. + * @return the Item itself for convenience in constructing. + */ + public final Gregtech_MetaItem_Base addItemBehavior(final int aMetaValue, final Interface_ItemBehaviour<Gregtech_MetaItem_Base> aBehavior) { + if ((aMetaValue < 0) || (aMetaValue >= 32766) || (aBehavior == null)) { + return this; + } + ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors.get((short) aMetaValue); + if (tList == null) { + tList = new ArrayList<>(1); + this.mItemBehaviors.put((short) aMetaValue, tList); + } + tList.add(aBehavior); + return this; + } + + public abstract Long[] getElectricStats(ItemStack aStack); + + public abstract Long[] getFluidContainerStats(ItemStack aStack); + + @Override + public boolean hasProjectile(final SubTag aProjectileType, final ItemStack aStack) { + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { + if (tBehavior.hasProjectile(this, aProjectileType, aStack)) { + return true; + } + } + } + return super.hasProjectile(aProjectileType, aStack); + } + + @Override + public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld, final double aX, final double aY, final double aZ) { + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { + final EntityArrow rArrow = tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aX, aY, aZ); + if (rArrow != null) { + return rArrow; + } + } + } + return super.getProjectile(aProjectileType, aStack, aWorld, aX, aY, aZ); + } + + @Override + public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld, final EntityLivingBase aEntity, final float aSpeed) { + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { + final EntityArrow rArrow = tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aEntity, aSpeed); + if (rArrow != null) { + return rArrow; + } + } + } + return super.getProjectile(aProjectileType, aStack, aWorld, aEntity, aSpeed); + } + + @Override + public ItemStack onDispense(final IBlockSource aSource, final ItemStack aStack) { + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { + if (tBehavior.canDispense(this, aSource, aStack)) { + return tBehavior.onDispense(this, aSource, aStack); + } + } + } + return super.onDispense(aSource, aStack); + } + + @Override + public boolean isItemStackUsable(final ItemStack aStack) { + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { + if (!tBehavior.isItemStackUsable(this, aStack)) { + return false; + } + } + } + return super.isItemStackUsable(aStack); + } + + @Override + public boolean onLeftClickEntity(final ItemStack aStack, final EntityPlayer aPlayer, final Entity aEntity) { + this.use(aStack, 0, aPlayer); + this.isItemStackUsable(aStack); + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { + try { + if (tBehavior.onLeftClickEntity(this, aStack, aPlayer, aEntity)) { + if (aStack.stackSize <= 0) { + aPlayer.destroyCurrentEquippedItem(); + } + return true; + } + if (aStack.stackSize <= 0) { + aPlayer.destroyCurrentEquippedItem(); + return false; + } + } catch (final Throwable e) { + if (D1) { + e.printStackTrace(GT_Log.err); + } + } + } + } + return false; + } + + @Override + public boolean onItemUse(final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) { + this.use(aStack, 0, aPlayer); + this.isItemStackUsable(aStack); + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { + try { + if (tBehavior.onItemUse(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) { + if (aStack.stackSize <= 0) { + aPlayer.destroyCurrentEquippedItem(); + } + return true; + } + if (aStack.stackSize <= 0) { + aPlayer.destroyCurrentEquippedItem(); + return false; + } + } catch (final Throwable e) { + if (D1) { + e.printStackTrace(GT_Log.err); + } + } + } + } + return false; + } + + @Override + public boolean onItemUseFirst(final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) { + this.use(aStack, 0, aPlayer); + this.isItemStackUsable(aStack); + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { + try { + if (tBehavior.onItemUseFirst(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) { + if (aStack.stackSize <= 0) { + aPlayer.destroyCurrentEquippedItem(); + } + return true; + } + if (aStack.stackSize <= 0) { + aPlayer.destroyCurrentEquippedItem(); + return false; + } + } catch (final Throwable e) { + if (D1) { + e.printStackTrace(GT_Log.err); + } + } + } + } + return false; + } + + @Override + public ItemStack onItemRightClick(ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { + this.use(aStack, 0, aPlayer); + this.isItemStackUsable(aStack); + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { + try { + aStack = tBehavior.onItemRightClick(this, aStack, aWorld, aPlayer); + } catch (final Throwable e) { + if (D1) { + e.printStackTrace(GT_Log.err); + } + } + } + } + return aStack; + } + + @Override + public final void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, List aList, final boolean aF3_H) { + final String tKey = this.getUnlocalizedName(aStack) + ".tooltip", tString = GT_LanguageManager.getTranslation(tKey); + if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) { + aList.add(tString); + } + + Long[] + tStats = this.getElectricStats(aStack); + if (tStats != null) { + if (tStats[3] > 0) { + aList.add(EnumChatFormatting.AQUA + "Contains " + GT_Utility.formatNumbers(tStats[3]) + " EU Tier: " + (tStats[2] >= 0 ? tStats[2] : 0) + EnumChatFormatting.GRAY); + } else { + final long tCharge = this.getRealCharge(aStack); + if ((tStats[3] == -2) && (tCharge <= 0)) { + aList.add(EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + EnumChatFormatting.GRAY); + } else { + aList.add(EnumChatFormatting.AQUA + "" + GT_Utility.formatNumbers(tCharge) + " / " + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + EnumChatFormatting.GRAY); + } + } + } + + tStats = this.getFluidContainerStats(aStack); + if ((tStats != null) && (tStats[0] > 0)) { + final FluidStack tFluid = this.getFluidContent(aStack); + aList.add(EnumChatFormatting.BLUE + ((tFluid == null ? "No Fluids Contained" : GT_Utility.getFluidName(tFluid, true))) + EnumChatFormatting.GRAY); + aList.add(EnumChatFormatting.BLUE + ((tFluid == null ? 0 : tFluid.amount) + "L / " + tStats[0] + "L") + EnumChatFormatting.GRAY); + } + + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { + aList = tBehavior.getAdditionalToolTips(this, aList, aStack); + } + } + + this.addAdditionalToolTips(aList, aStack); + } + + @Override + public void onUpdate(final ItemStack aStack, final World aWorld, final Entity aPlayer, final int aTimer, final boolean aIsInHand) { + final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) { + tBehavior.onUpdate(this, aStack, aWorld, aPlayer, aTimer, aIsInHand); + } + } + } + + @Override + public final boolean canProvideEnergy(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return false; + } + return (tStats[3] > 0) || ((aStack.stackSize == 1) && ((tStats[3] == -2) || (tStats[3] == -3))); + } + + @Override + public final double getMaxCharge(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return 0; + } + return Math.abs(tStats[0]); + } + + @Override + public final double getTransferLimit(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return 0; + } + return Math.max(tStats[1], tStats[3]); + } + + @Override + public final double charge(final ItemStack aStack, final double aCharge, final int aTier, final boolean aIgnoreTransferLimit, final boolean aSimulate) { + final Long[] tStats = this.getElectricStats(aStack); + if ((tStats == null) || (tStats[2] > aTier) || !((tStats[3] == -1) || (tStats[3] == -3) || ((tStats[3] < 0) && (aCharge == Integer.MAX_VALUE))) || (aStack.stackSize != 1)) { + return 0; + } + final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE ? Long.MAX_VALUE : Math.min(Math.abs(tStats[0]), tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); + if (!aSimulate) { + this.setCharge(aStack, tNewCharge); + } + return tNewCharge - tChargeBefore; + } + + @Override + public final double discharge(final ItemStack aStack, final double aCharge, final int aTier, final boolean aIgnoreTransferLimit, final boolean aBatteryAlike, final boolean aSimulate) { + final Long[] tStats = this.getElectricStats(aStack); + if ((tStats == null) || (tStats[2] > aTier)) { + return 0; + } + if (aBatteryAlike && !this.canProvideEnergy(aStack)) { + return 0; + } + if (tStats[3] > 0) { + if ((aCharge < tStats[3]) || (aStack.stackSize < 1)) { + return 0; + } + if (!aSimulate) { + aStack.stackSize--; + } + return tStats[3]; + } + final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = Math.max(0, tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); + if (!aSimulate) { + this.setCharge(aStack, tNewCharge); + } + return tChargeBefore - tNewCharge; + } + + @Override + public final double getCharge(final ItemStack aStack) { + return this.getRealCharge(aStack); + } + + @Override + public final boolean canUse(final ItemStack aStack, final double aAmount) { + return this.getRealCharge(aStack) >= aAmount; + } + + @Override + public final boolean use(final ItemStack aStack, final double aAmount, final EntityLivingBase aPlayer) { + this.chargeFromArmor(aStack, aPlayer); + if ((aPlayer instanceof EntityPlayer) && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) { + return true; + } + final double tTransfer = this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, true); + if (tTransfer == aAmount) { + this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); + this.chargeFromArmor(aStack, aPlayer); + return true; + } + this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); + this.chargeFromArmor(aStack, aPlayer); + return false; + } + + @Override + public final void chargeFromArmor(final ItemStack aStack, final EntityLivingBase aPlayer) { + if ((aPlayer == null) || aPlayer.worldObj.isRemote) { + return; + } + for (int i = 1; i < 5; i++) { + final ItemStack tArmor = aPlayer.getEquipmentInSlot(i); + if (GT_ModHandler.isElectricItem(tArmor)) { + final IElectricItem tArmorItem = (IElectricItem) tArmor.getItem(); + if (tArmorItem.canProvideEnergy(tArmor) && (tArmorItem.getTier(tArmor) >= this.getTier(aStack))) { + final double tCharge = ElectricItem.manager.discharge(tArmor, this.charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true), Integer.MAX_VALUE, true, true, false); + if (tCharge > 0) { + this.charge(aStack, tCharge, Integer.MAX_VALUE, true, false); + if (aPlayer instanceof EntityPlayer) { + final Container tContainer = ((EntityPlayer) aPlayer).openContainer; + if (tContainer != null) { + tContainer.detectAndSendChanges(); + } + } + } + } + } + } + } + + public final long getRealCharge(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return 0; + } + if (tStats[3] > 0) { + return (int) (long) tStats[3]; + } + final NBTTagCompound tNBT = aStack.getTagCompound(); + return tNBT == null ? 0 : tNBT.getLong("GT.ItemCharge"); + } + + public final boolean setCharge(final ItemStack aStack, long aCharge) { + final Long[] tStats = this.getElectricStats(aStack); + if ((tStats == null) || (tStats[3] > 0)) { + return false; + } + NBTTagCompound tNBT = aStack.getTagCompound(); + if (tNBT == null) { + tNBT = new NBTTagCompound(); + } + tNBT.removeTag("GT.ItemCharge"); + aCharge = Math.min(tStats[0] < 0 ? Math.abs(tStats[0] / 2) : aCharge, Math.abs(tStats[0])); + if (aCharge > 0) { + aStack.setItemDamage(this.getChargedMetaData(aStack)); + tNBT.setLong("GT.ItemCharge", aCharge); + } else { + aStack.setItemDamage(this.getEmptyMetaData(aStack)); + } + if (tNBT.hasNoTags()) { + aStack.setTagCompound(null); + } else { + aStack.setTagCompound(tNBT); + } + this.isItemStackUsable(aStack); + return true; + } + + public short getChargedMetaData(final ItemStack aStack) { + return (short) aStack.getItemDamage(); + } + + public short getEmptyMetaData(final ItemStack aStack) { + return (short) aStack.getItemDamage(); + } + + @Override + public FluidStack getFluid(final ItemStack aStack) { + return this.getFluidContent(aStack); + } + + @Override + public int getCapacity(final ItemStack aStack) { + final Long[] tStats = this.getFluidContainerStats(aStack); + return tStats == null ? 0 : (int) Math.max(0, tStats[0]); + } + + @Override + public int fill(final ItemStack aStack, final FluidStack aFluid, final boolean doFill) { + if ((aStack == null) || (aStack.stackSize != 1)) { + return 0; + } + + final ItemStack tStack = GT_Utility.fillFluidContainer(aFluid, aStack, false, false); + if (tStack != null) { + aStack.setItemDamage(tStack.getItemDamage()); + aStack.func_150996_a(tStack.getItem()); + return GT_Utility.getFluidForFilledItem(tStack, false).amount; + } + + final Long[] tStats = this.getFluidContainerStats(aStack); + if ((tStats == null) || (tStats[0] <= 0) || (aFluid == null) || (aFluid.getFluid().getID() <= 0) || (aFluid.amount <= 0)) { + return 0; + } + + FluidStack tFluid = this.getFluidContent(aStack); + + if ((tFluid == null) || (tFluid.getFluid().getID() <= 0)) { + if (aFluid.amount <= tStats[0]) { + if (doFill) { + this.setFluidContent(aStack, aFluid); + } + return aFluid.amount; + } + if (doFill) { + tFluid = aFluid.copy(); + tFluid.amount = (int) (long) tStats[0]; + this.setFluidContent(aStack, tFluid); + } + return (int) (long) tStats[0]; + } + + if (!tFluid.isFluidEqual(aFluid)) { + return 0; + } + + final int space = (int) (long) tStats[0] - tFluid.amount; + if (aFluid.amount <= space) { + if (doFill) { + tFluid.amount += aFluid.amount; + this.setFluidContent(aStack, tFluid); + } + return aFluid.amount; + } + if (doFill) { + tFluid.amount = (int) (long) tStats[0]; + this.setFluidContent(aStack, tFluid); + } + return space; + } + + @Override + public FluidStack drain(final ItemStack aStack, final int maxDrain, final boolean doDrain) { + if ((aStack == null) || (aStack.stackSize != 1)) { + return null; + } + + FluidStack tFluid = GT_Utility.getFluidForFilledItem(aStack, false); + if ((tFluid != null) && (maxDrain >= tFluid.amount)) { + final ItemStack tStack = GT_Utility.getContainerItem(aStack, false); + if (tStack == null) { + aStack.stackSize = 0; + return tFluid; + } + aStack.setItemDamage(tStack.getItemDamage()); + aStack.func_150996_a(tStack.getItem()); + return tFluid; + } + + final Long[] tStats = this.getFluidContainerStats(aStack); + if ((tStats == null) || (tStats[0] <= 0)) { + return null; + } + + tFluid = this.getFluidContent(aStack); + if (tFluid == null) { + return null; + } + + int used = maxDrain; + if (tFluid.amount < used) { + used = tFluid.amount; + } + if (doDrain) { + tFluid.amount -= used; + this.setFluidContent(aStack, tFluid); + } + + final FluidStack drained = tFluid.copy(); + drained.amount = used; + return drained; + } + + public FluidStack getFluidContent(final ItemStack aStack) { + final Long[] tStats = this.getFluidContainerStats(aStack); + if ((tStats == null) || (tStats[0] <= 0)) { + return GT_Utility.getFluidForFilledItem(aStack, false); + } + final NBTTagCompound tNBT = aStack.getTagCompound(); + return tNBT == null ? null : FluidStack.loadFluidStackFromNBT(tNBT.getCompoundTag("GT.FluidContent")); + } + + public void setFluidContent(final ItemStack aStack, final FluidStack aFluid) { + NBTTagCompound tNBT = aStack.getTagCompound(); + if (tNBT == null) { + tNBT = new NBTTagCompound(); + } else { + tNBT.removeTag("GT.FluidContent"); + } + if ((aFluid != null) && (aFluid.amount > 0)) { + tNBT.setTag("GT.FluidContent", aFluid.writeToNBT(new NBTTagCompound())); + } + if (tNBT.hasNoTags()) { + aStack.setTagCompound(null); + } else { + aStack.setTagCompound(tNBT); + } + this.isItemStackUsable(aStack); + } + + @Override + public int getItemStackLimit(final ItemStack aStack) { + Long[] tStats = this.getElectricStats(aStack); + if ((tStats != null) && ((tStats[3] == -1) || (tStats[3] == -3)) && (this.getRealCharge(aStack) > 0)) { + return 1; + } + tStats = this.getFluidContainerStats(aStack); + if (tStats != null) { + return (int) (long) tStats[1]; + } + return 64; + } + + @Override + public final Item getChargedItem(final ItemStack itemStack) { + return this; + } + + @Override + public final Item getEmptyItem(final ItemStack itemStack) { + return this; + } + + @Override + public final int getTier(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]); + } + + @Override + public final String getToolTip(final ItemStack aStack) { + return null; + } // This has its own ToolTip Handler, no need to let the IC2 Handler screw us up at this Point + + @Override + public final IElectricItemManager getManager(final ItemStack aStack) { + return this; + } // We are our own Manager + + @Override + public final boolean getShareTag() { + return true; + } // just to be sure. + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) { + return false; + } + + @Override + public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) { + return false; + } + + @Override + public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { + if (stack.getDisplayName().contains("LuV")){ + HEX_OxFFFFFF = 0xffffcc; + } else if (stack.getDisplayName().contains("ZPM")){ HEX_OxFFFFFF = 0xace600; } @@ -545,7 +666,7 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item imple } else { HEX_OxFFFFFF = 0xffffff; - } + } return HEX_OxFFFFFF; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java index 48d24832b9..3ab0ed5544 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java @@ -1,21 +1,20 @@ package gtPlusPlus.xmod.gregtech.api.items; +import java.util.Arrays; +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.interfaces.IIconContainer; import gregtech.api.util.*; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; - -import java.util.Arrays; -import java.util.List; - import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; /** * @author Gregorius Techneticies @@ -31,150 +30,164 @@ import cpw.mods.fml.relauncher.SideOnly; */ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem { - protected final OrePrefixes[] mGeneratedPrefixList; - - /** - * Creates the Item using these Parameters. - * - * @param aUnlocalized The Unlocalized Name of this Item. - * @param aGeneratedPrefixList The OreDict Prefixes you want to have generated. - */ - public Gregtech_MetaItem_X32(String aUnlocalized, OrePrefixes... aGeneratedPrefixList) { - super(aUnlocalized, (short) 32000, (short) 766); - mGeneratedPrefixList = Arrays.copyOf(aGeneratedPrefixList, 32); - - for (int i = 0; i < 32000; i++) { - OrePrefixes tPrefix = mGeneratedPrefixList[i / 1000]; - if (tPrefix == null) continue; - Materials tMaterial = GregTech_API.sGeneratedMaterials[i % 1000]; - if (tMaterial == null) continue; - if (doesMaterialAllowGeneration(tPrefix, tMaterial)) { - ItemStack tStack = new ItemStack(this, 1, i); - GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".name", getDefaultLocalization(tPrefix, tMaterial, i)); - GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / GT_Values.M)); - if (tPrefix.mIsUnificatable) { - GT_OreDictUnificator.set(tPrefix, tMaterial, tStack); - } else { - GT_OreDictUnificator.registerOre(tPrefix.get(tMaterial), tStack); - } - if ((tPrefix == OrePrefixes.stick || tPrefix == OrePrefixes.wireFine) && (tMaterial == Materials.Lead || tMaterial == Materials.Tin || tMaterial == Materials.SolderingAlloy)) { - GregTech_API.sSolderingMetalList.add(tStack); - } - } - } - } + protected final OrePrefixes[] mGeneratedPrefixList; + + /** + * Creates the Item using these Parameters. + * + * @param aUnlocalized The Unlocalized Name of this Item. + * @param aGeneratedPrefixList The OreDict Prefixes you want to have generated. + */ + public Gregtech_MetaItem_X32(final String aUnlocalized, final OrePrefixes... aGeneratedPrefixList) { + super(aUnlocalized, (short) 32000, (short) 766); + this.mGeneratedPrefixList = Arrays.copyOf(aGeneratedPrefixList, 32); + + for (int i = 0; i < 32000; i++) { + final OrePrefixes tPrefix = this.mGeneratedPrefixList[i / 1000]; + if (tPrefix == null) { + continue; + } + final Materials tMaterial = GregTech_API.sGeneratedMaterials[i % 1000]; + if (tMaterial == null) { + continue; + } + if (this.doesMaterialAllowGeneration(tPrefix, tMaterial)) { + final ItemStack tStack = new ItemStack(this, 1, i); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(tStack) + ".name", this.getDefaultLocalization(tPrefix, tMaterial, i)); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / GT_Values.M)); + if (tPrefix.mIsUnificatable) { + GT_OreDictUnificator.set(tPrefix, tMaterial, tStack); + } else { + GT_OreDictUnificator.registerOre(tPrefix.get(tMaterial), tStack); + } + if (((tPrefix == OrePrefixes.stick) || (tPrefix == OrePrefixes.wireFine)) && ((tMaterial == Materials.Lead) || (tMaterial == Materials.Tin) || (tMaterial == Materials.SolderingAlloy))) { + GregTech_API.sSolderingMetalList.add(tStack); + } + } + } + } /* ---------- OVERRIDEABLE FUNCTIONS ---------- */ - /** - * @return the Color Modulation the Material is going to be rendered with. - */ - @Override - public short[] getRGBa(ItemStack aStack) { - Materials tMaterial = GregTech_API.sGeneratedMaterials[getDamage(aStack) % 1000]; - return tMaterial == null ? Materials._NULL.mRGBa : tMaterial.mRGBa; - } - - /** - * @param aPrefix this can be null, you have to return false in that case - * @param aMaterial this can be null, you have to return false in that case - * @return if this Item should be generated and visible. - */ - public boolean doesMaterialAllowGeneration(OrePrefixes aPrefix, Materials aMaterial) { - // You have to check for at least these Conditions in every Case! So add a super Call like the following for this before executing your Code: - // if (!super.doesMaterialAllowGeneration(aPrefix, aMaterial)) return false; - return aPrefix != null && aMaterial != null && aPrefix.doGenerateItem(aMaterial); - } - + /** + * @return the Color Modulation the Material is going to be rendered with. + */ + @Override + public short[] getRGBa(final ItemStack aStack) { + final Materials tMaterial = GregTech_API.sGeneratedMaterials[this.getDamage(aStack) % 1000]; + return tMaterial == null ? Materials._NULL.mRGBa : tMaterial.mRGBa; + } + + /** + * @param aPrefix this can be null, you have to return false in that case + * @param aMaterial this can be null, you have to return false in that case + * @return if this Item should be generated and visible. + */ + public boolean doesMaterialAllowGeneration(final OrePrefixes aPrefix, final Materials aMaterial) { + // You have to check for at least these Conditions in every Case! So add a super Call like the following for this before executing your Code: + // if (!super.doesMaterialAllowGeneration(aPrefix, aMaterial)) return false; + return (aPrefix != null) && (aMaterial != null) && aPrefix.doGenerateItem(aMaterial); + } + /* ---------- OVERRIDEABLE FUNCTIONS ---------- */ - /** - * @param aPrefix the OreDict Prefix - * @param aMaterial the Material - * @param aMetaData a Index from [0 - 31999] - * @return the Localized Name when default LangFiles are used. - */ - public String getDefaultLocalization(OrePrefixes aPrefix, Materials aMaterial, int aMetaData) { - return aPrefix.getDefaultLocalNameForItem(aMaterial); - } - - /** - * @param aMetaData a Index from [0 - 31999] - * @param aMaterial the Material - * @return an Icon Container for the Item Display. - */ - public final IIconContainer getIconContainer(int aMetaData, Materials aMaterial) { - return mGeneratedPrefixList[aMetaData / 1000] != null && mGeneratedPrefixList[aMetaData / 1000].mTextureIndex >= 0 ? aMaterial.mIconSet.mTextures[mGeneratedPrefixList[aMetaData / 1000].mTextureIndex] : null; - } - - /** - * @param aPrefix always != null - * @param aMaterial always != null - * @param aDoShowAllItems this is the Configuration Setting of the User, if he wants to see all the Stuff like Tiny Dusts or Crushed Ores as well. - * @return if this Item should be visible in NEI or Creative - */ - public boolean doesShowInCreative(OrePrefixes aPrefix, Materials aMaterial, boolean aDoShowAllItems) { - return true; - } - + /** + * @param aPrefix the OreDict Prefix + * @param aMaterial the Material + * @param aMetaData a Index from [0 - 31999] + * @return the Localized Name when default LangFiles are used. + */ + public String getDefaultLocalization(final OrePrefixes aPrefix, final Materials aMaterial, final int aMetaData) { + return aPrefix.getDefaultLocalNameForItem(aMaterial); + } + + /** + * @param aMetaData a Index from [0 - 31999] + * @param aMaterial the Material + * @return an Icon Container for the Item Display. + */ + public final IIconContainer getIconContainer(final int aMetaData, final Materials aMaterial) { + return (this.mGeneratedPrefixList[aMetaData / 1000] != null) && (this.mGeneratedPrefixList[aMetaData / 1000].mTextureIndex >= 0) ? aMaterial.mIconSet.mTextures[this.mGeneratedPrefixList[aMetaData / 1000].mTextureIndex] : null; + } + + /** + * @param aPrefix always != null + * @param aMaterial always != null + * @param aDoShowAllItems this is the Configuration Setting of the User, if he wants to see all the Stuff like Tiny Dusts or Crushed Ores as well. + * @return if this Item should be visible in NEI or Creative + */ + public boolean doesShowInCreative(final OrePrefixes aPrefix, final Materials aMaterial, final boolean aDoShowAllItems) { + return true; + } + /* ---------- INTERNAL OVERRIDES ---------- */ - @Override - public ItemStack getContainerItem(ItemStack aStack) { - int aDamage = aStack.getItemDamage(); - if (aDamage < 32000 && aDamage >= 0) { - Materials aMaterial = GregTech_API.sGeneratedMaterials[aDamage % 1000]; - if (aMaterial != null && aMaterial != Materials.Empty && aMaterial != Materials._NULL) { - OrePrefixes aPrefix = mGeneratedPrefixList[aDamage / 1000]; - if (aPrefix != null) return GT_Utility.copyAmount(1, aPrefix.mContainerItem); - } - } - return null; - } - - @Override - public final IIconContainer getIconContainer(int aMetaData) { - return GregTech_API.sGeneratedMaterials[aMetaData % 1000] == null ? null : getIconContainer(aMetaData, GregTech_API.sGeneratedMaterials[aMetaData % 1000]); - } - - @Override - @SideOnly(Side.CLIENT) - public final void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) { - for (int i = 0; i < 32000; i++) - if (doesMaterialAllowGeneration(mGeneratedPrefixList[i / 1000], GregTech_API.sGeneratedMaterials[i % 1000]) && doesShowInCreative(mGeneratedPrefixList[i / 1000], GregTech_API.sGeneratedMaterials[i % 1000], GregTech_API.sDoShowAllItemsInCreative)) { - ItemStack tStack = new ItemStack(this, 1, i); - isItemStackUsable(tStack); - aList.add(tStack); - } - super.getSubItems(var1, aCreativeTab, aList); - } - - @Override - public final IIcon getIconFromDamage(int aMetaData) { - if (aMetaData < 0) return null; - if (aMetaData < 32000) { - Materials tMaterial = GregTech_API.sGeneratedMaterials[aMetaData % 1000]; - if (tMaterial == null) return null; - IIconContainer tIcon = getIconContainer(aMetaData, tMaterial); - if (tIcon != null) return tIcon.getIcon(); - return null; - } - return aMetaData - 32000 < mIconList.length ? mIconList[aMetaData - 32000][0] : null; - } - - @Override - public int getItemStackLimit(ItemStack aStack) { - int tDamage = getDamage(aStack); - if (tDamage < 32000 && mGeneratedPrefixList[tDamage / 1000] != null) - return Math.min(super.getItemStackLimit(aStack), mGeneratedPrefixList[tDamage / 1000].mDefaultStackSize); - return super.getItemStackLimit(aStack); - } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (stack.getDisplayName().contains("LuV")){ - HEX_OxFFFFFF = 0xffffcc; - } + @Override + public ItemStack getContainerItem(final ItemStack aStack) { + final int aDamage = aStack.getItemDamage(); + if ((aDamage < 32000) && (aDamage >= 0)) { + final Materials aMaterial = GregTech_API.sGeneratedMaterials[aDamage % 1000]; + if ((aMaterial != null) && (aMaterial != Materials.Empty) && (aMaterial != Materials._NULL)) { + final OrePrefixes aPrefix = this.mGeneratedPrefixList[aDamage / 1000]; + if (aPrefix != null) { + return GT_Utility.copyAmount(1, aPrefix.mContainerItem); + } + } + } + return null; + } + + @Override + public final IIconContainer getIconContainer(final int aMetaData) { + return GregTech_API.sGeneratedMaterials[aMetaData % 1000] == null ? null : this.getIconContainer(aMetaData, GregTech_API.sGeneratedMaterials[aMetaData % 1000]); + } + + @Override + @SideOnly(Side.CLIENT) + public final void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) { + for (int i = 0; i < 32000; i++) { + if (this.doesMaterialAllowGeneration(this.mGeneratedPrefixList[i / 1000], GregTech_API.sGeneratedMaterials[i % 1000]) && this.doesShowInCreative(this.mGeneratedPrefixList[i / 1000], GregTech_API.sGeneratedMaterials[i % 1000], GregTech_API.sDoShowAllItemsInCreative)) { + final ItemStack tStack = new ItemStack(this, 1, i); + this.isItemStackUsable(tStack); + aList.add(tStack); + } + } + super.getSubItems(var1, aCreativeTab, aList); + } + + @Override + public final IIcon getIconFromDamage(final int aMetaData) { + if (aMetaData < 0) { + return null; + } + if (aMetaData < 32000) { + final Materials tMaterial = GregTech_API.sGeneratedMaterials[aMetaData % 1000]; + if (tMaterial == null) { + return null; + } + final IIconContainer tIcon = this.getIconContainer(aMetaData, tMaterial); + if (tIcon != null) { + return tIcon.getIcon(); + } + return null; + } + return (aMetaData - 32000) < this.mIconList.length ? this.mIconList[aMetaData - 32000][0] : null; + } + + @Override + public int getItemStackLimit(final ItemStack aStack) { + final int tDamage = this.getDamage(aStack); + if ((tDamage < 32000) && (this.mGeneratedPrefixList[tDamage / 1000] != null)) { + return Math.min(super.getItemStackLimit(aStack), this.mGeneratedPrefixList[tDamage / 1000].mDefaultStackSize); + } + return super.getItemStackLimit(aStack); + } + + @Override + public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) { + if (stack.getDisplayName().contains("LuV")){ + HEX_OxFFFFFF = 0xffffcc; + } else if (stack.getDisplayName().contains("ZPM")){ HEX_OxFFFFFF = 0xffe600; } @@ -207,7 +220,7 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem { } else { HEX_OxFFFFFF = 0xffffff; - } + } return HEX_OxFFFFFF; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java index 549c3bbafa..38aea63cca 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java @@ -1,6 +1,12 @@ package gtPlusPlus.xmod.gregtech.api.items; import static gregtech.api.enums.GT_Values.MOD_ID_RC; + +import java.util.*; +import java.util.Map.Entry; + +import buildcraft.api.tools.IToolWrench; +import cpw.mods.fml.common.Optional; import gregtech.api.enchants.Enchantment_Radioactivity; import gregtech.api.enums.Materials; import gregtech.api.interfaces.IDamagableItem; @@ -10,10 +16,6 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ToolStats; - -import java.util.*; -import java.util.Map.Entry; - import mods.railcraft.api.core.items.IToolCrowbar; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; @@ -30,8 +32,6 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.event.world.BlockEvent; -import buildcraft.api.tools.IToolWrench; -import cpw.mods.fml.common.Optional; /** * This is an example on how you can create a Tool ItemStack, in this case a Bismuth Wrench: @@ -45,198 +45,239 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool implements * <p/> * You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item. */ - public static final HashMap<String, Gregtech_MetaTool> sInstances = new HashMap<String, Gregtech_MetaTool>(); + public static final HashMap<String, Gregtech_MetaTool> sInstances = new HashMap<>(); /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - public final HashMap<Short, IToolStats> mToolStats = new HashMap<Short, IToolStats>(); + public final HashMap<Short, IToolStats> mToolStats = new HashMap<>(); /** * Creates the Item using these Parameters. * * @param aUnlocalized The Unlocalized Name of this Item. */ - public Gregtech_MetaTool(String aUnlocalized) { + public Gregtech_MetaTool(final String aUnlocalized) { super(aUnlocalized); GT_ModHandler.registerBoxableItemToToolBox(this); - setCreativeTab(AddToCreativeTab.tabMachines); - setMaxStackSize(1); - sInstances.put(getUnlocalizedName(), this); + this.setCreativeTab(AddToCreativeTab.tabMachines); + this.setMaxStackSize(1); + sInstances.put(this.getUnlocalizedName(), this); } /** * Called by the Block Harvesting Event within the GT_Proxy */ @Override - public void onHarvestBlockEvent(ArrayList<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent) { - IToolStats tStats = getToolStats(aStack); - if (isItemStackUsable(aStack) && getDigSpeed(aStack, aBlock, aMetaData) > 0.0F) - doDamage(aStack, tStats.convertBlockDrops(aDrops, aStack, aPlayer, aBlock, aX, aY, aZ, aMetaData, aFortune, aSilkTouch, aEvent) * tStats.getToolDamagePerDropConversion()); + public void onHarvestBlockEvent(final ArrayList<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { + final IToolStats tStats = this.getToolStats(aStack); + if (this.isItemStackUsable(aStack) && (this.getDigSpeed(aStack, aBlock, aMetaData) > 0.0F)) { + this.doDamage(aStack, tStats.convertBlockDrops(aDrops, aStack, aPlayer, aBlock, aX, aY, aZ, aMetaData, aFortune, aSilkTouch, aEvent) * tStats.getToolDamagePerDropConversion()); + } } @Override - public boolean onLeftClickEntity(ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) { - IToolStats tStats = getToolStats(aStack); - if (tStats == null || !isItemStackUsable(aStack)) return true; + public boolean onLeftClickEntity(final ItemStack aStack, final EntityPlayer aPlayer, final Entity aEntity) { + final IToolStats tStats = this.getToolStats(aStack); + if ((tStats == null) || !this.isItemStackUsable(aStack)) { + return true; + } GT_Utility.doSoundAtClient(tStats.getEntityHitSound(), 1, 1.0F); - if (super.onLeftClickEntity(aStack, aPlayer, aEntity)) return true; + if (super.onLeftClickEntity(aStack, aPlayer, aEntity)) { + return true; + } if (aEntity.canAttackWithItem() && !aEntity.hitByEntity(aPlayer)) { - float tMagicDamage = tStats.getMagicDamageAgainstEntity(aEntity instanceof EntityLivingBase ? EnchantmentHelper.getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity) : 0.0F, aEntity, aStack, aPlayer), tDamage = tStats.getNormalDamageAgainstEntity((float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue() + getToolCombatDamage(aStack), aEntity, aStack, aPlayer); - if (tDamage + tMagicDamage > 0.0F) { - boolean tCriticalHit = aPlayer.fallDistance > 0.0F && !aPlayer.onGround && !aPlayer.isOnLadder() && !aPlayer.isInWater() && !aPlayer.isPotionActive(Potion.blindness) && aPlayer.ridingEntity == null && aEntity instanceof EntityLivingBase; - if (tCriticalHit && tDamage > 0.0F) tDamage *= 1.5F; + final float tMagicDamage = tStats.getMagicDamageAgainstEntity(aEntity instanceof EntityLivingBase ? EnchantmentHelper.getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity) : 0.0F, aEntity, aStack, aPlayer); + float tDamage = tStats.getNormalDamageAgainstEntity((float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue() + this.getToolCombatDamage(aStack), aEntity, aStack, aPlayer); + if ((tDamage + tMagicDamage) > 0.0F) { + final boolean tCriticalHit = (aPlayer.fallDistance > 0.0F) && !aPlayer.onGround && !aPlayer.isOnLadder() && !aPlayer.isInWater() && !aPlayer.isPotionActive(Potion.blindness) && (aPlayer.ridingEntity == null) && (aEntity instanceof EntityLivingBase); + if (tCriticalHit && (tDamage > 0.0F)) { + tDamage *= 1.5F; + } tDamage += tMagicDamage; if (aEntity.attackEntityFrom(tStats.getDamageSource(aPlayer, aEntity), tDamage)) { - if (aEntity instanceof EntityLivingBase) + if (aEntity instanceof EntityLivingBase) { aEntity.setFire(EnchantmentHelper.getFireAspectModifier(aPlayer) * 4); - int tKnockcack = (aPlayer.isSprinting() ? 1 : 0) + (aEntity instanceof EntityLivingBase ? EnchantmentHelper.getKnockbackModifier(aPlayer, (EntityLivingBase) aEntity) : 0); + } + final int tKnockcack = (aPlayer.isSprinting() ? 1 : 0) + (aEntity instanceof EntityLivingBase ? EnchantmentHelper.getKnockbackModifier(aPlayer, (EntityLivingBase) aEntity) : 0); if (tKnockcack > 0) { - aEntity.addVelocity(-MathHelper.sin(aPlayer.rotationYaw * (float) Math.PI / 180.0F) * tKnockcack * 0.5F, 0.1D, MathHelper.cos(aPlayer.rotationYaw * (float) Math.PI / 180.0F) * tKnockcack * 0.5F); + aEntity.addVelocity(-MathHelper.sin((aPlayer.rotationYaw * (float) Math.PI) / 180.0F) * tKnockcack * 0.5F, 0.1D, MathHelper.cos((aPlayer.rotationYaw * (float) Math.PI) / 180.0F) * tKnockcack * 0.5F); aPlayer.motionX *= 0.6D; aPlayer.motionZ *= 0.6D; aPlayer.setSprinting(false); } - if (tCriticalHit) aPlayer.onCriticalHit(aEntity); - if (tMagicDamage > 0.0F) aPlayer.onEnchantmentCritical(aEntity); - if (tDamage >= 18.0F) aPlayer.triggerAchievement(AchievementList.overkill); + if (tCriticalHit) { + aPlayer.onCriticalHit(aEntity); + } + if (tMagicDamage > 0.0F) { + aPlayer.onEnchantmentCritical(aEntity); + } + if (tDamage >= 18.0F) { + aPlayer.triggerAchievement(AchievementList.overkill); + } aPlayer.setLastAttacker(aEntity); - if (aEntity instanceof EntityLivingBase) + if (aEntity instanceof EntityLivingBase) { EnchantmentHelper.func_151384_a((EntityLivingBase) aEntity, aPlayer); + } EnchantmentHelper.func_151385_b(aPlayer, aEntity); - if (aEntity instanceof EntityLivingBase) + if (aEntity instanceof EntityLivingBase) { aPlayer.addStat(StatList.damageDealtStat, Math.round(tDamage * 10.0F)); + } aEntity.hurtResistantTime = Math.max(1, tStats.getHurtResistanceTime(aEntity.hurtResistantTime, aEntity)); aPlayer.addExhaustion(0.3F); - doDamage(aStack, tStats.getToolDamagePerEntityAttack()); + this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); } } } - if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); + if (aStack.stackSize <= 0) { + aPlayer.destroyCurrentEquippedItem(); + } return true; } @Override - public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - IToolStats tStats = getToolStats(aStack); - if (tStats != null && tStats.canBlock()) aPlayer.setItemInUse(aStack, 72000); + public ItemStack onItemRightClick(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { + final IToolStats tStats = this.getToolStats(aStack); + if ((tStats != null) && tStats.canBlock()) { + aPlayer.setItemInUse(aStack, 72000); + } return super.onItemRightClick(aStack, aWorld, aPlayer); } - - public void addAdditionalToolTips(List aList, ItemStack aStack) { - long tMaxDamage = getToolMaxDamage(aStack); - Materials tMaterial = getPrimaryMaterial(aStack); - IToolStats tStats = getToolStats(aStack); - int tOffset = getElectricStats(aStack) != null ? 2 : 1; + + @Override + public void addAdditionalToolTips(final List aList, final ItemStack aStack) { + final long tMaxDamage = getToolMaxDamage(aStack); + final Materials tMaterial = getPrimaryMaterial(aStack); + final IToolStats tStats = this.getToolStats(aStack); + final int tOffset = this.getElectricStats(aStack) != null ? 2 : 1; if (tStats != null) { - String name = aStack.getUnlocalizedName(); + final String name = aStack.getUnlocalizedName(); if (name.equals("gt.metatool.01.170") || name.equals("gt.metatool.01.172") || name.equals("gt.metatool.01.174") || name.equals("gt.metatool.01.176")) { aList.add(tOffset + 0, EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY); - aList.add(tOffset + 1, EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " + getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); - aList.add(tOffset + 2, EnumChatFormatting.WHITE + "Turbine Efficency: " + EnumChatFormatting.BLUE + (50.0F + (10.0F * getToolCombatDamage(aStack))) + EnumChatFormatting.GRAY); + aList.add(tOffset + 1, EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " + this.getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); + aList.add(tOffset + 2, EnumChatFormatting.WHITE + "Turbine Efficency: " + EnumChatFormatting.BLUE + (50.0F + (10.0F * this.getToolCombatDamage(aStack))) + EnumChatFormatting.GRAY); aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Steam flow: " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) + EnumChatFormatting.GRAY + "L/sec"); aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Gas flow(EU burnvalue per tick): " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 25) + EnumChatFormatting.GRAY + "EU/t"); aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Plasma flow(Plasma energyvalue per tick): " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) + EnumChatFormatting.GRAY + "EU/t"); } else { aList.add(tOffset + 0, EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY); - aList.add(tOffset + 1, EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " + getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); - aList.add(tOffset + 2, EnumChatFormatting.WHITE + "Attack Damage: " + EnumChatFormatting.BLUE + getToolCombatDamage(aStack) + EnumChatFormatting.GRAY); + aList.add(tOffset + 1, EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " + this.getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); + aList.add(tOffset + 2, EnumChatFormatting.WHITE + "Attack Damage: " + EnumChatFormatting.BLUE + this.getToolCombatDamage(aStack) + EnumChatFormatting.GRAY); + aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Mining Speed: " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) + EnumChatFormatting.GRAY); + } + } + } + + public void addAdditionalToolTips(final List aList, final ItemStack aStack, final EntityPlayer aPlayer) { + final long tMaxDamage = getToolMaxDamage(aStack); + final Materials tMaterial = getPrimaryMaterial(aStack); + final IToolStats tStats = this.getToolStats(aStack); + final int tOffset = this.getElectricStats(aStack) != null ? 2 : 1; + if (tStats != null) { + final String name = aStack.getUnlocalizedName(); + if (name.equals("gt.metatool.01.170") || name.equals("gt.metatool.01.172") || name.equals("gt.metatool.01.174") || name.equals("gt.metatool.01.176")) { + aList.add(tOffset + 0, EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY); + aList.add(tOffset + 1, EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " + this.getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); + aList.add(tOffset + 2, EnumChatFormatting.WHITE + "Turbine Efficency: " + EnumChatFormatting.BLUE + (50.0F + (10.0F * this.getToolCombatDamage(aStack))) + EnumChatFormatting.GRAY); + aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Steam flow: " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) + EnumChatFormatting.GRAY + "L/sec"); + aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Gas flow(EU burnvalue per tick): " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 50) + EnumChatFormatting.GRAY + "EU/t"); + aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Plasma flow(Plasma energyvalue per tick): " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) + EnumChatFormatting.GRAY + "EU/t"); + + } else { + aList.add(tOffset + 0, EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY); + aList.add(tOffset + 1, EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " + this.getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); + aList.add(tOffset + 2, EnumChatFormatting.WHITE + "Attack Damage: " + EnumChatFormatting.BLUE + this.getToolCombatDamage(aStack) + EnumChatFormatting.GRAY); aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Mining Speed: " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) + EnumChatFormatting.GRAY); + NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + aNBT = aNBT.getCompoundTag("GT.ToolStats"); + if ((aNBT != null) && aNBT.hasKey("Heat")){ + int tHeat = aNBT.getInteger("Heat"); + final long tWorldTime = aPlayer.getEntityWorld().getWorldTime(); + if(aNBT.hasKey("HeatTime")){ + final long tHeatTime = aNBT.getLong("HeatTime"); + if(tWorldTime>(tHeatTime+10)){ + tHeat = (int) (tHeat - ((tWorldTime-tHeatTime)/10)); + if((tHeat<300)&&(tHeat>-10000)) { + tHeat=300; + } + } + aNBT.setLong("HeatTime", tWorldTime); + if(tHeat>-10000) { + aNBT.setInteger("Heat", tHeat); + } + } + + aList.add(tOffset + 3, EnumChatFormatting.RED + "Heat: " + aNBT.getInteger("Heat")+" K" + EnumChatFormatting.GRAY); + } + } } } } - - public void addAdditionalToolTips(List aList, ItemStack aStack, EntityPlayer aPlayer) { - long tMaxDamage = getToolMaxDamage(aStack); - Materials tMaterial = getPrimaryMaterial(aStack); - IToolStats tStats = getToolStats(aStack); - int tOffset = getElectricStats(aStack) != null ? 2 : 1; - if (tStats != null) { - String name = aStack.getUnlocalizedName(); - if (name.equals("gt.metatool.01.170") || name.equals("gt.metatool.01.172") || name.equals("gt.metatool.01.174") || name.equals("gt.metatool.01.176")) { - aList.add(tOffset + 0, EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY); - aList.add(tOffset + 1, EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " + getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); - aList.add(tOffset + 2, EnumChatFormatting.WHITE + "Turbine Efficency: " + EnumChatFormatting.BLUE + (50.0F + (10.0F * getToolCombatDamage(aStack))) + EnumChatFormatting.GRAY); - aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Steam flow: " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) + EnumChatFormatting.GRAY + "L/sec"); - aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Gas flow(EU burnvalue per tick): " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 50) + EnumChatFormatting.GRAY + "EU/t"); - aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Plasma flow(Plasma energyvalue per tick): " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) + EnumChatFormatting.GRAY + "EU/t"); - - } else { - aList.add(tOffset + 0, EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY); - aList.add(tOffset + 1, EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " + getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); - aList.add(tOffset + 2, EnumChatFormatting.WHITE + "Attack Damage: " + EnumChatFormatting.BLUE + getToolCombatDamage(aStack) + EnumChatFormatting.GRAY); - aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Mining Speed: " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) + EnumChatFormatting.GRAY); - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("GT.ToolStats"); - if (aNBT != null && aNBT.hasKey("Heat")){ - int tHeat = aNBT.getInteger("Heat"); - long tWorldTime = aPlayer.getEntityWorld().getWorldTime(); - if(aNBT.hasKey("HeatTime")){ - long tHeatTime = aNBT.getLong("HeatTime"); - if(tWorldTime>(tHeatTime+10)){ - tHeat = (int) (tHeat - ((tWorldTime-tHeatTime)/10)); - if(tHeat<300&&tHeat>-10000)tHeat=300; - } - aNBT.setLong("HeatTime", tWorldTime); - if(tHeat>-10000)aNBT.setInteger("Heat", tHeat); - } - - aList.add(tOffset + 3, EnumChatFormatting.RED + "Heat: " + aNBT.getInteger("Heat")+" K" + EnumChatFormatting.GRAY); - } - } - } - } - } @Override - public Long[] getFluidContainerStats(ItemStack aStack) { + public Long[] getFluidContainerStats(final ItemStack aStack) { return null; } @Override - public Long[] getElectricStats(ItemStack aStack) { + public Long[] getElectricStats(final ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("GT.ToolStats"); - if (aNBT != null && aNBT.getBoolean("Electric")) + if ((aNBT != null) && aNBT.getBoolean("Electric")) { return new Long[]{aNBT.getLong("MaxCharge"), aNBT.getLong("Voltage"), aNBT.getLong("Tier"), aNBT.getLong("SpecialData")}; + } } return null; } @Override - public float getToolCombatDamage(ItemStack aStack) { - IToolStats tStats = getToolStats(aStack); - if (tStats == null) return 0; + public float getToolCombatDamage(final ItemStack aStack) { + final IToolStats tStats = this.getToolStats(aStack); + if (tStats == null) { + return 0; + } return tStats.getBaseDamage() + getPrimaryMaterial(aStack).mToolQuality; } @Override - public float getDigSpeed(ItemStack aStack, Block aBlock, int aMetaData) { - if (!isItemStackUsable(aStack)) return 0.0F; - IToolStats tStats = getToolStats(aStack); - if (tStats == null || Math.max(0, getHarvestLevel(aStack, "")) < aBlock.getHarvestLevel(aMetaData)) return 0.0F; + public float getDigSpeed(final ItemStack aStack, final Block aBlock, final int aMetaData) { + if (!this.isItemStackUsable(aStack)) { + return 0.0F; + } + final IToolStats tStats = this.getToolStats(aStack); + if ((tStats == null) || (Math.max(0, this.getHarvestLevel(aStack, "")) < aBlock.getHarvestLevel(aMetaData))) { + return 0.0F; + } return tStats.isMinableBlock(aBlock, (byte) aMetaData) ? Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) : 0.0F; } @Override - public boolean onBlockDestroyed(ItemStack aStack, World aWorld, Block aBlock, int aX, int aY, int aZ, EntityLivingBase aPlayer) { - if (!isItemStackUsable(aStack)) return false; - IToolStats tStats = getToolStats(aStack); - if (tStats == null) return false; + public boolean onBlockDestroyed(final ItemStack aStack, final World aWorld, final Block aBlock, final int aX, final int aY, final int aZ, final EntityLivingBase aPlayer) { + if (!this.isItemStackUsable(aStack)) { + return false; + } + final IToolStats tStats = this.getToolStats(aStack); + if (tStats == null) { + return false; + } GT_Utility.doSoundAtClient(tStats.getMiningSound(), 1, 1.0F); - doDamage(aStack, (int) Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak())); - return getDigSpeed(aStack, aBlock, aWorld.getBlockMetadata(aX, aY, aZ)) > 0.0F; + this.doDamage(aStack, (int) Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak())); + return this.getDigSpeed(aStack, aBlock, aWorld.getBlockMetadata(aX, aY, aZ)) > 0.0F; } - private ItemStack getContainerItem(ItemStack aStack, boolean playSound) { - if (!isItemStackUsable(aStack)) return null; + private ItemStack getContainerItem(ItemStack aStack, final boolean playSound) { + if (!this.isItemStackUsable(aStack)) { + return null; + } aStack = GT_Utility.copyAmount(1, aStack); - IToolStats tStats = getToolStats(aStack); - if (tStats == null) return null; - doDamage(aStack, tStats.getToolDamagePerContainerCraft()); + final IToolStats tStats = this.getToolStats(aStack); + if (tStats == null) { + return null; + } + this.doDamage(aStack, tStats.getToolDamagePerContainerCraft()); aStack = aStack.stackSize > 0 ? aStack : null; if (playSound) { //String sound = (aStack == null) ? tStats.getBreakingSound() : tStats.getCraftingSound(); @@ -246,76 +287,102 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool implements } @Override - public Interface_ToolStats getToolStats(ItemStack aStack) { - isItemStackUsable(aStack); - return getToolStatsInternal(aStack); + public Interface_ToolStats getToolStats(final ItemStack aStack) { + this.isItemStackUsable(aStack); + return this.getToolStatsInternal(aStack); } - private Interface_ToolStats getToolStatsInternal(ItemStack aStack) { - return (Interface_ToolStats) (aStack == null ? null : mToolStats.get((short) aStack.getItemDamage())); + private Interface_ToolStats getToolStatsInternal(final ItemStack aStack) { + return (Interface_ToolStats) (aStack == null ? null : this.mToolStats.get((short) aStack.getItemDamage())); } @Override - public boolean canWhack(EntityPlayer aPlayer, ItemStack aStack, int aX, int aY, int aZ) { - if (!isItemStackUsable(aStack)) return false; - IToolStats tStats = getToolStats(aStack); - return tStats != null && tStats.isCrowbar(); + public boolean canWhack(final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY, final int aZ) { + if (!this.isItemStackUsable(aStack)) { + return false; + } + final IToolStats tStats = this.getToolStats(aStack); + return (tStats != null) && tStats.isCrowbar(); } @Override - public void onWhack(EntityPlayer aPlayer, ItemStack aStack, int aX, int aY, int aZ) { - IToolStats tStats = getToolStats(aStack); - if (tStats != null) doDamage(aStack, tStats.getToolDamagePerEntityAttack()); + public void onWhack(final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY, final int aZ) { + final IToolStats tStats = this.getToolStats(aStack); + if (tStats != null) { + this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); + } } @Override - public boolean canWrench(EntityPlayer player, int x, int y, int z) { + public boolean canWrench(final EntityPlayer player, final int x, final int y, final int z) { //System.out.println("canWrench"); - if(player==null)return false; - if(player.getCurrentEquippedItem()==null)return false; - if (!isItemStackUsable(player.getCurrentEquippedItem())) return false; - Interface_ToolStats tStats = getToolStats(player.getCurrentEquippedItem()); - return tStats != null && tStats.isWrench(); + if(player==null) { + return false; + } + if(player.getCurrentEquippedItem()==null) { + return false; + } + if (!this.isItemStackUsable(player.getCurrentEquippedItem())) { + return false; + } + final Interface_ToolStats tStats = this.getToolStats(player.getCurrentEquippedItem()); + return (tStats != null) && tStats.isWrench(); } @Override - public void wrenchUsed(EntityPlayer player, int x, int y, int z) { - if(player==null)return; - if(player.getCurrentEquippedItem()==null)return; - IToolStats tStats = getToolStats(player.getCurrentEquippedItem()); - if (tStats != null) doDamage(player.getCurrentEquippedItem(), tStats.getToolDamagePerEntityAttack()); + public void wrenchUsed(final EntityPlayer player, final int x, final int y, final int z) { + if(player==null) { + return; + } + if(player.getCurrentEquippedItem()==null) { + return; + } + final IToolStats tStats = this.getToolStats(player.getCurrentEquippedItem()); + if (tStats != null) { + this.doDamage(player.getCurrentEquippedItem(), tStats.getToolDamagePerEntityAttack()); + } } @Override - public boolean canLink(EntityPlayer aPlayer, ItemStack aStack, EntityMinecart cart) { - if (!isItemStackUsable(aStack)) return false; - IToolStats tStats = getToolStats(aStack); - return tStats != null && tStats.isCrowbar(); + public boolean canLink(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { + if (!this.isItemStackUsable(aStack)) { + return false; + } + final IToolStats tStats = this.getToolStats(aStack); + return (tStats != null) && tStats.isCrowbar(); } @Override - public void onLink(EntityPlayer aPlayer, ItemStack aStack, EntityMinecart cart) { - IToolStats tStats = getToolStats(aStack); - if (tStats != null) doDamage(aStack, tStats.getToolDamagePerEntityAttack()); + public void onLink(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { + final IToolStats tStats = this.getToolStats(aStack); + if (tStats != null) { + this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); + } } @Override - public boolean canBoost(EntityPlayer aPlayer, ItemStack aStack, EntityMinecart cart) { - if (!isItemStackUsable(aStack)) return false; - IToolStats tStats = getToolStats(aStack); - return tStats != null && tStats.isCrowbar(); + public boolean canBoost(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { + if (!this.isItemStackUsable(aStack)) { + return false; + } + final IToolStats tStats = this.getToolStats(aStack); + return (tStats != null) && tStats.isCrowbar(); } @Override - public void onBoost(EntityPlayer aPlayer, ItemStack aStack, EntityMinecart cart) { - IToolStats tStats = getToolStats(aStack); - if (tStats != null) doDamage(aStack, tStats.getToolDamagePerEntityAttack()); + public void onBoost(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { + final IToolStats tStats = this.getToolStats(aStack); + if (tStats != null) { + this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); + } } @Override - public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - IToolStats tStats = getToolStats(aStack); - if (tStats != null && aPlayer != null) tStats.onToolCrafted(aStack, aPlayer); + public void onCreated(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { + final IToolStats tStats = this.getToolStats(aStack); + if ((tStats != null) && (aPlayer != null)) { + tStats.onToolCrafted(aStack, aPlayer); + } super.onCreated(aStack, aWorld, aPlayer); } @@ -325,38 +392,46 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool implements } @Override - public boolean isItemStackUsable(ItemStack aStack) { - IToolStats tStats = getToolStatsInternal(aStack); - if (aStack.getItemDamage() % 2 == 1 || tStats == null) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) aNBT.removeTag("ench"); + public boolean isItemStackUsable(final ItemStack aStack) { + final IToolStats tStats = this.getToolStatsInternal(aStack); + if (((aStack.getItemDamage() % 2) == 1) || (tStats == null)) { + final NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + aNBT.removeTag("ench"); + } return false; } - Materials aMaterial = getPrimaryMaterial(aStack); - HashMap<Integer, Integer> tMap = new HashMap<Integer, Integer>(), tResult = new HashMap<Integer, Integer>(); + final Materials aMaterial = getPrimaryMaterial(aStack); + final HashMap<Integer, Integer> tMap = new HashMap<>(), tResult = new HashMap<>(); if (aMaterial.mEnchantmentTools != null) { tMap.put(aMaterial.mEnchantmentTools.effectId, (int) aMaterial.mEnchantmentToolsLevel); - if (aMaterial.mEnchantmentTools == Enchantment.fortune) + if (aMaterial.mEnchantmentTools == Enchantment.fortune) { tMap.put(Enchantment.looting.effectId, (int) aMaterial.mEnchantmentToolsLevel); - if (aMaterial.mEnchantmentTools == Enchantment.knockback) + } + if (aMaterial.mEnchantmentTools == Enchantment.knockback) { tMap.put(Enchantment.power.effectId, (int) aMaterial.mEnchantmentToolsLevel); - if (aMaterial.mEnchantmentTools == Enchantment.fireAspect) + } + if (aMaterial.mEnchantmentTools == Enchantment.fireAspect) { tMap.put(Enchantment.flame.effectId, (int) aMaterial.mEnchantmentToolsLevel); + } } - Enchantment[] tEnchants = tStats.getEnchantments(aStack); - int[] tLevels = tStats.getEnchantmentLevels(aStack); - for (int i = 0; i < tEnchants.length; i++) + final Enchantment[] tEnchants = tStats.getEnchantments(aStack); + final int[] tLevels = tStats.getEnchantmentLevels(aStack); + for (int i = 0; i < tEnchants.length; i++) { if (tLevels[i] > 0) { - Integer tLevel = tMap.get(tEnchants[i].effectId); + final Integer tLevel = tMap.get(tEnchants[i].effectId); tMap.put(tEnchants[i].effectId, tLevel == null ? tLevels[i] : tLevel == tLevels[i] ? tLevel + 1 : Math.max(tLevel, tLevels[i])); } - for (Entry<Integer, Integer> tEntry : tMap.entrySet()) { - if (tEntry.getKey() == 33 || (tEntry.getKey() == 20 && tEntry.getValue() > 2) || tEntry.getKey() == Enchantment_Radioactivity.INSTANCE.effectId) + } + for (final Entry<Integer, Integer> tEntry : tMap.entrySet()) { + if ((tEntry.getKey() == 33) || ((tEntry.getKey() == 20) && (tEntry.getValue() > 2)) || (tEntry.getKey() == Enchantment_Radioactivity.INSTANCE.effectId)) { tResult.put(tEntry.getKey(), tEntry.getValue()); - else + } else { switch (Enchantment.enchantmentsList[tEntry.getKey()].type) { case weapon: - if (tStats.isWeapon()) tResult.put(tEntry.getKey(), tEntry.getValue()); + if (tStats.isWeapon()) { + tResult.put(tEntry.getKey(), tEntry.getValue()); + } break; case all: tResult.put(tEntry.getKey(), tEntry.getValue()); @@ -368,31 +443,38 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool implements case armor_torso: break; case bow: - if (tStats.isRangedWeapon()) tResult.put(tEntry.getKey(), tEntry.getValue()); + if (tStats.isRangedWeapon()) { + tResult.put(tEntry.getKey(), tEntry.getValue()); + } break; case breakable: break; case fishing_rod: break; case digger: - if (tStats.isMiningTool()) tResult.put(tEntry.getKey(), tEntry.getValue()); + if (tStats.isMiningTool()) { + tResult.put(tEntry.getKey(), tEntry.getValue()); + } break; } + } } EnchantmentHelper.setEnchantments(tResult, aStack); return true; } @Override - public short getChargedMetaData(ItemStack aStack) { + public short getChargedMetaData(final ItemStack aStack) { return (short) (aStack.getItemDamage() - (aStack.getItemDamage() % 2)); } @Override - public short getEmptyMetaData(ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) aNBT.removeTag("ench"); - return (short) (aStack.getItemDamage() + 1 - (aStack.getItemDamage() % 2)); + public short getEmptyMetaData(final ItemStack aStack) { + final NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + aNBT.removeTag("ench"); + } + return (short) ((aStack.getItemDamage() + 1) - (aStack.getItemDamage() % 2)); } @Override @@ -401,12 +483,12 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool implements } @Override - public boolean isBookEnchantable(ItemStack aStack, ItemStack aBook) { + public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) { return false; } @Override - public boolean getIsRepairable(ItemStack aStack, ItemStack aMaterial) { + public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) { return false; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java index ac40f47d23..a980a299d5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.api.items.tools; +import java.util.*; +import java.util.Map.Entry; + import gregtech.api.GregTech_API; import gregtech.api.enchants.Enchantment_Radioactivity; import gregtech.api.enums.Materials; @@ -8,10 +11,6 @@ import gregtech.api.interfaces.IToolStats; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.util.*; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ToolStats; - -import java.util.*; -import java.util.Map.Entry; - import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; @@ -38,41 +37,45 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { * <p/> * You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item. */ - public static final HashMap<String, GT_MetaGenTool> sInstances = new HashMap<String, GT_MetaGenTool>(); + public static final HashMap<String, GT_MetaGenTool> sInstances = new HashMap<>(); /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - public final HashMap<Short, IToolStats> mToolStats = new HashMap<Short, IToolStats>(); + public final HashMap<Short, IToolStats> mToolStats = new HashMap<>(); /** * Creates the Item using these Parameters. * * @param aUnlocalized The Unlocalized Name of this Item. */ - public GT_MetaGenTool(String aUnlocalized) { + public GT_MetaGenTool(final String aUnlocalized) { super(aUnlocalized); GT_ModHandler.registerBoxableItemToToolBox(this); - setCreativeTab(GregTech_API.TAB_GREGTECH); - setMaxStackSize(1); - sInstances.put(getUnlocalizedName(), this); + this.setCreativeTab(GregTech_API.TAB_GREGTECH); + this.setMaxStackSize(1); + sInstances.put(this.getUnlocalizedName(), this); } /* ---------- FOR ADDING CUSTOM ITEMS INTO THE REMAINING 766 RANGE ---------- */ - public static final Materials getPrimaryMaterialEx(ItemStack aStack) { + public static final Materials getPrimaryMaterialEx(final ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("GT.ToolStats"); - if (aNBT != null) return Materials.getRealMaterial(aNBT.getString("PrimaryMaterial")); + if (aNBT != null) { + return Materials.getRealMaterial(aNBT.getString("PrimaryMaterial")); + } } return Materials._NULL; } - public static final Materials getSecondaryMaterialEx(ItemStack aStack) { + public static final Materials getSecondaryMaterialEx(final ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("GT.ToolStats"); - if (aNBT != null) return Materials.getRealMaterial(aNBT.getString("SecondaryMaterial")); + if (aNBT != null) { + return Materials.getRealMaterial(aNBT.getString("SecondaryMaterial")); + } } return Materials._NULL; } @@ -87,26 +90,30 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { * @param aOreDictNamesAndAspects The OreDict Names you want to give the Item. Also used to assign Thaumcraft Aspects. * @return An ItemStack containing the newly created Item, but without specific Stats. */ - public final ItemStack addToolEx(int aID, String aEnglish, String aToolTip, IToolStats aToolStats, Object... aOreDictNamesAndAspects) { - if (aToolTip == null) aToolTip = ""; - if (aID >= 0 && aID < 32766 && aID % 2 == 0) { - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + aID + ".name", aEnglish); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + aID + ".tooltip", aToolTip); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (aID + 1) + ".name", aEnglish + " (Empty)"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (aID + 1) + ".tooltip", "You need to recharge it"); - mToolStats.put((short) aID, aToolStats); - mToolStats.put((short) (aID + 1), aToolStats); + public final ItemStack addToolEx(final int aID, final String aEnglish, String aToolTip, final IToolStats aToolStats, final Object... aOreDictNamesAndAspects) { + if (aToolTip == null) { + aToolTip = ""; + } + if ((aID >= 0) && (aID < 32766) && ((aID % 2) == 0)) { + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + "." + aID + ".name", aEnglish); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + "." + aID + ".tooltip", aToolTip); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + "." + (aID + 1) + ".name", aEnglish + " (Empty)"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + "." + (aID + 1) + ".tooltip", "You need to recharge it"); + this.mToolStats.put((short) aID, aToolStats); + this.mToolStats.put((short) (aID + 1), aToolStats); aToolStats.onStatsAddedToTool(this, aID); - ItemStack rStack = new ItemStack(this, 1, aID); - List<TC_AspectStack> tAspects = new ArrayList<TC_AspectStack>(); - for (Object tOreDictNameOrAspect : aOreDictNamesAndAspects) { - if (tOreDictNameOrAspect instanceof TC_AspectStack) + final ItemStack rStack = new ItemStack(this, 1, aID); + final List<TC_AspectStack> tAspects = new ArrayList<>(); + for (final Object tOreDictNameOrAspect : aOreDictNamesAndAspects) { + if (tOreDictNameOrAspect instanceof TC_AspectStack) { ((TC_AspectStack) tOreDictNameOrAspect).addToAspectList(tAspects); - else + } else { GT_OreDictUnificator.registerOre(tOreDictNameOrAspect, rStack); + } } - if (GregTech_API.sThaumcraftCompat != null) + if (GregTech_API.sThaumcraftCompat != null) { GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); + } return rStack; } return null; @@ -121,16 +128,18 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { * @param aSecondaryMaterial Secondary (Rod/Handle) Material of this Tool * @param aElectricArray The Electric Stats of this Tool (or null if not electric) */ - public final ItemStack getToolWithStatsEx(int aToolID, int aAmount, Materials aPrimaryMaterial, Materials aSecondaryMaterial, long[] aElectricArray) { - ItemStack rStack = new ItemStack(this, aAmount, aToolID); - IToolStats tToolStats = getToolStats(rStack); + public final ItemStack getToolWithStatsEx(final int aToolID, final int aAmount, final Materials aPrimaryMaterial, final Materials aSecondaryMaterial, final long[] aElectricArray) { + final ItemStack rStack = new ItemStack(this, aAmount, aToolID); + final IToolStats tToolStats = this.getToolStats(rStack); if (tToolStats != null) { - NBTTagCompound tMainNBT = new NBTTagCompound(), tToolNBT = new NBTTagCompound(); + final NBTTagCompound tMainNBT = new NBTTagCompound(), tToolNBT = new NBTTagCompound(); if (aPrimaryMaterial != null) { tToolNBT.setString("PrimaryMaterial", aPrimaryMaterial.toString()); tToolNBT.setLong("MaxDamage", 100L * (long) (aPrimaryMaterial.mDurability * tToolStats.getMaxDurabilityMultiplier())); } - if (aSecondaryMaterial != null) tToolNBT.setString("SecondaryMaterial", aSecondaryMaterial.toString()); + if (aSecondaryMaterial != null) { + tToolNBT.setString("SecondaryMaterial", aSecondaryMaterial.toString()); + } if (aElectricArray != null) { tToolNBT.setBoolean("Electric", true); @@ -143,114 +152,152 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { tMainNBT.setTag("GT.ToolStats", tToolNBT); rStack.setTagCompound(tMainNBT); } - isItemStackUsable(rStack); + this.isItemStackUsable(rStack); return rStack; } /** * Called by the Block Harvesting Event within the GT_Proxy */ - public void onHarvestBlockEvent(ArrayList<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent) { - IToolStats tStats = getToolStats(aStack); - if (isItemStackUsable(aStack) && getDigSpeed(aStack, aBlock, aMetaData) > 0.0F) - doDamage(aStack, tStats.convertBlockDrops(aDrops, aStack, aPlayer, aBlock, aX, aY, aZ, aMetaData, aFortune, aSilkTouch, aEvent) * tStats.getToolDamagePerDropConversion()); + @Override + public void onHarvestBlockEvent(final ArrayList<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { + final IToolStats tStats = this.getToolStats(aStack); + if (this.isItemStackUsable(aStack) && (this.getDigSpeed(aStack, aBlock, aMetaData) > 0.0F)) { + this.doDamage(aStack, tStats.convertBlockDrops(aDrops, aStack, aPlayer, aBlock, aX, aY, aZ, aMetaData, aFortune, aSilkTouch, aEvent) * tStats.getToolDamagePerDropConversion()); + } } @Override - public boolean onLeftClickEntity(ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) { - IToolStats tStats = getToolStats(aStack); - if (tStats == null || !isItemStackUsable(aStack)) return true; + public boolean onLeftClickEntity(final ItemStack aStack, final EntityPlayer aPlayer, final Entity aEntity) { + final IToolStats tStats = this.getToolStats(aStack); + if ((tStats == null) || !this.isItemStackUsable(aStack)) { + return true; + } GT_Utility.doSoundAtClient(tStats.getEntityHitSound(), 1, 1.0F); - if (super.onLeftClickEntity(aStack, aPlayer, aEntity)) return true; + if (super.onLeftClickEntity(aStack, aPlayer, aEntity)) { + return true; + } if (aEntity.canAttackWithItem() && !aEntity.hitByEntity(aPlayer)) { - float tMagicDamage = tStats.getMagicDamageAgainstEntity(aEntity instanceof EntityLivingBase ? EnchantmentHelper.getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity) : 0.0F, aEntity, aStack, aPlayer), tDamage = tStats.getNormalDamageAgainstEntity((float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue() + getToolCombatDamage(aStack), aEntity, aStack, aPlayer); - if (tDamage + tMagicDamage > 0.0F) { - boolean tCriticalHit = aPlayer.fallDistance > 0.0F && !aPlayer.onGround && !aPlayer.isOnLadder() && !aPlayer.isInWater() && !aPlayer.isPotionActive(Potion.blindness) && aPlayer.ridingEntity == null && aEntity instanceof EntityLivingBase; - if (tCriticalHit && tDamage > 0.0F) tDamage *= 1.5F; + final float tMagicDamage = tStats.getMagicDamageAgainstEntity(aEntity instanceof EntityLivingBase ? EnchantmentHelper.getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity) : 0.0F, aEntity, aStack, aPlayer); + float tDamage = tStats.getNormalDamageAgainstEntity((float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue() + this.getToolCombatDamage(aStack), aEntity, aStack, aPlayer); + if ((tDamage + tMagicDamage) > 0.0F) { + final boolean tCriticalHit = (aPlayer.fallDistance > 0.0F) && !aPlayer.onGround && !aPlayer.isOnLadder() && !aPlayer.isInWater() && !aPlayer.isPotionActive(Potion.blindness) && (aPlayer.ridingEntity == null) && (aEntity instanceof EntityLivingBase); + if (tCriticalHit && (tDamage > 0.0F)) { + tDamage *= 1.5F; + } tDamage += tMagicDamage; if (aEntity.attackEntityFrom(tStats.getDamageSource(aPlayer, aEntity), tDamage)) { - if (aEntity instanceof EntityLivingBase) + if (aEntity instanceof EntityLivingBase) { aEntity.setFire(EnchantmentHelper.getFireAspectModifier(aPlayer) * 4); - int tKnockcack = (aPlayer.isSprinting() ? 1 : 0) + (aEntity instanceof EntityLivingBase ? EnchantmentHelper.getKnockbackModifier(aPlayer, (EntityLivingBase) aEntity) : 0); + } + final int tKnockcack = (aPlayer.isSprinting() ? 1 : 0) + (aEntity instanceof EntityLivingBase ? EnchantmentHelper.getKnockbackModifier(aPlayer, (EntityLivingBase) aEntity) : 0); if (tKnockcack > 0) { - aEntity.addVelocity(-MathHelper.sin(aPlayer.rotationYaw * (float) Math.PI / 180.0F) * tKnockcack * 0.5F, 0.1D, MathHelper.cos(aPlayer.rotationYaw * (float) Math.PI / 180.0F) * tKnockcack * 0.5F); + aEntity.addVelocity(-MathHelper.sin((aPlayer.rotationYaw * (float) Math.PI) / 180.0F) * tKnockcack * 0.5F, 0.1D, MathHelper.cos((aPlayer.rotationYaw * (float) Math.PI) / 180.0F) * tKnockcack * 0.5F); aPlayer.motionX *= 0.6D; aPlayer.motionZ *= 0.6D; aPlayer.setSprinting(false); } - if (tCriticalHit) aPlayer.onCriticalHit(aEntity); - if (tMagicDamage > 0.0F) aPlayer.onEnchantmentCritical(aEntity); - if (tDamage >= 18.0F) aPlayer.triggerAchievement(AchievementList.overkill); + if (tCriticalHit) { + aPlayer.onCriticalHit(aEntity); + } + if (tMagicDamage > 0.0F) { + aPlayer.onEnchantmentCritical(aEntity); + } + if (tDamage >= 18.0F) { + aPlayer.triggerAchievement(AchievementList.overkill); + } aPlayer.setLastAttacker(aEntity); - if (aEntity instanceof EntityLivingBase) + if (aEntity instanceof EntityLivingBase) { EnchantmentHelper.func_151384_a((EntityLivingBase) aEntity, aPlayer); + } EnchantmentHelper.func_151385_b(aPlayer, aEntity); - if (aEntity instanceof EntityLivingBase) + if (aEntity instanceof EntityLivingBase) { aPlayer.addStat(StatList.damageDealtStat, Math.round(tDamage * 10.0F)); + } aEntity.hurtResistantTime = Math.max(1, tStats.getHurtResistanceTime(aEntity.hurtResistantTime, aEntity)); aPlayer.addExhaustion(0.3F); - doDamage(aStack, tStats.getToolDamagePerEntityAttack()); + this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); } } } - if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); + if (aStack.stackSize <= 0) { + aPlayer.destroyCurrentEquippedItem(); + } return true; } @Override - public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - IToolStats tStats = getToolStats(aStack); - if (tStats != null && tStats.canBlock()) aPlayer.setItemInUse(aStack, 72000); + public ItemStack onItemRightClick(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { + final IToolStats tStats = this.getToolStats(aStack); + if ((tStats != null) && tStats.canBlock()) { + aPlayer.setItemInUse(aStack, 72000); + } return super.onItemRightClick(aStack, aWorld, aPlayer); } - + @Override - public Long[] getFluidContainerStats(ItemStack aStack) { + public Long[] getFluidContainerStats(final ItemStack aStack) { return null; } @Override - public Long[] getElectricStats(ItemStack aStack) { + public Long[] getElectricStats(final ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("GT.ToolStats"); - if (aNBT != null && aNBT.getBoolean("Electric")) + if ((aNBT != null) && aNBT.getBoolean("Electric")) { return new Long[]{aNBT.getLong("MaxCharge"), aNBT.getLong("Voltage"), aNBT.getLong("Tier"), aNBT.getLong("SpecialData")}; + } } return null; } - public float getToolCombatDamage(ItemStack aStack) { - IToolStats tStats = getToolStats(aStack); - if (tStats == null) return 0; + @Override + public float getToolCombatDamage(final ItemStack aStack) { + final IToolStats tStats = this.getToolStats(aStack); + if (tStats == null) { + return 0; + } return tStats.getBaseDamage() + getPrimaryMaterial(aStack).mToolQuality; } @Override - public float getDigSpeed(ItemStack aStack, Block aBlock, int aMetaData) { - if (!isItemStackUsable(aStack)) return 0.0F; - IToolStats tStats = getToolStats(aStack); - if (tStats == null || Math.max(0, getHarvestLevel(aStack, "")) < aBlock.getHarvestLevel(aMetaData)) return 0.0F; + public float getDigSpeed(final ItemStack aStack, final Block aBlock, final int aMetaData) { + if (!this.isItemStackUsable(aStack)) { + return 0.0F; + } + final IToolStats tStats = this.getToolStats(aStack); + if ((tStats == null) || (Math.max(0, this.getHarvestLevel(aStack, "")) < aBlock.getHarvestLevel(aMetaData))) { + return 0.0F; + } return tStats.isMinableBlock(aBlock, (byte) aMetaData) ? Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) : 0.0F; } @Override - public boolean onBlockDestroyed(ItemStack aStack, World aWorld, Block aBlock, int aX, int aY, int aZ, EntityLivingBase aPlayer) { - if (!isItemStackUsable(aStack)) return false; - IToolStats tStats = getToolStats(aStack); - if (tStats == null) return false; + public boolean onBlockDestroyed(final ItemStack aStack, final World aWorld, final Block aBlock, final int aX, final int aY, final int aZ, final EntityLivingBase aPlayer) { + if (!this.isItemStackUsable(aStack)) { + return false; + } + final IToolStats tStats = this.getToolStats(aStack); + if (tStats == null) { + return false; + } GT_Utility.doSoundAtClient(tStats.getMiningSound(), 1, 1.0F); - doDamage(aStack, (int) Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak())); - return getDigSpeed(aStack, aBlock, aWorld.getBlockMetadata(aX, aY, aZ)) > 0.0F; + this.doDamage(aStack, (int) Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak())); + return this.getDigSpeed(aStack, aBlock, aWorld.getBlockMetadata(aX, aY, aZ)) > 0.0F; } - private ItemStack getContainerItem(ItemStack aStack, boolean playSound) { - if (!isItemStackUsable(aStack)) return null; + private ItemStack getContainerItem(ItemStack aStack, final boolean playSound) { + if (!this.isItemStackUsable(aStack)) { + return null; + } aStack = GT_Utility.copyAmount(1, aStack); - IToolStats tStats = getToolStats(aStack); - if (tStats == null) return null; - doDamage(aStack, tStats.getToolDamagePerContainerCraft()); + final IToolStats tStats = this.getToolStats(aStack); + if (tStats == null) { + return null; + } + this.doDamage(aStack, tStats.getToolDamagePerContainerCraft()); aStack = aStack.stackSize > 0 ? aStack : null; if (playSound) { //String sound = (aStack == null) ? tStats.getBreakingSound() : tStats.getCraftingSound(); @@ -259,96 +306,129 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { return aStack; } - public Interface_ToolStats getToolStats(ItemStack aStack) { - isItemStackUsable(aStack); - return getToolStatsInternal(aStack); + @Override + public Interface_ToolStats getToolStats(final ItemStack aStack) { + this.isItemStackUsable(aStack); + return this.getToolStatsInternal(aStack); } - private Interface_ToolStats getToolStatsInternal(ItemStack aStack) { - return (Interface_ToolStats) (aStack == null ? null : mToolStats.get((short) aStack.getItemDamage())); + private Interface_ToolStats getToolStatsInternal(final ItemStack aStack) { + return (Interface_ToolStats) (aStack == null ? null : this.mToolStats.get((short) aStack.getItemDamage())); } @Override - public float getSaplingModifier(ItemStack aStack, World aWorld, EntityPlayer aPlayer, int aX, int aY, int aZ) { - IToolStats tStats = getToolStats(aStack); - return tStats != null && tStats.isGrafter() ? Math.min(100.0F, (1 + getHarvestLevel(aStack, "")) * 20.0F) : 0.0F; + public float getSaplingModifier(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer, final int aX, final int aY, final int aZ) { + final IToolStats tStats = this.getToolStats(aStack); + return (tStats != null) && tStats.isGrafter() ? Math.min(100.0F, (1 + this.getHarvestLevel(aStack, "")) * 20.0F) : 0.0F; } @Override - public boolean canWhack(EntityPlayer aPlayer, ItemStack aStack, int aX, int aY, int aZ) { - if (!isItemStackUsable(aStack)) return false; - IToolStats tStats = getToolStats(aStack); - return tStats != null && tStats.isCrowbar(); + public boolean canWhack(final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY, final int aZ) { + if (!this.isItemStackUsable(aStack)) { + return false; + } + final IToolStats tStats = this.getToolStats(aStack); + return (tStats != null) && tStats.isCrowbar(); } @Override - public void onWhack(EntityPlayer aPlayer, ItemStack aStack, int aX, int aY, int aZ) { - IToolStats tStats = getToolStats(aStack); - if (tStats != null) doDamage(aStack, tStats.getToolDamagePerEntityAttack()); + public void onWhack(final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY, final int aZ) { + final IToolStats tStats = this.getToolStats(aStack); + if (tStats != null) { + this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); + } } - public boolean canWrench(EntityPlayer player, int x, int y, int z) { + public boolean canWrench(final EntityPlayer player, final int x, final int y, final int z) { System.out.println("canWrench"); - if(player==null)return false; - if(player.getCurrentEquippedItem()==null)return false; - if (!isItemStackUsable(player.getCurrentEquippedItem())) return false; - Interface_ToolStats tStats = getToolStats(player.getCurrentEquippedItem()); - return tStats != null && tStats.isWrench(); + if(player==null) { + return false; + } + if(player.getCurrentEquippedItem()==null) { + return false; + } + if (!this.isItemStackUsable(player.getCurrentEquippedItem())) { + return false; + } + final Interface_ToolStats tStats = this.getToolStats(player.getCurrentEquippedItem()); + return (tStats != null) && tStats.isWrench(); } - public void wrenchUsed(EntityPlayer player, int x, int y, int z) { - if(player==null)return; - if(player.getCurrentEquippedItem()==null)return; - IToolStats tStats = getToolStats(player.getCurrentEquippedItem()); - if (tStats != null) doDamage(player.getCurrentEquippedItem(), tStats.getToolDamagePerEntityAttack()); + public void wrenchUsed(final EntityPlayer player, final int x, final int y, final int z) { + if(player==null) { + return; + } + if(player.getCurrentEquippedItem()==null) { + return; + } + final IToolStats tStats = this.getToolStats(player.getCurrentEquippedItem()); + if (tStats != null) { + this.doDamage(player.getCurrentEquippedItem(), tStats.getToolDamagePerEntityAttack()); + } } - public boolean canUse(ItemStack stack, EntityPlayer player, int x, int y, int z){ - return canWrench(player, x, y, z); + public boolean canUse(final ItemStack stack, final EntityPlayer player, final int x, final int y, final int z){ + return this.canWrench(player, x, y, z); } - public void used(ItemStack stack, EntityPlayer player, int x, int y, int z){ - wrenchUsed(player, x, y, z); + public void used(final ItemStack stack, final EntityPlayer player, final int x, final int y, final int z){ + this.wrenchUsed(player, x, y, z); } - public boolean shouldHideFacades(ItemStack stack, EntityPlayer player) { - if(player==null)return false; - if(player.getCurrentEquippedItem()==null)return false; - if (!isItemStackUsable(player.getCurrentEquippedItem())) return false; - Interface_ToolStats tStats = getToolStats(player.getCurrentEquippedItem()); + public boolean shouldHideFacades(final ItemStack stack, final EntityPlayer player) { + if(player==null) { + return false; + } + if(player.getCurrentEquippedItem()==null) { + return false; + } + if (!this.isItemStackUsable(player.getCurrentEquippedItem())) { + return false; + } + final Interface_ToolStats tStats = this.getToolStats(player.getCurrentEquippedItem()); return tStats.isWrench(); } @Override - public boolean canLink(EntityPlayer aPlayer, ItemStack aStack, EntityMinecart cart) { - if (!isItemStackUsable(aStack)) return false; - IToolStats tStats = getToolStats(aStack); - return tStats != null && tStats.isCrowbar(); + public boolean canLink(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { + if (!this.isItemStackUsable(aStack)) { + return false; + } + final IToolStats tStats = this.getToolStats(aStack); + return (tStats != null) && tStats.isCrowbar(); } @Override - public void onLink(EntityPlayer aPlayer, ItemStack aStack, EntityMinecart cart) { - IToolStats tStats = getToolStats(aStack); - if (tStats != null) doDamage(aStack, tStats.getToolDamagePerEntityAttack()); + public void onLink(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { + final IToolStats tStats = this.getToolStats(aStack); + if (tStats != null) { + this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); + } } @Override - public boolean canBoost(EntityPlayer aPlayer, ItemStack aStack, EntityMinecart cart) { - if (!isItemStackUsable(aStack)) return false; - IToolStats tStats = getToolStats(aStack); - return tStats != null && tStats.isCrowbar(); + public boolean canBoost(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { + if (!this.isItemStackUsable(aStack)) { + return false; + } + final IToolStats tStats = this.getToolStats(aStack); + return (tStats != null) && tStats.isCrowbar(); } @Override - public void onBoost(EntityPlayer aPlayer, ItemStack aStack, EntityMinecart cart) { - IToolStats tStats = getToolStats(aStack); - if (tStats != null) doDamage(aStack, tStats.getToolDamagePerEntityAttack()); + public void onBoost(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { + final IToolStats tStats = this.getToolStats(aStack); + if (tStats != null) { + this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); + } } @Override - public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - IToolStats tStats = getToolStats(aStack); - if (tStats != null && aPlayer != null) tStats.onToolCrafted(aStack, aPlayer); + public void onCreated(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { + final IToolStats tStats = this.getToolStats(aStack); + if ((tStats != null) && (aPlayer != null)) { + tStats.onToolCrafted(aStack, aPlayer); + } super.onCreated(aStack, aWorld, aPlayer); } @@ -358,38 +438,46 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { } @Override - public boolean isItemStackUsable(ItemStack aStack) { - IToolStats tStats = getToolStatsInternal(aStack); - if (aStack.getItemDamage() % 2 == 1 || tStats == null) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) aNBT.removeTag("ench"); + public boolean isItemStackUsable(final ItemStack aStack) { + final IToolStats tStats = this.getToolStatsInternal(aStack); + if (((aStack.getItemDamage() % 2) == 1) || (tStats == null)) { + final NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + aNBT.removeTag("ench"); + } return false; } - Materials aMaterial = getPrimaryMaterial(aStack); - HashMap<Integer, Integer> tMap = new HashMap<Integer, Integer>(), tResult = new HashMap<Integer, Integer>(); + final Materials aMaterial = getPrimaryMaterial(aStack); + final HashMap<Integer, Integer> tMap = new HashMap<>(), tResult = new HashMap<>(); if (aMaterial.mEnchantmentTools != null) { tMap.put(aMaterial.mEnchantmentTools.effectId, (int) aMaterial.mEnchantmentToolsLevel); - if (aMaterial.mEnchantmentTools == Enchantment.fortune) + if (aMaterial.mEnchantmentTools == Enchantment.fortune) { tMap.put(Enchantment.looting.effectId, (int) aMaterial.mEnchantmentToolsLevel); - if (aMaterial.mEnchantmentTools == Enchantment.knockback) + } + if (aMaterial.mEnchantmentTools == Enchantment.knockback) { tMap.put(Enchantment.power.effectId, (int) aMaterial.mEnchantmentToolsLevel); - if (aMaterial.mEnchantmentTools == Enchantment.fireAspect) + } + if (aMaterial.mEnchantmentTools == Enchantment.fireAspect) { tMap.put(Enchantment.flame.effectId, (int) aMaterial.mEnchantmentToolsLevel); + } } - Enchantment[] tEnchants = tStats.getEnchantments(aStack); - int[] tLevels = tStats.getEnchantmentLevels(aStack); - for (int i = 0; i < tEnchants.length; i++) + final Enchantment[] tEnchants = tStats.getEnchantments(aStack); + final int[] tLevels = tStats.getEnchantmentLevels(aStack); + for (int i = 0; i < tEnchants.length; i++) { if (tLevels[i] > 0) { - Integer tLevel = tMap.get(tEnchants[i].effectId); + final Integer tLevel = tMap.get(tEnchants[i].effectId); tMap.put(tEnchants[i].effectId, tLevel == null ? tLevels[i] : tLevel == tLevels[i] ? tLevel + 1 : Math.max(tLevel, tLevels[i])); } - for (Entry<Integer, Integer> tEntry : tMap.entrySet()) { - if (tEntry.getKey() == 33 || (tEntry.getKey() == 20 && tEntry.getValue() > 2) || tEntry.getKey() == Enchantment_Radioactivity.INSTANCE.effectId) + } + for (final Entry<Integer, Integer> tEntry : tMap.entrySet()) { + if ((tEntry.getKey() == 33) || ((tEntry.getKey() == 20) && (tEntry.getValue() > 2)) || (tEntry.getKey() == Enchantment_Radioactivity.INSTANCE.effectId)) { tResult.put(tEntry.getKey(), tEntry.getValue()); - else + } else { switch (Enchantment.enchantmentsList[tEntry.getKey()].type) { case weapon: - if (tStats.isWeapon()) tResult.put(tEntry.getKey(), tEntry.getValue()); + if (tStats.isWeapon()) { + tResult.put(tEntry.getKey(), tEntry.getValue()); + } break; case all: tResult.put(tEntry.getKey(), tEntry.getValue()); @@ -401,31 +489,38 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { case armor_torso: break; case bow: - if (tStats.isRangedWeapon()) tResult.put(tEntry.getKey(), tEntry.getValue()); + if (tStats.isRangedWeapon()) { + tResult.put(tEntry.getKey(), tEntry.getValue()); + } break; case breakable: break; case fishing_rod: break; case digger: - if (tStats.isMiningTool()) tResult.put(tEntry.getKey(), tEntry.getValue()); + if (tStats.isMiningTool()) { + tResult.put(tEntry.getKey(), tEntry.getValue()); + } break; } + } } EnchantmentHelper.setEnchantments(tResult, aStack); return true; } @Override - public short getChargedMetaData(ItemStack aStack) { + public short getChargedMetaData(final ItemStack aStack) { return (short) (aStack.getItemDamage() - (aStack.getItemDamage() % 2)); } @Override - public short getEmptyMetaData(ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) aNBT.removeTag("ench"); - return (short) (aStack.getItemDamage() + 1 - (aStack.getItemDamage() % 2)); + public short getEmptyMetaData(final ItemStack aStack) { + final NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + aNBT.removeTag("ench"); + } + return (short) ((aStack.getItemDamage() + 1) - (aStack.getItemDamage() % 2)); } @Override @@ -434,12 +529,12 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { } @Override - public boolean isBookEnchantable(ItemStack aStack, ItemStack aBook) { + public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) { return false; } @Override - public boolean getIsRepairable(ItemStack aStack, ItemStack aMaterial) { + public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) { return false; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java index 0f09b06f14..f343890671 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java @@ -1,11 +1,10 @@ package gtPlusPlus.xmod.gregtech.api.items.types; +import java.util.List; + import gregtech.api.enums.SubTag; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour; import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_Base; - -import java.util.List; - import net.minecraft.block.BlockDispenser; import net.minecraft.dispenser.*; import net.minecraft.entity.Entity; @@ -17,66 +16,66 @@ import net.minecraft.util.EnumFacing; import net.minecraft.world.World; public class ToolType_Base implements Interface_ItemBehaviour<Gregtech_MetaItem_Base> { - @Override - public boolean onLeftClickEntity(Gregtech_MetaItem_Base aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) { - return false; - } + @Override + public boolean onLeftClickEntity(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, final EntityPlayer aPlayer, final Entity aEntity) { + return false; + } - @Override - public boolean onItemUse(Gregtech_MetaItem_Base aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - return false; - } + @Override + public boolean onItemUse(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) { + return false; + } - @Override - public boolean onItemUseFirst(Gregtech_MetaItem_Base aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - return false; - } + @Override + public boolean onItemUseFirst(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) { + return false; + } - @Override - public ItemStack onItemRightClick(Gregtech_MetaItem_Base aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - return aStack; - } + @Override + public ItemStack onItemRightClick(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { + return aStack; + } - @Override - public List<String> getAdditionalToolTips(Gregtech_MetaItem_Base aItem, List<String> aList, ItemStack aStack) { - return aList; - } + @Override + public List<String> getAdditionalToolTips(final Gregtech_MetaItem_Base aItem, final List<String> aList, final ItemStack aStack) { + return aList; + } - @Override - public void onUpdate(Gregtech_MetaItem_Base aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand) { - } + @Override + public void onUpdate(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, final World aWorld, final Entity aPlayer, final int aTimer, final boolean aIsInHand) { + } - @Override - public boolean isItemStackUsable(Gregtech_MetaItem_Base aItem, ItemStack aStack) { - return true; - } + @Override + public boolean isItemStackUsable(final Gregtech_MetaItem_Base aItem, final ItemStack aStack) { + return true; + } - @Override - public boolean canDispense(Gregtech_MetaItem_Base aItem, IBlockSource aSource, ItemStack aStack) { - return false; - } + @Override + public boolean canDispense(final Gregtech_MetaItem_Base aItem, final IBlockSource aSource, final ItemStack aStack) { + return false; + } - @Override - public ItemStack onDispense(Gregtech_MetaItem_Base aItem, IBlockSource aSource, ItemStack aStack) { - EnumFacing enumfacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata()); - IPosition iposition = BlockDispenser.func_149939_a(aSource); - ItemStack itemstack1 = aStack.splitStack(1); - BehaviorDefaultDispenseItem.doDispense(aSource.getWorld(), itemstack1, 6, enumfacing, iposition); - return aStack; - } + @Override + public ItemStack onDispense(final Gregtech_MetaItem_Base aItem, final IBlockSource aSource, final ItemStack aStack) { + final EnumFacing enumfacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata()); + final IPosition iposition = BlockDispenser.func_149939_a(aSource); + final ItemStack itemstack1 = aStack.splitStack(1); + BehaviorDefaultDispenseItem.doDispense(aSource.getWorld(), itemstack1, 6, enumfacing, iposition); + return aStack; + } - @Override - public boolean hasProjectile(Gregtech_MetaItem_Base aItem, SubTag aProjectileType, ItemStack aStack) { - return false; - } + @Override + public boolean hasProjectile(final Gregtech_MetaItem_Base aItem, final SubTag aProjectileType, final ItemStack aStack) { + return false; + } - @Override - public EntityArrow getProjectile(Gregtech_MetaItem_Base aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ) { - return null; - } + @Override + public EntityArrow getProjectile(final Gregtech_MetaItem_Base aItem, final SubTag aProjectileType, final ItemStack aStack, final World aWorld, final double aX, final double aY, final double aZ) { + return null; + } - @Override - public EntityArrow getProjectile(Gregtech_MetaItem_Base aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed) { - return null; - } + @Override + public EntityArrow getProjectile(final Gregtech_MetaItem_Base aItem, final SubTag aProjectileType, final ItemStack aStack, final World aWorld, final EntityLivingBase aEntity, final float aSpeed) { + return null; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java index 7b1f0344ff..783a0ec63d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.api.items.types; +import java.util.List; +import java.util.Random; + import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.items.GT_MetaBase_Item; @@ -8,10 +11,6 @@ import gregtech.api.objects.ItemData; import gregtech.api.util.*; import gregtech.common.blocks.GT_Block_Ores; import gregtech.common.blocks.GT_TileEntity_Ores; - -import java.util.List; -import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -22,103 +21,103 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.IFluidBlock; public class ToolType_HardHammer - extends ToolType_Base { - private final int mVanillaCosts; - private final int mEUCosts; - private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.prospecting", "Usable for Prospecting"); +extends ToolType_Base { + private final int mVanillaCosts; + private final int mEUCosts; + private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.prospecting", "Usable for Prospecting"); - public ToolType_HardHammer(int aVanillaCosts, int aEUCosts) { - this.mVanillaCosts = aVanillaCosts; - this.mEUCosts = aEUCosts; - } + public ToolType_HardHammer(final int aVanillaCosts, final int aEUCosts) { + this.mVanillaCosts = aVanillaCosts; + this.mEUCosts = aEUCosts; + } - public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - if (aWorld.isRemote) { - return false; - } - Block aBlock = aWorld.getBlock(aX, aY, aZ); - if (aBlock == null) { - return false; - } - byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); + public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) { + if (aWorld.isRemote) { + return false; + } + final Block aBlock = aWorld.getBlock(aX, aY, aZ); + if (aBlock == null) { + return false; + } + final byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); - ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta)); - if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { - GT_Utility.sendChatToPlayer(aPlayer, "This is " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); - return true; - } - if ((aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone))) { - if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) { - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); - int tX = aX; - int tY = aY; - int tZ = aZ; - int tMetaID = 0; - int tQuality = (aItem instanceof GT_MetaGenerated_Tool) ? ((GT_MetaGenerated_Tool) aItem).getHarvestLevel(aStack, "") : 0; + ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta)); + if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { + GT_Utility.sendChatToPlayer(aPlayer, "This is " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); + return true; + } + if ((aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone))) { + if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) { + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); + int tX = aX; + int tY = aY; + int tZ = aZ; + int tMetaID = 0; + final int tQuality = (aItem instanceof GT_MetaGenerated_Tool) ? ((GT_MetaGenerated_Tool) aItem).getHarvestLevel(aStack, "") : 0; - int i = 0; - for (int j = 6 + tQuality; i < j; i++) { - tX -= ForgeDirection.getOrientation(aSide).offsetX; - tY -= ForgeDirection.getOrientation(aSide).offsetY; - tZ -= ForgeDirection.getOrientation(aSide).offsetZ; + int i = 0; + for (final int j = 6 + tQuality; i < j; i++) { + tX -= ForgeDirection.getOrientation(aSide).offsetX; + tY -= ForgeDirection.getOrientation(aSide).offsetY; + tZ -= ForgeDirection.getOrientation(aSide).offsetZ; - Block tBlock = aWorld.getBlock(tX, tY, tZ); - if ((tBlock == Blocks.lava) || (tBlock == Blocks.flowing_lava)) { - GT_Utility.sendChatToPlayer(aPlayer, "There is Lava behind this Rock."); - break; - } - if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water) || ((tBlock instanceof IFluidBlock))) { - GT_Utility.sendChatToPlayer(aPlayer, "There is a Liquid behind this Rock."); - break; - } - if ((tBlock == Blocks.monster_egg) || (!GT_Utility.hasBlockHitBox(aWorld, tX, tY, tZ))) { - GT_Utility.sendChatToPlayer(aPlayer, "There is an Air Pocket behind this Rock."); - break; - } - if (tBlock != aBlock) { - if (i >= 4) { - break; - } - GT_Utility.sendChatToPlayer(aPlayer, "Material is changing behind this Rock."); - break; - } - } - Random tRandom = new Random(aX ^ aY ^ aZ ^ aSide); - i = 0; - for (int j = 9 + 2 * tQuality; i < j; i++) { - tX = aX - 4 - tQuality + tRandom.nextInt(j); - tY = aY - 4 - tQuality + tRandom.nextInt(j); - tZ = aZ - 4 - tQuality + tRandom.nextInt(j); - Block tBlock = aWorld.getBlock(tX, tY, tZ); - if ((tBlock instanceof GT_Block_Ores)) { - TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ); - if ((tTileEntity instanceof GT_TileEntity_Ores)) { - Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)]; - if ((tMaterial != null) && (tMaterial != Materials._NULL)) { - GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tMaterial.mDefaultLocalName + " Ore."); - return true; - } - } - } else { - tMetaID = aWorld.getBlockMetadata(tX, tY, tZ); - tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID)); - if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { - GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); - return true; - } - } - } - GT_Utility.sendChatToPlayer(aPlayer, "No Ores found."); - } - return true; - } - return false; - } + final Block tBlock = aWorld.getBlock(tX, tY, tZ); + if ((tBlock == Blocks.lava) || (tBlock == Blocks.flowing_lava)) { + GT_Utility.sendChatToPlayer(aPlayer, "There is Lava behind this Rock."); + break; + } + if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water) || ((tBlock instanceof IFluidBlock))) { + GT_Utility.sendChatToPlayer(aPlayer, "There is a Liquid behind this Rock."); + break; + } + if ((tBlock == Blocks.monster_egg) || (!GT_Utility.hasBlockHitBox(aWorld, tX, tY, tZ))) { + GT_Utility.sendChatToPlayer(aPlayer, "There is an Air Pocket behind this Rock."); + break; + } + if (tBlock != aBlock) { + if (i >= 4) { + break; + } + GT_Utility.sendChatToPlayer(aPlayer, "Material is changing behind this Rock."); + break; + } + } + final Random tRandom = new Random(aX ^ aY ^ aZ ^ aSide); + i = 0; + for (final int j = 9 + (2 * tQuality); i < j; i++) { + tX = (aX - 4 - tQuality) + tRandom.nextInt(j); + tY = (aY - 4 - tQuality) + tRandom.nextInt(j); + tZ = (aZ - 4 - tQuality) + tRandom.nextInt(j); + final Block tBlock = aWorld.getBlock(tX, tY, tZ); + if ((tBlock instanceof GT_Block_Ores)) { + final TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ); + if ((tTileEntity instanceof GT_TileEntity_Ores)) { + final Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)]; + if ((tMaterial != null) && (tMaterial != Materials._NULL)) { + GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tMaterial.mDefaultLocalName + " Ore."); + return true; + } + } + } else { + tMetaID = aWorld.getBlockMetadata(tX, tY, tZ); + tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID)); + if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { + GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); + return true; + } + } + } + GT_Utility.sendChatToPlayer(aPlayer, "No Ores found."); + } + return true; + } + return false; + } - public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) { - aList.add(this.mTooltip); - return aList; - } + public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList, final ItemStack aStack) { + aList.add(this.mTooltip); + return aList; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java b/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java index 63d97e49f9..cb1f4a2ffa 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java @@ -1,14 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.items.types; +import java.util.Arrays; +import java.util.List; + import gregtech.api.GregTech_API; import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.util.*; import ic2.api.tile.IWrenchable; - -import java.util.Arrays; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -19,129 +18,129 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class ToolType_Wrench - extends ToolType_Base { - private final int mCosts; - private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.wrench", "Rotates Blocks on Rightclick"); +extends ToolType_Base { + private final int mCosts; + private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.wrench", "Rotates Blocks on Rightclick"); - public ToolType_Wrench(int aCosts) { - this.mCosts = aCosts; - } + public ToolType_Wrench(final int aCosts) { + this.mCosts = aCosts; + } - public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - if (aWorld.isRemote) { - return false; - } - Block aBlock = aWorld.getBlock(aX, aY, aZ); - if (aBlock == null) { - return false; - } - byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); - byte aTargetSide = GT_Utility.determineWrenchingSide((byte) aSide, hitX, hitY, hitZ); - TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - try { - if ((aTileEntity != null) && ((aTileEntity instanceof IWrenchable))) { - if (((IWrenchable) aTileEntity).wrenchCanSetFacing(aPlayer, aTargetSide)) { - if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - ((IWrenchable) aTileEntity).setFacing((short) aTargetSide); - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if (((IWrenchable) aTileEntity).wrenchCanRemove(aPlayer)) { - int tDamage = ((IWrenchable) aTileEntity).getWrenchDropRate() < 1.0F ? 10 : 3; - if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, tDamage * this.mCosts))) { - ItemStack tOutput = ((IWrenchable) aTileEntity).getWrenchDrop(aPlayer); - for (ItemStack tStack : aBlock.getDrops(aWorld, aX, aY, aZ, aMeta, 0)) { - if (tOutput == null) { - aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tStack)); - } else { - aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tOutput)); - tOutput = null; - } - } - aWorld.setBlockToAir(aX, aY, aZ); - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - return true; - } - } catch (Throwable e) { - } - if ((aBlock == Blocks.log) || (aBlock == Blocks.log2) || (aBlock == Blocks.hay_block)) { - if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta + 4) % 12, 3); - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if ((aBlock == Blocks.powered_repeater) || (aBlock == Blocks.unpowered_repeater)) { - if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aMeta / 4 * 4 + (aMeta % 4 + 1) % 4, 3); - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if ((aBlock == Blocks.powered_comparator) || (aBlock == Blocks.unpowered_comparator)) { - if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aMeta / 4 * 4 + (aMeta % 4 + 1) % 4, 3); - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if ((aBlock == Blocks.crafting_table) || (aBlock == Blocks.bookshelf)) { - if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, aMeta))); - aWorld.setBlockToAir(aX, aY, aZ); - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if (aMeta == aTargetSide) { - if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper) || (aBlock == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == Blocks.trapped_chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.hopper)) { - if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, 0))); - aWorld.setBlockToAir(aX, aY, aZ); - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - } else { - if ((aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper)) { - if ((aMeta < 6) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.trapped_chest)) { - if ((aTargetSide > 1) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if (aBlock == Blocks.hopper) { - if ((aTargetSide != 1) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - } - if ((Arrays.asList(aBlock.getValidRotations(aWorld, aX, aY, aZ)).contains(ForgeDirection.getOrientation(aTargetSide))) && - ((aPlayer.capabilities.isCreativeMode) || (!GT_ModHandler.isElectricItem(aStack)) || (GT_ModHandler.canUseElectricItem(aStack, this.mCosts))) && - (aBlock.rotateBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(aTargetSide)))) { - if (!aPlayer.capabilities.isCreativeMode) { - ((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts); - } - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); - } - return false; - } + public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) { + if (aWorld.isRemote) { + return false; + } + final Block aBlock = aWorld.getBlock(aX, aY, aZ); + if (aBlock == null) { + return false; + } + final byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); + final byte aTargetSide = GT_Utility.determineWrenchingSide((byte) aSide, hitX, hitY, hitZ); + final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); + try { + if ((aTileEntity != null) && ((aTileEntity instanceof IWrenchable))) { + if (((IWrenchable) aTileEntity).wrenchCanSetFacing(aPlayer, aTargetSide)) { + if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { + ((IWrenchable) aTileEntity).setFacing(aTargetSide); + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + if (((IWrenchable) aTileEntity).wrenchCanRemove(aPlayer)) { + final int tDamage = ((IWrenchable) aTileEntity).getWrenchDropRate() < 1.0F ? 10 : 3; + if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, tDamage * this.mCosts))) { + ItemStack tOutput = ((IWrenchable) aTileEntity).getWrenchDrop(aPlayer); + for (final ItemStack tStack : aBlock.getDrops(aWorld, aX, aY, aZ, aMeta, 0)) { + if (tOutput == null) { + aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tStack)); + } else { + aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tOutput)); + tOutput = null; + } + } + aWorld.setBlockToAir(aX, aY, aZ); + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + return true; + } + } catch (final Throwable e) { + } + if ((aBlock == Blocks.log) || (aBlock == Blocks.log2) || (aBlock == Blocks.hay_block)) { + if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta + 4) % 12, 3); + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + if ((aBlock == Blocks.powered_repeater) || (aBlock == Blocks.unpowered_repeater)) { + if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3); + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + if ((aBlock == Blocks.powered_comparator) || (aBlock == Blocks.unpowered_comparator)) { + if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3); + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + if ((aBlock == Blocks.crafting_table) || (aBlock == Blocks.bookshelf)) { + if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { + aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, aMeta))); + aWorld.setBlockToAir(aX, aY, aZ); + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + if (aMeta == aTargetSide) { + if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper) || (aBlock == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == Blocks.trapped_chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.hopper)) { + if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { + aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, 0))); + aWorld.setBlockToAir(aX, aY, aZ); + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + } else { + if ((aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper)) { + if ((aMeta < 6) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.trapped_chest)) { + if ((aTargetSide > 1) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + if (aBlock == Blocks.hopper) { + if ((aTargetSide != 1) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { + aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return true; + } + } + if ((Arrays.asList(aBlock.getValidRotations(aWorld, aX, aY, aZ)).contains(ForgeDirection.getOrientation(aTargetSide))) && + ((aPlayer.capabilities.isCreativeMode) || (!GT_ModHandler.isElectricItem(aStack)) || (GT_ModHandler.canUseElectricItem(aStack, this.mCosts))) && + (aBlock.rotateBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(aTargetSide)))) { + if (!aPlayer.capabilities.isCreativeMode) { + ((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts); + } + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); + } + return false; + } - public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) { - aList.add(this.mTooltip); - return aList; - } + public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList, final ItemStack aStack) { + aList.add(this.mTooltip); + return aList; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java index 3cd26a8b7b..175869a1ac 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java @@ -25,11 +25,11 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas /** * @param aInvSlotCount should be 3 */ - public GT_MetaTileEntity_DeluxeTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { + public GT_MetaTileEntity_DeluxeTank(final int aID, final String aName, final String aNameRegional, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); } - public GT_MetaTileEntity_DeluxeTank(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_DeluxeTank(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @@ -39,20 +39,24 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas } @Override - public boolean isValidSlot(int aIndex) { - return aIndex != getStackDisplaySlot(); + public boolean isValidSlot(final int aIndex) { + return aIndex != this.getStackDisplaySlot(); } @Override - public void saveNBTData(NBTTagCompound aNBT) { - if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); - if (mFluid2 != null) aNBT.setTag("mFluid2", mFluid2.writeToNBT(new NBTTagCompound())); + public void saveNBTData(final NBTTagCompound aNBT) { + if (this.mFluid != null) { + aNBT.setTag("mFluid", this.mFluid.writeToNBT(new NBTTagCompound())); + } + if (this.mFluid2 != null) { + aNBT.setTag("mFluid2", this.mFluid2.writeToNBT(new NBTTagCompound())); + } } @Override - public void loadNBTData(NBTTagCompound aNBT) { - mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); - mFluid2 = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid2")); + public void loadNBTData(final NBTTagCompound aNBT) { + this.mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); + this.mFluid2 = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid2")); } @Override @@ -93,7 +97,7 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas } @Override - public boolean isFluidInputAllowed(FluidStack aFluid) { + public boolean isFluidInputAllowed(final FluidStack aFluid) { return true; } @@ -104,118 +108,121 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas @Override public FluidStack getFillableStack() { - return getFillableStackEx(1); + return this.getFillableStackEx(1); } - public FluidStack getFillableStackEx(int stackID) { + public FluidStack getFillableStackEx(final int stackID) { if (stackID <= 1){ - return mFluid; + return this.mFluid; } - return mFluid2; + return this.mFluid2; } @Override - public FluidStack setFillableStack(FluidStack aFluid) { - mFluid = aFluid; - return mFluid; + public FluidStack setFillableStack(final FluidStack aFluid) { + this.mFluid = aFluid; + return this.mFluid; } - - public FluidStack setFillableStack2(FluidStack aFluid) { - mFluid2 = aFluid; - return mFluid2; + + public FluidStack setFillableStack2(final FluidStack aFluid) { + this.mFluid2 = aFluid; + return this.mFluid2; } @Override public FluidStack getDrainableStack() { - return getDrainableStackEx(1); + return this.getDrainableStackEx(1); } - public FluidStack getDrainableStackEx(int stackID) { + public FluidStack getDrainableStackEx(final int stackID) { if (stackID <= 1){ - return mFluid; + return this.mFluid; } - return mFluid2; + return this.mFluid2; } @Override - public FluidStack setDrainableStack(FluidStack aFluid) { - mFluid = aFluid; - return mFluid; + public FluidStack setDrainableStack(final FluidStack aFluid) { + this.mFluid = aFluid; + return this.mFluid; } @Override public FluidStack getDisplayedFluid() { - return getDrainableStack(); + return this.getDrainableStack(); } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new CONTAINER_DeluxeTank(aPlayerInventory, aBaseMetaTileEntity); } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_DeluxeTank(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_DeluxeTank(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); } @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { if (aBaseMetaTileEntity.isServerSide()) { - if (isFluidChangingAllowed() && getFillableStack() != null && getFillableStack().amount <= 0) - setFillableStack(null); + if (this.isFluidChangingAllowed() && (this.getFillableStack() != null) && (this.getFillableStack().amount <= 0)) { + this.setFillableStack(null); + } - if (displaysItemStack() && getStackDisplaySlot() >= 0 && getStackDisplaySlot() < mInventory.length) { - if (getDisplayedFluid() == null) { - if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot()], true, true)) - mInventory[getStackDisplaySlot()] = null; + if (this.displaysItemStack() && (this.getStackDisplaySlot() >= 0) && (this.getStackDisplaySlot() < this.mInventory.length)) { + if (this.getDisplayedFluid() == null) { + if (ItemList.Display_Fluid.isStackEqual(this.mInventory[this.getStackDisplaySlot()], true, true)) { + this.mInventory[this.getStackDisplaySlot()] = null; + } } else { - mInventory[getStackDisplaySlot()] = GT_Utility.getFluidDisplayStack(getDisplayedFluid(), displaysStackSize()); + this.mInventory[this.getStackDisplaySlot()] = GT_Utility.getFluidDisplayStack(this.getDisplayedFluid(), this.displaysStackSize()); } } - if (displaysItemStack() && getStackDisplaySlot2() >= 0 && getStackDisplaySlot2() < mInventory.length) { - if (getDrainableStackEx(2) == null) { - if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot2()], true, true)) - mInventory[getStackDisplaySlot2()] = null; + if (this.displaysItemStack() && (this.getStackDisplaySlot2() >= 0) && (this.getStackDisplaySlot2() < this.mInventory.length)) { + if (this.getDrainableStackEx(2) == null) { + if (ItemList.Display_Fluid.isStackEqual(this.mInventory[this.getStackDisplaySlot2()], true, true)) { + this.mInventory[this.getStackDisplaySlot2()] = null; + } } else { - mInventory[getStackDisplaySlot2()] = GT_Utility.getFluidDisplayStack(getDrainableStackEx(2), displaysStackSize()); + this.mInventory[this.getStackDisplaySlot2()] = GT_Utility.getFluidDisplayStack(this.getDrainableStackEx(2), this.displaysStackSize()); } } - if (doesEmptyContainers()) { - FluidStack tFluid = GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true); - if (tFluid != null && isFluidInputAllowed(tFluid)) { + if (this.doesEmptyContainers()) { + final FluidStack tFluid = GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true); + if ((tFluid != null) && this.isFluidInputAllowed(tFluid)) { - if (tFluid.isFluidEqual(getDrainableStackEx(1)) || getDrainableStackEx(1) == null){ - if (getFillableStackEx(1) == null) { - if (isFluidInputAllowed(tFluid) && tFluid.amount <= getCapacity()) { - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) { - setFillableStack(tFluid.copy()); - aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); + if (tFluid.isFluidEqual(this.getDrainableStackEx(1)) || (this.getDrainableStackEx(1) == null)){ + if (this.getFillableStackEx(1) == null) { + if (this.isFluidInputAllowed(tFluid) && (tFluid.amount <= this.getCapacity())) { + if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), 1)) { + this.setFillableStack(tFluid.copy()); + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); } } } else { - if (tFluid.isFluidEqual(getFillableStack()) && tFluid.amount + getFillableStack().amount <= getCapacity()) { - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) { - getFillableStack().amount += tFluid.amount; - aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); + if (tFluid.isFluidEqual(this.getFillableStack()) && ((tFluid.amount + this.getFillableStack().amount) <= this.getCapacity())) { + if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), 1)) { + this.getFillableStack().amount += tFluid.amount; + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); } } } } - else if (tFluid.isFluidEqual(getDrainableStackEx(2)) || (getDrainableStackEx(2) == null)){ - if (getFillableStackEx(2) == null) { - if (isFluidInputAllowed(tFluid) && tFluid.amount <= getCapacity()) { - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) { - setFillableStack2(tFluid.copy()); - aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); + else if (tFluid.isFluidEqual(this.getDrainableStackEx(2)) || (this.getDrainableStackEx(2) == null)){ + if (this.getFillableStackEx(2) == null) { + if (this.isFluidInputAllowed(tFluid) && (tFluid.amount <= this.getCapacity())) { + if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), 1)) { + this.setFillableStack2(tFluid.copy()); + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); } } } else { - if (tFluid.isFluidEqual(getFillableStackEx(2)) && tFluid.amount + getFillableStackEx(2).amount <= getCapacity()) { - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) { - getFillableStackEx(2).amount += tFluid.amount; - aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); + if (tFluid.isFluidEqual(this.getFillableStackEx(2)) && ((tFluid.amount + this.getFillableStackEx(2).amount) <= this.getCapacity())) { + if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), 1)) { + this.getFillableStackEx(2).amount += tFluid.amount; + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); } } } @@ -226,13 +233,17 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas } } - if (doesFillContainers()) { - ItemStack tOutput = GT_Utility.fillFluidContainer(getDrainableStack(), mInventory[getInputSlot()], false, true); - if (tOutput != null && aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tOutput, 1)) { - FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true); - aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); - if (tFluid != null) getDrainableStack().amount -= tFluid.amount; - if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) setDrainableStack(null); + if (this.doesFillContainers()) { + final ItemStack tOutput = GT_Utility.fillFluidContainer(this.getDrainableStack(), this.mInventory[this.getInputSlot()], false, true); + if ((tOutput != null) && aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tOutput, 1)) { + final FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true); + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + if (tFluid != null) { + this.getDrainableStack().amount -= tFluid.amount; + } + if ((this.getDrainableStack().amount <= 0) && this.isFluidChangingAllowed()) { + this.setDrainableStack(null); + } } } } @@ -240,87 +251,93 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas @Override public FluidStack getFluid() { - return getDrainableStack(); + return this.getDrainableStack(); } @Override public int getFluidAmount() { - return getDrainableStack() != null ? getDrainableStack().amount : 0; + return this.getDrainableStack() != null ? this.getDrainableStack().amount : 0; } @Override - public int fill(FluidStack aFluid, boolean doFill) { - if (aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0 || !canTankBeFilled() || !isFluidInputAllowed(aFluid)) + public int fill(final FluidStack aFluid, final boolean doFill) { + if ((aFluid == null) || (aFluid.getFluid().getID() <= 0) || (aFluid.amount <= 0) || !this.canTankBeFilled() || !this.isFluidInputAllowed(aFluid)) { return 0; + } - if (getFillableStack() == null || getFillableStack().getFluid().getID() <= 0) { - if (aFluid.amount <= getCapacity()) { + if ((this.getFillableStack() == null) || (this.getFillableStack().getFluid().getID() <= 0)) { + if (aFluid.amount <= this.getCapacity()) { if (doFill) { - setFillableStack(aFluid.copy()); - getBaseMetaTileEntity().markDirty(); + this.setFillableStack(aFluid.copy()); + this.getBaseMetaTileEntity().markDirty(); } return aFluid.amount; } if (doFill) { - setFillableStack(aFluid.copy()); - getFillableStack().amount = getCapacity(); - getBaseMetaTileEntity().markDirty(); + this.setFillableStack(aFluid.copy()); + this.getFillableStack().amount = this.getCapacity(); + this.getBaseMetaTileEntity().markDirty(); } - return getCapacity(); + return this.getCapacity(); } - if (!getFillableStack().isFluidEqual(aFluid)) + if (!this.getFillableStack().isFluidEqual(aFluid)) { return 0; + } - int space = getCapacity() - getFillableStack().amount; + final int space = this.getCapacity() - this.getFillableStack().amount; if (aFluid.amount <= space) { if (doFill) { - getFillableStack().amount += aFluid.amount; - getBaseMetaTileEntity().markDirty(); + this.getFillableStack().amount += aFluid.amount; + this.getBaseMetaTileEntity().markDirty(); } return aFluid.amount; } - if (doFill) - getFillableStack().amount = getCapacity(); + if (doFill) { + this.getFillableStack().amount = this.getCapacity(); + } return space; } @Override - public FluidStack drain(int maxDrain, boolean doDrain) { - if (getDrainableStack() == null || !canTankBeEmptied()) return null; - if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) { - setDrainableStack(null); - getBaseMetaTileEntity().markDirty(); + public FluidStack drain(final int maxDrain, final boolean doDrain) { + if ((this.getDrainableStack() == null) || !this.canTankBeEmptied()) { + return null; + } + if ((this.getDrainableStack().amount <= 0) && this.isFluidChangingAllowed()) { + this.setDrainableStack(null); + this.getBaseMetaTileEntity().markDirty(); return null; } int used = maxDrain; - if (getDrainableStack().amount < used) - used = getDrainableStack().amount; + if (this.getDrainableStack().amount < used) { + used = this.getDrainableStack().amount; + } if (doDrain) { - getDrainableStack().amount -= used; - getBaseMetaTileEntity().markDirty(); + this.getDrainableStack().amount -= used; + this.getBaseMetaTileEntity().markDirty(); } - FluidStack drained = getDrainableStack().copy(); + final FluidStack drained = this.getDrainableStack().copy(); drained.amount = used; - if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) { - setDrainableStack(null); - getBaseMetaTileEntity().markDirty(); + if ((this.getDrainableStack().amount <= 0) && this.isFluidChangingAllowed()) { + this.setDrainableStack(null); + this.getBaseMetaTileEntity().markDirty(); } return drained; } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aIndex == getOutputSlot(); + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return aIndex == this.getOutputSlot(); } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aIndex == getInputSlot(); + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return aIndex == this.getInputSlot(); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaCondensor.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaCondensor.java index dcecc3ff34..9bbdba4517 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaCondensor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaCondensor.java @@ -20,146 +20,153 @@ import net.minecraftforge.fluids.IFluidHandler; public class GregtechMetaCondensor extends GregtechMetaBoilerBase{ - public GregtechMetaCondensor(int aID, String aName, String aNameRegional) - { - super(aID, aName, aNameRegional, "A Steam condenser - [IC2->Steam]", new ITexture[0]); - } - - public GregtechMetaCondensor(String aName, int aTier, String aDescription, ITexture[][][] aTextures) - { - super(aName, aTier, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - return new String[] {mDescription, CORE.GT_Tooltip}; + public GregtechMetaCondensor(final int aID, final String aName, final String aNameRegional) + { + super(aID, aName, aNameRegional, "A Steam condenser - [IC2->Steam]", new ITexture[0]); + } + + public GregtechMetaCondensor(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) + { + super(aName, aTier, aDescription, aTextures); + } + + @Override + public String[] getDescription() { + return new String[] {this.mDescription, CORE.GT_Tooltip}; + } + + @Override + public ITexture[][][] getTextureSet(final ITexture[] aTextures) + { + final ITexture[][][] rTextures = new ITexture[5][17][]; + for (byte i = -1; i < 16; i++){ + rTextures[0][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa))}; + rTextures[1][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) }; + rTextures[2][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) }; + rTextures[3][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER) }; + rTextures[4][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER_ACTIVE) }; } - - public ITexture[][][] getTextureSet(ITexture[] aTextures) - { - ITexture[][][] rTextures = new ITexture[5][17][]; - for (byte i = -1; i < 16; i++){ - rTextures[0][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa))}; - rTextures[1][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) }; - rTextures[2][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) }; - rTextures[3][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER) }; - rTextures[4][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER_ACTIVE) }; - } - return rTextures; - } - - public int maxProgresstime() - { - return 1000; - } - - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new CONTAINER_SteamCondenser(aPlayerInventory, aBaseMetaTileEntity, 32000); - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new GUI_SteamCondenser(aPlayerInventory, aBaseMetaTileEntity, "SteelBoiler.png", 32000); - } - - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GregtechMetaCondensor(this.mName, this.mTier, this.mDescription, this.mTextures); - } - - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) - { - this.RI = MathUtils.randLong(5L, 30L); - if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) - { - if (this.mTemperature <= 5) - { - this.mTemperature = 5; - this.mLossTimer = 0; - } - if (++this.mLossTimer > 10) - { - this.mTemperature -= 1; - this.mLossTimer = 0; - } - for (byte i = 1; (this.mSteam != null) && (i < 6); i = (byte)(i + 1)) { - if (i != aBaseMetaTileEntity.getFrontFacing()) - { - IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i); - if (tTileEntity != null) - { - FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false); - if (tDrained != null) - { - int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false); - if (tFilledAmount > 0) { - tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true); - } - } - } - } - } - if (aTick % 10L == 0L) { - if (this.mTemperature > 5) - { - if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) - { - this.mHadNoWater = true; - } - else - { - if (this.mHadNoWater) - { - aBaseMetaTileEntity.doExplosion(2048L); - return; - } - this.mFluid.amount -= 1; - if (this.mSteam == null) { - this.mSteam = GT_ModHandler.getSteam(30L); - } else if (GT_ModHandler.isSteam(this.mSteam)) { - this.mSteam.amount += 30; - } else { - this.mSteam = GT_ModHandler.getSteam(30L); - } - } - } - else { - this.mHadNoWater = false; - } - } - if ((this.mSteam != null) && - (this.mSteam.amount > 32000)) - { - sendSound((byte)1); - this.mSteam.amount = 24000; - } - /*if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && + return rTextures; + } + + @Override + public int maxProgresstime() + { + return 1000; + } + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) + { + return new CONTAINER_SteamCondenser(aPlayerInventory, aBaseMetaTileEntity, 32000); + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) + { + return new GUI_SteamCondenser(aPlayerInventory, aBaseMetaTileEntity, "SteelBoiler.png", 32000); + } + + @Override + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) + { + return new GregtechMetaCondensor(this.mName, this.mTier, this.mDescription, this.mTextures); + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) + { + this.RI = MathUtils.randLong(5L, 30L); + if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) + { + if (this.mTemperature <= 5) + { + this.mTemperature = 5; + this.mLossTimer = 0; + } + if (++this.mLossTimer > 10) + { + this.mTemperature -= 1; + this.mLossTimer = 0; + } + for (byte i = 1; (this.mSteam != null) && (i < 6); i = (byte)(i + 1)) { + if (i != aBaseMetaTileEntity.getFrontFacing()) + { + final IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i); + if (tTileEntity != null) + { + final FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false); + if (tDrained != null) + { + final int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false); + if (tFilledAmount > 0) { + tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true); + } + } + } + } + } + if ((aTick % 10L) == 0L) { + if (this.mTemperature > 5) + { + if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) + { + this.mHadNoWater = true; + } + else + { + if (this.mHadNoWater) + { + aBaseMetaTileEntity.doExplosion(2048L); + return; + } + this.mFluid.amount -= 1; + if (this.mSteam == null) { + this.mSteam = GT_ModHandler.getSteam(30L); + } else if (GT_ModHandler.isSteam(this.mSteam)) { + this.mSteam.amount += 30; + } else { + this.mSteam = GT_ModHandler.getSteam(30L); + } + } + } + else { + this.mHadNoWater = false; + } + } + if ((this.mSteam != null) && + (this.mSteam.amount > 32000)) + { + this.sendSound((byte)1); + this.mSteam.amount = 24000; + } + /*if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.bucket.get(IC2.getItemFromBlock(p_150898_0_))))) { this.mProcessingEnergy += 1000; aBaseMetaTileEntity.decrStackSize(2, 1); aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Empty, 1L)); - }*/ - if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && (aTick % RI == 0L)) - { - this.mProcessingEnergy -= 40; - this.mTemperature += 2; - } - aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); - } - } - - public final int fill(FluidStack aFluid, boolean doFill) - { - if ((Utils.isIC2Steam(aFluid)) && (this.mProcessingEnergy < 50)) - { - int tFilledAmount = Math.min(50, aFluid.amount); - if (doFill) { - this.mProcessingEnergy += tFilledAmount; - } - return tFilledAmount; - } - return super.fill(aFluid, doFill); - } + }*/ + if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && ((aTick % this.RI) == 0L)) + { + this.mProcessingEnergy -= 40; + this.mTemperature += 2; + } + aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); + } + } + + @Override + public final int fill(final FluidStack aFluid, final boolean doFill) + { + if ((Utils.isIC2Steam(aFluid)) && (this.mProcessingEnergy < 50)) + { + final int tFilledAmount = Math.min(50, aFluid.amount); + if (doFill) { + this.mProcessingEnergy += tFilledAmount; + } + return tFilledAmount; + } + return super.fill(aFluid, doFill); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaEnergyBuffer.java index 4f4f3f931f..741d116a3b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaEnergyBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaEnergyBuffer.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; + import gregtech.api.enums.Textures; import gregtech.api.gui.GT_Container_1by1; import gregtech.api.gui.GT_GUIContainer_1by1; @@ -33,96 +34,96 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { public boolean mCharge = false, mDecharge = false; public int mBatteryCount = 1, mChargeableCount = 1; - public GregtechMetaEnergyBuffer(int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) { + public GregtechMetaEnergyBuffer(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) { super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription); } - public GregtechMetaEnergyBuffer(String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) { + public GregtechMetaEnergyBuffer(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) { super(aName, aTier, aSlotCount, aDescription, aTextures); } @Override public String[] getDescription() { - return new String[] {mDescription, CORE.GT_Tooltip}; + return new String[] {this.mDescription, CORE.GT_Tooltip}; } /* * MACHINE_STEEL_SIDE */ - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = getFront(i); - rTextures[1][i + 1] = getBack(i); - rTextures[2][i + 1] = getBottom(i); - rTextures[3][i + 1] = getTop(i); - rTextures[4][i + 1] = getSides(i); - rTextures[5][i + 1] = getFrontActive(i); - rTextures[6][i + 1] = getBackActive(i); - rTextures[7][i + 1] = getBottomActive(i); - rTextures[8][i + 1] = getTopActive(i); - rTextures[9][i + 1] = getSidesActive(i); - } - return rTextures; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; - } - - - public ITexture[] getFront(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; - } - - - public ITexture[] getBack(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)}; - } - - - public ITexture[] getBottom(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)}; - } - - - public ITexture[] getTop(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Screen_Logo)}; - } - - - public ITexture[] getSides(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)}; - } - - - public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; - } - - - public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)}; - } - - - public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)}; - } - - - public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Screen_Logo)}; - } - - - public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)}; - } - + + @Override + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + final ITexture[][][] rTextures = new ITexture[10][17][]; + for (byte i = -1; i < 16; i++) { + rTextures[0][i + 1] = this.getFront(i); + rTextures[1][i + 1] = this.getBack(i); + rTextures[2][i + 1] = this.getBottom(i); + rTextures[3][i + 1] = this.getTop(i); + rTextures[4][i + 1] = this.getSides(i); + rTextures[5][i + 1] = this.getFrontActive(i); + rTextures[6][i + 1] = this.getBackActive(i); + rTextures[7][i + 1] = this.getBottomActive(i); + rTextures[8][i + 1] = this.getTopActive(i); + rTextures[9][i + 1] = this.getSidesActive(i); + } + return rTextures; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; + } + + + public ITexture[] getFront(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; + } + + + public ITexture[] getBack(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)}; + } + + + public ITexture[] getBottom(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)}; + } + + + public ITexture[] getTop(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Screen_Logo)}; + } + + + public ITexture[] getSides(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)}; + } + + + public ITexture[] getFrontActive(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; + } + + + public ITexture[] getBackActive(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)}; + } + + + public ITexture[] getBottomActive(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)}; + } + + + public ITexture[] getTopActive(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Screen_Logo)}; + } + + + public ITexture[] getSidesActive(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)}; + } + /*@Override public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[2][17][]; @@ -166,86 +167,89 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { }*/ @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaEnergyBuffer(mName, mTier, mDescription, mTextures, mInventory.length); + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaEnergyBuffer(this.mName, this.mTier, this.mDescription, this.mTextures, this.mInventory.length); } @Override public boolean isSimpleMachine() {return false;} @Override public boolean isElectric() {return true;} - @Override public boolean isValidSlot(int aIndex) {return true;} - @Override public boolean isFacingValid(byte aFacing) {return true;} + @Override public boolean isValidSlot(final int aIndex) {return true;} + @Override public boolean isFacingValid(final byte aFacing) {return true;} @Override public boolean isEnetInput() {return true;} @Override public boolean isEnetOutput() {return true;} - @Override public boolean isInputFacing(byte aSide) {return aSide!=getBaseMetaTileEntity().getFrontFacing();} - @Override public boolean isOutputFacing(byte aSide) {return aSide==getBaseMetaTileEntity().getFrontFacing();} + @Override public boolean isInputFacing(final byte aSide) {return aSide!=this.getBaseMetaTileEntity().getFrontFacing();} + @Override public boolean isOutputFacing(final byte aSide) {return aSide==this.getBaseMetaTileEntity().getFrontFacing();} @Override public boolean isTeleporterCompatible() {return false;} - @Override public long getMinimumStoredEU() {return V[mTier]*2;} - @Override public long maxEUStore() {return V[mTier]*250000;} + @Override public long getMinimumStoredEU() {return V[this.mTier]*2;} + @Override public long maxEUStore() {return V[this.mTier]*250000;} @Override public long maxEUInput() { - return V[mTier]; + return V[this.mTier]; } @Override public long maxEUOutput() { - return V[mTier]; + return V[this.mTier]; } @Override public long maxAmperesIn() { - return mChargeableCount * 4; + return this.mChargeableCount * 4; } @Override public long maxAmperesOut() { - return mChargeableCount * 4; + return this.mChargeableCount * 4; } @Override public int rechargerSlotStartIndex() {return 0;} @Override public int dechargerSlotStartIndex() {return 0;} - @Override public int rechargerSlotCount() {return mCharge?mInventory.length:0;} - @Override public int dechargerSlotCount() {return mDecharge?mInventory.length:0;} - @Override public int getProgresstime() {return (int)getBaseMetaTileEntity().getUniversalEnergyStored();} - @Override public int maxProgresstime() {return (int)getBaseMetaTileEntity().getUniversalEnergyCapacity();} - @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;} + @Override public int rechargerSlotCount() {return this.mCharge?this.mInventory.length:0;} + @Override public int dechargerSlotCount() {return this.mDecharge?this.mInventory.length:0;} + @Override public int getProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyStored();} + @Override public int maxProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyCapacity();} + @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;} @Override - public void saveNBTData(NBTTagCompound aNBT) { + public void saveNBTData(final NBTTagCompound aNBT) { // } @Override - public void loadNBTData(NBTTagCompound aNBT) { + public void loadNBTData(final NBTTagCompound aNBT) { // } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { Utils.LOG_WARNING("Right Click on MTE by Player"); - if (aBaseMetaTileEntity.isClientSide()) return true; - //aBaseMetaTileEntity.openGUI(aPlayer); + if (aBaseMetaTileEntity.isClientSide()) + { + return true; + //aBaseMetaTileEntity.openGUI(aPlayer); + } Utils.LOG_WARNING("MTE is Client-side"); - showEnergy(aPlayer.getEntityWorld(), aPlayer); + this.showEnergy(aPlayer.getEntityWorld(), aPlayer); return true; } - private void showEnergy(World worldIn, EntityPlayer playerIn){ - long tempStorage = getStoredEnergy()[0]; - final double c = ((double) tempStorage / maxEUStore()) * 100; + private void showEnergy(final World worldIn, final EntityPlayer playerIn){ + final long tempStorage = this.getStoredEnergy()[0]; + final double c = ((double) tempStorage / this.maxEUStore()) * 100; final double roundOff = Math.round(c * 100.00) / 100.00; - PlayerUtils.messagePlayer(playerIn, "Energy: " + tempStorage + " EU at "+V[mTier]+"v ("+roundOff+"%)"); + PlayerUtils.messagePlayer(playerIn, "Energy: " + tempStorage + " EU at "+V[this.mTier]+"v ("+roundOff+"%)"); } - //Utils.LOG_WARNING("Begin Show Energy"); - /* - * + //Utils.LOG_WARNING("Begin Show Energy"); + /* + * //Utils.LOG_INFO("getProgresstime: "+tempStorage+" maxProgresstime: "+maxEUStore()+" C: "+c); Utils.LOG_INFO("getProgressTime: "+getProgresstime()); Utils.LOG_INFO("maxProgressTime: "+maxProgresstime()); Utils.LOG_INFO("getMinimumStoredEU: "+getMinimumStoredEU()); Utils.LOG_INFO("maxEUStore: "+maxEUStore());*/ - /*final long d = (tempStorage * 100L) / maxEUStore(); + /*final long d = (tempStorage * 100L) / maxEUStore(); Utils.LOG_INFO("getProgresstime: "+tempStorage+" maxProgresstime: "+maxEUStore()+" D: "+d); final double roundOff2 = Math.round(d * 100.00) / 100.00; Utils.messagePlayer(playerIn, "Energy: " + tempStorage + " EU at "+V[mTier]+"v ("+roundOff2+"%)"); @@ -256,39 +260,39 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity); } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } public long[] getStoredEnergy(){ - long tScale = getBaseMetaTileEntity().getEUCapacity(); - long tStored = getBaseMetaTileEntity().getStoredEU(); - if (mInventory != null) { - for (ItemStack aStack : mInventory) { + long tScale = this.getBaseMetaTileEntity().getEUCapacity(); + long tStored = this.getBaseMetaTileEntity().getStoredEU(); + if (this.mInventory != null) { + for (final ItemStack aStack : this.mInventory) { if (GT_ModHandler.isElectricItem(aStack)) { if (aStack.getItem() instanceof GT_MetaBase_Item) { - Long[] stats = ((GT_MetaBase_Item) aStack.getItem()) + final Long[] stats = ((GT_MetaBase_Item) aStack.getItem()) .getElectricStats(aStack); if (stats != null) { tScale = tScale + stats[0]; @@ -317,17 +321,17 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { @Override public String[] getInfoData() { - count++; - if(mMax==0||count%20==0){ - long[] tmp = getStoredEnergy(); - mStored=tmp[0]; - mMax=tmp[1]; + this.count++; + if((this.mMax==0)||((this.count%20)==0)){ + final long[] tmp = this.getStoredEnergy(); + this.mStored=tmp[0]; + this.mMax=tmp[1]; } return new String[] { - getLocalName(), - GT_Utility.formatNumbers(mStored)+" EU /", - GT_Utility.formatNumbers(mMax)+" EU"}; + this.getLocalName(), + GT_Utility.formatNumbers(this.mStored)+" EU /", + GT_Utility.formatNumbers(this.mMax)+" EU"}; } @Override @@ -336,17 +340,17 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { } @Override - public int[] getAccessibleSlotsFromSide(int p_94128_1_) { + public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { return null; } @Override - public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) { + public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) { return false; } @Override - public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) { + public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { return false; } @@ -356,22 +360,22 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { } @Override - public ItemStack getStackInSlot(int p_70301_1_) { + public ItemStack getStackInSlot(final int p_70301_1_) { return null; } @Override - public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) { + public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) { return null; } @Override - public ItemStack getStackInSlotOnClosing(int p_70304_1_) { + public ItemStack getStackInSlotOnClosing(final int p_70304_1_) { return null; } @Override - public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) { + public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) { } @Override @@ -390,7 +394,7 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { } @Override - public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { + public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) { return false; } @@ -403,7 +407,7 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { } @Override - public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { + public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) { return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java index 3dbf274393..a3a800fa59 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java @@ -1,6 +1,11 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.D1; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map.Entry; + import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; @@ -14,10 +19,6 @@ import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; - -import java.util.*; -import java.util.Map.Entry; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; @@ -36,55 +37,55 @@ public class GregtechMetaPipeEntityFluid extends MetaPipeEntity { public FluidStack mFluid; public byte mLastReceivedFrom = 0, oLastReceivedFrom = 0; - public GregtechMetaPipeEntityFluid(int aID, String aName, String aNameRegional, float aThickNess, GT_Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof) { + public GregtechMetaPipeEntityFluid(final int aID, final String aName, final String aNameRegional, final float aThickNess, final GT_Materials aMaterial, final int aCapacity, final int aHeatResistance, final boolean aGasProof) { super(aID, aName, aNameRegional, 0); - mThickNess = aThickNess; - mMaterial = aMaterial; - mCapacity = aCapacity; - mGasProof = aGasProof; - mHeatResistance = aHeatResistance; + this.mThickNess = aThickNess; + this.mMaterial = aMaterial; + this.mCapacity = aCapacity; + this.mGasProof = aGasProof; + this.mHeatResistance = aHeatResistance; } - public GregtechMetaPipeEntityFluid(String aName, float aThickNess, GT_Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof) { + public GregtechMetaPipeEntityFluid(final String aName, final float aThickNess, final GT_Materials aMaterial, final int aCapacity, final int aHeatResistance, final boolean aGasProof) { super(aName, 0); - mThickNess = aThickNess; - mMaterial = aMaterial; - mCapacity = aCapacity; - mGasProof = aGasProof; - mHeatResistance = aHeatResistance; + this.mThickNess = aThickNess; + this.mMaterial = aMaterial; + this.mCapacity = aCapacity; + this.mGasProof = aGasProof; + this.mHeatResistance = aHeatResistance; } @Override public byte getTileEntityBaseType() { - return mMaterial == null ? 4 : (byte) ((mMaterial.contains(SubTag.WOOD) ? 12 : 4) + Math.max(0, Math.min(3, mMaterial.mToolQuality))); + return this.mMaterial == null ? 4 : (byte) ((this.mMaterial.contains(SubTag.WOOD) ? 12 : 4) + Math.max(0, Math.min(3, this.mMaterial.mToolQuality))); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaPipeEntityFluid(mName, mThickNess, mMaterial, mCapacity, mHeatResistance, mGasProof); + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaPipeEntityFluid(this.mName, this.mThickNess, this.mMaterial, this.mCapacity, this.mHeatResistance, this.mGasProof); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aConnections, final byte aColorIndex, final boolean aConnected, final boolean aRedstone) { - short[] colours = Dyes.getModulation(aColorIndex, mMaterial.mRGBa); + final short[] colours = Dyes.getModulation(aColorIndex, this.mMaterial.mRGBa); if (aConnected) { - float tThickNess = getThickNess(); + final float tThickNess = this.getThickNess(); if (tThickNess < 0.37F){ - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], colours)}; + return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], colours)}; } if (tThickNess < 0.49F){ - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], colours)}; + return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], colours)}; } if (tThickNess < 0.74F){ - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], colours)}; + return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], colours)}; } if (tThickNess < 0.99F){ - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], colours)}; - } - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], colours)}; + return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], colours)}; + } + return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], colours)}; } - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], colours)}; + return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], colours)}; } @Override @@ -93,46 +94,48 @@ public class GregtechMetaPipeEntityFluid extends MetaPipeEntity { } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return false; } @Override - public boolean isValidSlot(int aIndex) { + public boolean isValidSlot(final int aIndex) { return false; } @Override - public final boolean renderInside(byte aSide) { + public final boolean renderInside(final byte aSide) { return false; } @Override public int getProgresstime() { - return getFluidAmount(); + return this.getFluidAmount(); } @Override public int maxProgresstime() { - return getCapacity(); + return this.getCapacity(); } @Override - public void saveNBTData(NBTTagCompound aNBT) { - if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); - aNBT.setByte("mLastReceivedFrom", mLastReceivedFrom); + public void saveNBTData(final NBTTagCompound aNBT) { + if (this.mFluid != null) { + aNBT.setTag("mFluid", this.mFluid.writeToNBT(new NBTTagCompound())); + } + aNBT.setByte("mLastReceivedFrom", this.mLastReceivedFrom); } @Override - public void loadNBTData(NBTTagCompound aNBT) { - mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); - mLastReceivedFrom = aNBT.getByte("mLastReceivedFrom"); + public void loadNBTData(final NBTTagCompound aNBT) { + this.mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); + this.mLastReceivedFrom = aNBT.getByte("mLastReceivedFrom"); } @Override - public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) { - if (mFluid != null && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase) { - int tTemperature = mFluid.getFluid().getTemperature(mFluid); + public void onEntityCollidedWithBlock(final World aWorld, final int aX, final int aY, final int aZ, final Entity aEntity) { + if ((this.mFluid != null) && ((((BaseMetaPipeEntity) this.getBaseMetaTileEntity()).mConnections & -128) == 0) && (aEntity instanceof EntityLivingBase)) { + final int tTemperature = this.mFluid.getFluid().getTemperature(this.mFluid); if (tTemperature > 320) { GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, (tTemperature - 300) / 50.0F); } else if (tTemperature < 260) { @@ -142,217 +145,241 @@ public class GregtechMetaPipeEntityFluid extends MetaPipeEntity { } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { + public AxisAlignedBB getCollisionBoundingBoxFromPool(final World aWorld, final int aX, final int aY, final int aZ) { return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D); } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide() && aTick % 5 == 0) { - mLastReceivedFrom &= 63; - if (mLastReceivedFrom == 63) { - mLastReceivedFrom = 0; + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + if (aBaseMetaTileEntity.isServerSide() && ((aTick % 5) == 0)) { + this.mLastReceivedFrom &= 63; + if (this.mLastReceivedFrom == 63) { + this.mLastReceivedFrom = 0; } - if (mFluid != null && mFluid.amount > 0) { - int tTemperature = mFluid.getFluid().getTemperature(mFluid); - if (tTemperature > mHeatResistance) { + if ((this.mFluid != null) && (this.mFluid.amount > 0)) { + final int tTemperature = this.mFluid.getFluid().getTemperature(this.mFluid); + if (tTemperature > this.mHeatResistance) { if (aBaseMetaTileEntity.getRandomNumber(100) == 0) { aBaseMetaTileEntity.setToFire(); return; } aBaseMetaTileEntity.setOnFire(); } - if (!mGasProof && mFluid.getFluid().isGaseous(mFluid)) { - mFluid.amount -= 5; - sendSound((byte) 9); + if (!this.mGasProof && this.mFluid.getFluid().isGaseous(this.mFluid)) { + this.mFluid.amount -= 5; + this.sendSound((byte) 9); if (tTemperature > 320) { try { - for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(getBaseMetaTileEntity().getXCoord() - 2, getBaseMetaTileEntity().getYCoord() - 2, getBaseMetaTileEntity().getZCoord() - 2, getBaseMetaTileEntity().getXCoord() + 3, getBaseMetaTileEntity().getYCoord() + 3, getBaseMetaTileEntity().getZCoord() + 3))) { + for (final EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) this.getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.getBaseMetaTileEntity().getXCoord() - 2, this.getBaseMetaTileEntity().getYCoord() - 2, this.getBaseMetaTileEntity().getZCoord() - 2, this.getBaseMetaTileEntity().getXCoord() + 3, this.getBaseMetaTileEntity().getYCoord() + 3, this.getBaseMetaTileEntity().getZCoord() + 3))) { GT_Utility.applyHeatDamage(tLiving, (tTemperature - 300) / 25.0F); } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (final Throwable e) { + if (D1) { + e.printStackTrace(GT_Log.err); + } } } else if (tTemperature < 260) { try { - for (EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(getBaseMetaTileEntity().getXCoord() - 2, getBaseMetaTileEntity().getYCoord() - 2, getBaseMetaTileEntity().getZCoord() - 2, getBaseMetaTileEntity().getXCoord() + 3, getBaseMetaTileEntity().getYCoord() + 3, getBaseMetaTileEntity().getZCoord() + 3))) { + for (final EntityLivingBase tLiving : (ArrayList<EntityLivingBase>) this.getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.getBaseMetaTileEntity().getXCoord() - 2, this.getBaseMetaTileEntity().getYCoord() - 2, this.getBaseMetaTileEntity().getZCoord() - 2, this.getBaseMetaTileEntity().getXCoord() + 3, this.getBaseMetaTileEntity().getYCoord() + 3, this.getBaseMetaTileEntity().getZCoord() + 3))) { GT_Utility.applyFrostDamage(tLiving, (270 - tTemperature) / 12.5F); } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (final Throwable e) { + if (D1) { + e.printStackTrace(GT_Log.err); + } } } - if (mFluid.amount <= 0) mFluid = null; + if (this.mFluid.amount <= 0) { + this.mFluid = null; + } } } - if (mLastReceivedFrom == oLastReceivedFrom) { - HashMap<IFluidHandler, ForgeDirection> tTanks = new HashMap<IFluidHandler, ForgeDirection>(); + if (this.mLastReceivedFrom == this.oLastReceivedFrom) { + final HashMap<IFluidHandler, ForgeDirection> tTanks = new HashMap<>(); - mConnections = 0; + this.mConnections = 0; for (byte tSide = 0, i = 0, j = (byte) aBaseMetaTileEntity.getRandomNumber(6); i < 6; i++) { tSide = (byte) ((j + i) % 6); - IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(tSide); + final IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(tSide); if (tTileEntity != null) { if (tTileEntity instanceof IGregTechTileEntity) { if (aBaseMetaTileEntity.getColorization() >= 0) { - byte tColor = ((IGregTechTileEntity) tTileEntity).getColorization(); - if (tColor >= 0 && (tColor & 15) != (aBaseMetaTileEntity.getColorization() & 15)) { + final byte tColor = ((IGregTechTileEntity) tTileEntity).getColorization(); + if ((tColor >= 0) && ((tColor & 15) != (aBaseMetaTileEntity.getColorization() & 15))) { continue; } } } - FluidTankInfo[] tInfo = tTileEntity.getTankInfo(ForgeDirection.getOrientation(tSide).getOpposite()); - if (tInfo != null && tInfo.length > 0) { - if (tTileEntity instanceof ICoverable && ((ICoverable) tTileEntity).getCoverBehaviorAtSide(GT_Utility.getOppositeSide(tSide)).alwaysLookConnected(GT_Utility.getOppositeSide(tSide), ((ICoverable) tTileEntity).getCoverIDAtSide(GT_Utility.getOppositeSide(tSide)), ((ICoverable) tTileEntity).getCoverDataAtSide(GT_Utility.getOppositeSide(tSide)), ((ICoverable) tTileEntity))) { - mConnections |= (1 << tSide); + final FluidTankInfo[] tInfo = tTileEntity.getTankInfo(ForgeDirection.getOrientation(tSide).getOpposite()); + if ((tInfo != null) && (tInfo.length > 0)) { + if ((tTileEntity instanceof ICoverable) && ((ICoverable) tTileEntity).getCoverBehaviorAtSide(GT_Utility.getOppositeSide(tSide)).alwaysLookConnected(GT_Utility.getOppositeSide(tSide), ((ICoverable) tTileEntity).getCoverIDAtSide(GT_Utility.getOppositeSide(tSide)), ((ICoverable) tTileEntity).getCoverDataAtSide(GT_Utility.getOppositeSide(tSide)), ((ICoverable) tTileEntity))) { + this.mConnections |= (1 << tSide); } if (aBaseMetaTileEntity.getCoverBehaviorAtSide(tSide).letsFluidIn(tSide, aBaseMetaTileEntity.getCoverIDAtSide(tSide), aBaseMetaTileEntity.getCoverDataAtSide(tSide), null, aBaseMetaTileEntity)) { - mConnections |= (1 << tSide); + this.mConnections |= (1 << tSide); } if (aBaseMetaTileEntity.getCoverBehaviorAtSide(tSide).letsFluidOut(tSide, aBaseMetaTileEntity.getCoverIDAtSide(tSide), aBaseMetaTileEntity.getCoverDataAtSide(tSide), null, aBaseMetaTileEntity)) { - mConnections |= (1 << tSide); - if (((1 << tSide) & mLastReceivedFrom) == 0) + this.mConnections |= (1 << tSide); + if (((1 << tSide) & this.mLastReceivedFrom) == 0) { tTanks.put(tTileEntity, ForgeDirection.getOrientation(tSide).getOpposite()); + } } if (aBaseMetaTileEntity.getCoverBehaviorAtSide(tSide).alwaysLookConnected(tSide, aBaseMetaTileEntity.getCoverIDAtSide(tSide), aBaseMetaTileEntity.getCoverDataAtSide(tSide), aBaseMetaTileEntity)) { - mConnections |= (1 << tSide); + this.mConnections |= (1 << tSide); } } } } - if (mFluid != null && mFluid.amount > 0) { - int tAmount = Math.max(1, Math.min(mCapacity * 10, mFluid.amount / 2)), tSuccessfulTankAmount = 0; + if ((this.mFluid != null) && (this.mFluid.amount > 0)) { + int tAmount = Math.max(1, Math.min(this.mCapacity * 10, this.mFluid.amount / 2)), tSuccessfulTankAmount = 0; - for (Entry<IFluidHandler, ForgeDirection> tEntry : tTanks.entrySet()) - if (tEntry.getKey().fill(tEntry.getValue(), drain(tAmount, false), false) > 0) + for (final Entry<IFluidHandler, ForgeDirection> tEntry : tTanks.entrySet()) { + if (tEntry.getKey().fill(tEntry.getValue(), this.drain(tAmount, false), false) > 0) { tSuccessfulTankAmount++; + } + } if (tSuccessfulTankAmount > 0) { if (tAmount >= tSuccessfulTankAmount) { tAmount /= tSuccessfulTankAmount; - for (Entry<IFluidHandler, ForgeDirection> tTileEntity : tTanks.entrySet()) { - if (mFluid == null || mFluid.amount <= 0) break; - int tFilledAmount = tTileEntity.getKey().fill(tTileEntity.getValue(), drain(tAmount, false), false); - if (tFilledAmount > 0) - tTileEntity.getKey().fill(tTileEntity.getValue(), drain(tFilledAmount, true), true); + for (final Entry<IFluidHandler, ForgeDirection> tTileEntity : tTanks.entrySet()) { + if ((this.mFluid == null) || (this.mFluid.amount <= 0)) { + break; + } + final int tFilledAmount = tTileEntity.getKey().fill(tTileEntity.getValue(), this.drain(tAmount, false), false); + if (tFilledAmount > 0) { + tTileEntity.getKey().fill(tTileEntity.getValue(), this.drain(tFilledAmount, true), true); + } } } else { - for (Entry<IFluidHandler, ForgeDirection> tTileEntity : tTanks.entrySet()) { - if (mFluid == null || mFluid.amount <= 0) break; - int tFilledAmount = tTileEntity.getKey().fill(tTileEntity.getValue(), drain(mFluid.amount, false), false); - if (tFilledAmount > 0) - tTileEntity.getKey().fill(tTileEntity.getValue(), drain(tFilledAmount, true), true); + for (final Entry<IFluidHandler, ForgeDirection> tTileEntity : tTanks.entrySet()) { + if ((this.mFluid == null) || (this.mFluid.amount <= 0)) { + break; + } + final int tFilledAmount = tTileEntity.getKey().fill(tTileEntity.getValue(), this.drain(this.mFluid.amount, false), false); + if (tFilledAmount > 0) { + tTileEntity.getKey().fill(tTileEntity.getValue(), this.drain(tFilledAmount, true), true); + } } } } } - mLastReceivedFrom = 0; + this.mLastReceivedFrom = 0; } - oLastReceivedFrom = mLastReceivedFrom; + this.oLastReceivedFrom = this.mLastReceivedFrom; } } @Override - public void doSound(byte aIndex, double aX, double aY, double aZ) { + public void doSound(final byte aIndex, final double aX, final double aY, final double aZ) { super.doSound(aIndex, aX, aY, aZ); if (aIndex == 9) { GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 5, 1.0F, aX, aY, aZ); - for (byte i = 0; i < 6; i++) - for (int l = 0; l < 2; ++l) - getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5 + Math.random(), aY - 0.5 + Math.random(), aZ - 0.5 + Math.random(), ForgeDirection.getOrientation(i).offsetX / 5.0, ForgeDirection.getOrientation(i).offsetY / 5.0, ForgeDirection.getOrientation(i).offsetZ / 5.0); + for (byte i = 0; i < 6; i++) { + for (int l = 0; l < 2; ++l) { + this.getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", (aX - 0.5) + Math.random(), (aY - 0.5) + Math.random(), (aZ - 0.5) + Math.random(), ForgeDirection.getOrientation(i).offsetX / 5.0, ForgeDirection.getOrientation(i).offsetY / 5.0, ForgeDirection.getOrientation(i).offsetZ / 5.0); + } + } } } @Override public final int getCapacity() { - return mCapacity * 20; + return this.mCapacity * 20; } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override public final FluidStack getFluid() { - return mFluid; + return this.mFluid; } @Override public final int getFluidAmount() { - return mFluid != null ? mFluid.amount : 0; + return this.mFluid != null ? this.mFluid.amount : 0; } @Override - public final int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - if (aFluid == null || aFluid.getFluid().getID() <= 0) return 0; + public final int fill_default(final ForgeDirection aSide, final FluidStack aFluid, final boolean doFill) { + if ((aFluid == null) || (aFluid.getFluid().getID() <= 0)) { + return 0; + } - if (mFluid == null || mFluid.getFluid().getID() <= 0) { - if (aFluid.amount <= getCapacity()) { + if ((this.mFluid == null) || (this.mFluid.getFluid().getID() <= 0)) { + if (aFluid.amount <= this.getCapacity()) { if (doFill) { - mFluid = aFluid.copy(); - mLastReceivedFrom |= (1 << aSide.ordinal()); + this.mFluid = aFluid.copy(); + this.mLastReceivedFrom |= (1 << aSide.ordinal()); } return aFluid.amount; } if (doFill) { - mFluid = aFluid.copy(); - mLastReceivedFrom |= (1 << aSide.ordinal()); - mFluid.amount = getCapacity(); + this.mFluid = aFluid.copy(); + this.mLastReceivedFrom |= (1 << aSide.ordinal()); + this.mFluid.amount = this.getCapacity(); } - return getCapacity(); + return this.getCapacity(); } - if (!mFluid.isFluidEqual(aFluid)) return 0; + if (!this.mFluid.isFluidEqual(aFluid)) { + return 0; + } - int space = getCapacity() - mFluid.amount; + final int space = this.getCapacity() - this.mFluid.amount; if (aFluid.amount <= space) { if (doFill) { - mFluid.amount += aFluid.amount; - mLastReceivedFrom |= (1 << aSide.ordinal()); + this.mFluid.amount += aFluid.amount; + this.mLastReceivedFrom |= (1 << aSide.ordinal()); } return aFluid.amount; } if (doFill) { - mFluid.amount = getCapacity(); - mLastReceivedFrom |= (1 << aSide.ordinal()); + this.mFluid.amount = this.getCapacity(); + this.mLastReceivedFrom |= (1 << aSide.ordinal()); } return space; } @Override - public final FluidStack drain(int maxDrain, boolean doDrain) { - if (mFluid == null) return null; - if (mFluid.amount <= 0) { - mFluid = null; + public final FluidStack drain(final int maxDrain, final boolean doDrain) { + if (this.mFluid == null) { + return null; + } + if (this.mFluid.amount <= 0) { + this.mFluid = null; return null; } int used = maxDrain; - if (mFluid.amount < used) - used = mFluid.amount; + if (this.mFluid.amount < used) { + used = this.mFluid.amount; + } if (doDrain) { - mFluid.amount -= used; + this.mFluid.amount -= used; } - FluidStack drained = mFluid.copy(); + final FluidStack drained = this.mFluid.copy(); drained.amount = used; - if (mFluid.amount <= 0) { - mFluid = null; + if (this.mFluid.amount <= 0) { + this.mFluid = null; } return drained; @@ -360,21 +387,21 @@ public class GregtechMetaPipeEntityFluid extends MetaPipeEntity { @Override public int getTankPressure() { - return (mFluid == null ? 0 : mFluid.amount) - (getCapacity() / 2); + return (this.mFluid == null ? 0 : this.mFluid.amount) - (this.getCapacity() / 2); } @Override public String[] getDescription() { return new String[]{ - EnumChatFormatting.BLUE + "Fluid Capacity: " + (mCapacity * 20) + "L/sec" + EnumChatFormatting.GRAY, - EnumChatFormatting.RED + "Heat Limit: " + mHeatResistance + " K" + EnumChatFormatting.GRAY, - EnumChatFormatting.DARK_GREEN + "Gas Proof: " + (mGasProof) + EnumChatFormatting.GRAY, + EnumChatFormatting.BLUE + "Fluid Capacity: " + (this.mCapacity * 20) + "L/sec" + EnumChatFormatting.GRAY, + EnumChatFormatting.RED + "Heat Limit: " + this.mHeatResistance + " K" + EnumChatFormatting.GRAY, + EnumChatFormatting.DARK_GREEN + "Gas Proof: " + (this.mGasProof) + EnumChatFormatting.GRAY, CORE.GT_Tooltip }; } @Override public float getThickNess() { - return mThickNess; + return this.mThickNess; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java index 802687dd88..b349e81c3f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java @@ -1,6 +1,11 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.VN; + +import java.util.ArrayList; +import java.util.Arrays; + +import cofh.energy.IEnergyReceiver; import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; @@ -13,10 +18,6 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; import ic2.api.energy.tile.IEnergySink; - -import java.util.ArrayList; -import java.util.Arrays; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.tileentity.TileEntity; @@ -24,7 +25,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import cofh.energy.IEnergyReceiver; public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implements IMetaTileEntityCable { @@ -33,171 +33,201 @@ public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implem public final long mCableLossPerMeter, mAmperage, mVoltage; public final boolean mInsulated, mCanShock; - public GregtechMetaPipeEntity_Cable(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { + public GregtechMetaPipeEntity_Cable(final int aID, final String aName, final String aNameRegional, final float aThickNess, final Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock) { super(aID, aName, aNameRegional, 0, aMaterial, aCableLossPerMeter, aAmperage, aVoltage, aInsulated, aCanShock); - mThickNess = aThickNess; - mMaterial = aMaterial; - mAmperage = aAmperage; - mVoltage = aVoltage; - mInsulated = aInsulated; - mCanShock = aCanShock; - mCableLossPerMeter = aCableLossPerMeter; + this.mThickNess = aThickNess; + this.mMaterial = aMaterial; + this.mAmperage = aAmperage; + this.mVoltage = aVoltage; + this.mInsulated = aInsulated; + this.mCanShock = aCanShock; + this.mCableLossPerMeter = aCableLossPerMeter; } - public GregtechMetaPipeEntity_Cable(String aName, float aThickNess, Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { + public GregtechMetaPipeEntity_Cable(final String aName, final float aThickNess, final Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock) { super(aName, 0, aMaterial, aCableLossPerMeter, aAmperage, aVoltage, aInsulated, aCanShock); - mThickNess = aThickNess; - mMaterial = aMaterial; - mAmperage = aAmperage; - mVoltage = aVoltage; - mInsulated = aInsulated; - mCanShock = aCanShock; - mCableLossPerMeter = aCableLossPerMeter; + this.mThickNess = aThickNess; + this.mMaterial = aMaterial; + this.mAmperage = aAmperage; + this.mVoltage = aVoltage; + this.mInsulated = aInsulated; + this.mCanShock = aCanShock; + this.mCableLossPerMeter = aCableLossPerMeter; } @Override public byte getTileEntityBaseType() { - return (byte)(mInsulated?9:8); + return (byte)(this.mInsulated?9:8); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaPipeEntity_Cable(mName, mThickNess, mMaterial, mCableLossPerMeter, mAmperage, mVoltage, mInsulated, mCanShock); + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaPipeEntity_Cable(this.mName, this.mThickNess, this.mMaterial, this.mCableLossPerMeter, this.mAmperage, this.mVoltage, this.mInsulated, this.mCanShock); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { - if (!mInsulated) return new ITexture[] {new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa)}; + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aConnections, final byte aColorIndex, final boolean aConnected, final boolean aRedstone) { + if (!this.mInsulated) { + return new ITexture[] {new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa)}; + } if (aConnected) { - float tThickNess = getThickNess(); - if (tThickNess < 0.37F) return new ITexture[] {new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.49F) return new ITexture[] {new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.74F) return new ITexture[] {new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.99F) return new ITexture[] {new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - return new ITexture[] {new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + final float tThickNess = this.getThickNess(); + if (tThickNess < 0.37F) { + return new ITexture[] {new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + } + if (tThickNess < 0.49F) { + return new ITexture[] {new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + } + if (tThickNess < 0.74F) { + return new ITexture[] {new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + } + if (tThickNess < 0.99F) { + return new ITexture[] {new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + } + return new ITexture[] {new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; } return new ITexture[] {new GT_RenderedTexture(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; } @Override - public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) { - if (mCanShock && (((BaseMetaPipeEntity)getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase) GT_Utility.applyElectricityDamage((EntityLivingBase)aEntity, mTransferredVoltageLast20, mTransferredAmperageLast20); + public void onEntityCollidedWithBlock(final World aWorld, final int aX, final int aY, final int aZ, final Entity aEntity) { + if (this.mCanShock && ((((BaseMetaPipeEntity)this.getBaseMetaTileEntity()).mConnections & -128) == 0) && (aEntity instanceof EntityLivingBase)) { + GT_Utility.applyElectricityDamage((EntityLivingBase)aEntity, this.mTransferredVoltageLast20, this.mTransferredAmperageLast20); + } } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - if (!mCanShock) return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + public AxisAlignedBB getCollisionBoundingBoxFromPool(final World aWorld, final int aX, final int aY, final int aZ) { + if (!this.mCanShock) { + return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + } return AxisAlignedBB.getBoundingBox(aX+0.125D, aY+0.125D, aZ+0.125D, aX+0.875D, aY+0.875D, aZ+0.875D); } - + @Override public boolean isSimpleMachine() {return true;} - @Override public boolean isFacingValid(byte aFacing) {return false;} - @Override public boolean isValidSlot(int aIndex) {return true;} - // @Override public final boolean renderInside(byte aSide) {return false;} - @Override public int getProgresstime() {return (int)mTransferredAmperage*64;} - @Override public int maxProgresstime() {return (int)mAmperage*64;} + @Override public boolean isFacingValid(final byte aFacing) {return false;} + @Override public boolean isValidSlot(final int aIndex) {return true;} + // @Override public final boolean renderInside(byte aSide) {return false;} + @Override public int getProgresstime() {return (int)this.mTransferredAmperage*64;} + @Override public int maxProgresstime() {return (int)this.mAmperage*64;} @Override - public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (!getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity())) return 0; - return transferElectricity(aSide, aVoltage, aAmperage, new ArrayList<TileEntity>(Arrays.asList((TileEntity)getBaseMetaTileEntity()))); + public long injectEnergyUnits(final byte aSide, final long aVoltage, final long aAmperage) { + if (!this.getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, this.getBaseMetaTileEntity().getCoverIDAtSide(aSide), this.getBaseMetaTileEntity().getCoverDataAtSide(aSide), this.getBaseMetaTileEntity())) { + return 0; + } + return this.transferElectricity(aSide, aVoltage, aAmperage, new ArrayList<>(Arrays.asList((TileEntity)this.getBaseMetaTileEntity()))); } @Override - public long transferElectricity(byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList) { + public long transferElectricity(final byte aSide, long aVoltage, final long aAmperage, final ArrayList<TileEntity> aAlreadyPassedTileEntityList) { long rUsedAmperes = 0; - aVoltage -= mCableLossPerMeter; - if (aVoltage > 0) for (byte i = 0; i < 6 && aAmperage > rUsedAmperes; i++) if (i != aSide && (mConnections & (1<<i)) != 0 && getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i, getBaseMetaTileEntity().getCoverIDAtSide(i), getBaseMetaTileEntity().getCoverDataAtSide(i), getBaseMetaTileEntity())) { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(i); - if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) { - aAlreadyPassedTileEntityList.add(tTileEntity); - if (tTileEntity instanceof IEnergyConnected) { - if (getBaseMetaTileEntity().getColorization() >= 0) { - byte tColor = ((IEnergyConnected)tTileEntity).getColorization(); - if (tColor >= 0 && tColor != getBaseMetaTileEntity().getColorization()) continue; - } - if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity)tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable && ((IGregTechTileEntity)tTileEntity).getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i)).letsEnergyIn(GT_Utility.getOppositeSide(i), ((IGregTechTileEntity)tTileEntity).getCoverIDAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity)tTileEntity).getCoverDataAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity)tTileEntity))) { - if (((IGregTechTileEntity)tTileEntity).getTimer() > 50) rUsedAmperes += ((IMetaTileEntityCable)((IGregTechTileEntity)tTileEntity).getMetaTileEntity()).transferElectricity(GT_Utility.getOppositeSide(i), aVoltage, aAmperage-rUsedAmperes, aAlreadyPassedTileEntityList); - } else { - rUsedAmperes += ((IEnergyConnected)tTileEntity).injectEnergyUnits(GT_Utility.getOppositeSide(i), aVoltage, aAmperage-rUsedAmperes); - } - // } else if (tTileEntity instanceof IEnergySink) { - // ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); - // if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)getBaseMetaTileEntity(), tDirection)) { - // if (((IEnergySink)tTileEntity).demandedEnergyUnits() > 0 && ((IEnergySink)tTileEntity).injectEnergyUnits(tDirection, aVoltage) < aVoltage) rUsedAmperes++; - // } - } else if (tTileEntity instanceof IEnergySink) { - ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); - if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)getBaseMetaTileEntity(), tDirection)) { - if (((IEnergySink)tTileEntity).getDemandedEnergy() > 0 && ((IEnergySink)tTileEntity).injectEnergy(tDirection, aVoltage, aVoltage) < aVoltage) rUsedAmperes++; - } - } else if(GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver){ - ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); - int rfOut = (int) (aVoltage * GregTech_API.mEUtoRF / 100); - if(((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, true)==rfOut){ - ((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, false); rUsedAmperes++; - }else if(((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, true)>0){ - if(mRestRF==0){ - int RFtrans = ((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, (int) rfOut, false);rUsedAmperes++; - mRestRF = rfOut - RFtrans; - }else{ - int RFtrans = ((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, (int) mRestRF, false); - mRestRF = mRestRF - RFtrans; + aVoltage -= this.mCableLossPerMeter; + if (aVoltage > 0) { + for (byte i = 0; (i < 6) && (aAmperage > rUsedAmperes); i++) { + if ((i != aSide) && ((this.mConnections & (1<<i)) != 0) && this.getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i, this.getBaseMetaTileEntity().getCoverIDAtSide(i), this.getBaseMetaTileEntity().getCoverDataAtSide(i), this.getBaseMetaTileEntity())) { + final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(i); + if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) { + aAlreadyPassedTileEntityList.add(tTileEntity); + if (tTileEntity instanceof IEnergyConnected) { + if (this.getBaseMetaTileEntity().getColorization() >= 0) { + final byte tColor = ((IEnergyConnected)tTileEntity).getColorization(); + if ((tColor >= 0) && (tColor != this.getBaseMetaTileEntity().getColorization())) { + continue; + } + } + if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity)tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable) && ((IGregTechTileEntity)tTileEntity).getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i)).letsEnergyIn(GT_Utility.getOppositeSide(i), ((IGregTechTileEntity)tTileEntity).getCoverIDAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity)tTileEntity).getCoverDataAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity)tTileEntity))) { + if (((IGregTechTileEntity)tTileEntity).getTimer() > 50) { + rUsedAmperes += ((IMetaTileEntityCable)((IGregTechTileEntity)tTileEntity).getMetaTileEntity()).transferElectricity(GT_Utility.getOppositeSide(i), aVoltage, aAmperage-rUsedAmperes, aAlreadyPassedTileEntityList); + } + } else { + rUsedAmperes += ((IEnergyConnected)tTileEntity).injectEnergyUnits(GT_Utility.getOppositeSide(i), aVoltage, aAmperage-rUsedAmperes); + } + // } else if (tTileEntity instanceof IEnergySink) { + // ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); + // if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)getBaseMetaTileEntity(), tDirection)) { + // if (((IEnergySink)tTileEntity).demandedEnergyUnits() > 0 && ((IEnergySink)tTileEntity).injectEnergyUnits(tDirection, aVoltage) < aVoltage) rUsedAmperes++; + // } + } else if (tTileEntity instanceof IEnergySink) { + final ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); + if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)this.getBaseMetaTileEntity(), tDirection)) { + if ((((IEnergySink)tTileEntity).getDemandedEnergy() > 0) && (((IEnergySink)tTileEntity).injectEnergy(tDirection, aVoltage, aVoltage) < aVoltage)) { + rUsedAmperes++; + } + } + } else if(GregTech_API.mOutputRF && (tTileEntity instanceof IEnergyReceiver)){ + final ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); + final int rfOut = (int) ((aVoltage * GregTech_API.mEUtoRF) / 100); + if(((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, true)==rfOut){ + ((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, false); rUsedAmperes++; + }else if(((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, true)>0){ + if(this.mRestRF==0){ + final int RFtrans = ((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, false);rUsedAmperes++; + this.mRestRF = rfOut - RFtrans; + }else{ + final int RFtrans = ((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, (int) this.mRestRF, false); + this.mRestRF = this.mRestRF - RFtrans; + } + } + if(GregTech_API.mRFExplosions && (((IEnergyReceiver)tTileEntity).getMaxEnergyStored(tDirection) < (rfOut * 600))){ + if(rfOut > ((32 * GregTech_API.mEUtoRF) / 100)) { + this.doExplosion(rfOut); + } + } } } - if(GregTech_API.mRFExplosions && ((IEnergyReceiver)tTileEntity).getMaxEnergyStored(tDirection) < rfOut * 600){ - if(rfOut > 32 * GregTech_API.mEUtoRF / 100) this.doExplosion(rfOut); - } } } } - mTransferredAmperage += rUsedAmperes; - mTransferredVoltageLast20 = Math.max(mTransferredVoltageLast20, aVoltage); - mTransferredAmperageLast20 = Math.max(mTransferredAmperageLast20, mTransferredAmperage); - if (aVoltage > mVoltage || mTransferredAmperage > mAmperage) { - getBaseMetaTileEntity().setToFire(); + this.mTransferredAmperage += rUsedAmperes; + this.mTransferredVoltageLast20 = Math.max(this.mTransferredVoltageLast20, aVoltage); + this.mTransferredAmperageLast20 = Math.max(this.mTransferredAmperageLast20, this.mTransferredAmperage); + if ((aVoltage > this.mVoltage) || (this.mTransferredAmperage > this.mAmperage)) { + this.getBaseMetaTileEntity().setToFire(); return aAmperage; } return rUsedAmperes; } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { if (aBaseMetaTileEntity.isServerSide()) { - mTransferredAmperage = 0; + this.mTransferredAmperage = 0; - if (aTick % 20 == 0) { - mTransferredVoltageLast20 = 0; - mTransferredAmperageLast20 = 0; - mConnections = 0; + if ((aTick % 20) == 0) { + this.mTransferredVoltageLast20 = 0; + this.mTransferredAmperageLast20 = 0; + this.mConnections = 0; for (byte i = 0, j = 0; i < 6; i++) { j = GT_Utility.getOppositeSide(i); if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity) || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyIn(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity) || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyOut(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity)) { - TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); + final TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); if (tTileEntity instanceof IColoredTileEntity) { if (aBaseMetaTileEntity.getColorization() >= 0) { - byte tColor = ((IColoredTileEntity)tTileEntity).getColorization(); - if (tColor >= 0 && tColor != aBaseMetaTileEntity.getColorization()) continue; + final byte tColor = ((IColoredTileEntity)tTileEntity).getColorization(); + if ((tColor >= 0) && (tColor != aBaseMetaTileEntity.getColorization())) { + continue; + } } } - if (tTileEntity instanceof IEnergyConnected && (((IEnergyConnected)tTileEntity).inputEnergyFrom(j) || ((IEnergyConnected)tTileEntity).outputsEnergyTo(j))) { - mConnections |= (1<<i); + if ((tTileEntity instanceof IEnergyConnected) && (((IEnergyConnected)tTileEntity).inputEnergyFrom(j) || ((IEnergyConnected)tTileEntity).outputsEnergyTo(j))) { + this.mConnections |= (1<<i); continue; } - if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity)tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable) { + if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity)tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable)) { if (((IGregTechTileEntity)tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j, ((IGregTechTileEntity)tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity)tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity)tTileEntity)) || ((IGregTechTileEntity)tTileEntity).getCoverBehaviorAtSide(j).letsEnergyIn(j, ((IGregTechTileEntity)tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity)tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity)tTileEntity)) || ((IGregTechTileEntity)tTileEntity).getCoverBehaviorAtSide(j).letsEnergyOut(j, ((IGregTechTileEntity)tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity)tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity)tTileEntity))) { - mConnections |= (1<<i); + this.mConnections |= (1<<i); continue; } } - if (tTileEntity instanceof IEnergySink && ((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) { - mConnections |= (1<<i); + if ((tTileEntity instanceof IEnergySink) && ((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) { + this.mConnections |= (1<<i); + continue; + } + if(GregTech_API.mOutputRF && (tTileEntity instanceof IEnergyReceiver) && ((IEnergyReceiver)tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(j))){ + this.mConnections |= (1<<i); continue; } - if(GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver && ((IEnergyReceiver)tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(j))){ - mConnections |= (1<<i); - continue; - } /* if (tTileEntity instanceof IEnergyEmitter && ((IEnergyEmitter)tTileEntity).emitsEnergyTo((TileEntity)aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) { mConnections |= (1<<i); @@ -213,9 +243,9 @@ public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implem @Override public String[] getDescription() { return new String[] { - "Max Voltage: " + EnumChatFormatting.GREEN + mVoltage + " (" + VN[GT_Utility.getTier(mVoltage)] + ")" + EnumChatFormatting.GRAY, - "Max Amperage: " + EnumChatFormatting.YELLOW + mAmperage + EnumChatFormatting.GRAY, - "Loss/Meter/Ampere: " + EnumChatFormatting.RED + mCableLossPerMeter + EnumChatFormatting.GRAY + " EU-Volt", + "Max Voltage: " + EnumChatFormatting.GREEN + this.mVoltage + " (" + VN[GT_Utility.getTier(this.mVoltage)] + ")" + EnumChatFormatting.GRAY, + "Max Amperage: " + EnumChatFormatting.YELLOW + this.mAmperage + EnumChatFormatting.GRAY, + "Loss/Meter/Ampere: " + EnumChatFormatting.RED + this.mCableLossPerMeter + EnumChatFormatting.GRAY + " EU-Volt", CORE.GT_Tooltip }; } @@ -223,7 +253,7 @@ public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implem @Override public float getThickNess() { - return mThickNess; + return this.mThickNess; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_SuperConductor.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_SuperConductor.java index 5333b1ae24..b6f798c57a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_SuperConductor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_SuperConductor.java @@ -1,6 +1,11 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.VN; + +import java.util.ArrayList; +import java.util.Arrays; + +import cofh.energy.IEnergyReceiver; import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; @@ -14,10 +19,6 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaPipeEntityBase_Cable; import ic2.api.energy.tile.IEnergySink; - -import java.util.ArrayList; -import java.util.Arrays; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.tileentity.TileEntity; @@ -25,180 +26,209 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import cofh.energy.IEnergyReceiver; public class GregtechMetaPipeEntity_SuperConductor extends GregtechMetaPipeEntityBase_Cable implements IMetaTileEntityCable { - + public final float mThickNess; public final GT_Materials mMaterial; public final long mCableLossPerMeter, mAmperage, mVoltage; public final boolean mInsulated, mCanShock; - public GregtechMetaPipeEntity_SuperConductor(int aID, String aName, String aNameRegional, float aThickNess, GT_Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { + public GregtechMetaPipeEntity_SuperConductor(final int aID, final String aName, final String aNameRegional, final float aThickNess, final GT_Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock) { super(aID, aName, aNameRegional, 0, aMaterial, 0, aAmperage, aVoltage, aInsulated, aCanShock); - mThickNess = aThickNess; - mMaterial = aMaterial; - mAmperage = aAmperage; - mVoltage = aVoltage; - mInsulated = aInsulated; - mCanShock = aCanShock; - mCableLossPerMeter = 0; + this.mThickNess = aThickNess; + this.mMaterial = aMaterial; + this.mAmperage = aAmperage; + this.mVoltage = aVoltage; + this.mInsulated = aInsulated; + this.mCanShock = aCanShock; + this.mCableLossPerMeter = 0; } - public GregtechMetaPipeEntity_SuperConductor(String aName, float aThickNess, GT_Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { + public GregtechMetaPipeEntity_SuperConductor(final String aName, final float aThickNess, final GT_Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock) { super(aName, 0, aMaterial, 0, aAmperage, aVoltage, aInsulated, aCanShock); - mThickNess = aThickNess; - mMaterial = aMaterial; - mAmperage = aAmperage; - mVoltage = aVoltage; - mInsulated = aInsulated; - mCanShock = aCanShock; - mCableLossPerMeter = 0; + this.mThickNess = aThickNess; + this.mMaterial = aMaterial; + this.mAmperage = aAmperage; + this.mVoltage = aVoltage; + this.mInsulated = aInsulated; + this.mCanShock = aCanShock; + this.mCableLossPerMeter = 0; } @Override public byte getTileEntityBaseType() { - return (byte)(mInsulated?9:8); + return (byte)(this.mInsulated?9:8); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaPipeEntity_SuperConductor(mName, mThickNess, mMaterial, mCableLossPerMeter, mAmperage, mVoltage, mInsulated, mCanShock); + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaPipeEntity_SuperConductor(this.mName, this.mThickNess, this.mMaterial, this.mCableLossPerMeter, this.mAmperage, this.mVoltage, this.mInsulated, this.mCanShock); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { - if (!mInsulated) return new ITexture[] {new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa)}; + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aConnections, final byte aColorIndex, final boolean aConnected, final boolean aRedstone) { + if (!this.mInsulated) { + return new ITexture[] {new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa)}; + } if (aConnected) { - float tThickNess = getThickNess(); - if (tThickNess < 0.37F) return new ITexture[] {new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.49F) return new ITexture[] {new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.74F) return new ITexture[] {new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.99F) return new ITexture[] {new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - return new ITexture[] {new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + final float tThickNess = this.getThickNess(); + if (tThickNess < 0.37F) { + return new ITexture[] {new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + } + if (tThickNess < 0.49F) { + return new ITexture[] {new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + } + if (tThickNess < 0.74F) { + return new ITexture[] {new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + } + if (tThickNess < 0.99F) { + return new ITexture[] {new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + } + return new ITexture[] {new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE , Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; } return new ITexture[] {new GT_RenderedTexture(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; } @Override - public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) { - if (mCanShock && (((BaseMetaPipeEntity)getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase) GT_Utility.applyElectricityDamage((EntityLivingBase)aEntity, mTransferredVoltageLast20, mTransferredAmperageLast20); + public void onEntityCollidedWithBlock(final World aWorld, final int aX, final int aY, final int aZ, final Entity aEntity) { + if (this.mCanShock && ((((BaseMetaPipeEntity)this.getBaseMetaTileEntity()).mConnections & -128) == 0) && (aEntity instanceof EntityLivingBase)) { + GT_Utility.applyElectricityDamage((EntityLivingBase)aEntity, this.mTransferredVoltageLast20, this.mTransferredAmperageLast20); + } } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - if (!mCanShock) return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + public AxisAlignedBB getCollisionBoundingBoxFromPool(final World aWorld, final int aX, final int aY, final int aZ) { + if (!this.mCanShock) { + return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + } return AxisAlignedBB.getBoundingBox(aX+0.125D, aY+0.125D, aZ+0.125D, aX+0.875D, aY+0.875D, aZ+0.875D); } - + @Override public boolean isSimpleMachine() {return true;} - @Override public boolean isFacingValid(byte aFacing) {return false;} - @Override public boolean isValidSlot(int aIndex) {return true;} - // @Override public final boolean renderInside(byte aSide) {return false;} - @Override public int getProgresstime() {return (int)mTransferredAmperage*64;} - @Override public int maxProgresstime() {return (int)mAmperage*64;} + @Override public boolean isFacingValid(final byte aFacing) {return false;} + @Override public boolean isValidSlot(final int aIndex) {return true;} + // @Override public final boolean renderInside(byte aSide) {return false;} + @Override public int getProgresstime() {return (int)this.mTransferredAmperage*64;} + @Override public int maxProgresstime() {return (int)this.mAmperage*64;} @Override - public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (!getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity())) return 0; - return transferElectricity(aSide, aVoltage, aAmperage, new ArrayList<TileEntity>(Arrays.asList((TileEntity)getBaseMetaTileEntity()))); + public long injectEnergyUnits(final byte aSide, final long aVoltage, final long aAmperage) { + if (!this.getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, this.getBaseMetaTileEntity().getCoverIDAtSide(aSide), this.getBaseMetaTileEntity().getCoverDataAtSide(aSide), this.getBaseMetaTileEntity())) { + return 0; + } + return this.transferElectricity(aSide, aVoltage, aAmperage, new ArrayList<>(Arrays.asList((TileEntity)this.getBaseMetaTileEntity()))); } @Override - public long transferElectricity(byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList) { + public long transferElectricity(final byte aSide, long aVoltage, final long aAmperage, final ArrayList<TileEntity> aAlreadyPassedTileEntityList) { long rUsedAmperes = 0; - aVoltage -= mCableLossPerMeter; - if (aVoltage > 0) for (byte i = 0; i < 6 && aAmperage > rUsedAmperes; i++) if (i != aSide && (mConnections & (1<<i)) != 0 && getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i, getBaseMetaTileEntity().getCoverIDAtSide(i), getBaseMetaTileEntity().getCoverDataAtSide(i), getBaseMetaTileEntity())) { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(i); - if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) { - aAlreadyPassedTileEntityList.add(tTileEntity); - if (tTileEntity instanceof IEnergyConnected) { - if (getBaseMetaTileEntity().getColorization() >= 0) { - byte tColor = ((IEnergyConnected)tTileEntity).getColorization(); - if (tColor >= 0 && tColor != getBaseMetaTileEntity().getColorization()) continue; - } - if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity)tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable && ((IGregTechTileEntity)tTileEntity).getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i)).letsEnergyIn(GT_Utility.getOppositeSide(i), ((IGregTechTileEntity)tTileEntity).getCoverIDAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity)tTileEntity).getCoverDataAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity)tTileEntity))) { - if (((IGregTechTileEntity)tTileEntity).getTimer() > 50) rUsedAmperes += ((IMetaTileEntityCable)((IGregTechTileEntity)tTileEntity).getMetaTileEntity()).transferElectricity(GT_Utility.getOppositeSide(i), aVoltage, aAmperage-rUsedAmperes, aAlreadyPassedTileEntityList); - } else { - rUsedAmperes += ((IEnergyConnected)tTileEntity).injectEnergyUnits(GT_Utility.getOppositeSide(i), aVoltage, aAmperage-rUsedAmperes); - } - // } else if (tTileEntity instanceof IEnergySink) { - // ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); - // if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)getBaseMetaTileEntity(), tDirection)) { - // if (((IEnergySink)tTileEntity).demandedEnergyUnits() > 0 && ((IEnergySink)tTileEntity).injectEnergyUnits(tDirection, aVoltage) < aVoltage) rUsedAmperes++; - // } - } else if (tTileEntity instanceof IEnergySink) { - ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); - if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)getBaseMetaTileEntity(), tDirection)) { - if (((IEnergySink)tTileEntity).getDemandedEnergy() > 0 && ((IEnergySink)tTileEntity).injectEnergy(tDirection, aVoltage, aVoltage) < aVoltage) rUsedAmperes++; - } - } else if(GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver){ - ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); - int rfOut = (int) (aVoltage * GregTech_API.mEUtoRF / 100); - if(((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, true)==rfOut){ - ((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, false); rUsedAmperes++; - }else if(((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, true)>0){ - if(mRestRF==0){ - int RFtrans = ((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, (int) rfOut, false);rUsedAmperes++; - mRestRF = rfOut - RFtrans; - }else{ - int RFtrans = ((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, (int) mRestRF, false); - mRestRF = mRestRF - RFtrans; + aVoltage -= this.mCableLossPerMeter; + if (aVoltage > 0) { + for (byte i = 0; (i < 6) && (aAmperage > rUsedAmperes); i++) { + if ((i != aSide) && ((this.mConnections & (1<<i)) != 0) && this.getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i, this.getBaseMetaTileEntity().getCoverIDAtSide(i), this.getBaseMetaTileEntity().getCoverDataAtSide(i), this.getBaseMetaTileEntity())) { + final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(i); + if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) { + aAlreadyPassedTileEntityList.add(tTileEntity); + if (tTileEntity instanceof IEnergyConnected) { + if (this.getBaseMetaTileEntity().getColorization() >= 0) { + final byte tColor = ((IEnergyConnected)tTileEntity).getColorization(); + if ((tColor >= 0) && (tColor != this.getBaseMetaTileEntity().getColorization())) { + continue; + } + } + if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity)tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable) && ((IGregTechTileEntity)tTileEntity).getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i)).letsEnergyIn(GT_Utility.getOppositeSide(i), ((IGregTechTileEntity)tTileEntity).getCoverIDAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity)tTileEntity).getCoverDataAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity)tTileEntity))) { + if (((IGregTechTileEntity)tTileEntity).getTimer() > 50) { + rUsedAmperes += ((IMetaTileEntityCable)((IGregTechTileEntity)tTileEntity).getMetaTileEntity()).transferElectricity(GT_Utility.getOppositeSide(i), aVoltage, aAmperage-rUsedAmperes, aAlreadyPassedTileEntityList); + } + } else { + rUsedAmperes += ((IEnergyConnected)tTileEntity).injectEnergyUnits(GT_Utility.getOppositeSide(i), aVoltage, aAmperage-rUsedAmperes); + } + // } else if (tTileEntity instanceof IEnergySink) { + // ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); + // if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)getBaseMetaTileEntity(), tDirection)) { + // if (((IEnergySink)tTileEntity).demandedEnergyUnits() > 0 && ((IEnergySink)tTileEntity).injectEnergyUnits(tDirection, aVoltage) < aVoltage) rUsedAmperes++; + // } + } else if (tTileEntity instanceof IEnergySink) { + final ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); + if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)this.getBaseMetaTileEntity(), tDirection)) { + if ((((IEnergySink)tTileEntity).getDemandedEnergy() > 0) && (((IEnergySink)tTileEntity).injectEnergy(tDirection, aVoltage, aVoltage) < aVoltage)) { + rUsedAmperes++; + } + } + } else if(GregTech_API.mOutputRF && (tTileEntity instanceof IEnergyReceiver)){ + final ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); + final int rfOut = (int) ((aVoltage * GregTech_API.mEUtoRF) / 100); + if(((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, true)==rfOut){ + ((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, false); rUsedAmperes++; + }else if(((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, true)>0){ + if(this.mRestRF==0){ + final int RFtrans = ((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, false);rUsedAmperes++; + this.mRestRF = rfOut - RFtrans; + }else{ + final int RFtrans = ((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, (int) this.mRestRF, false); + this.mRestRF = this.mRestRF - RFtrans; + } + } + if(GregTech_API.mRFExplosions && (((IEnergyReceiver)tTileEntity).getMaxEnergyStored(tDirection) < (rfOut * 600))){ + if(rfOut > ((32 * GregTech_API.mEUtoRF) / 100)) { + this.doExplosion(rfOut); + } + } } } - if(GregTech_API.mRFExplosions && ((IEnergyReceiver)tTileEntity).getMaxEnergyStored(tDirection) < rfOut * 600){ - if(rfOut > 32 * GregTech_API.mEUtoRF / 100) this.doExplosion(rfOut); - } } } } - mTransferredAmperage += rUsedAmperes; - mTransferredVoltageLast20 = Math.max(mTransferredVoltageLast20, aVoltage); - mTransferredAmperageLast20 = Math.max(mTransferredAmperageLast20, mTransferredAmperage); - if (aVoltage > mVoltage || mTransferredAmperage > mAmperage) { - getBaseMetaTileEntity().setToFire(); + this.mTransferredAmperage += rUsedAmperes; + this.mTransferredVoltageLast20 = Math.max(this.mTransferredVoltageLast20, aVoltage); + this.mTransferredAmperageLast20 = Math.max(this.mTransferredAmperageLast20, this.mTransferredAmperage); + if ((aVoltage > this.mVoltage) || (this.mTransferredAmperage > this.mAmperage)) { + this.getBaseMetaTileEntity().setToFire(); return aAmperage; } return rUsedAmperes; } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { if (aBaseMetaTileEntity.isServerSide()) { - mTransferredAmperage = 0; + this.mTransferredAmperage = 0; - if (aTick % 20 == 0) { - mTransferredVoltageLast20 = 0; - mTransferredAmperageLast20 = 0; - mConnections = 0; + if ((aTick % 20) == 0) { + this.mTransferredVoltageLast20 = 0; + this.mTransferredAmperageLast20 = 0; + this.mConnections = 0; for (byte i = 0, j = 0; i < 6; i++) { j = GT_Utility.getOppositeSide(i); if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity) || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyIn(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity) || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyOut(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity)) { - TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); + final TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); if (tTileEntity instanceof IColoredTileEntity) { if (aBaseMetaTileEntity.getColorization() >= 0) { - byte tColor = ((IColoredTileEntity)tTileEntity).getColorization(); - if (tColor >= 0 && tColor != aBaseMetaTileEntity.getColorization()) continue; + final byte tColor = ((IColoredTileEntity)tTileEntity).getColorization(); + if ((tColor >= 0) && (tColor != aBaseMetaTileEntity.getColorization())) { + continue; + } } } - if (tTileEntity instanceof IEnergyConnected && (((IEnergyConnected)tTileEntity).inputEnergyFrom(j) || ((IEnergyConnected)tTileEntity).outputsEnergyTo(j))) { - mConnections |= (1<<i); + if ((tTileEntity instanceof IEnergyConnected) && (((IEnergyConnected)tTileEntity).inputEnergyFrom(j) || ((IEnergyConnected)tTileEntity).outputsEnergyTo(j))) { + this.mConnections |= (1<<i); continue; } - if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity)tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable) { + if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity)tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable)) { if (((IGregTechTileEntity)tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j, ((IGregTechTileEntity)tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity)tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity)tTileEntity)) || ((IGregTechTileEntity)tTileEntity).getCoverBehaviorAtSide(j).letsEnergyIn(j, ((IGregTechTileEntity)tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity)tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity)tTileEntity)) || ((IGregTechTileEntity)tTileEntity).getCoverBehaviorAtSide(j).letsEnergyOut(j, ((IGregTechTileEntity)tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity)tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity)tTileEntity))) { - mConnections |= (1<<i); + this.mConnections |= (1<<i); continue; } } - if (tTileEntity instanceof IEnergySink && ((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) { - mConnections |= (1<<i); + if ((tTileEntity instanceof IEnergySink) && ((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) { + this.mConnections |= (1<<i); + continue; + } + if(GregTech_API.mOutputRF && (tTileEntity instanceof IEnergyReceiver) && ((IEnergyReceiver)tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(j))){ + this.mConnections |= (1<<i); continue; } - if(GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver && ((IEnergyReceiver)tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(j))){ - mConnections |= (1<<i); - continue; - } /* if (tTileEntity instanceof IEnergyEmitter && ((IEnergyEmitter)tTileEntity).emitsEnergyTo((TileEntity)aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) { mConnections |= (1<<i); @@ -214,9 +244,9 @@ public class GregtechMetaPipeEntity_SuperConductor extends GregtechMetaPipeEntit @Override public String[] getDescription() { return new String[] { - "Max Voltage: " + EnumChatFormatting.GREEN + mVoltage + " (" + VN[GT_Utility.getTier(mVoltage)] + ")" + EnumChatFormatting.GRAY, - "Max Amperage: " + EnumChatFormatting.YELLOW + mAmperage + EnumChatFormatting.GRAY, - "Loss/Meter/Ampere: " + EnumChatFormatting.RED + mCableLossPerMeter + EnumChatFormatting.GRAY + " EU-Volt", + "Max Voltage: " + EnumChatFormatting.GREEN + this.mVoltage + " (" + VN[GT_Utility.getTier(this.mVoltage)] + ")" + EnumChatFormatting.GRAY, + "Max Amperage: " + EnumChatFormatting.YELLOW + this.mAmperage + EnumChatFormatting.GRAY, + "Loss/Meter/Ampere: " + EnumChatFormatting.RED + this.mCableLossPerMeter + EnumChatFormatting.GRAY + " EU-Volt", CORE.GT_Tooltip, " ", "This Wire is Lossless.", @@ -227,7 +257,7 @@ public class GregtechMetaPipeEntity_SuperConductor extends GregtechMetaPipeEntit @Override public float getThickNess() { - return mThickNess; + return this.mThickNess; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaSafeBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaSafeBlock.java index 2dfdd5a8c4..10ba822da9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaSafeBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaSafeBlock.java @@ -12,47 +12,47 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines import net.minecraft.entity.player.InventoryPlayer; public class GregtechMetaSafeBlock - extends GregtechMetaSafeBlockBase { - +extends GregtechMetaSafeBlockBase { + @Override public String[] getDescription() { - return new String[] {mDescription, CORE.GT_Tooltip}; + return new String[] {this.mDescription, CORE.GT_Tooltip}; } - - public GregtechMetaSafeBlock(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 28, "Protecting your items from sticky fingers."); - } - public GregtechMetaSafeBlock(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { - super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); - } + public GregtechMetaSafeBlock(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier, 28, "Protecting your items from sticky fingers."); + } - public GregtechMetaSafeBlock(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } + public GregtechMetaSafeBlock(final int aID, final String aName, final String aNameRegional, final int aTier, final int aInvSlotCount, final String aDescription) { + super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); + } - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaSafeBlock(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); - } + public GregtechMetaSafeBlock(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } - @Override + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaSafeBlock(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); + } + + @Override public ITexture getOverlayIcon() { - return new GT_RenderedTexture(Textures.BlockIcons.VOID); - } - - @Override - public boolean isValidSlot(int aIndex) { - return aIndex < this.mInventory.length - 1; - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_SafeBlock(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_SafeBlock(aPlayerInventory, aBaseMetaTileEntity); - } + return new GT_RenderedTexture(Textures.BlockIcons.VOID); + } + + @Override + public boolean isValidSlot(final int aIndex) { + return aIndex < (this.mInventory.length - 1); + } + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new CONTAINER_SafeBlock(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_SafeBlock(aPlayerInventory, aBaseMetaTileEntity); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaSuperConductorNodeBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaSuperConductorNodeBase.java index d5d0fa1b03..e8cbf4abe2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaSuperConductorNodeBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaSuperConductorNodeBase.java @@ -1,296 +1,316 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; + +import java.util.Collection; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.*; +import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.lossless.GregtechMetaTileEntityLosslessBasicTank; - -import java.util.Collection; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; public abstract class GregtechMetaSuperConductorNodeBase extends GregtechMetaTileEntityLosslessBasicTank { - public GregtechMetaSuperConductorNodeBase(int aID, String aName, String aNameRegional, int aTier, String aDescription, ITexture... aTextures) { - super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); - } - - public GregtechMetaSuperConductorNodeBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = getFront(i); - rTextures[1][i + 1] = getBack(i); - rTextures[2][i + 1] = getBottom(i); - rTextures[3][i + 1] = getTop(i); - rTextures[4][i + 1] = getSides(i); - rTextures[5][i + 1] = getFrontActive(i); - rTextures[6][i + 1] = getBackActive(i); - rTextures[7][i + 1] = getBottomActive(i); - rTextures[8][i + 1] = getTopActive(i); - rTextures[9][i + 1] = getSidesActive(i); - } - return rTextures; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; - } - - @Override - public String[] getDescription() { - return new String[]{mDescription, "Cooling Efficiency: " + getEfficiency() + "%", CORE.GT_Tooltip}; - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - - public ITexture[] getFront(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getBack(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getBottom(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getTop(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getSides(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getFrontActive(byte aColor) { - return getFront(aColor); - } - - public ITexture[] getBackActive(byte aColor) { - return getBack(aColor); - } - - public ITexture[] getBottomActive(byte aColor) { - return getBottom(aColor); - } - - public ITexture[] getTopActive(byte aColor) { - return getTop(aColor); - } - - public ITexture[] getSidesActive(byte aColor) { - return getSides(aColor); - } - - @Override - public boolean isFacingValid(byte aSide) { - return aSide > 1; - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isValidSlot(int aIndex) { - return aIndex < 2; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isEnetOutput() { - return true; - } - - @Override - public boolean isOutputFacing(byte aSide) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public long getMinimumStoredEU() { - return V[mTier] * 16 * mInventory.length; - } - - @Override - public long maxEUStore() { - return V[mTier] * 64; - } - - @Override - public long maxEUInput() { - return V[mTier]; - } - - @Override - public long maxEUOutput() { - return V[mTier]; - } - - @Override - public long maxAmperesIn() { - return 16; - } - - @Override - public long maxAmperesOut() { - return 16; - } - - @Override - public boolean doesFillContainers() { - return getBaseMetaTileEntity().isAllowedToWork(); - } - - @Override - public boolean doesEmptyContainers() { - return getBaseMetaTileEntity().isAllowedToWork(); - } - - @Override - public boolean canTankBeFilled() { - return getBaseMetaTileEntity().isAllowedToWork(); - } - - @Override - public boolean canTankBeEmptied() { - return getBaseMetaTileEntity().isAllowedToWork(); - } - - @Override - public boolean displaysItemStack() { - return true; - } - - @Override - public boolean displaysStackSize() { - return false; - } - - @Override - public boolean isFluidInputAllowed(FluidStack aFluid) { - return getFuelValue(aFluid) > 0; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (getEUVar() == maxEUStore() || mFluid == null){ - aBaseMetaTileEntity.disableWorking(); - } - else { - aBaseMetaTileEntity.enableWorking(); - } - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10 == 0) { - if (mFluid == null) { - if (aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() + getMinimumStoredEU()) { - mInventory[getStackDisplaySlot()] = null; - } else { - if (mInventory[getStackDisplaySlot()] == null) - mInventory[getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); - mInventory[getStackDisplaySlot()].setStackDisplayName("Generating: " + (aBaseMetaTileEntity.getUniversalEnergyStored() - getMinimumStoredEU()) + " EU"); - } - } else { - int tFuelValue = getFuelValue(mFluid), tConsumed = consumedFluidPerOperation(mFluid); - if (tConsumed > 0 && mFluid.amount > tConsumed) { - long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored())); - if (tFluidAmountToUse > 0 /*&& aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)*/) - mFluid.amount -= tFluidAmountToUse * tConsumed; - } - } - if (mInventory[getInputSlot()] != null && aBaseMetaTileEntity.getUniversalEnergyStored() < (maxEUOutput() * 20 + getMinimumStoredEU()) && GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true) == null) { - int tFuelValue = getFuelValue(mInventory[getInputSlot()]); - if (tFuelValue >= 0) { - ItemStack tEmptyContainer = getEmptyContainer(mInventory[getInputSlot()]); - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tEmptyContainer)) { - //aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true); - aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); - } - } - } - } - - if (aBaseMetaTileEntity.isServerSide()) - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); - } - - public abstract GT_Recipe_Map getRecipes(); - - public abstract int getEfficiency(); - - public int consumedFluidPerOperation(FluidStack aLiquid) { - return 1; - } - - public int getFuelValue(FluidStack aLiquid) { - if (aLiquid == null || getRecipes() == null) return 0; - FluidStack tLiquid; - Collection<GT_Recipe> tRecipeList = getRecipes().mRecipeList; - if (tRecipeList != null) for (GT_Recipe tFuel : tRecipeList) - if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null) - if (aLiquid.isFluidEqual(tLiquid)) - return 0; - //return (int) (((long) tFuel.mSpecialValue * getEfficiency() * consumedFluidPerOperation(tLiquid)) / 100); - return 0; - } - - public int getFuelValue(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack) || getRecipes() == null) return 0; - GT_Recipe tFuel = getRecipes().findRecipe(getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); - if (tFuel != null) - return 0; - //return (int) ((tFuel.mSpecialValue * 1000L * getEfficiency()) / 100); - return 0; - } - - public ItemStack getEmptyContainer(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack) || getRecipes() == null) return null; - GT_Recipe tFuel = getRecipes().findRecipe(getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); - if (tFuel != null) return GT_Utility.copy(tFuel.getOutput(0)); - return GT_Utility.getContainerItem(aStack, true); - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (getFuelValue(aStack) > 0 || getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0); - } - - @Override - public int getCapacity() { - return 16000; - } - - @Override - public int getTankPressure() { - return -100; - } - - + public GregtechMetaSuperConductorNodeBase(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final ITexture... aTextures) { + super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); + } + + public GregtechMetaSuperConductorNodeBase(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + @Override + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + final ITexture[][][] rTextures = new ITexture[10][17][]; + for (byte i = -1; i < 16; i++) { + rTextures[0][i + 1] = this.getFront(i); + rTextures[1][i + 1] = this.getBack(i); + rTextures[2][i + 1] = this.getBottom(i); + rTextures[3][i + 1] = this.getTop(i); + rTextures[4][i + 1] = this.getSides(i); + rTextures[5][i + 1] = this.getFrontActive(i); + rTextures[6][i + 1] = this.getBackActive(i); + rTextures[7][i + 1] = this.getBottomActive(i); + rTextures[8][i + 1] = this.getTopActive(i); + rTextures[9][i + 1] = this.getSidesActive(i); + } + return rTextures; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; + } + + @Override + public String[] getDescription() { + return new String[]{this.mDescription, "Cooling Efficiency: " + this.getEfficiency() + "%", CORE.GT_Tooltip}; + } + + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + public ITexture[] getFront(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getBack(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getBottom(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getTop(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getSides(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getFrontActive(final byte aColor) { + return this.getFront(aColor); + } + + public ITexture[] getBackActive(final byte aColor) { + return this.getBack(aColor); + } + + public ITexture[] getBottomActive(final byte aColor) { + return this.getBottom(aColor); + } + + public ITexture[] getTopActive(final byte aColor) { + return this.getTop(aColor); + } + + public ITexture[] getSidesActive(final byte aColor) { + return this.getSides(aColor); + } + + @Override + public boolean isFacingValid(final byte aSide) { + return aSide > 1; + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isValidSlot(final int aIndex) { + return aIndex < 2; + } + + @Override + public boolean isEnetInput() { + return true; + } + + @Override + public boolean isEnetOutput() { + return true; + } + + @Override + public boolean isOutputFacing(final byte aSide) { + return true; + } + + @Override + public boolean isAccessAllowed(final EntityPlayer aPlayer) { + return true; + } + + @Override + public long getMinimumStoredEU() { + return V[this.mTier] * 16 * this.mInventory.length; + } + + @Override + public long maxEUStore() { + return V[this.mTier] * 64; + } + + @Override + public long maxEUInput() { + return V[this.mTier]; + } + + @Override + public long maxEUOutput() { + return V[this.mTier]; + } + + @Override + public long maxAmperesIn() { + return 16; + } + + @Override + public long maxAmperesOut() { + return 16; + } + + @Override + public boolean doesFillContainers() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + @Override + public boolean doesEmptyContainers() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + @Override + public boolean canTankBeFilled() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + @Override + public boolean canTankBeEmptied() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + @Override + public boolean displaysItemStack() { + return true; + } + + @Override + public boolean displaysStackSize() { + return false; + } + + @Override + public boolean isFluidInputAllowed(final FluidStack aFluid) { + return this.getFuelValue(aFluid) > 0; + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + if ((this.getEUVar() == this.maxEUStore()) || (this.mFluid == null)){ + aBaseMetaTileEntity.disableWorking(); + } + else { + aBaseMetaTileEntity.enableWorking(); + } + if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && ((aTick % 10) == 0)) { + if (this.mFluid == null) { + if (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUOutput() + this.getMinimumStoredEU())) { + this.mInventory[this.getStackDisplaySlot()] = null; + } else { + if (this.mInventory[this.getStackDisplaySlot()] == null) { + this.mInventory[this.getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); + } + this.mInventory[this.getStackDisplaySlot()].setStackDisplayName("Generating: " + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + " EU"); + } + } else { + final int tFuelValue = this.getFuelValue(this.mFluid), tConsumed = this.consumedFluidPerOperation(this.mFluid); + if ((tConsumed > 0) && (this.mFluid.amount > tConsumed)) { + final long tFluidAmountToUse = Math.min(this.mFluid.amount / tConsumed, (((this.maxEUOutput() * 20) + this.getMinimumStoredEU()) - aBaseMetaTileEntity.getUniversalEnergyStored())); + if (tFluidAmountToUse > 0 /*&& aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)*/) { + this.mFluid.amount -= tFluidAmountToUse * tConsumed; + } + } + } + if ((this.mInventory[this.getInputSlot()] != null) && (aBaseMetaTileEntity.getUniversalEnergyStored() < ((this.maxEUOutput() * 20) + this.getMinimumStoredEU())) && (GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true) == null)) { + final int tFuelValue = this.getFuelValue(this.mInventory[this.getInputSlot()]); + if (tFuelValue >= 0) { + final ItemStack tEmptyContainer = this.getEmptyContainer(this.mInventory[this.getInputSlot()]); + if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tEmptyContainer)) { + //aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true); + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + } + } + } + } + + if (aBaseMetaTileEntity.isServerSide()) { + aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && (aBaseMetaTileEntity.getUniversalEnergyStored() >= (this.maxEUOutput() + this.getMinimumStoredEU()))); + } + } + + public abstract GT_Recipe_Map getRecipes(); + + public abstract int getEfficiency(); + + public int consumedFluidPerOperation(final FluidStack aLiquid) { + return 1; + } + + public int getFuelValue(final FluidStack aLiquid) { + if ((aLiquid == null) || (this.getRecipes() == null)) { + return 0; + } + FluidStack tLiquid; + final Collection<GT_Recipe> tRecipeList = this.getRecipes().mRecipeList; + if (tRecipeList != null) { + for (final GT_Recipe tFuel : tRecipeList) { + if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null) { + if (aLiquid.isFluidEqual(tLiquid)) { + return 0; + } + } + } + } + //return (int) (((long) tFuel.mSpecialValue * getEfficiency() * consumedFluidPerOperation(tLiquid)) / 100); + return 0; + } + + public int getFuelValue(final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack) || (this.getRecipes() == null)) { + return 0; + } + final GT_Recipe tFuel = this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + if (tFuel != null) { + return 0; + } + //return (int) ((tFuel.mSpecialValue * 1000L * getEfficiency()) / 100); + return 0; + } + + public ItemStack getEmptyContainer(final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack) || (this.getRecipes() == null)) { + return null; + } + final GT_Recipe tFuel = this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + if (tFuel != null) { + return GT_Utility.copy(tFuel.getOutput(0)); + } + return GT_Utility.getContainerItem(aStack, true); + } + + @Override + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && ((this.getFuelValue(aStack) > 0) || (this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0)); + } + + @Override + public int getCapacity() { + return 16000; + } + + @Override + public int getTankPressure() { + return -100; + } + + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java index 8920525da4..8e16b68edd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java @@ -10,45 +10,45 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines import net.minecraft.nbt.NBTTagCompound; public class GregtechMetaTreeFarmerStructural - extends GregtechMetaTreeFarmerBase { - +extends GregtechMetaTreeFarmerBase { + @Override public String[] getDescription() { - return new String[] {mDescription, CORE.GT_Tooltip}; + return new String[] {this.mDescription, CORE.GT_Tooltip}; } - - public GregtechMetaTreeFarmerStructural(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Structural Blocks for the Tree Farmer."); - } - public GregtechMetaTreeFarmerStructural(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { - super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); - } + public GregtechMetaTreeFarmerStructural(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier, 0, "Structural Blocks for the Tree Farmer."); + } - public GregtechMetaTreeFarmerStructural(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } + public GregtechMetaTreeFarmerStructural(final int aID, final String aName, final String aNameRegional, final int aTier, final int aInvSlotCount, final String aDescription) { + super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); + } - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTreeFarmerStructural(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); - } + public GregtechMetaTreeFarmerStructural(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } - @Override + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTreeFarmerStructural(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); + } + + @Override public ITexture getOverlayIcon() { - return new GT_RenderedTexture(Textures.BlockIcons.VOID); - } + return new GT_RenderedTexture(Textures.BlockIcons.VOID); + } - @Override - public boolean isValidSlot(int aIndex) { - return false; - } + @Override + public boolean isValidSlot(final int aIndex) { + return false; + } @Override - public void saveNBTData(NBTTagCompound paramNBTTagCompound) { + public void saveNBTData(final NBTTagCompound paramNBTTagCompound) { } @Override - public void loadNBTData(NBTTagCompound paramNBTTagCompound) { + public void loadNBTData(final NBTTagCompound paramNBTTagCompound) { } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java index 0e7d7f30da..ee58e0f20f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java @@ -1,6 +1,12 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; import static gregtech.api.enums.GT_Values.VN; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; + +import cofh.energy.IEnergyReceiver; import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.*; @@ -17,12 +23,6 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import ic2.api.energy.tile.IEnergySink; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; - -import cofh.energy.IEnergyReceiver; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; @@ -43,93 +43,101 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements public short mOverheat; public final int mWireHeatingTicks; - public GregtechMetaPipeEntityBase_Cable(int aID, String aName, String aNameRegional, float aThickNess, GT_Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { + public GregtechMetaPipeEntityBase_Cable(final int aID, final String aName, final String aNameRegional, final float aThickNess, final GT_Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock) { super(aID, aName, aNameRegional, 0); - mThickNess = aThickNess; - mMaterial = aMaterial; - mAmperage = aAmperage; - mVoltage = aVoltage; - mInsulated = aInsulated; - mCanShock = aCanShock; - mCableLossPerMeter = aCableLossPerMeter; - mWireHeatingTicks = getGT5Var(); + this.mThickNess = aThickNess; + this.mMaterial = aMaterial; + this.mAmperage = aAmperage; + this.mVoltage = aVoltage; + this.mInsulated = aInsulated; + this.mCanShock = aCanShock; + this.mCableLossPerMeter = aCableLossPerMeter; + this.mWireHeatingTicks = this.getGT5Var(); } - public GregtechMetaPipeEntityBase_Cable(String aName, float aThickNess, GT_Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { + public GregtechMetaPipeEntityBase_Cable(final String aName, final float aThickNess, final GT_Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, final boolean aCanShock) { super(aName, 0); - mThickNess = aThickNess; - mMaterial = aMaterial; - mAmperage = aAmperage; - mVoltage = aVoltage; - mInsulated = aInsulated; - mCanShock = aCanShock; - mCableLossPerMeter = aCableLossPerMeter; - mWireHeatingTicks = getGT5Var(); + this.mThickNess = aThickNess; + this.mMaterial = aMaterial; + this.mAmperage = aAmperage; + this.mVoltage = aVoltage; + this.mInsulated = aInsulated; + this.mCanShock = aCanShock; + this.mCableLossPerMeter = aCableLossPerMeter; + this.mWireHeatingTicks = this.getGT5Var(); } - + private int getGT5Var(){ - Class<? extends GT_Proxy> clazz = GT_Mod.gregtechproxy.getClass(); - String lookingForValue = "mWireHeatingTicks"; + final Class<? extends GT_Proxy> clazz = GT_Mod.gregtechproxy.getClass(); + final String lookingForValue = "mWireHeatingTicks"; int temp = 4; Field field; if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - try { - field = clazz.getClass().getField(lookingForValue); - Class<?> clazzType = field.getType(); - if (clazzType.toString().equals("int")){ - temp = (field.getInt(clazz)); - } - else { + try { + field = clazz.getClass().getField(lookingForValue); + final Class<?> clazzType = field.getType(); + if (clazzType.toString().equals("int")){ + temp = (field.getInt(clazz)); + } + else { + temp = 4; + } + } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { + //Utils.LOG_INFO("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); + Utils.LOG_WARNING("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); + Utils.LOG_ERROR("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); temp = 4; } - } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { - //Utils.LOG_INFO("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); - Utils.LOG_WARNING("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); - Utils.LOG_ERROR("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); - temp = 4; - } } return temp; } @Override public byte getTileEntityBaseType() { - return (byte) (mInsulated ? 9 : 8); + return (byte) (this.mInsulated ? 9 : 8); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaPipeEntityBase_Cable(mName, mThickNess, mMaterial, mCableLossPerMeter, mAmperage, mVoltage, mInsulated, mCanShock); + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaPipeEntityBase_Cable(this.mName, this.mThickNess, this.mMaterial, this.mCableLossPerMeter, this.mAmperage, this.mVoltage, this.mInsulated, this.mCanShock); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { - if (!mInsulated) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa)}; + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aConnections, final byte aColorIndex, final boolean aConnected, final boolean aRedstone) { + if (!this.mInsulated) { + return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa)}; + } if (aConnected) { - float tThickNess = getThickNess(); - if (tThickNess < 0.37F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.49F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.74F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - if (tThickNess < 0.99F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + final float tThickNess = this.getThickNess(); + if (tThickNess < 0.37F) { + return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + } + if (tThickNess < 0.49F) { + return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + } + if (tThickNess < 0.74F) { + return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + } + if (tThickNess < 0.99F) { + return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + } + return new ITexture[]{new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], this.mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; } return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; } @Override - public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) { - if (mCanShock && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase) - GT_Utility.applyElectricityDamage((EntityLivingBase) aEntity, mTransferredVoltageLast20, mTransferredAmperageLast20); + public void onEntityCollidedWithBlock(final World aWorld, final int aX, final int aY, final int aZ, final Entity aEntity) { + if (this.mCanShock && ((((BaseMetaPipeEntity) this.getBaseMetaTileEntity()).mConnections & -128) == 0) && (aEntity instanceof EntityLivingBase)) { + GT_Utility.applyElectricityDamage((EntityLivingBase) aEntity, this.mTransferredVoltageLast20, this.mTransferredAmperageLast20); + } } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - if (!mCanShock) return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + public AxisAlignedBB getCollisionBoundingBoxFromPool(final World aWorld, final int aX, final int aY, final int aZ) { + if (!this.mCanShock) { + return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + } return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D); } @@ -139,154 +147,168 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return false; } @Override - public boolean isValidSlot(int aIndex) { + public boolean isValidSlot(final int aIndex) { return true; } @Override - public final boolean renderInside(byte aSide) { + public final boolean renderInside(final byte aSide) { return false; } @Override public int getProgresstime() { - return (int) mTransferredAmperage * 64; + return (int) this.mTransferredAmperage * 64; } @Override public int maxProgresstime() { - return (int) mAmperage * 64; + return (int) this.mAmperage * 64; } @Override - public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (!getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity())) + public long injectEnergyUnits(final byte aSide, final long aVoltage, final long aAmperage) { + if (!this.getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, this.getBaseMetaTileEntity().getCoverIDAtSide(aSide), this.getBaseMetaTileEntity().getCoverDataAtSide(aSide), this.getBaseMetaTileEntity())) { return 0; - return transferElectricity(aSide, aVoltage, aAmperage, new ArrayList<TileEntity>(Arrays.asList((TileEntity) getBaseMetaTileEntity()))); + } + return this.transferElectricity(aSide, aVoltage, aAmperage, new ArrayList<>(Arrays.asList((TileEntity) this.getBaseMetaTileEntity()))); } @Override - public long transferElectricity(byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList) { + public long transferElectricity(final byte aSide, long aVoltage, final long aAmperage, final ArrayList<TileEntity> aAlreadyPassedTileEntityList) { long rUsedAmperes = 0; - aVoltage -= mCableLossPerMeter; - if (aVoltage > 0) for (byte i = 0; i < 6 && aAmperage > rUsedAmperes; i++) - if (i != aSide && (mConnections & (1 << i)) != 0 && getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i, getBaseMetaTileEntity().getCoverIDAtSide(i), getBaseMetaTileEntity().getCoverDataAtSide(i), getBaseMetaTileEntity())) { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(i); - if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) { - aAlreadyPassedTileEntityList.add(tTileEntity); - if (tTileEntity instanceof IEnergyConnected) { - if (getBaseMetaTileEntity().getColorization() >= 0) { - byte tColor = ((IEnergyConnected) tTileEntity).getColorization(); - if (tColor >= 0 && tColor != getBaseMetaTileEntity().getColorization()) continue; - } - if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable && ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i)).letsEnergyIn(GT_Utility.getOppositeSide(i), ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity) tTileEntity))) { - if (((IGregTechTileEntity) tTileEntity).getTimer() > 50) - rUsedAmperes += ((IMetaTileEntityCable) ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()).transferElectricity(GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes, aAlreadyPassedTileEntityList); - } else { - rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits(GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes); - } - // } else if (tTileEntity instanceof IEnergySink) { + aVoltage -= this.mCableLossPerMeter; + if (aVoltage > 0) { + for (byte i = 0; (i < 6) && (aAmperage > rUsedAmperes); i++) { + if ((i != aSide) && ((this.mConnections & (1 << i)) != 0) && this.getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i, this.getBaseMetaTileEntity().getCoverIDAtSide(i), this.getBaseMetaTileEntity().getCoverDataAtSide(i), this.getBaseMetaTileEntity())) { + final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(i); + if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) { + aAlreadyPassedTileEntityList.add(tTileEntity); + if (tTileEntity instanceof IEnergyConnected) { + if (this.getBaseMetaTileEntity().getColorization() >= 0) { + final byte tColor = ((IEnergyConnected) tTileEntity).getColorization(); + if ((tColor >= 0) && (tColor != this.getBaseMetaTileEntity().getColorization())) { + continue; + } + } + if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable) && ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i)).letsEnergyIn(GT_Utility.getOppositeSide(i), ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(GT_Utility.getOppositeSide(i)), ((IGregTechTileEntity) tTileEntity))) { + if (((IGregTechTileEntity) tTileEntity).getTimer() > 50) { + rUsedAmperes += ((IMetaTileEntityCable) ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()).transferElectricity(GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes, aAlreadyPassedTileEntityList); + } + } else { + rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits(GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes); + } + // } else if (tTileEntity instanceof IEnergySink) { // ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); // if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)getBaseMetaTileEntity(), tDirection)) { - // if (((IEnergySink)tTileEntity).demandedEnergyUnits() > 0 && ((IEnergySink)tTileEntity).injectEnergyUnits(tDirection, aVoltage) < aVoltage) rUsedAmperes++; - // } + // if (((IEnergySink)tTileEntity).demandedEnergyUnits() > 0 && ((IEnergySink)tTileEntity).injectEnergyUnits(tDirection, aVoltage) < aVoltage) rUsedAmperes++; + // } } else if (tTileEntity instanceof IEnergySink) { - ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); - if (((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) getBaseMetaTileEntity(), tDirection)) { - if (((IEnergySink) tTileEntity).getDemandedEnergy() > 0 && ((IEnergySink) tTileEntity).injectEnergy(tDirection, aVoltage, aVoltage) < aVoltage) + final ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); + if (((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) this.getBaseMetaTileEntity(), tDirection)) { + if ((((IEnergySink) tTileEntity).getDemandedEnergy() > 0) && (((IEnergySink) tTileEntity).injectEnergy(tDirection, aVoltage, aVoltage) < aVoltage)) { rUsedAmperes++; + } } - } else if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver) { - ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); - int rfOut = (int) (aVoltage * GregTech_API.mEUtoRF / 100); + } else if (GregTech_API.mOutputRF && (tTileEntity instanceof IEnergyReceiver)) { + final ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); + final int rfOut = (int) ((aVoltage * GregTech_API.mEUtoRF) / 100); if (((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, true) == rfOut) { ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, false); rUsedAmperes++; } else if (((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, true) > 0) { - if (mRestRF == 0) { - int RFtrans = ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, (int) rfOut, false); + if (this.mRestRF == 0) { + final int RFtrans = ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, false); rUsedAmperes++; - mRestRF = rfOut - RFtrans; + this.mRestRF = rfOut - RFtrans; } else { - int RFtrans = ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, (int) mRestRF, false); - mRestRF = mRestRF - RFtrans; + final int RFtrans = ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, (int) this.mRestRF, false); + this.mRestRF = this.mRestRF - RFtrans; } } - if (GregTech_API.mRFExplosions && ((IEnergyReceiver) tTileEntity).getMaxEnergyStored(tDirection) < rfOut * 600) { - if (rfOut > 32 * GregTech_API.mEUtoRF / 100) this.doExplosion(rfOut); + if (GregTech_API.mRFExplosions && (((IEnergyReceiver) tTileEntity).getMaxEnergyStored(tDirection) < (rfOut * 600))) { + if (rfOut > ((32 * GregTech_API.mEUtoRF) / 100)) { + this.doExplosion(rfOut); + } } } + } } } + } + + this.mTransferredAmperage += rUsedAmperes; + this.mTransferredVoltageLast20 = Math.max(this.mTransferredVoltageLast20, aVoltage); + this.mTransferredAmperageLast20 = Math.max(this.mTransferredAmperageLast20, this.mTransferredAmperage); - mTransferredAmperage += rUsedAmperes; - mTransferredVoltageLast20 = Math.max(mTransferredVoltageLast20, aVoltage); - mTransferredAmperageLast20 = Math.max(mTransferredAmperageLast20, mTransferredAmperage); - - - if (aVoltage > mVoltage || mTransferredAmperage > mAmperage){ + + if ((aVoltage > this.mVoltage) || (this.mTransferredAmperage > this.mAmperage)){ //GT 5.09 if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - if(mOverheat>mWireHeatingTicks * 100){ - getBaseMetaTileEntity().setToFire(); - } + if(this.mOverheat>(this.mWireHeatingTicks * 100)){ + this.getBaseMetaTileEntity().setToFire(); + } else{ - mOverheat +=100; - } + this.mOverheat +=100; + } return aAmperage; } //GT 5.08 else { - getBaseMetaTileEntity().setToFire(); + this.getBaseMetaTileEntity().setToFire(); return aAmperage; } } - + return rUsedAmperes; } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { if (aBaseMetaTileEntity.isServerSide()) { - mTransferredAmperage = 0; - if(mOverheat>0)mOverheat--; + this.mTransferredAmperage = 0; + if(this.mOverheat>0) { + this.mOverheat--; + } - if (aTick % 20 == 0) { - mTransferredVoltageLast20 = 0; - mTransferredAmperageLast20 = 0; - mConnections = 0; + if ((aTick % 20) == 0) { + this.mTransferredVoltageLast20 = 0; + this.mTransferredAmperageLast20 = 0; + this.mConnections = 0; for (byte i = 0, j = 0; i < 6; i++) { j = GT_Utility.getOppositeSide(i); if (aBaseMetaTileEntity.getCoverBehaviorAtSide(i).alwaysLookConnected(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity) || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyIn(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity) || aBaseMetaTileEntity.getCoverBehaviorAtSide(i).letsEnergyOut(i, aBaseMetaTileEntity.getCoverIDAtSide(i), aBaseMetaTileEntity.getCoverDataAtSide(i), aBaseMetaTileEntity)) { - TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); + final TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i); if (tTileEntity instanceof IColoredTileEntity) { if (aBaseMetaTileEntity.getColorization() >= 0) { - byte tColor = ((IColoredTileEntity) tTileEntity).getColorization(); - if (tColor >= 0 && tColor != aBaseMetaTileEntity.getColorization()) continue; + final byte tColor = ((IColoredTileEntity) tTileEntity).getColorization(); + if ((tColor >= 0) && (tColor != aBaseMetaTileEntity.getColorization())) { + continue; + } } } - if (tTileEntity instanceof IEnergyConnected && (((IEnergyConnected) tTileEntity).inputEnergyFrom(j) || ((IEnergyConnected) tTileEntity).outputsEnergyTo(j))) { - mConnections |= (1 << i); + if ((tTileEntity instanceof IEnergyConnected) && (((IEnergyConnected) tTileEntity).inputEnergyFrom(j) || ((IEnergyConnected) tTileEntity).outputsEnergyTo(j))) { + this.mConnections |= (1 << i); continue; } - if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable) { + if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof IMetaTileEntityCable)) { if (((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).letsEnergyIn(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).letsEnergyOut(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity))) { - mConnections |= (1 << i); + this.mConnections |= (1 << i); continue; } } - if (tTileEntity instanceof IEnergySink && ((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) { - mConnections |= (1 << i); + if ((tTileEntity instanceof IEnergySink) && ((IEnergySink) tTileEntity).acceptsEnergyFrom((TileEntity) aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) { + this.mConnections |= (1 << i); continue; } - if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver && ((IEnergyReceiver) tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(j))) { - mConnections |= (1 << i); + if (GregTech_API.mOutputRF && (tTileEntity instanceof IEnergyReceiver) && ((IEnergyReceiver) tTileEntity).canConnectEnergy(ForgeDirection.getOrientation(j))) { + this.mConnections |= (1 << i); continue; } /* @@ -301,36 +323,36 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override public String[] getDescription() { return new String[]{ - "Max Voltage: " + EnumChatFormatting.GREEN + mVoltage + " (" + VN[GT_Utility.getTier(mVoltage)] + ")" + EnumChatFormatting.GRAY, - "Max Amperage: " + EnumChatFormatting.YELLOW + mAmperage + EnumChatFormatting.GRAY, - "Loss/Meter/Ampere: " + EnumChatFormatting.RED + mCableLossPerMeter + EnumChatFormatting.GRAY + " EU-Volt" + "Max Voltage: " + EnumChatFormatting.GREEN + this.mVoltage + " (" + VN[GT_Utility.getTier(this.mVoltage)] + ")" + EnumChatFormatting.GRAY, + "Max Amperage: " + EnumChatFormatting.YELLOW + this.mAmperage + EnumChatFormatting.GRAY, + "Loss/Meter/Ampere: " + EnumChatFormatting.RED + this.mCableLossPerMeter + EnumChatFormatting.GRAY + " EU-Volt" }; } @Override public float getThickNess() { - return mThickNess; + return this.mThickNess; } @Override - public void saveNBTData(NBTTagCompound aNBT) { + public void saveNBTData(final NBTTagCompound aNBT) { // } @Override - public void loadNBTData(NBTTagCompound aNBT) { + public void loadNBTData(final NBTTagCompound aNBT) { // } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java index cd91d05970..2997a3d7af 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; import static gregtech.api.enums.GT_Values.GT; + import gregtech.api.interfaces.ITexture; import gregtech.api.metatileentity.MetaTileEntity; import gtPlusPlus.core.lib.CORE; @@ -10,54 +11,58 @@ public abstract class GregtechMetaTileEntity extends MetaTileEntity { * Value between [0 - 9] to describe the Tier of this Machine. */ public final byte mTier; - + /** * A simple Description. */ public final String mDescription; - + /** * Contains all Textures used by this Block. */ public final ITexture[][][] mTextures; - - public GregtechMetaTileEntity(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { + + public GregtechMetaTileEntity(final int aID, final String aName, final String aNameRegional, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture... aTextures) { super(aID, aName, aNameRegional, aInvSlotCount); - mTier = (byte)Math.max(0, Math.min(aTier, 9)); - mDescription = aDescription; - + this.mTier = (byte)Math.max(0, Math.min(aTier, 9)); + this.mDescription = aDescription; + // must always be the last call! - if (GT.isClientSide()) mTextures = getTextureSet(aTextures); else mTextures = null; + if (GT.isClientSide()) { + this.mTextures = this.getTextureSet(aTextures); + } else { + this.mTextures = null; + } } - - public GregtechMetaTileEntity(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + + public GregtechMetaTileEntity(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) { super(aName, aInvSlotCount); - mTier = (byte)aTier; - mDescription = aDescription; - mTextures = aTextures; - + this.mTier = (byte)aTier; + this.mDescription = aDescription; + this.mTextures = aTextures; + } - + @Override public byte getTileEntityBaseType() { - return (byte)(Math.min(3, mTier<=0?0:1+((mTier-1) / 4))); + return (byte)(Math.min(3, this.mTier<=0?0:1+((this.mTier-1) / 4))); } - - @Override + + @Override public long getInputTier() { - return mTier; - } - - @Override + return this.mTier; + } + + @Override public long getOutputTier() { - return mTier; - } - + return this.mTier; + } + @Override public String[] getDescription() { - return new String[] {mDescription, CORE.GT_Tooltip}; + return new String[] {this.mDescription, CORE.GT_Tooltip}; } - + /** * Used Client Side to get a Texture Set for this Block. * Called after setting the Tier and the Description so that those two are accessible. diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 289fde0391..c39c8f3789 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -1,6 +1,9 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; import static gregtech.api.enums.GT_Values.V; + +import java.util.ArrayList; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.*; @@ -16,9 +19,6 @@ import gregtech.common.items.GT_MetaGenerated_Tool_01; import gtPlusPlus.core.util.array.Pair; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; - -import java.util.ArrayList; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -27,820 +27,939 @@ import net.minecraftforge.fluids.FluidStack; public abstract class GregtechMeta_MultiBlockBase extends MetaTileEntity { - public static boolean disableMaintenance; - public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = true, mCrowbar = false, mRunningOnLoad = false; - public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, mUpdate = 0, mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0; - public ItemStack[] mOutputItems = null; - public FluidStack[] mOutputFluids = null; - public ArrayList<GT_MetaTileEntity_Hatch_Input> mInputHatches = new ArrayList<GT_MetaTileEntity_Hatch_Input>(); - public ArrayList<GT_MetaTileEntity_Hatch_Output> mOutputHatches = new ArrayList<GT_MetaTileEntity_Hatch_Output>(); - public ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<GT_MetaTileEntity_Hatch_InputBus>(); - public ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<GT_MetaTileEntity_Hatch_OutputBus>(); - public ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch_Dynamo>(); - public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<GT_MetaTileEntity_Hatch_Muffler>(); - public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch_Energy>(); - public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<GT_MetaTileEntity_Hatch_Maintenance>(); - - public GregtechMeta_MultiBlockBase(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, 2); - this.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); - } - - public GregtechMeta_MultiBlockBase(String aName) { - super(aName, 2); - this.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); - } - - public static boolean isValidMetaTileEntity(MetaTileEntity aMetaTileEntity) { - return aMetaTileEntity.getBaseMetaTileEntity() != null && aMetaTileEntity.getBaseMetaTileEntity().getMetaTileEntity() == aMetaTileEntity && !aMetaTileEntity.getBaseMetaTileEntity().isDead(); - } - - @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { - return aSide != getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return aIndex > 0; - } - - @Override - public int getProgresstime() { - return mProgresstime; - } - - @Override - public int maxProgresstime() { - return mMaxProgresstime; - } - - @Override - public int increaseProgress(int aProgress) { - return aProgress; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mEUt", mEUt); - aNBT.setInteger("mProgresstime", mProgresstime); - aNBT.setInteger("mMaxProgresstime", mMaxProgresstime); - aNBT.setInteger("mEfficiencyIncrease", mEfficiencyIncrease); - aNBT.setInteger("mEfficiency", mEfficiency); - aNBT.setInteger("mPollution", mPollution); - aNBT.setInteger("mRuntime", mRuntime); - - if (mOutputItems != null) for (int i = 0; i < mOutputItems.length; i++) - if (mOutputItems[i] != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputItems[i].writeToNBT(tNBT); - aNBT.setTag("mOutputItem" + i, tNBT); - } - if (mOutputFluids != null) for (int i = 0; i < mOutputFluids.length; i++) - if (mOutputFluids[i] != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputFluids[i].writeToNBT(tNBT); - aNBT.setTag("mOutputFluids" + i, tNBT); - } - - aNBT.setBoolean("mWrench", mWrench); - aNBT.setBoolean("mScrewdriver", mScrewdriver); - aNBT.setBoolean("mSoftHammer", mSoftHammer); - aNBT.setBoolean("mHardHammer", mHardHammer); - aNBT.setBoolean("mSolderingTool", mSolderingTool); - aNBT.setBoolean("mCrowbar", mCrowbar); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - mEUt = aNBT.getInteger("mEUt"); - mProgresstime = aNBT.getInteger("mProgresstime"); - mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); - if (mMaxProgresstime > 0) mRunningOnLoad = true; - mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease"); - mEfficiency = aNBT.getInteger("mEfficiency"); - mPollution = aNBT.getInteger("mPollution"); - mRuntime = aNBT.getInteger("mRuntime"); - mOutputItems = new ItemStack[getAmountOfOutputs()]; - for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); - mOutputFluids = new FluidStack[getAmountOfOutputs()]; - for (int i = 0; i < mOutputFluids.length; i++) - mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); - mWrench = aNBT.getBoolean("mWrench"); - mScrewdriver = aNBT.getBoolean("mScrewdriver"); - mSoftHammer = aNBT.getBoolean("mSoftHammer"); - mHardHammer = aNBT.getBoolean("mHardHammer"); - mSolderingTool = aNBT.getBoolean("mSolderingTool"); - mCrowbar = aNBT.getBoolean("mCrowbar"); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiblockDisplay.png"); - } - - @Override - public byte getTileEntityBaseType() { - return 2; - } - - @Override - public void onMachineBlockUpdate() { - mUpdate = 50; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (mEfficiency < 0) mEfficiency = 0; - if (--mUpdate == 0 || --mStartUpCheck == 0) { - mInputHatches.clear(); - mInputBusses.clear(); - mOutputHatches.clear(); - mOutputBusses.clear(); - mDynamoHatches.clear(); - mEnergyHatches.clear(); - mMufflerHatches.clear(); - mMaintenanceHatches.clear(); - mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]); - } - if (mStartUpCheck < 0) { - if (mMachine) { - for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (!this.disableMaintenance) { - if (tHatch.mWrench) mWrench = true; - if (tHatch.mScrewdriver) mScrewdriver = true; - if (tHatch.mSoftHammer) mSoftHammer = true; - if (tHatch.mHardHammer) mHardHammer = true; - if (tHatch.mSolderingTool) mSolderingTool = true; - if (tHatch.mCrowbar) mCrowbar = true; - } else { - mWrench = true; - mScrewdriver = true; - mSoftHammer = true; - mHardHammer = true; - mSolderingTool = true; - mCrowbar = true; - } - - tHatch.mWrench = false; - tHatch.mScrewdriver = false; - tHatch.mSoftHammer = false; - tHatch.mHardHammer = false; - tHatch.mSolderingTool = true; - tHatch.mCrowbar = false; - } - } - if (getRepairStatus() > 0) { - if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) { - if (onRunningTick(mInventory[1])) { - if (!polluteEnvironment(getPollutionPerTick(mInventory[1]))) { - stopMachine(); - } - if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { - if (mOutputItems != null) for (ItemStack tStack : mOutputItems) - if (tStack != null) { - try { - GT_Mod.instance.achievements.issueAchivementHatch(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack); - } catch (Exception e) { - } - addOutput(tStack); - } - if (mOutputFluids != null && mOutputFluids.length == 1) { - for (FluidStack tStack : mOutputFluids) - if (tStack != null) { - addOutput(tStack); - } - } else if (mOutputFluids != null && mOutputFluids.length > 1) { - addFluidOutputs(mOutputFluids); - } - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); - mOutputItems = null; - mProgresstime = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - if (aBaseMetaTileEntity.isAllowedToWork()) checkRecipe(mInventory[1]); - if (mOutputFluids != null && mOutputFluids.length > 0) { - if (mOutputFluids.length > 1) { - GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant"); - } - } - } - } - } else { - if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { - - if (aBaseMetaTileEntity.isAllowedToWork()) { - checkRecipe(mInventory[1]); - } - if (mMaxProgresstime <= 0) mEfficiency = Math.max(0, mEfficiency - 1000); - } - } - } else { - stopMachine(); - } - } else { - stopMachine(); - } - } - aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); - aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); - } - } - - public boolean polluteEnvironment(int aPollutionLevel) { - mPollution += aPollutionLevel; - for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (mPollution >= 10000) { - if (tHatch.polluteEnvironment()) { - mPollution -= 10000; - } - } else { - break; - } - } - } - return mPollution < 10000; - } - - /** - * Called every tick the Machine runs - */ - public boolean onRunningTick(ItemStack aStack) { - if (mEUt > 0) { - addEnergyOutput(((long) mEUt * mEfficiency) / 10000); - return true; - } - if (mEUt < 0) { - if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) { - stopMachine(); - return false; - } - } - return true; - } - - /** - * Checks if this is a Correct Machine Part for this kind of Machine (Turbine Rotor for example) - */ - //public abstract boolean isCorrectMachinePart(ItemStack aStack); - - /** - * Checks the Recipe - */ - public abstract boolean checkRecipe(ItemStack aStack); - - /** - * Checks the Machine. You have to assign the MetaTileEntities for the Hatches here. - */ - public abstract boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack); - - /** - * Gets the maximum Efficiency that spare Part can get (0 - 10000) - */ - public abstract int getMaxEfficiency(ItemStack aStack); - - /** - * Gets the pollution this Device outputs to a Muffler per tick (10000 = one Pullution Block) - */ - public abstract int getPollutionPerTick(ItemStack aStack); - - /** - * Gets the damage to the ItemStack, usually 0 or 1. - */ - //public abstract int getDamageToComponent(ItemStack aStack); - - /** - * Gets the Amount of possibly outputted Items for loading the Output Stack Array from NBT. - * This should be the largest Amount that can ever happen legitimately. - */ - public abstract int getAmountOfOutputs(); - - /** - * If it explodes when the Component has to be replaced. - */ - public abstract boolean explodesOnComponentBreak(ItemStack aStack); - - public void stopMachine() { - mOutputItems = null; - mEUt = 0; - mEfficiency = 0; - mProgresstime = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - getBaseMetaTileEntity().disableWorking(); - } - - public int getRepairStatus() { - return (mWrench ? 1 : 0) + (mScrewdriver ? 1 : 0) + (mSoftHammer ? 1 : 0) + (mHardHammer ? 1 : 0) + (mSolderingTool ? 1 : 0) + (mCrowbar ? 1 : 0); - } - - public int getIdealStatus() { - return 6; - } - - public boolean doRandomMaintenanceDamage() { - if (getRepairStatus() == 0) { - stopMachine(); - return false; - } - if (mRuntime++ > 1000) { - mRuntime = 0; - if (getBaseMetaTileEntity().getRandomNumber(6000) == 0) { - switch (getBaseMetaTileEntity().getRandomNumber(6)) { - case 0: - mWrench = false; - break; - case 1: - mScrewdriver = false; - break; - case 2: - mSoftHammer = false; - break; - case 3: - mHardHammer = false; - break; - case 4: - mSolderingTool = true; - break; - case 5: - mCrowbar = false; - break; - } - } - if (mInventory[1] != null && getBaseMetaTileEntity().getRandomNumber(2) == 0 && !mInventory[1].getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.")) { - if (mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { - NBTTagCompound tNBT = mInventory[1].getTagCompound(); - if (tNBT != null) { - NBTTagCompound tNBT2 = tNBT.getCompoundTag("GT.CraftingComponents"); - if (!tNBT.getBoolean("mDis")) { - tNBT2 = new NBTTagCompound(); - Materials tMaterial = GT_MetaGenerated_Tool.getPrimaryMaterial(mInventory[1]); - ItemStack tTurbine = GT_OreDictUnificator.get(OrePrefixes.turbineBlade, tMaterial, 1); - int i = mInventory[1].getItemDamage(); - if (i == 170) { - ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Magnalium, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } else if (i == 172) { - ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.7", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.8", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Titanium, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } else if (i == 174) { - ItemStack tStack = GT_Utility.copyAmount(2, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.TungstenSteel, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } else if (i == 176) { - ItemStack tStack = GT_Utility.copyAmount(2, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.7", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.8", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Americium, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } - tNBT.setTag("GT.CraftingComponents", tNBT2); - tNBT.setBoolean("mDis", true); - mInventory[1].setTagCompound(tNBT); - - } - } - - ((GT_MetaGenerated_Tool) mInventory[1].getItem()).doDamage(mInventory[1], (long) Math.min(mEUt / 5, Math.pow(mEUt, 0.7))); - if (mInventory[1].stackSize == 0) mInventory[1] = null; - } - } - } - return true; - } - - public void explodeMultiblock() { - mInventory[1] = null; - for (MetaTileEntity tTileEntity : mInputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mOutputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mInputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mOutputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mDynamoHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mMufflerHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mEnergyHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mMaintenanceHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - getBaseMetaTileEntity().doExplosion(V[8]); - } - - public boolean addEnergyOutput(long aEU) { - if (aEU <= 0) return true; - for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(aEU, false)) { - return true; - } - } - } - return false; - } - - public long getMaxInputVoltage() { - long rVoltage = 0; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); - return rVoltage; - } - - public boolean drainEnergyInput(long aEU) { - if (aEU <= 0) return true; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) return true; - } - return false; - } - - public boolean addOutput(FluidStack aLiquid) { - if (aLiquid == null) return false; - FluidStack tLiquid = aLiquid.copy(); - for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { - if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) { - int tAmount = tHatch.fill(tLiquid, false); - if (tAmount >= tLiquid.amount) { - return tHatch.fill(tLiquid, true) >= tLiquid.amount; - } else if (tAmount > 0) { - tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true); - } - } - } - return false; - } - - private void addFluidOutputs(FluidStack[] mOutputFluids2) { - for (int i = 0; i < mOutputFluids2.length; i++) { - if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) { - mOutputHatches.get(i).fill(mOutputFluids2[i], true); - } - } - - } - - public boolean depleteInput(FluidStack aLiquid) { - if (aLiquid == null) return false; - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - FluidStack tLiquid = tHatch.getFluid(); - if (tLiquid != null && tLiquid.isFluidEqual(aLiquid)) { - tLiquid = tHatch.drain(aLiquid.amount, false); - if (tLiquid != null && tLiquid.amount >= aLiquid.amount) { - tLiquid = tHatch.drain(aLiquid.amount, true); - return tLiquid != null && tLiquid.amount >= aLiquid.amount; - } - } - } - } - return false; - } - - public boolean addOutput(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return false; - aStack = GT_Utility.copy(aStack); -// FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); -// if (aLiquid == null) { - for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) { - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getSizeInventory() - 1; i >= 0; i--) { - if (tHatch.getBaseMetaTileEntity().addStackToSlot(i, aStack)) return true; - } - } - } - for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { - if (isValidMetaTileEntity(tHatch) && tHatch.outputsItems()) { - if (tHatch.getBaseMetaTileEntity().addStackToSlot(1, aStack)) return true; - } - } -// }else { -// for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { -// if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid)?tHatch.outputsSteam():tHatch.outputsLiquids()) { -// int tAmount = tHatch.fill(aLiquid, false); -// if (tAmount >= aLiquid.amount) { -// return tHatch.fill(aLiquid, true) >= aLiquid.amount; -// } -// } -// } -// } - return false; - } - - public boolean depleteInput(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return false; - FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); - if (aLiquid != null) return depleteInput(aLiquid); - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { - tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); - return true; - } - } - } - } - for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { - tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); - return true; - } - } - } - } - } - return false; - } - - public ArrayList<ItemStack> getStoredOutputs() { - ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); - for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { - if (isValidMetaTileEntity(tHatch)) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1)); - } - } - for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) { - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); - } - } - } - return rList; - } - - public ArrayList<FluidStack> getStoredFluids() { - ArrayList<FluidStack> rList = new ArrayList<FluidStack>(); - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch) && tHatch.getFillableStack() != null) { - rList.add(tHatch.getFillableStack()); - } - } - return rList; - } - - public ArrayList<ItemStack> getStoredInputs() { - ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().getStackInSlot(0) != null) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(0)); - } - } - for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null) - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); - } - } - } - return rList; - } - - public GT_Recipe_Map getRecipeMap() { - return null; - } - - public void updateSlots() { - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) - if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); - for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) - if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); - } - - public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) - return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) - return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) - return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) - return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) - return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) - return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) - return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) - return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); - return false; - } - - public boolean addMaintenanceToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); - } - return false; - } - - public boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); - } - return false; - } - - public boolean addDynamoToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); - } - return false; - } - - public boolean addMufflerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); - } - return false; - } - - public boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); - } - return false; - } - - public boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); - } - return false; - } - - @Override - public String[] getInfoData() { - return new String[]{"Progress:", (mProgresstime / 20) + "secs", (mMaxProgresstime / 20) + "secs", "Efficiency:", (mEfficiency / 100.0F) + "%", "Problems:", "" + (getIdealStatus() - getRepairStatus())}; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } - - /** - * Called whenever the Machine successfully started a Process, useful for Sound Effects - */ - public void startProcess() { - // - } - - /** - * Called whenever the Machine successfully finished a Process, useful for Sound Effects - */ - public void endProcess() { - // - } - - /** - * Called whenever the Machine aborted a Process, useful for Sound Effects - */ - public void abortProcess() { - // - } - - public int getValidOutputSlots(GT_Recipe.GT_Recipe_Map sRecipeMap, ItemStack[] sInputs){ - ArrayList<ItemStack> tInputList = getStoredInputs(); - GT_Recipe tRecipe = sRecipeMap.findRecipe(getBaseMetaTileEntity(), false, 9223372036854775807L, null, sInputs); - ArrayList<Pair<GT_MetaTileEntity_Hatch_OutputBus, Integer>> rList = new ArrayList<Pair<GT_MetaTileEntity_Hatch_OutputBus, Integer>>(); + public static boolean disableMaintenance; + public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = true, mCrowbar = false, mRunningOnLoad = false; + public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, mUpdate = 0, mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0; + public ItemStack[] mOutputItems = null; + public FluidStack[] mOutputFluids = null; + public ArrayList<GT_MetaTileEntity_Hatch_Input> mInputHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Output> mOutputHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<>(); + + public GregtechMeta_MultiBlockBase(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional, 2); + GregtechMeta_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); + } + + public GregtechMeta_MultiBlockBase(final String aName) { + super(aName, 2); + GregtechMeta_MultiBlockBase.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); + } + + public static boolean isValidMetaTileEntity(final MetaTileEntity aMetaTileEntity) { + return (aMetaTileEntity.getBaseMetaTileEntity() != null) && (aMetaTileEntity.getBaseMetaTileEntity().getMetaTileEntity() == aMetaTileEntity) && !aMetaTileEntity.getBaseMetaTileEntity().isDead(); + } + + @Override + public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aCoverID) { + return aSide != this.getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return true; + } + + @Override + public boolean isAccessAllowed(final EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isValidSlot(final int aIndex) { + return aIndex > 0; + } + + @Override + public int getProgresstime() { + return this.mProgresstime; + } + + @Override + public int maxProgresstime() { + return this.mMaxProgresstime; + } + + @Override + public int increaseProgress(final int aProgress) { + return aProgress; + } + + @Override + public void saveNBTData(final NBTTagCompound aNBT) { + aNBT.setInteger("mEUt", this.mEUt); + aNBT.setInteger("mProgresstime", this.mProgresstime); + aNBT.setInteger("mMaxProgresstime", this.mMaxProgresstime); + aNBT.setInteger("mEfficiencyIncrease", this.mEfficiencyIncrease); + aNBT.setInteger("mEfficiency", this.mEfficiency); + aNBT.setInteger("mPollution", this.mPollution); + aNBT.setInteger("mRuntime", this.mRuntime); + + if (this.mOutputItems != null) { + for (int i = 0; i < this.mOutputItems.length; i++) { + if (this.mOutputItems[i] != null) { + final NBTTagCompound tNBT = new NBTTagCompound(); + this.mOutputItems[i].writeToNBT(tNBT); + aNBT.setTag("mOutputItem" + i, tNBT); + } + } + } + if (this.mOutputFluids != null) { + for (int i = 0; i < this.mOutputFluids.length; i++) { + if (this.mOutputFluids[i] != null) { + final NBTTagCompound tNBT = new NBTTagCompound(); + this.mOutputFluids[i].writeToNBT(tNBT); + aNBT.setTag("mOutputFluids" + i, tNBT); + } + } + } + + aNBT.setBoolean("mWrench", this.mWrench); + aNBT.setBoolean("mScrewdriver", this.mScrewdriver); + aNBT.setBoolean("mSoftHammer", this.mSoftHammer); + aNBT.setBoolean("mHardHammer", this.mHardHammer); + aNBT.setBoolean("mSolderingTool", this.mSolderingTool); + aNBT.setBoolean("mCrowbar", this.mCrowbar); + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + this.mEUt = aNBT.getInteger("mEUt"); + this.mProgresstime = aNBT.getInteger("mProgresstime"); + this.mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); + if (this.mMaxProgresstime > 0) { + this.mRunningOnLoad = true; + } + this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease"); + this.mEfficiency = aNBT.getInteger("mEfficiency"); + this.mPollution = aNBT.getInteger("mPollution"); + this.mRuntime = aNBT.getInteger("mRuntime"); + this.mOutputItems = new ItemStack[this.getAmountOfOutputs()]; + for (int i = 0; i < this.mOutputItems.length; i++) { + this.mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); + } + this.mOutputFluids = new FluidStack[this.getAmountOfOutputs()]; + for (int i = 0; i < this.mOutputFluids.length; i++) { + this.mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); + } + this.mWrench = aNBT.getBoolean("mWrench"); + this.mScrewdriver = aNBT.getBoolean("mScrewdriver"); + this.mSoftHammer = aNBT.getBoolean("mSoftHammer"); + this.mHardHammer = aNBT.getBoolean("mHardHammer"); + this.mSolderingTool = aNBT.getBoolean("mSolderingTool"); + this.mCrowbar = aNBT.getBoolean("mCrowbar"); + } + + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new CONTAINER_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); + } + + @Override + public byte getTileEntityBaseType() { + return 2; + } + + @Override + public void onMachineBlockUpdate() { + this.mUpdate = 50; + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if (this.mEfficiency < 0) { + this.mEfficiency = 0; + } + if ((--this.mUpdate == 0) || (--this.mStartUpCheck == 0)) { + this.mInputHatches.clear(); + this.mInputBusses.clear(); + this.mOutputHatches.clear(); + this.mOutputBusses.clear(); + this.mDynamoHatches.clear(); + this.mEnergyHatches.clear(); + this.mMufflerHatches.clear(); + this.mMaintenanceHatches.clear(); + this.mMachine = this.checkMachine(aBaseMetaTileEntity, this.mInventory[1]); + } + if (this.mStartUpCheck < 0) { + if (this.mMachine) { + for (final GT_MetaTileEntity_Hatch_Maintenance tHatch : this.mMaintenanceHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (!GregtechMeta_MultiBlockBase.disableMaintenance) { + if (tHatch.mWrench) { + this.mWrench = true; + } + if (tHatch.mScrewdriver) { + this.mScrewdriver = true; + } + if (tHatch.mSoftHammer) { + this.mSoftHammer = true; + } + if (tHatch.mHardHammer) { + this.mHardHammer = true; + } + if (tHatch.mSolderingTool) { + this.mSolderingTool = true; + } + if (tHatch.mCrowbar) { + this.mCrowbar = true; + } + } else { + this.mWrench = true; + this.mScrewdriver = true; + this.mSoftHammer = true; + this.mHardHammer = true; + this.mSolderingTool = true; + this.mCrowbar = true; + } + + tHatch.mWrench = false; + tHatch.mScrewdriver = false; + tHatch.mSoftHammer = false; + tHatch.mHardHammer = false; + tHatch.mSolderingTool = true; + tHatch.mCrowbar = false; + } + } + if (this.getRepairStatus() > 0) { + if ((this.mMaxProgresstime > 0) && this.doRandomMaintenanceDamage()) { + if (this.onRunningTick(this.mInventory[1])) { + if (!this.polluteEnvironment(this.getPollutionPerTick(this.mInventory[1]))) { + this.stopMachine(); + } + if ((this.mMaxProgresstime > 0) && (++this.mProgresstime >= this.mMaxProgresstime)) { + if (this.mOutputItems != null) { + for (final ItemStack tStack : this.mOutputItems) { + if (tStack != null) { + try { + GT_Mod.achievements.issueAchivementHatch(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack); + } catch (final Exception e) { + } + this.addOutput(tStack); + } + } + } + if ((this.mOutputFluids != null) && (this.mOutputFluids.length == 1)) { + for (final FluidStack tStack : this.mOutputFluids) { + if (tStack != null) { + this.addOutput(tStack); + } + } + } else if ((this.mOutputFluids != null) && (this.mOutputFluids.length > 1)) { + this.addFluidOutputs(this.mOutputFluids); + } + this.mEfficiency = Math.max(0, Math.min(this.mEfficiency + this.mEfficiencyIncrease, this.getMaxEfficiency(this.mInventory[1]) - ((this.getIdealStatus() - this.getRepairStatus()) * 1000))); + this.mOutputItems = null; + this.mProgresstime = 0; + this.mMaxProgresstime = 0; + this.mEfficiencyIncrease = 0; + if (aBaseMetaTileEntity.isAllowedToWork()) { + this.checkRecipe(this.mInventory[1]); + } + if ((this.mOutputFluids != null) && (this.mOutputFluids.length > 0)) { + if (this.mOutputFluids.length > 1) { + GT_Mod.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant"); + } + } + } + } + } else { + if (((aTick % 100) == 0) || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { + + if (aBaseMetaTileEntity.isAllowedToWork()) { + this.checkRecipe(this.mInventory[1]); + } + if (this.mMaxProgresstime <= 0) { + this.mEfficiency = Math.max(0, this.mEfficiency - 1000); + } + } + } + } else { + this.stopMachine(); + } + } else { + this.stopMachine(); + } + } + aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (this.mWrench ? 0 : 1) | (this.mScrewdriver ? 0 : 2) | (this.mSoftHammer ? 0 : 4) | (this.mHardHammer ? 0 : 8) | (this.mSolderingTool ? 0 : 16) | (this.mCrowbar ? 0 : 32) | (this.mMachine ? 0 : 64)); + aBaseMetaTileEntity.setActive(this.mMaxProgresstime > 0); + } + } + + public boolean polluteEnvironment(final int aPollutionLevel) { + this.mPollution += aPollutionLevel; + for (final GT_MetaTileEntity_Hatch_Muffler tHatch : this.mMufflerHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (this.mPollution >= 10000) { + if (tHatch.polluteEnvironment()) { + this.mPollution -= 10000; + } + } else { + break; + } + } + } + return this.mPollution < 10000; + } + + /** + * Called every tick the Machine runs + */ + public boolean onRunningTick(final ItemStack aStack) { + if (this.mEUt > 0) { + this.addEnergyOutput(((long) this.mEUt * this.mEfficiency) / 10000); + return true; + } + if (this.mEUt < 0) { + if (!this.drainEnergyInput(((long) -this.mEUt * 10000) / Math.max(1000, this.mEfficiency))) { + this.stopMachine(); + return false; + } + } + return true; + } + + /** + * Checks if this is a Correct Machine Part for this kind of Machine (Turbine Rotor for example) + */ + //public abstract boolean isCorrectMachinePart(ItemStack aStack); + + /** + * Checks the Recipe + */ + public abstract boolean checkRecipe(ItemStack aStack); + + /** + * Checks the Machine. You have to assign the MetaTileEntities for the Hatches here. + */ + public abstract boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack); + + /** + * Gets the maximum Efficiency that spare Part can get (0 - 10000) + */ + public abstract int getMaxEfficiency(ItemStack aStack); + + /** + * Gets the pollution this Device outputs to a Muffler per tick (10000 = one Pullution Block) + */ + public abstract int getPollutionPerTick(ItemStack aStack); + + /** + * Gets the damage to the ItemStack, usually 0 or 1. + */ + //public abstract int getDamageToComponent(ItemStack aStack); + + /** + * Gets the Amount of possibly outputted Items for loading the Output Stack Array from NBT. + * This should be the largest Amount that can ever happen legitimately. + */ + public abstract int getAmountOfOutputs(); + + /** + * If it explodes when the Component has to be replaced. + */ + public abstract boolean explodesOnComponentBreak(ItemStack aStack); + + public void stopMachine() { + this.mOutputItems = null; + this.mEUt = 0; + this.mEfficiency = 0; + this.mProgresstime = 0; + this.mMaxProgresstime = 0; + this.mEfficiencyIncrease = 0; + this.getBaseMetaTileEntity().disableWorking(); + } + + public int getRepairStatus() { + return (this.mWrench ? 1 : 0) + (this.mScrewdriver ? 1 : 0) + (this.mSoftHammer ? 1 : 0) + (this.mHardHammer ? 1 : 0) + (this.mSolderingTool ? 1 : 0) + (this.mCrowbar ? 1 : 0); + } + + public int getIdealStatus() { + return 6; + } + + public boolean doRandomMaintenanceDamage() { + if (this.getRepairStatus() == 0) { + this.stopMachine(); + return false; + } + if (this.mRuntime++ > 1000) { + this.mRuntime = 0; + if (this.getBaseMetaTileEntity().getRandomNumber(6000) == 0) { + switch (this.getBaseMetaTileEntity().getRandomNumber(6)) { + case 0: + this.mWrench = false; + break; + case 1: + this.mScrewdriver = false; + break; + case 2: + this.mSoftHammer = false; + break; + case 3: + this.mHardHammer = false; + break; + case 4: + this.mSolderingTool = true; + break; + case 5: + this.mCrowbar = false; + break; + } + } + if ((this.mInventory[1] != null) && (this.getBaseMetaTileEntity().getRandomNumber(2) == 0) && !this.mInventory[1].getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.")) { + if (this.mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { + final NBTTagCompound tNBT = this.mInventory[1].getTagCompound(); + if (tNBT != null) { + NBTTagCompound tNBT2 = tNBT.getCompoundTag("GT.CraftingComponents"); + if (!tNBT.getBoolean("mDis")) { + tNBT2 = new NBTTagCompound(); + final Materials tMaterial = GT_MetaGenerated_Tool.getPrimaryMaterial(this.mInventory[1]); + final ItemStack tTurbine = GT_OreDictUnificator.get(OrePrefixes.turbineBlade, tMaterial, 1); + final int i = this.mInventory[1].getItemDamage(); + if (i == 170) { + ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); + tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); + tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Magnalium, 1); + tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); + } else if (i == 172) { + ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); + tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.7", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.8", tStack.writeToNBT(new NBTTagCompound())); + tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Titanium, 1); + tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); + } else if (i == 174) { + ItemStack tStack = GT_Utility.copyAmount(2, tTurbine); + tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); + tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.TungstenSteel, 1); + tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); + } else if (i == 176) { + ItemStack tStack = GT_Utility.copyAmount(2, tTurbine); + tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.7", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.8", tStack.writeToNBT(new NBTTagCompound())); + tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Americium, 1); + tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); + } + tNBT.setTag("GT.CraftingComponents", tNBT2); + tNBT.setBoolean("mDis", true); + this.mInventory[1].setTagCompound(tNBT); + + } + } + + ((GT_MetaGenerated_Tool) this.mInventory[1].getItem()).doDamage(this.mInventory[1], (long) Math.min(this.mEUt / 5, Math.pow(this.mEUt, 0.7))); + if (this.mInventory[1].stackSize == 0) { + this.mInventory[1] = null; + } + } + } + } + return true; + } + + public void explodeMultiblock() { + this.mInventory[1] = null; + for (final MetaTileEntity tTileEntity : this.mInputBusses) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mOutputBusses) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mInputHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mOutputHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mDynamoHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mMufflerHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mEnergyHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mMaintenanceHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + this.getBaseMetaTileEntity().doExplosion(V[8]); + } + + public boolean addEnergyOutput(final long aEU) { + if (aEU <= 0) { + return true; + } + for (final GT_MetaTileEntity_Hatch_Dynamo tHatch : this.mDynamoHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(aEU, false)) { + return true; + } + } + } + return false; + } + + public long getMaxInputVoltage() { + long rVoltage = 0; + for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) { + if (isValidMetaTileEntity(tHatch)) { + rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); + } + } + return rVoltage; + } + + public boolean drainEnergyInput(final long aEU) { + if (aEU <= 0) { + return true; + } + for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) { + return true; + } + } + } + return false; + } + + public boolean addOutput(final FluidStack aLiquid) { + if (aLiquid == null) { + return false; + } + final FluidStack tLiquid = aLiquid.copy(); + for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { + if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) { + final int tAmount = tHatch.fill(tLiquid, false); + if (tAmount >= tLiquid.amount) { + return tHatch.fill(tLiquid, true) >= tLiquid.amount; + } else if (tAmount > 0) { + tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true); + } + } + } + return false; + } + + private void addFluidOutputs(final FluidStack[] mOutputFluids2) { + for (int i = 0; i < mOutputFluids2.length; i++) { + if ((this.mOutputHatches.size() > i) && (this.mOutputHatches.get(i) != null) && (mOutputFluids2[i] != null) && isValidMetaTileEntity(this.mOutputHatches.get(i))) { + this.mOutputHatches.get(i).fill(mOutputFluids2[i], true); + } + } + + } + + public boolean depleteInput(final FluidStack aLiquid) { + if (aLiquid == null) { + return false; + } + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + FluidStack tLiquid = tHatch.getFluid(); + if ((tLiquid != null) && tLiquid.isFluidEqual(aLiquid)) { + tLiquid = tHatch.drain(aLiquid.amount, false); + if ((tLiquid != null) && (tLiquid.amount >= aLiquid.amount)) { + tLiquid = tHatch.drain(aLiquid.amount, true); + return (tLiquid != null) && (tLiquid.amount >= aLiquid.amount); + } + } + } + } + return false; + } + + public boolean addOutput(ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) { + return false; + } + aStack = GT_Utility.copy(aStack); + // FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); + // if (aLiquid == null) { + for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) { + if (isValidMetaTileEntity(tHatch)) { + for (int i = tHatch.getSizeInventory() - 1; i >= 0; i--) { + if (tHatch.getBaseMetaTileEntity().addStackToSlot(i, aStack)) { + return true; + } + } + } + } + for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { + if (isValidMetaTileEntity(tHatch) && tHatch.outputsItems()) { + if (tHatch.getBaseMetaTileEntity().addStackToSlot(1, aStack)) { + return true; + } + } + } + // }else { + // for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { + // if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid)?tHatch.outputsSteam():tHatch.outputsLiquids()) { + // int tAmount = tHatch.fill(aLiquid, false); + // if (tAmount >= aLiquid.amount) { + // return tHatch.fill(aLiquid, true) >= aLiquid.amount; + // } + // } + // } + // } + return false; + } + + public boolean depleteInput(final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) { + return false; + } + final FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); + if (aLiquid != null) { + return this.depleteInput(aLiquid); + } + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) { + if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { + tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); + return true; + } + } + } + } + for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) { + if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { + tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); + return true; + } + } + } + } + } + return false; + } + + public ArrayList<ItemStack> getStoredOutputs() { + final ArrayList<ItemStack> rList = new ArrayList<>(); + for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { + if (isValidMetaTileEntity(tHatch)) { + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1)); + } + } + for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) { + if (isValidMetaTileEntity(tHatch)) { + for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + } + return rList; + } + + public ArrayList<FluidStack> getStoredFluids() { + final ArrayList<FluidStack> rList = new ArrayList<>(); + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch) && (tHatch.getFillableStack() != null)) { + rList.add(tHatch.getFillableStack()); + } + } + return rList; + } + + public ArrayList<ItemStack> getStoredInputs() { + final ArrayList<ItemStack> rList = new ArrayList<>(); + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch) && (tHatch.getBaseMetaTileEntity().getStackInSlot(0) != null)) { + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(0)); + } + } + for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null) { + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + } + } + return rList; + } + + public GT_Recipe_Map getRecipeMap() { + return null; + } + + public void updateSlots() { + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + if (isValidMetaTileEntity(tHatch)) { + tHatch.updateSlots(); + } + } + for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { + if (isValidMetaTileEntity(tHatch)) { + tHatch.updateSlots(); + } + } + } + + public boolean addToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { + return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { + return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { + return this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { + return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { + return this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); + } + return false; + } + + public boolean addMaintenanceToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + } + return false; + } + + public boolean addEnergyInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + } + return false; + } + + public boolean addDynamoToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); + } + return false; + } + + public boolean addMufflerToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); + } + return false; + } + + public boolean addInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = this.getRecipeMap(); + return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = this.getRecipeMap(); + return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + } + return false; + } + + public boolean addOutputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); + } + return false; + } + + @Override + public String[] getInfoData() { + return new String[]{"Progress:", (this.mProgresstime / 20) + "secs", (this.mMaxProgresstime / 20) + "secs", "Efficiency:", (this.mEfficiency / 100.0F) + "%", "Problems:", "" + (this.getIdealStatus() - this.getRepairStatus())}; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return false; + } + + /** + * Called whenever the Machine successfully started a Process, useful for Sound Effects + */ + public void startProcess() { + // + } + + /** + * Called whenever the Machine successfully finished a Process, useful for Sound Effects + */ + public void endProcess() { + // + } + + /** + * Called whenever the Machine aborted a Process, useful for Sound Effects + */ + public void abortProcess() { + // + } + + public int getValidOutputSlots(final GT_Recipe.GT_Recipe_Map sRecipeMap, final ItemStack[] sInputs){ + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + final GT_Recipe tRecipe = sRecipeMap.findRecipe(this.getBaseMetaTileEntity(), false, 9223372036854775807L, null, sInputs); + final ArrayList<Pair<GT_MetaTileEntity_Hatch_OutputBus, Integer>> rList = new ArrayList<>(); int tTotalHatches=0; - for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) { + for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) { int hatchUsedSlotCount = 0; if (isValidMetaTileEntity(tHatch)) { tTotalHatches++; for (int i=0; i<tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null){hatchUsedSlotCount++;} + if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null){hatchUsedSlotCount++;} } - rList.add(new Pair<GT_MetaTileEntity_Hatch_OutputBus, Integer>(tHatch, hatchUsedSlotCount)); + rList.add(new Pair<>(tHatch, hatchUsedSlotCount)); } } - boolean[] mValidOutputSlots = new boolean[tTotalHatches]; + final boolean[] mValidOutputSlots = new boolean[tTotalHatches]; int arrayPos=0; - for (Pair<GT_MetaTileEntity_Hatch_OutputBus, Integer> IE : rList) { - GT_MetaTileEntity_Hatch_OutputBus vTE = IE.getKey(); - int vUsedSlots = IE.getValue(); - if (vUsedSlots == 0){mValidOutputSlots[arrayPos] = true;} - else if (vUsedSlots < vTE.getSizeInventory()){ - int outputItemCount = tRecipe.mOutputs.length; - if (vUsedSlots < vTE.getSizeInventory()-outputItemCount){mValidOutputSlots[arrayPos] = true;} - else if (vUsedSlots >= vTE.getSizeInventory()-outputItemCount){ - if (vUsedSlots > vTE.getSizeInventory()-outputItemCount){if (arrayPos == tTotalHatches){return 0;} /*Change to Hatch total*/ } - } - } + for (final Pair<GT_MetaTileEntity_Hatch_OutputBus, Integer> IE : rList) { + final GT_MetaTileEntity_Hatch_OutputBus vTE = IE.getKey(); + final int vUsedSlots = IE.getValue(); + if (vUsedSlots == 0){mValidOutputSlots[arrayPos] = true;} + else if (vUsedSlots < vTE.getSizeInventory()){ + final int outputItemCount = tRecipe.mOutputs.length; + if (vUsedSlots < (vTE.getSizeInventory()-outputItemCount)){mValidOutputSlots[arrayPos] = true;} + else if (vUsedSlots >= (vTE.getSizeInventory()-outputItemCount)){ + if (vUsedSlots > (vTE.getSizeInventory()-outputItemCount)){if (arrayPos == tTotalHatches){return 0;} /*Change to Hatch total*/ } + } + } //Hatch is full if (vUsedSlots == vTE.getSizeInventory()){ mValidOutputSlots[arrayPos] = false; @@ -850,9 +969,9 @@ public abstract class GregtechMeta_MultiBlockBase extends MetaTileEntity { } int tValidOutputSlots = 0; for (int cr=0;cr<mValidOutputSlots.length;cr++){if (mValidOutputSlots[cr]){tValidOutputSlots++;}} - if (tValidOutputSlots >= 1) {return tValidOutputSlots;} - return 0; - } - - + if (tValidOutputSlots >= 1) {return tValidOutputSlots;} + return 0; + } + + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java index f8a0437265..717616ff71 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java @@ -1,17 +1,18 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators; import static gregtech.api.enums.GT_Values.V; + +import java.util.Collection; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.*; +import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_DeluxeTank; - -import java.util.Collection; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -21,41 +22,41 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ private boolean useFuel = false; - public GregtechDoubleFuelGeneratorBase(int aID, String aName, String aNameRegional, int aTier, String aDescription, ITexture... aTextures) { + public GregtechDoubleFuelGeneratorBase(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final ITexture... aTextures) { super(aID, aName, aNameRegional, aTier, 4, aDescription, aTextures); } - public GregtechDoubleFuelGeneratorBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GregtechDoubleFuelGeneratorBase(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, 4, aDescription, aTextures); } @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[10][17][]; + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + final ITexture[][][] rTextures = new ITexture[10][17][]; for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = getFront(i); - rTextures[1][i + 1] = getBack(i); - rTextures[2][i + 1] = getBottom(i); - rTextures[3][i + 1] = getTop(i); - rTextures[4][i + 1] = getSides(i); - rTextures[5][i + 1] = getFrontActive(i); - rTextures[6][i + 1] = getBackActive(i); - rTextures[7][i + 1] = getBottomActive(i); - rTextures[8][i + 1] = getTopActive(i); - rTextures[9][i + 1] = getSidesActive(i); + rTextures[0][i + 1] = this.getFront(i); + rTextures[1][i + 1] = this.getBack(i); + rTextures[2][i + 1] = this.getBottom(i); + rTextures[3][i + 1] = this.getTop(i); + rTextures[4][i + 1] = this.getSides(i); + rTextures[5][i + 1] = this.getFrontActive(i); + rTextures[6][i + 1] = this.getBackActive(i); + rTextures[7][i + 1] = this.getBottomActive(i); + rTextures[8][i + 1] = this.getTopActive(i); + rTextures[9][i + 1] = this.getSidesActive(i); } return rTextures; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; } @Override public String[] getDescription() { - return new String[]{mDescription, "Fuel Efficiency: " + getEfficiency() + "%", CORE.GT_Tooltip}; + return new String[]{this.mDescription, "Fuel Efficiency: " + this.getEfficiency() + "%", CORE.GT_Tooltip}; } @@ -67,7 +68,7 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ }*/ @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()){ Utils.LOG_WARNING("Entity is Client side, simply returning true"); return true; @@ -75,50 +76,50 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ Utils.LOG_WARNING("Entity is not Client side, opening entity Container and by extension, it's GUI, then returning true"); aBaseMetaTileEntity.openGUI(aPlayer); return true; - } + } - public ITexture[] getFront(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + public ITexture[] getFront(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; } - public ITexture[] getBack(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + public ITexture[] getBack(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; } - public ITexture[] getBottom(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + public ITexture[] getBottom(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; } - public ITexture[] getTop(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + public ITexture[] getTop(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; } - public ITexture[] getSides(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + public ITexture[] getSides(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; } - public ITexture[] getFrontActive(byte aColor) { - return getFront(aColor); + public ITexture[] getFrontActive(final byte aColor) { + return this.getFront(aColor); } - public ITexture[] getBackActive(byte aColor) { - return getBack(aColor); + public ITexture[] getBackActive(final byte aColor) { + return this.getBack(aColor); } - public ITexture[] getBottomActive(byte aColor) { - return getBottom(aColor); + public ITexture[] getBottomActive(final byte aColor) { + return this.getBottom(aColor); } - public ITexture[] getTopActive(byte aColor) { - return getTop(aColor); + public ITexture[] getTopActive(final byte aColor) { + return this.getTop(aColor); } - public ITexture[] getSidesActive(byte aColor) { - return getSides(aColor); + public ITexture[] getSidesActive(final byte aColor) { + return this.getSides(aColor); } @Override - public boolean isFacingValid(byte aSide) { + public boolean isFacingValid(final byte aSide) { return aSide > 1; } @@ -128,7 +129,7 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ } @Override - public boolean isValidSlot(int aIndex) { + public boolean isValidSlot(final int aIndex) { return aIndex < 2; } @@ -138,43 +139,43 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ } @Override - public boolean isOutputFacing(byte aSide) { + public boolean isOutputFacing(final byte aSide) { return true; } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { + public boolean isAccessAllowed(final EntityPlayer aPlayer) { return true; } @Override public long maxEUOutput() { - return getBaseMetaTileEntity().isAllowedToWork() ? V[mTier] : 0; + return this.getBaseMetaTileEntity().isAllowedToWork() ? V[this.mTier] : 0; } @Override public long maxEUStore() { - return Math.max(getEUVar(), V[mTier] * 115 + getMinimumStoredEU()); + return Math.max(this.getEUVar(), (V[this.mTier] * 115) + this.getMinimumStoredEU()); } @Override public boolean doesFillContainers() { - return getBaseMetaTileEntity().isAllowedToWork(); + return this.getBaseMetaTileEntity().isAllowedToWork(); } @Override public boolean doesEmptyContainers() { - return getBaseMetaTileEntity().isAllowedToWork(); + return this.getBaseMetaTileEntity().isAllowedToWork(); } @Override public boolean canTankBeFilled() { - return getBaseMetaTileEntity().isAllowedToWork(); + return this.getBaseMetaTileEntity().isAllowedToWork(); } @Override public boolean canTankBeEmptied() { - return getBaseMetaTileEntity().isAllowedToWork(); + return this.getBaseMetaTileEntity().isAllowedToWork(); } @Override @@ -188,53 +189,54 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ } @Override - public boolean isFluidInputAllowed(FluidStack aFluid) { - return getFuelValue(aFluid) > 0; + public boolean isFluidInputAllowed(final FluidStack aFluid) { + return this.getFuelValue(aFluid) > 0; } - + @Override public long getMinimumStoredEU() { - return 512; - } + return 512; + } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10 == 0) { - if (mFluid == null) { - if (aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() + getMinimumStoredEU()) { - mInventory[getStackDisplaySlot()] = null; + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && ((aTick % 10) == 0)) { + if (this.mFluid == null) { + if (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUOutput() + this.getMinimumStoredEU())) { + this.mInventory[this.getStackDisplaySlot()] = null; } else { - if (mInventory[getStackDisplaySlot()] == null) - mInventory[getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); - mInventory[getStackDisplaySlot()].setStackDisplayName("Generating: " + (aBaseMetaTileEntity.getUniversalEnergyStored() - getMinimumStoredEU()) + " EU"); + if (this.mInventory[this.getStackDisplaySlot()] == null) { + this.mInventory[this.getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); + } + this.mInventory[this.getStackDisplaySlot()].setStackDisplayName("Generating: " + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + " EU"); } } else { - if (mFluid != null && mFluid2 != null){ - int tFuelValue = getFuelValue(mFluid), tConsumed = consumedFluidPerOperation(mFluid); - int tFuelValue2 = getFuelValue(mFluid2), tConsumed2 = consumedFluidPerOperation(mFluid2); - if ((tFuelValue > 0 && tConsumed > 0 && mFluid.amount > tConsumed)/* && (tFuelValue2 > 0 && tConsumed2 > 0 && mFluid2.amount > tConsumed2)*/) { + if ((this.mFluid != null) && (this.mFluid2 != null)){ + final int tFuelValue = this.getFuelValue(this.mFluid), tConsumed = this.consumedFluidPerOperation(this.mFluid); + final int tFuelValue2 = this.getFuelValue(this.mFluid2), tConsumed2 = this.consumedFluidPerOperation(this.mFluid2); + if (((tFuelValue > 0) && (tConsumed > 0) && (this.mFluid.amount > tConsumed))/* && (tFuelValue2 > 0 && tConsumed2 > 0 && mFluid2.amount > tConsumed2)*/) { Utils.LOG_WARNING("tFuelValue: "+tFuelValue); Utils.LOG_WARNING("tConsumed: "+tConsumed); - Utils.LOG_WARNING("mFluid.name: "+mFluid.getFluid().getName()); - Utils.LOG_WARNING("mFluid.amount: "+mFluid.amount); - Utils.LOG_WARNING("mFluid.amount > tConsumed: "+(mFluid.amount > tConsumed)); + Utils.LOG_WARNING("mFluid.name: "+this.mFluid.getFluid().getName()); + Utils.LOG_WARNING("mFluid.amount: "+this.mFluid.amount); + Utils.LOG_WARNING("mFluid.amount > tConsumed: "+(this.mFluid.amount > tConsumed)); Utils.LOG_WARNING("========================================================="); Utils.LOG_WARNING("tFuelValue2: "+tFuelValue2); Utils.LOG_WARNING("tConsumed2: "+tConsumed2); - Utils.LOG_WARNING("mFluid2.name: "+mFluid2.getFluid().getName()); - Utils.LOG_WARNING("mFluid2.amount: "+mFluid2.amount); - Utils.LOG_WARNING("mFluid2.amount > tConsumed2: "+(mFluid2.amount > tConsumed2)); - long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUOutput() * 30 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); - long tFluidAmountToUse2 = Math.min(mFluid2.amount / tConsumed2, (maxEUOutput() * 30 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue2); + Utils.LOG_WARNING("mFluid2.name: "+this.mFluid2.getFluid().getName()); + Utils.LOG_WARNING("mFluid2.amount: "+this.mFluid2.amount); + Utils.LOG_WARNING("mFluid2.amount > tConsumed2: "+(this.mFluid2.amount > tConsumed2)); + long tFluidAmountToUse = Math.min(this.mFluid.amount / tConsumed, (((this.maxEUOutput() * 30) + this.getMinimumStoredEU()) - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); + long tFluidAmountToUse2 = Math.min(this.mFluid2.amount / tConsumed2, (((this.maxEUOutput() * 30) + this.getMinimumStoredEU()) - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue2); if (tFluidAmountToUse <= 0){ /*if ((mFluid.amount / tConsumed) == getCapacity()){ tFluidAmountToUse = 1; }*/ - + if (aBaseMetaTileEntity.getUniversalEnergyStored() <= (aBaseMetaTileEntity.getEUCapacity()-aBaseMetaTileEntity.getUniversalEnergyStored())){ tFluidAmountToUse = 1; Utils.LOG_WARNING("========================================================="); @@ -242,7 +244,7 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ Utils.LOG_WARNING("========================================================="); } } - + if (tFluidAmountToUse2 <= 0){ /*if ((mFluid2.amount / tConsumed) == getCapacity()){ tFluidAmountToUse2 = 1; @@ -254,7 +256,7 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ Utils.LOG_WARNING("========================================================="); } } - + Utils.LOG_WARNING("========================================================="); Utils.LOG_WARNING("tFluidAmountToUse: "+tFluidAmountToUse); Utils.LOG_WARNING("========================================================="); @@ -263,13 +265,13 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ Utils.LOG_WARNING("maxEUOutput() * 20 + getMinimumStoredEU(): "+(maxEUOutput() * 30 + getMinimumStoredEU())); Utils.LOG_WARNING("maxEUOutput(): "+maxEUOutput()); Utils.LOG_WARNING("maxEUOutput() * 20: "+(maxEUOutput() * 30)); - Utils.LOG_WARNING("getMinimumStoredEU(): "+(getMinimumStoredEU())); - Utils.LOG_WARNING("aBaseMetaTileEntity.getUniversalEnergyStored(): "+(aBaseMetaTileEntity.getUniversalEnergyStored())); - Utils.LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()): "+((maxEUOutput() * 30 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()))); + Utils.LOG_WARNING("getMinimumStoredEU(): "+(getMinimumStoredEU())); + Utils.LOG_WARNING("aBaseMetaTileEntity.getUniversalEnergyStored(): "+(aBaseMetaTileEntity.getUniversalEnergyStored())); + Utils.LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()): "+((maxEUOutput() * 30 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()))); Utils.LOG_WARNING("tFuelValue: "+(tFuelValue)); Utils.LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue): "+((maxEUOutput() * 30 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue)); - */ - + */ + Utils.LOG_WARNING("========================================================="); Utils.LOG_WARNING("tFluidAmountToUse2: "+tFluidAmountToUse2); Utils.LOG_WARNING("========================================================="); @@ -278,35 +280,35 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ Utils.LOG_WARNING("maxEUOutput() * 20 + getMinimumStoredEU(): "+(maxEUOutput() * 30 + getMinimumStoredEU())); Utils.LOG_WARNING("maxEUOutput(): "+maxEUOutput()); Utils.LOG_WARNING("maxEUOutput() * 20: "+(maxEUOutput() * 30)); - Utils.LOG_WARNING("getMinimumStoredEU(): "+(getMinimumStoredEU())); - Utils.LOG_WARNING("aBaseMetaTileEntity.getUniversalEnergyStored(): "+(aBaseMetaTileEntity.getUniversalEnergyStored())); - Utils.LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()): "+((maxEUOutput() * 30 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()))); + Utils.LOG_WARNING("getMinimumStoredEU(): "+(getMinimumStoredEU())); + Utils.LOG_WARNING("aBaseMetaTileEntity.getUniversalEnergyStored(): "+(aBaseMetaTileEntity.getUniversalEnergyStored())); + Utils.LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()): "+((maxEUOutput() * 30 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()))); Utils.LOG_WARNING("tFuelValue2: "+(tFuelValue2)); Utils.LOG_WARNING("(maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue2): "+((maxEUOutput() * 30 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue2)); - */ - if ((tFluidAmountToUse > 0 && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) && (tFluidAmountToUse2 > 0 && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse2 * tFuelValue2, true))){ + */ + if (((tFluidAmountToUse > 0) && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) && ((tFluidAmountToUse2 > 0) && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse2 * tFuelValue2, true))){ Utils.LOG_WARNING("tFuelValue: "+tFuelValue); Utils.LOG_WARNING("tConsumed: "+tConsumed); - Utils.LOG_WARNING("mFluid.name: "+mFluid.getFluid().getName()); - Utils.LOG_WARNING("mFluid.amount: "+mFluid.amount); - Utils.LOG_WARNING("mFluid.amount > tConsumed: "+(mFluid.amount > tConsumed)); + Utils.LOG_WARNING("mFluid.name: "+this.mFluid.getFluid().getName()); + Utils.LOG_WARNING("mFluid.amount: "+this.mFluid.amount); + Utils.LOG_WARNING("mFluid.amount > tConsumed: "+(this.mFluid.amount > tConsumed)); Utils.LOG_WARNING("========================================================="); Utils.LOG_WARNING("tFuelValue2: "+tFuelValue2); Utils.LOG_WARNING("tConsumed2: "+tConsumed2); - Utils.LOG_WARNING("mFluid2.name: "+mFluid2.getFluid().getName()); - Utils.LOG_WARNING("mFluid2.amount: "+mFluid2.amount); - Utils.LOG_WARNING("mFluid2.amount > tConsumed2: "+(mFluid2.amount > tConsumed2)); - - if (useFuel){ - mFluid.amount -= tFluidAmountToUse * tConsumed; - mFluid2.amount -= tFluidAmountToUse2 * tConsumed2; - useFuel = false; + Utils.LOG_WARNING("mFluid2.name: "+this.mFluid2.getFluid().getName()); + Utils.LOG_WARNING("mFluid2.amount: "+this.mFluid2.amount); + Utils.LOG_WARNING("mFluid2.amount > tConsumed2: "+(this.mFluid2.amount > tConsumed2)); + + if (this.useFuel){ + this.mFluid.amount -= tFluidAmountToUse * tConsumed; + this.mFluid2.amount -= tFluidAmountToUse2 * tConsumed2; + this.useFuel = false; } else { - useFuel = true; + this.useFuel = true; } } @@ -318,80 +320,98 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ } } else { - /*Utils.LOG_WARNING("(tFuelValue > 0 && tConsumed > 0 && mFluid.amount > tConsumed) && (tFuelValue2 > 0 && tConsumed2 > 0 && mFluid2.amount > tConsumed2)"); + /*Utils.LOG_WARNING("(tFuelValue > 0 && tConsumed > 0 && mFluid.amount > tConsumed) && (tFuelValue2 > 0 && tConsumed2 > 0 && mFluid2.amount > tConsumed2)"); Utils.LOG_WARNING("tFuelValue: "+tFuelValue); Utils.LOG_WARNING("tConsumed: "+tConsumed); Utils.LOG_WARNING("mFluid.amount: "+mFluid.amount); - Utils.LOG_WARNING("mFluid.amount > tConsumed: "+(mFluid.amount > tConsumed)); + Utils.LOG_WARNING("mFluid.amount > tConsumed: "+(mFluid.amount > tConsumed)); Utils.LOG_WARNING("========================================================="); Utils.LOG_WARNING("tFuelValue2: "+tFuelValue2); Utils.LOG_WARNING("tConsumed2: "+tConsumed2); Utils.LOG_WARNING("mFluid2.amount: "+mFluid2.amount); - Utils.LOG_WARNING("mFluid2.amount > tConsumed2: "+(mFluid2.amount > tConsumed2)); */ + Utils.LOG_WARNING("mFluid2.amount > tConsumed2: "+(mFluid2.amount > tConsumed2)); */ } - } + } else { Utils.LOG_WARNING("One mFluid is null"); - if (mFluid != null) + if (this.mFluid != null) { Utils.LOG_WARNING("mFluid1 is not null"); - if (mFluid2 != null) + } + if (this.mFluid2 != null) { Utils.LOG_WARNING("mFluid2 is not null"); + } } } - if (mInventory[getInputSlot()] != null && aBaseMetaTileEntity.getUniversalEnergyStored() < (maxEUOutput() * 20 + getMinimumStoredEU()) && GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true) == null) { - int tFuelValue = getFuelValue(mInventory[getInputSlot()]); + if ((this.mInventory[this.getInputSlot()] != null) && (aBaseMetaTileEntity.getUniversalEnergyStored() < ((this.maxEUOutput() * 20) + this.getMinimumStoredEU())) && (GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true) == null)) { + final int tFuelValue = this.getFuelValue(this.mInventory[this.getInputSlot()]); if (tFuelValue > 0) { - ItemStack tEmptyContainer = getEmptyContainer(mInventory[getInputSlot()]); - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tEmptyContainer)) { + final ItemStack tEmptyContainer = this.getEmptyContainer(this.mInventory[this.getInputSlot()]); + if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tEmptyContainer)) { aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true); - aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); } } } } - if (aBaseMetaTileEntity.isServerSide()) - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); + if (aBaseMetaTileEntity.isServerSide()) { + aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && (aBaseMetaTileEntity.getUniversalEnergyStored() >= (this.maxEUOutput() + this.getMinimumStoredEU()))); + } } public abstract GT_Recipe_Map getRecipes(); public abstract int getEfficiency(); - public int consumedFluidPerOperation(FluidStack aLiquid) { + public int consumedFluidPerOperation(final FluidStack aLiquid) { return 1; } - public int getFuelValue(FluidStack aLiquid) { - if (aLiquid == null || getRecipes() == null) return 0; + public int getFuelValue(final FluidStack aLiquid) { + if ((aLiquid == null) || (this.getRecipes() == null)) { + return 0; + } FluidStack tLiquid; - Collection<GT_Recipe> tRecipeList = getRecipes().mRecipeList; - if (tRecipeList != null) for (GT_Recipe tFuel : tRecipeList) - if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null) - if (aLiquid.isFluidEqual(tLiquid)) - return (int) (((long) tFuel.mSpecialValue * getEfficiency() * consumedFluidPerOperation(tLiquid)) / 100); + final Collection<GT_Recipe> tRecipeList = this.getRecipes().mRecipeList; + if (tRecipeList != null) { + for (final GT_Recipe tFuel : tRecipeList) { + if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null) { + if (aLiquid.isFluidEqual(tLiquid)) { + return (int) (((long) tFuel.mSpecialValue * this.getEfficiency() * this.consumedFluidPerOperation(tLiquid)) / 100); + } + } + } + } return 0; } - public int getFuelValue(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack) || getRecipes() == null) return 0; - GT_Recipe tFuel = getRecipes().findRecipe(getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); - if (tFuel != null) return (int) ((tFuel.mSpecialValue * 1000L * getEfficiency()) / 100); + public int getFuelValue(final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack) || (this.getRecipes() == null)) { + return 0; + } + final GT_Recipe tFuel = this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + if (tFuel != null) { + return (int) ((tFuel.mSpecialValue * 1000L * this.getEfficiency()) / 100); + } return 0; } - public ItemStack getEmptyContainer(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack) || getRecipes() == null) return null; - GT_Recipe tFuel = getRecipes().findRecipe(getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); - if (tFuel != null) return GT_Utility.copy(tFuel.getOutput(0)); + public ItemStack getEmptyContainer(final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack) || (this.getRecipes() == null)) { + return null; + } + final GT_Recipe tFuel = this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + if (tFuel != null) { + return GT_Utility.copy(tFuel.getOutput(0)); + } return GT_Utility.getContainerItem(aStack, true); } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (getFuelValue(aStack) > 0 || getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0); + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && ((this.getFuelValue(aStack) > 0) || (this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0)); } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java index f1c0b6fa60..f458f73cb9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java @@ -19,308 +19,337 @@ import net.minecraftforge.fluids.IFluidHandler; public abstract class GregtechMetaBoilerBase extends GT_MetaTileEntity_BasicTank { - public int mTemperature = 20; - public int mProcessingEnergy = 0; - public int mLossTimer = 0; - public FluidStack mSteam = null; - public boolean mHadNoWater = false; - public long RI = MathUtils.randLong(5L, 30L); - - public GregtechMetaBoilerBase(int aID, String aName, String aNameRegional, String aDescription, ITexture... aTextures) - { - super(aID, aName, aNameRegional, 0, 4, aDescription, aTextures); - } - - public GregtechMetaBoilerBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) - { - super(aName, aTier, 4, aDescription, aTextures); - } - - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) - { - ITexture[] tmp = mTextures[aSide >= 2 ? aSide != aFacing ? 2 : ((byte)(aActive ? 4 : 3)) : aSide][aColorIndex + 1]; - //mTextures[(aSide==aFacing?(aActive?4:3):aSide==GT_Utility.getOppositeSide(aFacing)?2:aSide==0?0:aSide==1?1:2)][aColorIndex+1]; - if(aSide!=aFacing&&tmp.length==2){ - tmp = new ITexture[]{tmp[0]}; - } - return tmp; - } - - public boolean isElectric() - { - return false; - } - - public boolean isPneumatic() - { - return false; - } - - public boolean isSteampowered() - { - return false; - } - - public boolean isSimpleMachine() - { - return false; - } - - public boolean isFacingValid(byte aFacing) - { - return aFacing > 1; - } - - public boolean isAccessAllowed(EntityPlayer aPlayer) - { - return true; - } - - public boolean isValidSlot(int aIndex) - { - return true; - } - - public int getProgresstime() - { - return this.mTemperature; - } - - public int maxProgresstime() - { - return 500; - } - - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) - { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - if (aPlayer != null) { - if (GT_Utility.areStacksEqual(aPlayer.getCurrentEquippedItem(), new ItemStack(Items.water_bucket, 1))) - { - fill(Materials.Water.getFluid(1000 * aPlayer.getCurrentEquippedItem().stackSize), true); - aPlayer.getCurrentEquippedItem().func_150996_a(Items.bucket); - } - else - { - aBaseMetaTileEntity.openGUI(aPlayer); - } - } - return true; - } - - public boolean doesFillContainers() - { - return true; - } - - public boolean doesEmptyContainers() - { - return true; - } - - public boolean canTankBeFilled() - { - return true; - } - - public boolean canTankBeEmptied() - { - return true; - } - - public boolean displaysItemStack() - { - return false; - } - - public boolean displaysStackSize() - { - return false; - } - - public boolean isFluidInputAllowed(FluidStack aFluid) - { - return GT_ModHandler.isWater(aFluid); - } - - public FluidStack getDrainableStack() - { - return this.mSteam; - } - - public FluidStack setDrainableStack(FluidStack aFluid) - { - this.mSteam = aFluid;return this.mSteam; - } - - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCover) - { - return GregTech_API.getCoverBehavior(aCover.toStack()).isSimpleCover(); - } - - public void saveNBTData(NBTTagCompound aNBT) - { - super.saveNBTData(aNBT); - aNBT.setInteger("mLossTimer", this.mLossTimer); - aNBT.setInteger("mTemperature", this.mTemperature); - aNBT.setInteger("mProcessingEnergy", this.mProcessingEnergy); - if (this.mSteam != null) { - try - { - aNBT.setTag("mSteam", this.mSteam.writeToNBT(new NBTTagCompound())); - } - catch (Throwable e) {} - } - } - - public void loadNBTData(NBTTagCompound aNBT) - { - super.loadNBTData(aNBT); - this.mLossTimer = aNBT.getInteger("mLossTimer"); - this.mTemperature = aNBT.getInteger("mTemperature"); - this.mProcessingEnergy = aNBT.getInteger("mProcessingEnergy"); - this.mSteam = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mSteam")); - } - - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) - { - if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) - { - if (this.mTemperature <= 20) - { - this.mTemperature = 20; - this.mLossTimer = 0; - } - if (++this.mLossTimer > 40) - { - this.mTemperature -= 1; - this.mLossTimer = 0; - } - for (byte i = 1; (this.mSteam != null) && (i < 6); i = (byte)(i + 1)) { - if (i != aBaseMetaTileEntity.getFrontFacing()) - { - IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i); - if (tTileEntity != null) - { - FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false); - if (tDrained != null) - { - int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false); - if (tFilledAmount > 0) { - tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true); - } - } - } - } - } - if (aTick % 10L == 0L) { - if (this.mTemperature > 100) - { - if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) - { - this.mHadNoWater = true; - } - else - { - if (this.mHadNoWater) - { - aBaseMetaTileEntity.doExplosion(2048L); - return; - } - this.mFluid.amount -= 1; - if (this.mSteam == null) { - this.mSteam = GT_ModHandler.getSteam(150L); - } else if (GT_ModHandler.isSteam(this.mSteam)) { - this.mSteam.amount += 150; - } else { - this.mSteam = GT_ModHandler.getSteam(150L); - } - } - } - else { - this.mHadNoWater = false; - } - } - if ((this.mSteam != null) && - (this.mSteam.amount > 32000)) - { - sendSound((byte)1); - this.mSteam.amount = 24000; - } - if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && - (this.mInventory[2] != null)) { - if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Coal)))) - { - this.mProcessingEnergy += 160; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { - aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); - } - } - else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Charcoal))) - { - this.mProcessingEnergy += 160; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { - aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); - } - } - else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke")) - { - this.mProcessingEnergy += 640; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(2) == 0) { - aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); - } - } - else if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Lignite)))) - { - this.mProcessingEnergy += 40; - aBaseMetaTileEntity.decrStackSize(2, 1); - if (aBaseMetaTileEntity.getRandomNumber(8) == 0) { - aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); - } - } - } - if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L)) - { - this.mProcessingEnergy -= 2; - this.mTemperature += 1; - } - aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); - } - } - - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) - { - return (aIndex == 1) || (aIndex == 3); - } - - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) - { - return aIndex == 2; - } - - public void doSound(byte aIndex, double aX, double aY, double aZ) - { - if (aIndex == 1) - { - GT_Utility.doSoundAtClient((String)GregTech_API.sSoundList.get(Integer.valueOf(4)), 2, 1.0F, aX, aY, aZ); - for (int l = 0; l < 8; l++) { - getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5D + Math.random(), aY, aZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D); - } - } - } - - public int getCapacity() - { - return 16000; - } - - public int getTankPressure() - { - return 100; - } + public int mTemperature = 20; + public int mProcessingEnergy = 0; + public int mLossTimer = 0; + public FluidStack mSteam = null; + public boolean mHadNoWater = false; + public long RI = MathUtils.randLong(5L, 30L); + + public GregtechMetaBoilerBase(final int aID, final String aName, final String aNameRegional, final String aDescription, final ITexture... aTextures) + { + super(aID, aName, aNameRegional, 0, 4, aDescription, aTextures); + } + + public GregtechMetaBoilerBase(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) + { + super(aName, aTier, 4, aDescription, aTextures); + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) + { + ITexture[] tmp = this.mTextures[aSide >= 2 ? aSide != aFacing ? 2 : ((byte)(aActive ? 4 : 3)) : aSide][aColorIndex + 1]; + //mTextures[(aSide==aFacing?(aActive?4:3):aSide==GT_Utility.getOppositeSide(aFacing)?2:aSide==0?0:aSide==1?1:2)][aColorIndex+1]; + if((aSide!=aFacing)&&(tmp.length==2)){ + tmp = new ITexture[]{tmp[0]}; + } + return tmp; + } + + @Override + public boolean isElectric() + { + return false; + } + + @Override + public boolean isPneumatic() + { + return false; + } + + @Override + public boolean isSteampowered() + { + return false; + } + + @Override + public boolean isSimpleMachine() + { + return false; + } + + @Override + public boolean isFacingValid(final byte aFacing) + { + return aFacing > 1; + } + + @Override + public boolean isAccessAllowed(final EntityPlayer aPlayer) + { + return true; + } + + @Override + public boolean isValidSlot(final int aIndex) + { + return true; + } + + @Override + public int getProgresstime() + { + return this.mTemperature; + } + + @Override + public int maxProgresstime() + { + return 500; + } + + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) + { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + if (aPlayer != null) { + if (GT_Utility.areStacksEqual(aPlayer.getCurrentEquippedItem(), new ItemStack(Items.water_bucket, 1))) + { + this.fill(Materials.Water.getFluid(1000 * aPlayer.getCurrentEquippedItem().stackSize), true); + aPlayer.getCurrentEquippedItem().func_150996_a(Items.bucket); + } + else + { + aBaseMetaTileEntity.openGUI(aPlayer); + } + } + return true; + } + + @Override + public boolean doesFillContainers() + { + return true; + } + + @Override + public boolean doesEmptyContainers() + { + return true; + } + + @Override + public boolean canTankBeFilled() + { + return true; + } + + @Override + public boolean canTankBeEmptied() + { + return true; + } + + @Override + public boolean displaysItemStack() + { + return false; + } + + @Override + public boolean displaysStackSize() + { + return false; + } + + @Override + public boolean isFluidInputAllowed(final FluidStack aFluid) + { + return GT_ModHandler.isWater(aFluid); + } + + @Override + public FluidStack getDrainableStack() + { + return this.mSteam; + } + + @Override + public FluidStack setDrainableStack(final FluidStack aFluid) + { + this.mSteam = aFluid;return this.mSteam; + } + + @Override + public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aCover) + { + return GregTech_API.getCoverBehavior(aCover.toStack()).isSimpleCover(); + } + + @Override + public void saveNBTData(final NBTTagCompound aNBT) + { + super.saveNBTData(aNBT); + aNBT.setInteger("mLossTimer", this.mLossTimer); + aNBT.setInteger("mTemperature", this.mTemperature); + aNBT.setInteger("mProcessingEnergy", this.mProcessingEnergy); + if (this.mSteam != null) { + try + { + aNBT.setTag("mSteam", this.mSteam.writeToNBT(new NBTTagCompound())); + } + catch (final Throwable e) {} + } + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) + { + super.loadNBTData(aNBT); + this.mLossTimer = aNBT.getInteger("mLossTimer"); + this.mTemperature = aNBT.getInteger("mTemperature"); + this.mProcessingEnergy = aNBT.getInteger("mProcessingEnergy"); + this.mSteam = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mSteam")); + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) + { + if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) + { + if (this.mTemperature <= 20) + { + this.mTemperature = 20; + this.mLossTimer = 0; + } + if (++this.mLossTimer > 40) + { + this.mTemperature -= 1; + this.mLossTimer = 0; + } + for (byte i = 1; (this.mSteam != null) && (i < 6); i = (byte)(i + 1)) { + if (i != aBaseMetaTileEntity.getFrontFacing()) + { + final IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i); + if (tTileEntity != null) + { + final FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false); + if (tDrained != null) + { + final int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false); + if (tFilledAmount > 0) { + tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true); + } + } + } + } + } + if ((aTick % 10L) == 0L) { + if (this.mTemperature > 100) + { + if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) + { + this.mHadNoWater = true; + } + else + { + if (this.mHadNoWater) + { + aBaseMetaTileEntity.doExplosion(2048L); + return; + } + this.mFluid.amount -= 1; + if (this.mSteam == null) { + this.mSteam = GT_ModHandler.getSteam(150L); + } else if (GT_ModHandler.isSteam(this.mSteam)) { + this.mSteam.amount += 150; + } else { + this.mSteam = GT_ModHandler.getSteam(150L); + } + } + } + else { + this.mHadNoWater = false; + } + } + if ((this.mSteam != null) && + (this.mSteam.amount > 32000)) + { + this.sendSound((byte)1); + this.mSteam.amount = 24000; + } + if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && + (this.mInventory[2] != null)) { + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Coal))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Coal)))) + { + this.mProcessingEnergy += 160; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { + aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); + } + } + else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Charcoal))) + { + this.mProcessingEnergy += 160; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(3) == 0) { + aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); + } + } + else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke")) + { + this.mProcessingEnergy += 640; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(2) == 0) { + aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 1L)); + } + } + else if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.gem.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dust.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.dustImpure.get(Materials.Lignite))) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.crushed.get(Materials.Lignite)))) + { + this.mProcessingEnergy += 40; + aBaseMetaTileEntity.decrStackSize(2, 1); + if (aBaseMetaTileEntity.getRandomNumber(8) == 0) { + aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); + } + } + } + if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && ((aTick % 12L) == 0L)) + { + this.mProcessingEnergy -= 2; + this.mTemperature += 1; + } + aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); + } + } + + @Override + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) + { + return (aIndex == 1) || (aIndex == 3); + } + + @Override + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) + { + return aIndex == 2; + } + + @Override + public void doSound(final byte aIndex, final double aX, final double aY, final double aZ) + { + if (aIndex == 1) + { + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(Integer.valueOf(4)), 2, 1.0F, aX, aY, aZ); + for (int l = 0; l < 8; l++) { + this.getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", (aX - 0.5D) + Math.random(), aY, (aZ - 0.5D) + Math.random(), 0.0D, 0.0D, 0.0D); + } + } + } + + @Override + public int getCapacity() + { + return 16000; + } + + @Override + public int getTankPressure() + { + return 100; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java index e43b7db9aa..c00ae258a3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators; import static gregtech.api.enums.GT_Values.V; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -9,140 +10,142 @@ import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; public abstract class GregtechMetaSolarGenerator extends GT_MetaTileEntity_BasicTank { - + public int mEfficiency; public int mProcessingEnergy = 0; public int mSolarCharge = 20; public int mLossTimer = 0; public static int sEnergyPerTick = 16; - - public GregtechMetaSolarGenerator(int aID, String aName, String aNameRegional, int aTier, String aDescription, ITexture... aTextures) { - super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); - } - - public GregtechMetaSolarGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = getFront(i); - rTextures[1][i + 1] = getBack(i); - rTextures[2][i + 1] = getBottom(i); - rTextures[3][i + 1] = getTop(i); - rTextures[4][i + 1] = getSides(i); - rTextures[5][i + 1] = getFrontActive(i); - rTextures[6][i + 1] = getBackActive(i); - rTextures[7][i + 1] = getBottomActive(i); - rTextures[8][i + 1] = getTopActive(i); - rTextures[9][i + 1] = getSidesActive(i); - } - return rTextures; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; - } - - @Override - public String[] getDescription() { - return new String[]{mDescription, "Efficiency: " + getEfficiency() + "%"}; - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - - public ITexture[] getFront(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getBack(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getBottom(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getTop(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getSides(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getFrontActive(byte aColor) { - return getFront(aColor); - } - - public ITexture[] getBackActive(byte aColor) { - return getBack(aColor); - } - - public ITexture[] getBottomActive(byte aColor) { - return getBottom(aColor); - } - - public ITexture[] getTopActive(byte aColor) { - return getTop(aColor); - } - - public ITexture[] getSidesActive(byte aColor) { - return getSides(aColor); - } - - @Override - public boolean isFacingValid(byte aSide) { - return aSide > 1; - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isValidSlot(int aIndex) { - return aIndex < 2; - } - - @Override - public boolean isEnetOutput() { - return true; - } - - @Override - public boolean isOutputFacing(byte aSide) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public long maxEUOutput() { - return getBaseMetaTileEntity().isAllowedToWork() ? V[mTier] : 0; - } - - @Override - public long maxEUStore() { - return Math.max(getEUVar(), V[mTier] * 40 + getMinimumStoredEU()); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick > 20L - && aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() + aBaseMetaTileEntity.getEUCapacity()) { + + public GregtechMetaSolarGenerator(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final ITexture... aTextures) { + super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); + } + + public GregtechMetaSolarGenerator(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + @Override + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + final ITexture[][][] rTextures = new ITexture[10][17][]; + for (byte i = -1; i < 16; i++) { + rTextures[0][i + 1] = this.getFront(i); + rTextures[1][i + 1] = this.getBack(i); + rTextures[2][i + 1] = this.getBottom(i); + rTextures[3][i + 1] = this.getTop(i); + rTextures[4][i + 1] = this.getSides(i); + rTextures[5][i + 1] = this.getFrontActive(i); + rTextures[6][i + 1] = this.getBackActive(i); + rTextures[7][i + 1] = this.getBottomActive(i); + rTextures[8][i + 1] = this.getTopActive(i); + rTextures[9][i + 1] = this.getSidesActive(i); + } + return rTextures; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; + } + + @Override + public String[] getDescription() { + return new String[]{this.mDescription, "Efficiency: " + this.getEfficiency() + "%"}; + } + + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + public ITexture[] getFront(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getBack(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getBottom(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getTop(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getSides(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getFrontActive(final byte aColor) { + return this.getFront(aColor); + } + + public ITexture[] getBackActive(final byte aColor) { + return this.getBack(aColor); + } + + public ITexture[] getBottomActive(final byte aColor) { + return this.getBottom(aColor); + } + + public ITexture[] getTopActive(final byte aColor) { + return this.getTop(aColor); + } + + public ITexture[] getSidesActive(final byte aColor) { + return this.getSides(aColor); + } + + @Override + public boolean isFacingValid(final byte aSide) { + return aSide > 1; + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isValidSlot(final int aIndex) { + return aIndex < 2; + } + + @Override + public boolean isEnetOutput() { + return true; + } + + @Override + public boolean isOutputFacing(final byte aSide) { + return true; + } + + @Override + public boolean isAccessAllowed(final EntityPlayer aPlayer) { + return true; + } + + @Override + public long maxEUOutput() { + return this.getBaseMetaTileEntity().isAllowedToWork() ? V[this.mTier] : 0; + } + + @Override + public long maxEUStore() { + return Math.max(this.getEUVar(), (V[this.mTier] * 40) + this.getMinimumStoredEU()); + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && (aTick > 20L) + && (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUOutput() + aBaseMetaTileEntity.getEUCapacity()))) { if (this.mSolarCharge <= 20) { this.mSolarCharge = 20; @@ -153,59 +156,59 @@ public abstract class GregtechMetaSolarGenerator extends GT_MetaTileEntity_Basic this.mLossTimer = 0; } - if (aTick % 25L == 0L) { + if ((aTick % 25L) == 0L) { if (this.mSolarCharge > 100) { - if ((this.mProcessingEnergy > 0) && (aBaseMetaTileEntity.isAllowedToWork()) && (aTick % 256L == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering() && aBaseMetaTileEntity.getUniversalEnergyStored() < (maxEUOutput() * 20 + getMinimumStoredEU()))) { - getBaseMetaTileEntity().increaseStoredEnergyUnits(sEnergyPerTick * getEfficiency() / 10, false); + if ((this.mProcessingEnergy > 0) && (aBaseMetaTileEntity.isAllowedToWork()) && ((aTick % 256L) == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering() && (aBaseMetaTileEntity.getUniversalEnergyStored() < ((this.maxEUOutput() * 20) + this.getMinimumStoredEU())))) { + this.getBaseMetaTileEntity().increaseStoredEnergyUnits((sEnergyPerTick * this.getEfficiency()) / 10, false); } } - } + } - if ((this.mSolarCharge < 500) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L)) { + if ((this.mSolarCharge < 500) && (this.mProcessingEnergy > 0) && ((aTick % 12L) == 0L)) { this.mProcessingEnergy -= 1; this.mSolarCharge += 1; } - if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && (aTick % 256L == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering())) { - boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() && aBaseMetaTileEntity.getBiome().rainfall > 0.0F; - mProcessingEnergy += bRain && aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4 || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8 : 1; + if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && ((aTick % 256L) == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering())) { + final boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() && (aBaseMetaTileEntity.getBiome().rainfall > 0.0F); + this.mProcessingEnergy += (bRain && (aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4)) || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8 : 1; } if (aBaseMetaTileEntity.isServerSide()){ - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); + aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && (aBaseMetaTileEntity.getUniversalEnergyStored() >= (this.maxEUOutput() + this.getMinimumStoredEU()))); } } } - public abstract int getEfficiency(); - - @Override - public boolean doesFillContainers() { - return false; - } - - @Override - public boolean doesEmptyContainers() { - return false; - } - - @Override - public boolean canTankBeFilled() { - return false; - } - - @Override - public boolean canTankBeEmptied() { - return false; - } - - @Override - public boolean displaysItemStack() { - return false; - } - - @Override - public boolean displaysStackSize() { - return false; - } + public abstract int getEfficiency(); + + @Override + public boolean doesFillContainers() { + return false; + } + + @Override + public boolean doesEmptyContainers() { + return false; + } + + @Override + public boolean canTankBeFilled() { + return false; + } + + @Override + public boolean canTankBeEmptied() { + return false; + } + + @Override + public boolean displaysItemStack() { + return false; + } + + @Override + public boolean displaysStackSize() { + return false; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java index 0047f7a9e8..160710b9eb 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java @@ -1,272 +1,292 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators; import static gregtech.api.enums.GT_Values.V; + +import java.util.Collection; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.util.*; +import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; - -import java.util.Collection; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_BasicTank { - + private boolean useFuel = false; - - public GregtechRocketFuelGeneratorBase(int aID, String aName, String aNameRegional, int aTier, String aDescription, ITexture... aTextures) { - super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); - } - - public GregtechRocketFuelGeneratorBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = getFront(i); - rTextures[1][i + 1] = getBack(i); - rTextures[2][i + 1] = getBottom(i); - rTextures[3][i + 1] = getTop(i); - rTextures[4][i + 1] = getSides(i); - rTextures[5][i + 1] = getFrontActive(i); - rTextures[6][i + 1] = getBackActive(i); - rTextures[7][i + 1] = getBottomActive(i); - rTextures[8][i + 1] = getTopActive(i); - rTextures[9][i + 1] = getSidesActive(i); - } - return rTextures; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; - } - - - @Override - public String[] getDescription() { - return new String[]{mDescription, "Fuel Efficiency: " + getEfficiency() + "%", CORE.GT_Tooltip}; - } - - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - - public ITexture[] getFront(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getBack(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getBottom(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getTop(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getSides(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; - } - - public ITexture[] getFrontActive(byte aColor) { - return getFront(aColor); - } - - public ITexture[] getBackActive(byte aColor) { - return getBack(aColor); - } - - public ITexture[] getBottomActive(byte aColor) { - return getBottom(aColor); - } - - public ITexture[] getTopActive(byte aColor) { - return getTop(aColor); - } - - public ITexture[] getSidesActive(byte aColor) { - return getSides(aColor); - } - - @Override - public boolean isFacingValid(byte aSide) { - return aSide > 1; - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isValidSlot(int aIndex) { - return aIndex < 2; - } - - @Override - public boolean isEnetOutput() { - return true; - } - - @Override - public boolean isOutputFacing(byte aSide) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public long maxEUOutput() { - return getBaseMetaTileEntity().isAllowedToWork() ? V[mTier] : 0; - } - - @Override - public long maxEUStore() { - return Math.max(getEUVar(), V[mTier] * 80 + getMinimumStoredEU()); - } - - @Override - public boolean doesFillContainers() { - return getBaseMetaTileEntity().isAllowedToWork(); - } - - @Override - public boolean doesEmptyContainers() { - return getBaseMetaTileEntity().isAllowedToWork(); - } - - @Override - public boolean canTankBeFilled() { - return getBaseMetaTileEntity().isAllowedToWork(); - } - - @Override - public boolean canTankBeEmptied() { - return getBaseMetaTileEntity().isAllowedToWork(); - } - - @Override - public boolean displaysItemStack() { - return true; - } - - @Override - public boolean displaysStackSize() { - return false; - } - - @Override - public boolean isFluidInputAllowed(FluidStack aFluid) { - return getFuelValue(aFluid) > 0; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10 == 0) { - if (mFluid == null) { - if (aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() + getMinimumStoredEU()) { - mInventory[getStackDisplaySlot()] = null; - } else { - if (mInventory[getStackDisplaySlot()] == null) - mInventory[getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); - mInventory[getStackDisplaySlot()].setStackDisplayName("Generating: " + (aBaseMetaTileEntity.getUniversalEnergyStored() - getMinimumStoredEU()) + " EU"); - } - } else { - int tFuelValue = getFuelValue(mFluid), tConsumed = consumedFluidPerOperation(mFluid); - if (tFuelValue > 0 && tConsumed > 0 && mFluid.amount > tConsumed) { - long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); - if (tFluidAmountToUse > 0 && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)){ - if (useFuel){ - mFluid.amount -= tFluidAmountToUse * tConsumed; - useFuel = false; - } - else { - useFuel = true; - } - } - } - } - if (mInventory[getInputSlot()] != null && aBaseMetaTileEntity.getUniversalEnergyStored() < (maxEUOutput() * 20 + getMinimumStoredEU()) && GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true) == null) { - int tFuelValue = getFuelValue(mInventory[getInputSlot()]); - if (tFuelValue > 0) { - ItemStack tEmptyContainer = getEmptyContainer(mInventory[getInputSlot()]); - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tEmptyContainer)) { - aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true); - aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); - } - } - } - } - - if (aBaseMetaTileEntity.isServerSide()) - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); - } - - public abstract GT_Recipe_Map getRecipes(); - - public abstract int getEfficiency(); - - public int consumedFluidPerOperation(FluidStack aLiquid) { - return 1; - } - - public int getFuelValue(FluidStack aLiquid) { - if (aLiquid == null || getRecipes() == null) return 0; - FluidStack tLiquid; - Collection<GT_Recipe> tRecipeList = getRecipes().mRecipeList; - if (tRecipeList != null) for (GT_Recipe tFuel : tRecipeList) - if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null) - if (aLiquid.isFluidEqual(tLiquid)) - return (int) (((long) tFuel.mSpecialValue * getEfficiency() * consumedFluidPerOperation(tLiquid)) / 100); - return 0; - } - - public int getFuelValue(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack) || getRecipes() == null) return 0; - GT_Recipe tFuel = getRecipes().findRecipe(getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); - if (tFuel != null) return (int) ((tFuel.mSpecialValue * 1000L * getEfficiency()) / 100); - return 0; - } - - public ItemStack getEmptyContainer(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack) || getRecipes() == null) return null; - GT_Recipe tFuel = getRecipes().findRecipe(getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); - if (tFuel != null) return GT_Utility.copy(tFuel.getOutput(0)); - return GT_Utility.getContainerItem(aStack, true); - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (getFuelValue(aStack) > 0 || getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0); - } - - @Override - public int getCapacity() { - return 32000; - } - - @Override - public int getTankPressure() { - return -100; - } + + public GregtechRocketFuelGeneratorBase(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final ITexture... aTextures) { + super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); + } + + public GregtechRocketFuelGeneratorBase(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + @Override + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + final ITexture[][][] rTextures = new ITexture[10][17][]; + for (byte i = -1; i < 16; i++) { + rTextures[0][i + 1] = this.getFront(i); + rTextures[1][i + 1] = this.getBack(i); + rTextures[2][i + 1] = this.getBottom(i); + rTextures[3][i + 1] = this.getTop(i); + rTextures[4][i + 1] = this.getSides(i); + rTextures[5][i + 1] = this.getFrontActive(i); + rTextures[6][i + 1] = this.getBackActive(i); + rTextures[7][i + 1] = this.getBottomActive(i); + rTextures[8][i + 1] = this.getTopActive(i); + rTextures[9][i + 1] = this.getSidesActive(i); + } + return rTextures; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; + } + + + @Override + public String[] getDescription() { + return new String[]{this.mDescription, "Fuel Efficiency: " + this.getEfficiency() + "%", CORE.GT_Tooltip}; + } + + + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + public ITexture[] getFront(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getBack(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getBottom(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getTop(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getSides(final byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getFrontActive(final byte aColor) { + return this.getFront(aColor); + } + + public ITexture[] getBackActive(final byte aColor) { + return this.getBack(aColor); + } + + public ITexture[] getBottomActive(final byte aColor) { + return this.getBottom(aColor); + } + + public ITexture[] getTopActive(final byte aColor) { + return this.getTop(aColor); + } + + public ITexture[] getSidesActive(final byte aColor) { + return this.getSides(aColor); + } + + @Override + public boolean isFacingValid(final byte aSide) { + return aSide > 1; + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isValidSlot(final int aIndex) { + return aIndex < 2; + } + + @Override + public boolean isEnetOutput() { + return true; + } + + @Override + public boolean isOutputFacing(final byte aSide) { + return true; + } + + @Override + public boolean isAccessAllowed(final EntityPlayer aPlayer) { + return true; + } + + @Override + public long maxEUOutput() { + return this.getBaseMetaTileEntity().isAllowedToWork() ? V[this.mTier] : 0; + } + + @Override + public long maxEUStore() { + return Math.max(this.getEUVar(), (V[this.mTier] * 80) + this.getMinimumStoredEU()); + } + + @Override + public boolean doesFillContainers() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + @Override + public boolean doesEmptyContainers() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + @Override + public boolean canTankBeFilled() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + @Override + public boolean canTankBeEmptied() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + @Override + public boolean displaysItemStack() { + return true; + } + + @Override + public boolean displaysStackSize() { + return false; + } + + @Override + public boolean isFluidInputAllowed(final FluidStack aFluid) { + return this.getFuelValue(aFluid) > 0; + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && ((aTick % 10) == 0)) { + if (this.mFluid == null) { + if (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUOutput() + this.getMinimumStoredEU())) { + this.mInventory[this.getStackDisplaySlot()] = null; + } else { + if (this.mInventory[this.getStackDisplaySlot()] == null) { + this.mInventory[this.getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); + } + this.mInventory[this.getStackDisplaySlot()].setStackDisplayName("Generating: " + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + " EU"); + } + } else { + final int tFuelValue = this.getFuelValue(this.mFluid), tConsumed = this.consumedFluidPerOperation(this.mFluid); + if ((tFuelValue > 0) && (tConsumed > 0) && (this.mFluid.amount > tConsumed)) { + final long tFluidAmountToUse = Math.min(this.mFluid.amount / tConsumed, (((this.maxEUOutput() * 20) + this.getMinimumStoredEU()) - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); + if ((tFluidAmountToUse > 0) && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)){ + if (this.useFuel){ + this.mFluid.amount -= tFluidAmountToUse * tConsumed; + this.useFuel = false; + } + else { + this.useFuel = true; + } + } + } + } + if ((this.mInventory[this.getInputSlot()] != null) && (aBaseMetaTileEntity.getUniversalEnergyStored() < ((this.maxEUOutput() * 20) + this.getMinimumStoredEU())) && (GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true) == null)) { + final int tFuelValue = this.getFuelValue(this.mInventory[this.getInputSlot()]); + if (tFuelValue > 0) { + final ItemStack tEmptyContainer = this.getEmptyContainer(this.mInventory[this.getInputSlot()]); + if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tEmptyContainer)) { + aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true); + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + } + } + } + } + + if (aBaseMetaTileEntity.isServerSide()) { + aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && (aBaseMetaTileEntity.getUniversalEnergyStored() >= (this.maxEUOutput() + this.getMinimumStoredEU()))); + } + } + + public abstract GT_Recipe_Map getRecipes(); + + public abstract int getEfficiency(); + + public int consumedFluidPerOperation(final FluidStack aLiquid) { + return 1; + } + + public int getFuelValue(final FluidStack aLiquid) { + if ((aLiquid == null) || (this.getRecipes() == null)) { + return 0; + } + FluidStack tLiquid; + final Collection<GT_Recipe> tRecipeList = this.getRecipes().mRecipeList; + if (tRecipeList != null) { + for (final GT_Recipe tFuel : tRecipeList) { + if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null) { + if (aLiquid.isFluidEqual(tLiquid)) { + return (int) (((long) tFuel.mSpecialValue * this.getEfficiency() * this.consumedFluidPerOperation(tLiquid)) / 100); + } + } + } + } + return 0; + } + + public int getFuelValue(final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack) || (this.getRecipes() == null)) { + return 0; + } + final GT_Recipe tFuel = this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + if (tFuel != null) { + return (int) ((tFuel.mSpecialValue * 1000L * this.getEfficiency()) / 100); + } + return 0; + } + + public ItemStack getEmptyContainer(final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack) || (this.getRecipes() == null)) { + return null; + } + final GT_Recipe tFuel = this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + if (tFuel != null) { + return GT_Utility.copy(tFuel.getOutput(0)); + } + return GT_Utility.getContainerItem(aStack, true); + } + + @Override + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && ((this.getFuelValue(aStack) > 0) || (this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0)); + } + + @Override + public int getCapacity() { + return 32000; + } + + @Override + public int getTankPressure() { + return -100; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechBaseMetaTileEntityLossless.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechBaseMetaTileEntityLossless.java index 752055e22e..aea0014e0c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechBaseMetaTileEntityLossless.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechBaseMetaTileEntityLossless.java @@ -2,6 +2,9 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.lossles import static gregtech.api.enums.GT_Values.NW; import static gregtech.api.enums.GT_Values.V; + +import java.util.*; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; @@ -16,9 +19,6 @@ import gregtech.api.net.GT_Packet_TileEntity; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.*; import ic2.api.Direction; - -import java.util.*; - import net.minecraft.block.Block; import net.minecraft.block.BlockFire; import net.minecraft.entity.Entity; @@ -42,1187 +42,1374 @@ import net.minecraftforge.fluids.*; * This is the main TileEntity for EVERYTHING. */ public class GregtechBaseMetaTileEntityLossless extends BaseTileEntity implements IGregTechTileEntity { - private final GT_CoverBehavior[] mCoverBehaviors = new GT_CoverBehavior[]{GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior}; - protected MetaTileEntity mMetaTileEntity; - protected long mStoredEnergy = 0, mStoredSteam = 0; - protected int mAverageEUInputIndex = 0, mAverageEUOutputIndex = 0; - protected boolean mReleaseEnergy = false; - protected int[] mAverageEUInput = new int[]{0, 0, 0, 0, 0}, mAverageEUOutput = new int[]{0, 0, 0, 0, 0}; - private boolean[] mActiveEUInputs = new boolean[]{false, false, false, false, false, false}, mActiveEUOutputs = new boolean[]{false, false, false, false, false, false}; - private byte[] mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15}; - private int[] mCoverSides = new int[]{0, 0, 0, 0, 0, 0}, mCoverData = new int[]{0, 0, 0, 0, 0, 0}, mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING]; - private boolean mHasEnoughEnergy = true, mRunningThroughTick = false, mInputDisabled = false, mOutputDisabled = false, mMuffler = false, mLockUpgrade = false, mActive = false, mRedstone = false, mWorkUpdate = false, mSteamConverter = false, mInventoryChanged = false, mWorks = true, mNeedsUpdate = true, mNeedsBlockUpdate = true, mSendClientData = false, oRedstone = false; - private byte mColor = 0, oColor = 0, mStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, oLightValueClient = -1, oLightValue = -1, mLightValue = 0, mOtherUpgrades = 0, mFacing = 0, oFacing = 0, mWorkData = 0; - private int mDisplayErrorCode = 0, oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0, mLagWarningCount = 0; - private short mID = 0; - private long mTickTimer = 0, oOutput = 0, mAcceptedAmperes = Long.MAX_VALUE; - private String mOwnerName = ""; - private NBTTagCompound mRecipeStuff = new NBTTagCompound(); - - public GregtechBaseMetaTileEntityLossless() { - } - - @Override - public void writeToNBT(NBTTagCompound aNBT) { - try { - super.writeToNBT(aNBT); - } catch (Throwable e) { - GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); - e.printStackTrace(GT_Log.err); - } - try { - aNBT.setInteger("mID", mID); - aNBT.setLong("mStoredSteam", mStoredSteam); - aNBT.setLong("mStoredEnergy", mStoredEnergy); - aNBT.setIntArray("mCoverData", mCoverData); - aNBT.setIntArray("mCoverSides", mCoverSides); - aNBT.setByteArray("mRedstoneSided", mSidedRedstone); - aNBT.setByte("mColor", mColor); - aNBT.setByte("mLightValue", mLightValue); - aNBT.setByte("mOtherUpgrades", mOtherUpgrades); - aNBT.setByte("mWorkData", mWorkData); - aNBT.setByte("mStrongRedstone", mStrongRedstone); - aNBT.setShort("mFacing", mFacing); - aNBT.setString("mOwnerName", mOwnerName); - aNBT.setBoolean("mLockUpgrade", mLockUpgrade); - aNBT.setBoolean("mMuffler", mMuffler); - aNBT.setBoolean("mSteamConverter", mSteamConverter); - aNBT.setBoolean("mActive", mActive); - aNBT.setBoolean("mRedstone", mRedstone); - aNBT.setBoolean("mWorks", !mWorks); - aNBT.setBoolean("mInputDisabled", mInputDisabled); - aNBT.setBoolean("mOutputDisabled", mOutputDisabled); - aNBT.setTag("GT.CraftingComponents", mRecipeStuff); - } catch (Throwable e) { - GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); - e.printStackTrace(GT_Log.err); - } - try { - if (hasValidMetaTileEntity()) { - NBTTagList tItemList = new NBTTagList(); - for (int i = 0; i < mMetaTileEntity.getRealInventory().length; i++) { - ItemStack tStack = mMetaTileEntity.getRealInventory()[i]; - if (tStack != null) { - NBTTagCompound tTag = new NBTTagCompound(); - tTag.setInteger("IntSlot", i); - tStack.writeToNBT(tTag); - tItemList.appendTag(tTag); - } - } - aNBT.setTag("Inventory", tItemList); - - try { - mMetaTileEntity.saveNBTData(aNBT); - } catch (Throwable e) { - GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); - e.printStackTrace(GT_Log.err); - } - } - } catch (Throwable e) { - GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); - e.printStackTrace(GT_Log.err); - } - } - - @Override - public void readFromNBT(NBTTagCompound aNBT) { - super.readFromNBT(aNBT); - setInitialValuesAsNBT(aNBT, (short) 0); - } - - @Override - public void setInitialValuesAsNBT(NBTTagCompound aNBT, short aID) { - if (aNBT == null) { - if (aID > 0) mID = aID; - else mID = mID > 0 ? mID : 0; - if (mID != 0) createNewMetatileEntity(mID); - mSidedRedstone = (hasValidMetaTileEntity() && mMetaTileEntity.hasSidedRedstoneOutputBehavior() ? new byte[]{0, 0, 0, 0, 0, 0} : new byte[]{15, 15, 15, 15, 15, 15}); - } else { - if (aID <= 0) mID = (short) aNBT.getInteger("mID"); - else mID = aID; - mStoredSteam = aNBT.getInteger("mStoredSteam"); - mStoredEnergy = aNBT.getInteger("mStoredEnergy"); - mColor = aNBT.getByte("mColor"); - mLightValue = aNBT.getByte("mLightValue"); - mWorkData = aNBT.getByte("mWorkData"); - mStrongRedstone = aNBT.getByte("mStrongRedstone"); - mFacing = oFacing = (byte) aNBT.getShort("mFacing"); - mOwnerName = aNBT.getString("mOwnerName"); - mLockUpgrade = aNBT.getBoolean("mLockUpgrade"); - mMuffler = aNBT.getBoolean("mMuffler"); - mSteamConverter = aNBT.getBoolean("mSteamConverter"); - mActive = aNBT.getBoolean("mActive"); - mRedstone = aNBT.getBoolean("mRedstone"); - mWorks = !aNBT.getBoolean("mWorks"); - mInputDisabled = aNBT.getBoolean("mInputDisabled"); - mOutputDisabled = aNBT.getBoolean("mOutputDisabled"); - mOtherUpgrades = (byte) (aNBT.getByte("mOtherUpgrades") + aNBT.getByte("mBatteries") + aNBT.getByte("mLiBatteries")); - mCoverSides = aNBT.getIntArray("mCoverSides"); - mCoverData = aNBT.getIntArray("mCoverData"); - mSidedRedstone = aNBT.getByteArray("mRedstoneSided"); - mRecipeStuff = aNBT.getCompoundTag("GT.CraftingComponents"); - - if (mCoverData.length != 6) mCoverData = new int[]{0, 0, 0, 0, 0, 0}; - if (mCoverSides.length != 6) mCoverSides = new int[]{0, 0, 0, 0, 0, 0}; - if (mSidedRedstone.length != 6) - if (hasValidMetaTileEntity() && mMetaTileEntity.hasSidedRedstoneOutputBehavior()) - mSidedRedstone = new byte[]{0, 0, 0, 0, 0, 0}; - else mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15}; - - for (byte i = 0; i < 6; i++) mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]); - - if (mID != 0 && createNewMetatileEntity(mID)) { - NBTTagList tItemList = aNBT.getTagList("Inventory", 10); - for (int i = 0; i < tItemList.tagCount(); i++) { - NBTTagCompound tTag = tItemList.getCompoundTagAt(i); - int tSlot = tTag.getInteger("IntSlot"); - if (tSlot >= 0 && tSlot < mMetaTileEntity.getRealInventory().length) { - mMetaTileEntity.getRealInventory()[tSlot] = GT_Utility.loadItem(tTag); - } - } - - try { - mMetaTileEntity.loadNBTData(aNBT); - } catch (Throwable e) { - GT_Log.err.println("Encountered Exception while loading MetaTileEntity, the Server should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); - e.printStackTrace(GT_Log.err); - } - } - } - - if (mCoverData.length != 6) mCoverData = new int[]{0, 0, 0, 0, 0, 0}; - if (mCoverSides.length != 6) mCoverSides = new int[]{0, 0, 0, 0, 0, 0}; - if (mSidedRedstone.length != 6) - if (hasValidMetaTileEntity() && mMetaTileEntity.hasSidedRedstoneOutputBehavior()) - mSidedRedstone = new byte[]{0, 0, 0, 0, 0, 0}; - else mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15}; - - for (byte i = 0; i < 6; i++) mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]); - } - - private boolean createNewMetatileEntity(short aID) { - if (aID <= 0 || aID >= GregTech_API.METATILEENTITIES.length || GregTech_API.METATILEENTITIES[aID] == null) { - GT_Log.err.println("MetaID " + aID + " not loadable => locking TileEntity!"); - } else { - if (aID != 0) { - if (hasValidMetaTileEntity()) mMetaTileEntity.setBaseMetaTileEntity(null); - GregTech_API.METATILEENTITIES[aID].newMetaEntity(this).setBaseMetaTileEntity(this); - mTickTimer = 0; - mID = aID; - return true; - } - } - return false; - } - - /** - * Used for ticking special BaseMetaTileEntities, which need that for Energy Conversion - * It's called right before onPostTick() - */ - public void updateStatus() { - // - } - - /** - * Called when trying to charge Items - */ - public void chargeItem(ItemStack aStack) { - decreaseStoredEU(GT_ModHandler.chargeElectricItem(aStack, (int) Math.min(Integer.MAX_VALUE, getStoredEU()), (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getOutputTier()), false, false), true); - } - - /** - * Called when trying to discharge Items - */ - public void dischargeItem(ItemStack aStack) { - increaseStoredEnergyUnits(GT_ModHandler.dischargeElectricItem(aStack, (int) Math.min(Integer.MAX_VALUE, getEUCapacity() - getStoredEU()), (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), false, false, false), true); - } - - @Override - public void updateEntity() { - super.updateEntity(); - - if (!hasValidMetaTileEntity()) { - if (mMetaTileEntity == null) return; - mMetaTileEntity.setBaseMetaTileEntity(this); - } - - mRunningThroughTick = true; - long tTime = System.currentTimeMillis(); - - for (int tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) { - try { - switch (tCode) { - case 0: - tCode++; - if (mTickTimer++ == 0) { - oX = xCoord; - oY = yCoord; - oZ = zCoord; - if (isServerSide()) for (byte i = 0; i < 6; i++) - if (getCoverIDAtSide(i) != 0) - if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i)))) - dropCover(i, i, true); - - worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this); - - mMetaTileEntity.onFirstTick(this); - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } - } - case 1: - tCode++; - if (isClientSide()) { - if (mColor != oColor) { - mMetaTileEntity.onColorChangeClient(oColor = mColor); - issueTextureUpdate(); - } - - if (mLightValue != oLightValueClient) { - worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord - 1, yCoord, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord + 1, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1); - oLightValueClient = mLightValue; - issueTextureUpdate(); - } - - if (mNeedsUpdate) { - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - //worldObj.func_147479_m(xCoord, yCoord, zCoord); - mNeedsUpdate = false; - } - } - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - if (isServerSide() && mTickTimer > 10) { - for (byte i = (byte) (tCode - 2); i < 6; i++) - if (getCoverIDAtSide(i) != 0) { - tCode++; - GT_CoverBehavior tCover = getCoverBehaviorAtSide(i); - int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this); - if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) { - mCoverData[i] = tCover.doCoverThings(i, getInputRedstoneSignal(i), getCoverIDAtSide(i), mCoverData[i], this, mTickTimer); - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } - } - } - - } - case 8: - tCode = 9; - if (isServerSide()) { - if (++mAverageEUInputIndex >= mAverageEUInput.length) mAverageEUInputIndex = 0; - if (++mAverageEUOutputIndex >= mAverageEUOutput.length) mAverageEUOutputIndex = 0; - - mAverageEUInput[mAverageEUInputIndex] = 0; - mAverageEUOutput[mAverageEUOutputIndex] = 0; - } - case 9: - tCode++; - mMetaTileEntity.onPreTick(this, mTickTimer); - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } - case 10: - tCode++; - if (isServerSide()) { - if (mRedstone != oRedstone || mTickTimer == 10) { - for (byte i = 0; i < 6; i++) - mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]); - oRedstone = mRedstone; - issueBlockUpdate(); - } - - if (xCoord != oX || yCoord != oY || zCoord != oZ) { - oX = xCoord; - oY = yCoord; - oZ = zCoord; - issueClientUpdate(); - clearTileEntityBuffer(); - } - - if (mFacing != oFacing) { - oFacing = mFacing; - for (byte i = 0; i < 6; i++) - if (getCoverIDAtSide(i) != 0) - if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i)))) - dropCover(i, i, true); - issueBlockUpdate(); - } - - if (mTickTimer > 20 && mMetaTileEntity.isElectric()) { - mAcceptedAmperes = 0; - - if (getOutputVoltage() != oOutput) { - oOutput = getOutputVoltage(); - } - - if (mMetaTileEntity.isEnetOutput() || mMetaTileEntity.isEnetInput()) { - for (byte i = 0; i < 6; i++) { - boolean - temp = isEnergyInputSide(i); - if (temp != mActiveEUInputs[i]) { - mActiveEUInputs[i] = temp; - } - temp = isEnergyOutputSide(i); - if (temp != mActiveEUOutputs[i]) { - mActiveEUOutputs[i] = temp; - } - } - } - - - - if (mMetaTileEntity.isEnetOutput() && oOutput > 0) { - long tOutputVoltage = oOutput, tUsableAmperage = Math.min(getOutputAmperage(), (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage); - if (tUsableAmperage > 0) { - long tEU = tOutputVoltage * IEnergyConnected.Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this); - mAverageEUOutput[mAverageEUOutputIndex] += tEU; - decreaseStoredEU(tEU, true); - } - } - - - if (getEUCapacity() > 0) { - if (GregTech_API.sMachineFireExplosions && getRandomNumber(1000) == 0) { - Block tBlock = getBlockAtSide((byte) getRandomNumber(6)); - if (tBlock != null && tBlock instanceof BlockFire) doEnergyExplosion(); - } - - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } - - if (getRandomNumber(1000) == 0) { - if ((getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord) - || (getCoverIDAtSide((byte) 2) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord - 1) - 1 < yCoord) - || (getCoverIDAtSide((byte) 3) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord + 1) - 1 < yCoord) - || (getCoverIDAtSide((byte) 4) == 0 && worldObj.getPrecipitationHeight(xCoord - 1, zCoord) - 1 < yCoord) - || (getCoverIDAtSide((byte) 5) == 0 && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) - 1 < yCoord)) { - if (GregTech_API.sMachineRainExplosions && worldObj.isRaining() && getBiome().rainfall > 0) { - if (getRandomNumber(10) == 0) { - try { - GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); - } catch (Exception e) { - } - doEnergyExplosion(); - } else setOnFire(); - } - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } - if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getBiome().rainfall > 0 && getRandomNumber(3) == 0) { - try { - GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); - } catch (Exception e) { - } - doEnergyExplosion(); - } - } - } - } - } - - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } - } - case 11: - tCode++; - if (isServerSide()) { - if (mMetaTileEntity.dechargerSlotCount() > 0 && getStoredEU() < getEUCapacity()) { - for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) { - if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) { - dischargeItem(mMetaTileEntity.mInventory[i]); - if (mMetaTileEntity.mInventory[i].stackSize <= 0) - mMetaTileEntity.mInventory[i] = null; - mInventoryChanged = true; - } - } - } - } - case 12: - tCode++; - if (isServerSide()) { - if (mMetaTileEntity.rechargerSlotCount() > 0 && getStoredEU() > 0) { - for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) { - if (getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) { - chargeItem(mMetaTileEntity.mInventory[i]); - if (mMetaTileEntity.mInventory[i].stackSize <= 0) - mMetaTileEntity.mInventory[i] = null; - mInventoryChanged = true; - } - } - } - } - case 13: - tCode++; - updateStatus(); - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } - case 14: - tCode++; - mMetaTileEntity.onPostTick(this, mTickTimer); - if (!hasValidMetaTileEntity()) { - mRunningThroughTick = false; - return; - } - case 15: - tCode++; - if (isServerSide()) { - if (mTickTimer % 10 == 0) { - if (mSendClientData) { - NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)), oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord); - mSendClientData = false; - } - } - - if (mTickTimer > 10) { - byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)); - if (tData != oTextureData) sendBlockEvent((byte) 0, oTextureData = tData); - tData = mMetaTileEntity.getUpdateData(); - if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData); - if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor); - tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)); - if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData); - if (mLightValue != oLightValue) { - worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord - 1, yCoord, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord + 1, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1); - worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1); - issueTextureUpdate(); - sendBlockEvent((byte) 7, oLightValue = mLightValue); - } - } - - if (mNeedsBlockUpdate) { - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0)); - mNeedsBlockUpdate = false; - } - } - default: - tCode = -1; - break; - } - } catch (Throwable e) { - GT_Log.err.println("Encountered Exception while ticking MetaTileEntity in Step " + (tCode - 1) + ". The Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); - e.printStackTrace(GT_Log.err); - } - } - - if (isServerSide() && hasValidMetaTileEntity()) { - tTime = System.currentTimeMillis() - tTime; - if (mTimeStatistics.length > 0) - mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1) % mTimeStatistics.length] = (int) tTime; - if (tTime > 0 && tTime > GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING && mTickTimer > 1000 && getMetaTileEntity().doTickProfilingMessageDuringThisTick() && mLagWarningCount++ < 10) - System.out.println("WARNING: Possible Lag Source at [" + xCoord + ", " + yCoord + ", " + zCoord + "] in Dimension " + worldObj.provider.dimensionId + " with " + tTime + "ms caused by an instance of " + getMetaTileEntity().getClass()); - } - - mWorkUpdate = mInventoryChanged = mRunningThroughTick = false; - } - - @Override - public Packet getDescriptionPacket() { - issueClientUpdate(); - return null; - } - - public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) { - issueTextureUpdate(); - if (mID != aID && aID > 0) { - mID = aID; - createNewMetatileEntity(mID); - } - - mCoverSides[0] = aCover0; - mCoverSides[1] = aCover1; - mCoverSides[2] = aCover2; - mCoverSides[3] = aCover3; - mCoverSides[4] = aCover4; - mCoverSides[5] = aCover5; - - for (byte i = 0; i < 6; i++) mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]); - - receiveClientEvent(0, aTextureData); - receiveClientEvent(1, aUpdateData); - receiveClientEvent(2, aColorData); - receiveClientEvent(3, aRedstoneData); - } - - @Override - public boolean receiveClientEvent(int aEventID, int aValue) { - super.receiveClientEvent(aEventID, aValue); - - if (hasValidMetaTileEntity()) { - try { - mMetaTileEntity.receiveClientEvent((byte) aEventID, (byte) aValue); - } catch (Throwable e) { - GT_Log.err.println("Encountered Exception while receiving Data from the Server, the Client should've been crashed by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); - e.printStackTrace(GT_Log.err); - } - } - - if (isClientSide()) { - issueTextureUpdate(); - switch (aEventID) { - case 0: - mFacing = (byte) (aValue & 7); - mActive = ((aValue & 8) != 0); - mRedstone = ((aValue & 16) != 0); - //mLockUpgrade = ((aValue&32) != 0); - break; - case 1: - if (hasValidMetaTileEntity()) mMetaTileEntity.onValueUpdate((byte) aValue); - break; - case 2: - if (aValue > 16 || aValue < 0) aValue = 0; - mColor = (byte) aValue; - break; - case 3: - mSidedRedstone[0] = (byte) ((aValue & 1) > 0 ? 15 : 0); - mSidedRedstone[1] = (byte) ((aValue & 2) > 0 ? 15 : 0); - mSidedRedstone[2] = (byte) ((aValue & 4) > 0 ? 15 : 0); - mSidedRedstone[3] = (byte) ((aValue & 8) > 0 ? 15 : 0); - mSidedRedstone[4] = (byte) ((aValue & 16) > 0 ? 15 : 0); - mSidedRedstone[5] = (byte) ((aValue & 32) > 0 ? 15 : 0); - break; - case 4: - if (hasValidMetaTileEntity() && mTickTimer > 20) - mMetaTileEntity.doSound((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); - break; - case 5: - if (hasValidMetaTileEntity() && mTickTimer > 20) - mMetaTileEntity.startSoundLoop((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); - break; - case 6: - if (hasValidMetaTileEntity() && mTickTimer > 20) - mMetaTileEntity.stopSoundLoop((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); - break; - case 7: - mLightValue = (byte) aValue; - break; - } - } - return true; - } - - public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aLogLevel) { - ArrayList<String> tList = new ArrayList<String>(); - if (aLogLevel > 2) { - tList.add("Meta-ID: " + mID + (canAccessData() ? " valid" : " invalid") + (mMetaTileEntity == null ? " MetaTileEntity == null!" : " ")); - } - if (aLogLevel > 1) { - if (mTimeStatistics.length > 0) { - double tAverageTime = 0; - for (int tTime : mTimeStatistics) tAverageTime += tTime; - tList.add("This particular TileEntity has caused an average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) + "ms over the last " + mTimeStatistics.length + " ticks."); - } - if (mLagWarningCount > 0) { - tList.add("This TileEntity has also caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + " Lag Spike Warnings (anything taking longer than " + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server."); - } - tList.add("Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : " not ") + "accessible for you"); - } - if (aLogLevel > 0) { - if (getSteamCapacity() > 0 && hasSteamEngineUpgrade()) - tList.add(getStoredSteam() + " of " + getSteamCapacity() + " Steam"); - tList.add("Machine is " + (mActive ? "active" : "inactive")); - if (!mHasEnoughEnergy) - tList.add("ATTENTION: This Device consumes Energy at a higher Rate than you input. You could insert more to speed up the process."); - } - return mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList); - } - - @Override - public void issueTextureUpdate() { - mNeedsUpdate = true; - } - - @Override - public void issueBlockUpdate() { - mNeedsBlockUpdate = true; - } - - @Override - public void issueClientUpdate() { - mSendClientData = true; - } - - @Override - public void issueCoverUpdate(byte aSide) { - issueClientUpdate(); - } - - @Override - public byte getStrongestRedstone() { - return (byte) Math.max(getInternalInputRedstoneSignal((byte) 0), Math.max(getInternalInputRedstoneSignal((byte) 1), Math.max(getInternalInputRedstoneSignal((byte) 2), Math.max(getInternalInputRedstoneSignal((byte) 3), Math.max(getInternalInputRedstoneSignal((byte) 4), getInternalInputRedstoneSignal((byte) 5)))))); - } - - @Override - public boolean getRedstone() { - return getRedstone((byte) 0) || getRedstone((byte) 1) || getRedstone((byte) 2) || getRedstone((byte) 3) || getRedstone((byte) 4) || getRedstone((byte) 5); - } - - @Override - public boolean getRedstone(byte aSide) { - return getInternalInputRedstoneSignal(aSide) > 0; - } - - public ITexture getCoverTexture(byte aSide) { - return GregTech_API.sCovers.get(new GT_ItemStack(getCoverIDAtSide(aSide))); - } - - @Override - public boolean isGivingInformation() { - if (canAccessData()) return mMetaTileEntity.isGivingInformation(); - return false; - } - - @Override - public boolean isValidFacing(byte aSide) { - if (canAccessData()) return mMetaTileEntity.isFacingValid(aSide); - return false; - } - - @Override - public byte getBackFacing() { - return GT_Utility.getOppositeSide(mFacing); - } - - @Override - public byte getFrontFacing() { - return mFacing; - } - - @Override - public void setFrontFacing(byte aFacing) { - if (isValidFacing(aFacing)) { - mFacing = aFacing; - mMetaTileEntity.onFacingChange(); - onMachineBlockUpdate(); - } - } - - @Override - public int getSizeInventory() { - if (canAccessData()) return mMetaTileEntity.getSizeInventory(); - return 0; - } - - @Override - public ItemStack getStackInSlot(int aIndex) { - if (canAccessData()) return mMetaTileEntity.getStackInSlot(aIndex); - return null; - } - - @Override - public void setInventorySlotContents(int aIndex, ItemStack aStack) { - mInventoryChanged = true; - if (canAccessData()) - mMetaTileEntity.setInventorySlotContents(aIndex, worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); - } - - @Override - public String getInventoryName() { - if (canAccessData()) return mMetaTileEntity.getInventoryName(); - if (GregTech_API.METATILEENTITIES[mID] != null) return GregTech_API.METATILEENTITIES[mID].getInventoryName(); - return ""; - } - - @Override - public int getInventoryStackLimit() { - if (canAccessData()) return mMetaTileEntity.getInventoryStackLimit(); - return 64; - } - - @Override - public void openInventory() { - if (canAccessData()) mMetaTileEntity.onOpenGUI(); - } - - @Override - public void closeInventory() { - if (canAccessData()) mMetaTileEntity.onCloseGUI(); - } - - @Override - public boolean isUseableByPlayer(EntityPlayer aPlayer) { - return canAccessData() && playerOwnsThis(aPlayer, false) && mTickTimer > 40 && getTileEntityOffset(0, 0, 0) == this && aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 && mMetaTileEntity.isAccessAllowed(aPlayer); - } - - @Override - public void validate() { - super.validate(); - mTickTimer = 0; - } - - @Override - public void invalidate() { - tileEntityInvalid = false; - if (canAccessData()) { - mMetaTileEntity.onRemoval(); - mMetaTileEntity.setBaseMetaTileEntity(null); - } - super.invalidate(); - } - - @Override - public void onChunkUnload() { - super.onChunkUnload(); - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) { - ItemStack stack = getStackInSlot(slot); - if (stack != null) setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void onMachineBlockUpdate() { - if (canAccessData()) mMetaTileEntity.onMachineBlockUpdate(); - } - - @Override - public int getProgress() { - return canAccessData() ? mMetaTileEntity.getProgresstime() : 0; - } - - @Override - public int getMaxProgress() { - return canAccessData() ? mMetaTileEntity.maxProgresstime() : 0; - } - - @Override - public boolean increaseProgress(int aProgressAmountInTicks) { - return canAccessData() ? mMetaTileEntity.increaseProgress(aProgressAmountInTicks) != aProgressAmountInTicks : false; - } - - @Override - public boolean hasThingsToDo() { - return getMaxProgress() > 0; - } - - @Override - public void enableWorking() { - if (!mWorks) mWorkUpdate = true; - mWorks = true; - } - - @Override - public void disableWorking() { - mWorks = false; - } - - @Override - public boolean isAllowedToWork() { - return mWorks; - } - - @Override - public boolean hasWorkJustBeenEnabled() { - return mWorkUpdate; - } - - @Override - public byte getWorkDataValue() { - return mWorkData; - } - - @Override - public void setWorkDataValue(byte aValue) { - mWorkData = aValue; - } - - @Override - public int getMetaTileID() { - return mID; - } - - @Override - public int setMetaTileID(short aID) { - return mID = aID; - } - - @Override - public boolean isActive() { - return mActive; - } - - @Override - public void setActive(boolean aActive) { - mActive = aActive; - } - - @Override - public long getTimer() { - return mTickTimer; - } - - @Override - public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { - if (!canAccessData()) return false; - return mHasEnoughEnergy = decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy) || decreaseStoredSteam(aEnergy, false) || (aIgnoreTooLessEnergy && (decreaseStoredSteam(aEnergy, true))); - } - - @Override - public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) { - if (!canAccessData()) return false; - if (getStoredEU() < getEUCapacity() || aIgnoreTooMuchEnergy) { - setStoredEU(mMetaTileEntity.getEUVar() + aEnergy); - return true; - } - return false; - } - - @Override - public boolean inputEnergyFrom(byte aSide) { - if (aSide == 6) return true; - if (isServerSide()) return (aSide >= 0 && aSide < 6 ? mActiveEUInputs[aSide] : false) && !mReleaseEnergy; - return isEnergyInputSide(aSide); - } - - @Override - public boolean outputsEnergyTo(byte aSide) { - if (aSide == 6) return true; - if (isServerSide()) return (aSide >= 0 && aSide < 6 ? mActiveEUOutputs[aSide] : false) || mReleaseEnergy; - return isEnergyOutputSide(aSide); - } - - @Override - public long getOutputAmperage() { - if (canAccessData() && mMetaTileEntity.isElectric()) return mMetaTileEntity.maxAmperesOut(); - return 0; - } - - @Override - public long getOutputVoltage() { - if (canAccessData() && mMetaTileEntity.isElectric() && mMetaTileEntity.isEnetOutput()) - return mMetaTileEntity.maxEUOutput(); - return 0; - } - - @Override - public long getInputAmperage() { - if (canAccessData() && mMetaTileEntity.isElectric()) return mMetaTileEntity.maxAmperesIn(); - return 0; - } - - @Override - public long getInputVoltage() { - if (canAccessData() && mMetaTileEntity.isElectric()) return mMetaTileEntity.maxEUInput(); - return Integer.MAX_VALUE; - } - - @Override - public boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy) { - if (!canAccessData()) return false; - if (mMetaTileEntity.getSteamVar() < getSteamCapacity() || aIgnoreTooMuchEnergy) { - setStoredSteam(mMetaTileEntity.getSteamVar() + aEnergy); - return true; - } - return false; - } - - @Override - public String[] getDescription() { - if (canAccessData()) return mMetaTileEntity.getDescription(); - return new String[0]; - } - - @Override - public boolean isValidSlot(int aIndex) { - if (canAccessData()) return mMetaTileEntity.isValidSlot(aIndex); - return false; - } - - @Override - public long getUniversalEnergyStored() { - return Math.max(getStoredEU(), getStoredSteam()); - } - - @Override - public long getUniversalEnergyCapacity() { - return Math.max(getEUCapacity(), getSteamCapacity()); - } - - @Override - public long getStoredEU() { - if (canAccessData()) return Math.min(mMetaTileEntity.getEUVar(), getEUCapacity()); - return 0; - } - - @Override - public long getEUCapacity() { - if (canAccessData()) return mMetaTileEntity.maxEUStore(); - return 0; - } - - @Override - public long getStoredSteam() { - if (canAccessData()) return Math.min(mMetaTileEntity.getSteamVar(), getSteamCapacity()); - return 0; - } - - @Override - public long getSteamCapacity() { - if (canAccessData()) return mMetaTileEntity.maxSteamStore(); - return 0; - } - - private boolean isEnergyInputSide(byte aSide) { - if (aSide >= 0 && aSide < 6) { - if (!getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this)) - return false; - if (isInvalid() || mReleaseEnergy) return false; - if (canAccessData() && mMetaTileEntity.isElectric() && mMetaTileEntity.isEnetInput()) - return mMetaTileEntity.isInputFacing(aSide); - } - return false; - } - - private boolean isEnergyOutputSide(byte aSide) { - if (aSide >= 0 && aSide < 6) { - if (!getCoverBehaviorAtSide(aSide).letsEnergyOut(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this)) - return false; - if (isInvalid() || mReleaseEnergy) return mReleaseEnergy; - if (canAccessData() && mMetaTileEntity.isElectric() && mMetaTileEntity.isEnetOutput()) - return mMetaTileEntity.isOutputFacing(aSide); - } - return false; - } - - protected boolean hasValidMetaTileEntity() { - return mMetaTileEntity != null && mMetaTileEntity.getBaseMetaTileEntity() == this; - } - - protected boolean canAccessData() { - return !isDead && hasValidMetaTileEntity(); - } - - public boolean setStoredEU(long aEnergy) { - if (!canAccessData()) return false; - if (aEnergy < 0) aEnergy = 0; - mMetaTileEntity.setEUVar(aEnergy); - return true; - } - - public boolean setStoredSteam(long aEnergy) { - if (!canAccessData()) return false; - if (aEnergy < 0) aEnergy = 0; - mMetaTileEntity.setSteamVar(aEnergy); - return true; - } - - public boolean decreaseStoredEU(long aEnergy, boolean aIgnoreTooLessEnergy) { - if (!canAccessData()) { - return false; - } - if (mMetaTileEntity.getEUVar() - aEnergy >= 0 || aIgnoreTooLessEnergy) { - setStoredEU(mMetaTileEntity.getEUVar() - aEnergy); - if (mMetaTileEntity.getEUVar() < 0) { - setStoredEU(0); - return false; - } - return true; - } - return false; - } - - public boolean decreaseStoredSteam(long aEnergy, boolean aIgnoreTooLessEnergy) { - if (!canAccessData()) return false; - if (mMetaTileEntity.getSteamVar() - aEnergy >= 0 || aIgnoreTooLessEnergy) { - setStoredSteam(mMetaTileEntity.getSteamVar() - aEnergy); - if (mMetaTileEntity.getSteamVar() < 0) { - setStoredSteam(0); - return false; - } - return true; - } - return false; - } - - public boolean playerOwnsThis(EntityPlayer aPlayer, boolean aCheckPrecicely) { - if (!canAccessData()) return false; - if (aCheckPrecicely || privateAccess() || mOwnerName.equals("")) - if (mOwnerName.equals("") && isServerSide()) setOwnerName(aPlayer.getDisplayName()); - else if (privateAccess() && !aPlayer.getDisplayName().equals("Player") && !mOwnerName.equals("Player") && !mOwnerName.equals(aPlayer.getDisplayName())) - return false; - return true; - } - - public boolean privateAccess() { - if (!canAccessData()) return mLockUpgrade; - return mLockUpgrade || mMetaTileEntity.ownerControl(); - } - - public void doEnergyExplosion() { - if (getUniversalEnergyCapacity() > 0 && getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 5) { - doExplosion(oOutput * (getUniversalEnergyStored() >= getUniversalEnergyCapacity() ? 4 : getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 2 ? 2 : 1)); - GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "electricproblems"); - } - } - - @Override - public void doExplosion(long aAmount) { - if (canAccessData()) { - // This is only for Electric Machines - if (GregTech_API.sMachineWireFire && mMetaTileEntity.isElectric()) { - try { - mReleaseEnergy = true; - IEnergyConnected.Util.emitEnergyToNetwork(V[5], Math.max(1, getStoredEU() / V[5]), this); - } catch (Exception e) {/* Fun Fact: all these "do nothing" Comments you see in my Code, are just there to let Eclipse shut up about the intended empty Brackets, but I need eclipse to yell at me in some of the regular Cases where I forget to add Code */} - } - mReleaseEnergy = false; - // Normal Explosion Code - mMetaTileEntity.onExplosion(); - mMetaTileEntity.doExplosion(aAmount); - } - } - - @Override - public ArrayList<ItemStack> getDrops() { - ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, mID); - NBTTagCompound tNBT = new NBTTagCompound(); - if (mRecipeStuff != null && !mRecipeStuff.hasNoTags()) tNBT.setTag("GT.CraftingComponents", mRecipeStuff); - if (mMuffler) tNBT.setBoolean("mMuffler", mMuffler); - if (mLockUpgrade) tNBT.setBoolean("mLockUpgrade", mLockUpgrade); - if (mSteamConverter) tNBT.setBoolean("mSteamConverter", mSteamConverter); - if (mColor > 0) tNBT.setByte("mColor", mColor); - if (mOtherUpgrades > 0) tNBT.setByte("mOtherUpgrades", mOtherUpgrades); - if (mStrongRedstone > 0) tNBT.setByte("mStrongRedstone", mStrongRedstone); - for (byte i = 0; i < mCoverSides.length; i++) { - if (mCoverSides[i] != 0) { - tNBT.setIntArray("mCoverData", mCoverData); - tNBT.setIntArray("mCoverSides", mCoverSides); - break; - } - } - if (hasValidMetaTileEntity()) mMetaTileEntity.setItemNBT(tNBT); - if (!tNBT.hasNoTags()) rStack.setTagCompound(tNBT); - return new ArrayList<ItemStack>(Arrays.asList(rStack)); - } - - public int getUpgradeCount() { - return (mMuffler ? 1 : 0) + (mLockUpgrade ? 1 : 0) + (mSteamConverter ? 1 : 0) + mOtherUpgrades; - } - - @Override - public boolean onRightclick(EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { - if (isClientSide()) { - if (getCoverBehaviorAtSide(aSide).onCoverRightclickClient(aSide, this, aPlayer, aX, aY, aZ)) return true; - if (!getCoverBehaviorAtSide(aSide).isGUIClickable(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this)) - return false; - } - if (isServerSide()) { - if (!privateAccess() || aPlayer.getDisplayName().equalsIgnoreCase(getOwnerName())) { - ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); - if (tCurrentItem != null) { - if (getColorization() >= 0 && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { - tCurrentItem.func_150996_a(Items.bucket); - setColorization((byte) (getColorization() >= 16 ? -2 : -1)); - return true; - } - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) { - if (mMetaTileEntity.onWrenchRightClick(aSide, GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ), aPlayer, aX, aY, aZ)) { - GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord); - } - return true; - } - - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)) { - if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 200, aPlayer)) { - setCoverDataAtSide(aSide, getCoverBehaviorAtSide(aSide).onCoverScrewdriverclick(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ)); - mMetaTileEntity.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord); - } - return true; - } - - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sHardHammerList)) { - if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { - mInputDisabled = !mInputDisabled; - if (mInputDisabled) mOutputDisabled = !mOutputDisabled; - GT_Utility.sendChatToPlayer(aPlayer, "Auto-Input: " + (mInputDisabled ? "Disabled" : "Enabled") + " Auto-Output: " + (mOutputDisabled ? "Disabled" : "Enabled")); - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(1), 1.0F, -1, xCoord, yCoord, zCoord); - } - return true; - } - - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)) { - if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { - if (mWorks) disableWorking(); - else enableWorking(); - GT_Utility.sendChatToPlayer(aPlayer, "Machine Processing: " + (isAllowedToWork() ? "Enabled" : "Disabled")); - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(101), 1.0F, -1, xCoord, yCoord, zCoord); - } - return true; - } - - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) { - byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); - if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) { - mStrongRedstone ^= (1 << tSide); - GT_Utility.sendChatToPlayer(aPlayer, "Redstone Output at Side " + tSide + " set to: " + ((mStrongRedstone & (1 << tSide)) != 0 ? "Strong" : "Weak")); - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 3.0F, -1, xCoord, yCoord, zCoord); - } - return true; - } - - if (getCoverIDAtSide(aSide) == 0) { - if (GregTech_API.sCovers.containsKey(new GT_ItemStack(tCurrentItem))) { - if (GregTech_API.getCoverBehavior(tCurrentItem).isCoverPlaceable(aSide, new GT_ItemStack(tCurrentItem), this) && mMetaTileEntity.allowCoverOnSide(aSide, new GT_ItemStack(tCurrentItem))) { - setCoverItemAtSide(aSide, tCurrentItem); - if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--; - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord); - } - return true; - } - } else { - if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)) { - if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(0), 1.0F, -1, xCoord, yCoord, zCoord); - dropCover(aSide, aSide, false); - } - return true; - } - } - } - - if (getCoverBehaviorAtSide(aSide).onCoverRightclick(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ)) - return true; - - if (!getCoverBehaviorAtSide(aSide).isGUIClickable(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this)) - return false; - - if (isUpgradable() && aPlayer.inventory.getCurrentItem() != null) {/* + private final GT_CoverBehavior[] mCoverBehaviors = new GT_CoverBehavior[]{GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior}; + protected MetaTileEntity mMetaTileEntity; + protected long mStoredEnergy = 0, mStoredSteam = 0; + protected int mAverageEUInputIndex = 0, mAverageEUOutputIndex = 0; + protected boolean mReleaseEnergy = false; + protected int[] mAverageEUInput = new int[]{0, 0, 0, 0, 0}, mAverageEUOutput = new int[]{0, 0, 0, 0, 0}; + private final boolean[] mActiveEUInputs = new boolean[]{false, false, false, false, false, false}, mActiveEUOutputs = new boolean[]{false, false, false, false, false, false}; + private byte[] mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15}; + private int[] mCoverSides = new int[]{0, 0, 0, 0, 0, 0}, mCoverData = new int[]{0, 0, 0, 0, 0, 0}; + private final int[] mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING]; + private boolean mHasEnoughEnergy = true, mRunningThroughTick = false, mInputDisabled = false, mOutputDisabled = false, mMuffler = false, mLockUpgrade = false, mActive = false, mRedstone = false, mWorkUpdate = false, mSteamConverter = false, mInventoryChanged = false, mWorks = true, mNeedsUpdate = true, mNeedsBlockUpdate = true, mSendClientData = false, oRedstone = false; + private byte mColor = 0, oColor = 0, mStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, oLightValueClient = -1, oLightValue = -1, mLightValue = 0, mOtherUpgrades = 0, mFacing = 0, oFacing = 0, mWorkData = 0; + private int mDisplayErrorCode = 0, oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0, mLagWarningCount = 0; + private short mID = 0; + private long mTickTimer = 0, oOutput = 0, mAcceptedAmperes = Long.MAX_VALUE; + private String mOwnerName = ""; + private NBTTagCompound mRecipeStuff = new NBTTagCompound(); + + public GregtechBaseMetaTileEntityLossless() { + } + + @Override + public void writeToNBT(final NBTTagCompound aNBT) { + try { + super.writeToNBT(aNBT); + } catch (final Throwable e) { + GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); + e.printStackTrace(GT_Log.err); + } + try { + aNBT.setInteger("mID", this.mID); + aNBT.setLong("mStoredSteam", this.mStoredSteam); + aNBT.setLong("mStoredEnergy", this.mStoredEnergy); + aNBT.setIntArray("mCoverData", this.mCoverData); + aNBT.setIntArray("mCoverSides", this.mCoverSides); + aNBT.setByteArray("mRedstoneSided", this.mSidedRedstone); + aNBT.setByte("mColor", this.mColor); + aNBT.setByte("mLightValue", this.mLightValue); + aNBT.setByte("mOtherUpgrades", this.mOtherUpgrades); + aNBT.setByte("mWorkData", this.mWorkData); + aNBT.setByte("mStrongRedstone", this.mStrongRedstone); + aNBT.setShort("mFacing", this.mFacing); + aNBT.setString("mOwnerName", this.mOwnerName); + aNBT.setBoolean("mLockUpgrade", this.mLockUpgrade); + aNBT.setBoolean("mMuffler", this.mMuffler); + aNBT.setBoolean("mSteamConverter", this.mSteamConverter); + aNBT.setBoolean("mActive", this.mActive); + aNBT.setBoolean("mRedstone", this.mRedstone); + aNBT.setBoolean("mWorks", !this.mWorks); + aNBT.setBoolean("mInputDisabled", this.mInputDisabled); + aNBT.setBoolean("mOutputDisabled", this.mOutputDisabled); + aNBT.setTag("GT.CraftingComponents", this.mRecipeStuff); + } catch (final Throwable e) { + GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); + e.printStackTrace(GT_Log.err); + } + try { + if (this.hasValidMetaTileEntity()) { + final NBTTagList tItemList = new NBTTagList(); + for (int i = 0; i < this.mMetaTileEntity.getRealInventory().length; i++) { + final ItemStack tStack = this.mMetaTileEntity.getRealInventory()[i]; + if (tStack != null) { + final NBTTagCompound tTag = new NBTTagCompound(); + tTag.setInteger("IntSlot", i); + tStack.writeToNBT(tTag); + tItemList.appendTag(tTag); + } + } + aNBT.setTag("Inventory", tItemList); + + try { + this.mMetaTileEntity.saveNBTData(aNBT); + } catch (final Throwable e) { + GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); + e.printStackTrace(GT_Log.err); + } + } + } catch (final Throwable e) { + GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); + e.printStackTrace(GT_Log.err); + } + } + + @Override + public void readFromNBT(final NBTTagCompound aNBT) { + super.readFromNBT(aNBT); + this.setInitialValuesAsNBT(aNBT, (short) 0); + } + + @Override + public void setInitialValuesAsNBT(final NBTTagCompound aNBT, final short aID) { + if (aNBT == null) { + if (aID > 0) { + this.mID = aID; + } else { + this.mID = this.mID > 0 ? this.mID : 0; + } + if (this.mID != 0) { + this.createNewMetatileEntity(this.mID); + } + this.mSidedRedstone = (this.hasValidMetaTileEntity() && this.mMetaTileEntity.hasSidedRedstoneOutputBehavior() ? new byte[]{0, 0, 0, 0, 0, 0} : new byte[]{15, 15, 15, 15, 15, 15}); + } else { + if (aID <= 0) { + this.mID = (short) aNBT.getInteger("mID"); + } else { + this.mID = aID; + } + this.mStoredSteam = aNBT.getInteger("mStoredSteam"); + this.mStoredEnergy = aNBT.getInteger("mStoredEnergy"); + this.mColor = aNBT.getByte("mColor"); + this.mLightValue = aNBT.getByte("mLightValue"); + this.mWorkData = aNBT.getByte("mWorkData"); + this.mStrongRedstone = aNBT.getByte("mStrongRedstone"); + this.mFacing = this.oFacing = (byte) aNBT.getShort("mFacing"); + this.mOwnerName = aNBT.getString("mOwnerName"); + this.mLockUpgrade = aNBT.getBoolean("mLockUpgrade"); + this.mMuffler = aNBT.getBoolean("mMuffler"); + this.mSteamConverter = aNBT.getBoolean("mSteamConverter"); + this.mActive = aNBT.getBoolean("mActive"); + this.mRedstone = aNBT.getBoolean("mRedstone"); + this.mWorks = !aNBT.getBoolean("mWorks"); + this.mInputDisabled = aNBT.getBoolean("mInputDisabled"); + this.mOutputDisabled = aNBT.getBoolean("mOutputDisabled"); + this.mOtherUpgrades = (byte) (aNBT.getByte("mOtherUpgrades") + aNBT.getByte("mBatteries") + aNBT.getByte("mLiBatteries")); + this.mCoverSides = aNBT.getIntArray("mCoverSides"); + this.mCoverData = aNBT.getIntArray("mCoverData"); + this.mSidedRedstone = aNBT.getByteArray("mRedstoneSided"); + this.mRecipeStuff = aNBT.getCompoundTag("GT.CraftingComponents"); + + if (this.mCoverData.length != 6) { + this.mCoverData = new int[]{0, 0, 0, 0, 0, 0}; + } + if (this.mCoverSides.length != 6) { + this.mCoverSides = new int[]{0, 0, 0, 0, 0, 0}; + } + if (this.mSidedRedstone.length != 6) { + if (this.hasValidMetaTileEntity() && this.mMetaTileEntity.hasSidedRedstoneOutputBehavior()) { + this.mSidedRedstone = new byte[]{0, 0, 0, 0, 0, 0}; + } else { + this.mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15}; + } + } + + for (byte i = 0; i < 6; i++) { + this.mCoverBehaviors[i] = GregTech_API.getCoverBehavior(this.mCoverSides[i]); + } + + if ((this.mID != 0) && this.createNewMetatileEntity(this.mID)) { + final NBTTagList tItemList = aNBT.getTagList("Inventory", 10); + for (int i = 0; i < tItemList.tagCount(); i++) { + final NBTTagCompound tTag = tItemList.getCompoundTagAt(i); + final int tSlot = tTag.getInteger("IntSlot"); + if ((tSlot >= 0) && (tSlot < this.mMetaTileEntity.getRealInventory().length)) { + this.mMetaTileEntity.getRealInventory()[tSlot] = GT_Utility.loadItem(tTag); + } + } + + try { + this.mMetaTileEntity.loadNBTData(aNBT); + } catch (final Throwable e) { + GT_Log.err.println("Encountered Exception while loading MetaTileEntity, the Server should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); + e.printStackTrace(GT_Log.err); + } + } + } + + if (this.mCoverData.length != 6) { + this.mCoverData = new int[]{0, 0, 0, 0, 0, 0}; + } + if (this.mCoverSides.length != 6) { + this.mCoverSides = new int[]{0, 0, 0, 0, 0, 0}; + } + if (this.mSidedRedstone.length != 6) { + if (this.hasValidMetaTileEntity() && this.mMetaTileEntity.hasSidedRedstoneOutputBehavior()) { + this.mSidedRedstone = new byte[]{0, 0, 0, 0, 0, 0}; + } else { + this.mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15}; + } + } + + for (byte i = 0; i < 6; i++) { + this.mCoverBehaviors[i] = GregTech_API.getCoverBehavior(this.mCoverSides[i]); + } + } + + private boolean createNewMetatileEntity(final short aID) { + if ((aID <= 0) || (aID >= GregTech_API.METATILEENTITIES.length) || (GregTech_API.METATILEENTITIES[aID] == null)) { + GT_Log.err.println("MetaID " + aID + " not loadable => locking TileEntity!"); + } else { + if (aID != 0) { + if (this.hasValidMetaTileEntity()) { + this.mMetaTileEntity.setBaseMetaTileEntity(null); + } + GregTech_API.METATILEENTITIES[aID].newMetaEntity(this).setBaseMetaTileEntity(this); + this.mTickTimer = 0; + this.mID = aID; + return true; + } + } + return false; + } + + /** + * Used for ticking special BaseMetaTileEntities, which need that for Energy Conversion + * It's called right before onPostTick() + */ + public void updateStatus() { + // + } + + /** + * Called when trying to charge Items + */ + public void chargeItem(final ItemStack aStack) { + this.decreaseStoredEU(GT_ModHandler.chargeElectricItem(aStack, (int) Math.min(Integer.MAX_VALUE, this.getStoredEU()), (int) Math.min(Integer.MAX_VALUE, this.mMetaTileEntity.getOutputTier()), false, false), true); + } + + /** + * Called when trying to discharge Items + */ + public void dischargeItem(final ItemStack aStack) { + this.increaseStoredEnergyUnits(GT_ModHandler.dischargeElectricItem(aStack, (int) Math.min(Integer.MAX_VALUE, this.getEUCapacity() - this.getStoredEU()), (int) Math.min(Integer.MAX_VALUE, this.mMetaTileEntity.getInputTier()), false, false, false), true); + } + + @Override + public void updateEntity() { + super.updateEntity(); + + if (!this.hasValidMetaTileEntity()) { + if (this.mMetaTileEntity == null) { + return; + } + this.mMetaTileEntity.setBaseMetaTileEntity(this); + } + + this.mRunningThroughTick = true; + long tTime = System.currentTimeMillis(); + + for (int tCode = 0; this.hasValidMetaTileEntity() && (tCode >= 0); ) { + try { + switch (tCode) { + case 0: + tCode++; + if (this.mTickTimer++ == 0) { + this.oX = this.xCoord; + this.oY = this.yCoord; + this.oZ = this.zCoord; + if (this.isServerSide()) { + for (byte i = 0; i < 6; i++) { + if (this.getCoverIDAtSide(i) != 0) { + if (!this.mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(this.getCoverIDAtSide(i)))) { + this.dropCover(i, i, true); + } + } + } + } + + this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this); + + this.mMetaTileEntity.onFirstTick(this); + if (!this.hasValidMetaTileEntity()) { + this.mRunningThroughTick = false; + return; + } + } + case 1: + tCode++; + if (this.isClientSide()) { + if (this.mColor != this.oColor) { + this.mMetaTileEntity.onColorChangeClient(this.oColor = this.mColor); + this.issueTextureUpdate(); + } + + if (this.mLightValue != this.oLightValueClient) { + this.worldObj.setLightValue(EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord, this.mLightValue); + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord); + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord + 1, this.yCoord, this.zCoord); + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord - 1, this.yCoord, this.zCoord); + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord + 1, this.zCoord); + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord - 1, this.zCoord); + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord + 1); + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord - 1); + this.oLightValueClient = this.mLightValue; + this.issueTextureUpdate(); + } + + if (this.mNeedsUpdate) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + //worldObj.func_147479_m(xCoord, yCoord, zCoord); + this.mNeedsUpdate = false; + } + } + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + if (this.isServerSide() && (this.mTickTimer > 10)) { + for (byte i = (byte) (tCode - 2); i < 6; i++) { + if (this.getCoverIDAtSide(i) != 0) { + tCode++; + final GT_CoverBehavior tCover = this.getCoverBehaviorAtSide(i); + final int tCoverTickRate = tCover.getTickRate(i, this.getCoverIDAtSide(i), this.mCoverData[i], this); + if ((tCoverTickRate > 0) && ((this.mTickTimer % tCoverTickRate) == 0)) { + this.mCoverData[i] = tCover.doCoverThings(i, this.getInputRedstoneSignal(i), this.getCoverIDAtSide(i), this.mCoverData[i], this, this.mTickTimer); + if (!this.hasValidMetaTileEntity()) { + this.mRunningThroughTick = false; + return; + } + } + } + } + + } + case 8: + tCode = 9; + if (this.isServerSide()) { + if (++this.mAverageEUInputIndex >= this.mAverageEUInput.length) { + this.mAverageEUInputIndex = 0; + } + if (++this.mAverageEUOutputIndex >= this.mAverageEUOutput.length) { + this.mAverageEUOutputIndex = 0; + } + + this.mAverageEUInput[this.mAverageEUInputIndex] = 0; + this.mAverageEUOutput[this.mAverageEUOutputIndex] = 0; + } + case 9: + tCode++; + this.mMetaTileEntity.onPreTick(this, this.mTickTimer); + if (!this.hasValidMetaTileEntity()) { + this.mRunningThroughTick = false; + return; + } + case 10: + tCode++; + if (this.isServerSide()) { + if ((this.mRedstone != this.oRedstone) || (this.mTickTimer == 10)) { + for (byte i = 0; i < 6; i++) { + this.mCoverBehaviors[i] = GregTech_API.getCoverBehavior(this.mCoverSides[i]); + } + this.oRedstone = this.mRedstone; + this.issueBlockUpdate(); + } + + if ((this.xCoord != this.oX) || (this.yCoord != this.oY) || (this.zCoord != this.oZ)) { + this.oX = this.xCoord; + this.oY = this.yCoord; + this.oZ = this.zCoord; + this.issueClientUpdate(); + this.clearTileEntityBuffer(); + } + + if (this.mFacing != this.oFacing) { + this.oFacing = this.mFacing; + for (byte i = 0; i < 6; i++) { + if (this.getCoverIDAtSide(i) != 0) { + if (!this.mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(this.getCoverIDAtSide(i)))) { + this.dropCover(i, i, true); + } + } + } + this.issueBlockUpdate(); + } + + if ((this.mTickTimer > 20) && this.mMetaTileEntity.isElectric()) { + this.mAcceptedAmperes = 0; + + if (this.getOutputVoltage() != this.oOutput) { + this.oOutput = this.getOutputVoltage(); + } + + if (this.mMetaTileEntity.isEnetOutput() || this.mMetaTileEntity.isEnetInput()) { + for (byte i = 0; i < 6; i++) { + boolean + temp = this.isEnergyInputSide(i); + if (temp != this.mActiveEUInputs[i]) { + this.mActiveEUInputs[i] = temp; + } + temp = this.isEnergyOutputSide(i); + if (temp != this.mActiveEUOutputs[i]) { + this.mActiveEUOutputs[i] = temp; + } + } + } + + + + if (this.mMetaTileEntity.isEnetOutput() && (this.oOutput > 0)) { + final long tOutputVoltage = this.oOutput, tUsableAmperage = Math.min(this.getOutputAmperage(), (this.getStoredEU() - this.mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage); + if (tUsableAmperage > 0) { + final long tEU = tOutputVoltage * IEnergyConnected.Util.emitEnergyToNetwork(this.oOutput, tUsableAmperage, this); + this.mAverageEUOutput[this.mAverageEUOutputIndex] += tEU; + this.decreaseStoredEU(tEU, true); + } + } + + + if (this.getEUCapacity() > 0) { + if (GregTech_API.sMachineFireExplosions && (this.getRandomNumber(1000) == 0)) { + final Block tBlock = this.getBlockAtSide((byte) this.getRandomNumber(6)); + if ((tBlock != null) && (tBlock instanceof BlockFire)) { + this.doEnergyExplosion(); + } + } + + if (!this.hasValidMetaTileEntity()) { + this.mRunningThroughTick = false; + return; + } + + if (this.getRandomNumber(1000) == 0) { + if (((this.getCoverIDAtSide((byte) 1) == 0) && ((this.worldObj.getPrecipitationHeight(this.xCoord, this.zCoord) - 2) < this.yCoord)) + || ((this.getCoverIDAtSide((byte) 2) == 0) && ((this.worldObj.getPrecipitationHeight(this.xCoord, this.zCoord - 1) - 1) < this.yCoord)) + || ((this.getCoverIDAtSide((byte) 3) == 0) && ((this.worldObj.getPrecipitationHeight(this.xCoord, this.zCoord + 1) - 1) < this.yCoord)) + || ((this.getCoverIDAtSide((byte) 4) == 0) && ((this.worldObj.getPrecipitationHeight(this.xCoord - 1, this.zCoord) - 1) < this.yCoord)) + || ((this.getCoverIDAtSide((byte) 5) == 0) && ((this.worldObj.getPrecipitationHeight(this.xCoord + 1, this.zCoord) - 1) < this.yCoord))) { + if (GregTech_API.sMachineRainExplosions && this.worldObj.isRaining() && (this.getBiome().rainfall > 0)) { + if (this.getRandomNumber(10) == 0) { + try { + GT_Mod.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(this.mOwnerName), "badweather"); + } catch (final Exception e) { + } + this.doEnergyExplosion(); + } else { + this.setOnFire(); + } + } + if (!this.hasValidMetaTileEntity()) { + this.mRunningThroughTick = false; + return; + } + if (GregTech_API.sMachineThunderExplosions && this.worldObj.isThundering() && (this.getBiome().rainfall > 0) && (this.getRandomNumber(3) == 0)) { + try { + GT_Mod.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(this.mOwnerName), "badweather"); + } catch (final Exception e) { + } + this.doEnergyExplosion(); + } + } + } + } + } + + if (!this.hasValidMetaTileEntity()) { + this.mRunningThroughTick = false; + return; + } + } + case 11: + tCode++; + if (this.isServerSide()) { + if ((this.mMetaTileEntity.dechargerSlotCount() > 0) && (this.getStoredEU() < this.getEUCapacity())) { + for (int i = this.mMetaTileEntity.dechargerSlotStartIndex(), k = this.mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) { + if ((this.mMetaTileEntity.mInventory[i] != null) && (this.getStoredEU() < this.getEUCapacity())) { + this.dischargeItem(this.mMetaTileEntity.mInventory[i]); + if (this.mMetaTileEntity.mInventory[i].stackSize <= 0) { + this.mMetaTileEntity.mInventory[i] = null; + } + this.mInventoryChanged = true; + } + } + } + } + case 12: + tCode++; + if (this.isServerSide()) { + if ((this.mMetaTileEntity.rechargerSlotCount() > 0) && (this.getStoredEU() > 0)) { + for (int i = this.mMetaTileEntity.rechargerSlotStartIndex(), k = this.mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) { + if ((this.getStoredEU() > 0) && (this.mMetaTileEntity.mInventory[i] != null)) { + this.chargeItem(this.mMetaTileEntity.mInventory[i]); + if (this.mMetaTileEntity.mInventory[i].stackSize <= 0) { + this.mMetaTileEntity.mInventory[i] = null; + } + this.mInventoryChanged = true; + } + } + } + } + case 13: + tCode++; + this.updateStatus(); + if (!this.hasValidMetaTileEntity()) { + this.mRunningThroughTick = false; + return; + } + case 14: + tCode++; + this.mMetaTileEntity.onPostTick(this, this.mTickTimer); + if (!this.hasValidMetaTileEntity()) { + this.mRunningThroughTick = false; + return; + } + case 15: + tCode++; + if (this.isServerSide()) { + if ((this.mTickTimer % 10) == 0) { + if (this.mSendClientData) { + NW.sendPacketToAllPlayersInRange(this.worldObj, new GT_Packet_TileEntity(this.xCoord, (short) this.yCoord, this.zCoord, this.mID, this.mCoverSides[0], this.mCoverSides[1], this.mCoverSides[2], this.mCoverSides[3], this.mCoverSides[4], this.mCoverSides[5], this.oTextureData = (byte) ((this.mFacing & 7) | (this.mActive ? 8 : 0) | (this.mRedstone ? 16 : 0) | (this.mLockUpgrade ? 32 : 0)), this.oUpdateData = this.hasValidMetaTileEntity() ? this.mMetaTileEntity.getUpdateData() : 0, this.oRedstoneData = (byte) (((this.mSidedRedstone[0] > 0) ? 1 : 0) | ((this.mSidedRedstone[1] > 0) ? 2 : 0) | ((this.mSidedRedstone[2] > 0) ? 4 : 0) | ((this.mSidedRedstone[3] > 0) ? 8 : 0) | ((this.mSidedRedstone[4] > 0) ? 16 : 0) | ((this.mSidedRedstone[5] > 0) ? 32 : 0)), this.oColor = this.mColor), this.xCoord, this.zCoord); + this.mSendClientData = false; + } + } + + if (this.mTickTimer > 10) { + byte tData = (byte) ((this.mFacing & 7) | (this.mActive ? 8 : 0) | (this.mRedstone ? 16 : 0) | (this.mLockUpgrade ? 32 : 0)); + if (tData != this.oTextureData) { + this.sendBlockEvent((byte) 0, this.oTextureData = tData); + } + tData = this.mMetaTileEntity.getUpdateData(); + if (tData != this.oUpdateData) { + this.sendBlockEvent((byte) 1, this.oUpdateData = tData); + } + if (this.mColor != this.oColor) { + this.sendBlockEvent((byte) 2, this.oColor = this.mColor); + } + tData = (byte) (((this.mSidedRedstone[0] > 0) ? 1 : 0) | ((this.mSidedRedstone[1] > 0) ? 2 : 0) | ((this.mSidedRedstone[2] > 0) ? 4 : 0) | ((this.mSidedRedstone[3] > 0) ? 8 : 0) | ((this.mSidedRedstone[4] > 0) ? 16 : 0) | ((this.mSidedRedstone[5] > 0) ? 32 : 0)); + if (tData != this.oRedstoneData) { + this.sendBlockEvent((byte) 3, this.oRedstoneData = tData); + } + if (this.mLightValue != this.oLightValue) { + this.worldObj.setLightValue(EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord, this.mLightValue); + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord); + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord + 1, this.yCoord, this.zCoord); + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord - 1, this.yCoord, this.zCoord); + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord + 1, this.zCoord); + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord - 1, this.zCoord); + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord + 1); + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord - 1); + this.issueTextureUpdate(); + this.sendBlockEvent((byte) 7, this.oLightValue = this.mLightValue); + } + } + + if (this.mNeedsBlockUpdate) { + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockOffset(0, 0, 0)); + this.mNeedsBlockUpdate = false; + } + } + default: + tCode = -1; + break; + } + } catch (final Throwable e) { + GT_Log.err.println("Encountered Exception while ticking MetaTileEntity in Step " + (tCode - 1) + ". The Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); + e.printStackTrace(GT_Log.err); + } + } + + if (this.isServerSide() && this.hasValidMetaTileEntity()) { + tTime = System.currentTimeMillis() - tTime; + if (this.mTimeStatistics.length > 0) { + this.mTimeStatistics[this.mTimeStatisticsIndex = (this.mTimeStatisticsIndex + 1) % this.mTimeStatistics.length] = (int) tTime; + } + if ((tTime > 0) && (tTime > GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING) && (this.mTickTimer > 1000) && this.getMetaTileEntity().doTickProfilingMessageDuringThisTick() && (this.mLagWarningCount++ < 10)) { + System.out.println("WARNING: Possible Lag Source at [" + this.xCoord + ", " + this.yCoord + ", " + this.zCoord + "] in Dimension " + this.worldObj.provider.dimensionId + " with " + tTime + "ms caused by an instance of " + this.getMetaTileEntity().getClass()); + } + } + + this.mWorkUpdate = this.mInventoryChanged = this.mRunningThroughTick = false; + } + + @Override + public Packet getDescriptionPacket() { + this.issueClientUpdate(); + return null; + } + + public final void receiveMetaTileEntityData(final short aID, final int aCover0, final int aCover1, final int aCover2, final int aCover3, final int aCover4, final int aCover5, final byte aTextureData, final byte aUpdateData, final byte aRedstoneData, final byte aColorData) { + this.issueTextureUpdate(); + if ((this.mID != aID) && (aID > 0)) { + this.mID = aID; + this.createNewMetatileEntity(this.mID); + } + + this.mCoverSides[0] = aCover0; + this.mCoverSides[1] = aCover1; + this.mCoverSides[2] = aCover2; + this.mCoverSides[3] = aCover3; + this.mCoverSides[4] = aCover4; + this.mCoverSides[5] = aCover5; + + for (byte i = 0; i < 6; i++) { + this.mCoverBehaviors[i] = GregTech_API.getCoverBehavior(this.mCoverSides[i]); + } + + this.receiveClientEvent(0, aTextureData); + this.receiveClientEvent(1, aUpdateData); + this.receiveClientEvent(2, aColorData); + this.receiveClientEvent(3, aRedstoneData); + } + + @Override + public boolean receiveClientEvent(final int aEventID, int aValue) { + super.receiveClientEvent(aEventID, aValue); + + if (this.hasValidMetaTileEntity()) { + try { + this.mMetaTileEntity.receiveClientEvent((byte) aEventID, (byte) aValue); + } catch (final Throwable e) { + GT_Log.err.println("Encountered Exception while receiving Data from the Server, the Client should've been crashed by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); + e.printStackTrace(GT_Log.err); + } + } + + if (this.isClientSide()) { + this.issueTextureUpdate(); + switch (aEventID) { + case 0: + this.mFacing = (byte) (aValue & 7); + this.mActive = ((aValue & 8) != 0); + this.mRedstone = ((aValue & 16) != 0); + //mLockUpgrade = ((aValue&32) != 0); + break; + case 1: + if (this.hasValidMetaTileEntity()) { + this.mMetaTileEntity.onValueUpdate((byte) aValue); + } + break; + case 2: + if ((aValue > 16) || (aValue < 0)) { + aValue = 0; + } + this.mColor = (byte) aValue; + break; + case 3: + this.mSidedRedstone[0] = (byte) ((aValue & 1) > 0 ? 15 : 0); + this.mSidedRedstone[1] = (byte) ((aValue & 2) > 0 ? 15 : 0); + this.mSidedRedstone[2] = (byte) ((aValue & 4) > 0 ? 15 : 0); + this.mSidedRedstone[3] = (byte) ((aValue & 8) > 0 ? 15 : 0); + this.mSidedRedstone[4] = (byte) ((aValue & 16) > 0 ? 15 : 0); + this.mSidedRedstone[5] = (byte) ((aValue & 32) > 0 ? 15 : 0); + break; + case 4: + if (this.hasValidMetaTileEntity() && (this.mTickTimer > 20)) { + this.mMetaTileEntity.doSound((byte) aValue, this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5); + } + break; + case 5: + if (this.hasValidMetaTileEntity() && (this.mTickTimer > 20)) { + this.mMetaTileEntity.startSoundLoop((byte) aValue, this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5); + } + break; + case 6: + if (this.hasValidMetaTileEntity() && (this.mTickTimer > 20)) { + this.mMetaTileEntity.stopSoundLoop((byte) aValue, this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5); + } + break; + case 7: + this.mLightValue = (byte) aValue; + break; + } + } + return true; + } + + public ArrayList<String> getDebugInfo(final EntityPlayer aPlayer, final int aLogLevel) { + final ArrayList<String> tList = new ArrayList<>(); + if (aLogLevel > 2) { + tList.add("Meta-ID: " + this.mID + (this.canAccessData() ? " valid" : " invalid") + (this.mMetaTileEntity == null ? " MetaTileEntity == null!" : " ")); + } + if (aLogLevel > 1) { + if (this.mTimeStatistics.length > 0) { + double tAverageTime = 0; + for (final int tTime : this.mTimeStatistics) { + tAverageTime += tTime; + } + tList.add("This particular TileEntity has caused an average CPU-load of ~" + (tAverageTime / this.mTimeStatistics.length) + "ms over the last " + this.mTimeStatistics.length + " ticks."); + } + if (this.mLagWarningCount > 0) { + tList.add("This TileEntity has also caused " + (this.mLagWarningCount >= 10 ? "more than 10" : this.mLagWarningCount) + " Lag Spike Warnings (anything taking longer than " + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server."); + } + tList.add("Is" + (this.mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : " not ") + "accessible for you"); + } + if (aLogLevel > 0) { + if ((this.getSteamCapacity() > 0) && this.hasSteamEngineUpgrade()) { + tList.add(this.getStoredSteam() + " of " + this.getSteamCapacity() + " Steam"); + } + tList.add("Machine is " + (this.mActive ? "active" : "inactive")); + if (!this.mHasEnoughEnergy) { + tList.add("ATTENTION: This Device consumes Energy at a higher Rate than you input. You could insert more to speed up the process."); + } + } + return this.mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList); + } + + @Override + public void issueTextureUpdate() { + this.mNeedsUpdate = true; + } + + @Override + public void issueBlockUpdate() { + this.mNeedsBlockUpdate = true; + } + + @Override + public void issueClientUpdate() { + this.mSendClientData = true; + } + + @Override + public void issueCoverUpdate(final byte aSide) { + this.issueClientUpdate(); + } + + @Override + public byte getStrongestRedstone() { + return (byte) Math.max(this.getInternalInputRedstoneSignal((byte) 0), Math.max(this.getInternalInputRedstoneSignal((byte) 1), Math.max(this.getInternalInputRedstoneSignal((byte) 2), Math.max(this.getInternalInputRedstoneSignal((byte) 3), Math.max(this.getInternalInputRedstoneSignal((byte) 4), this.getInternalInputRedstoneSignal((byte) 5)))))); + } + + @Override + public boolean getRedstone() { + return this.getRedstone((byte) 0) || this.getRedstone((byte) 1) || this.getRedstone((byte) 2) || this.getRedstone((byte) 3) || this.getRedstone((byte) 4) || this.getRedstone((byte) 5); + } + + @Override + public boolean getRedstone(final byte aSide) { + return this.getInternalInputRedstoneSignal(aSide) > 0; + } + + public ITexture getCoverTexture(final byte aSide) { + return GregTech_API.sCovers.get(new GT_ItemStack(this.getCoverIDAtSide(aSide))); + } + + @Override + public boolean isGivingInformation() { + if (this.canAccessData()) { + return this.mMetaTileEntity.isGivingInformation(); + } + return false; + } + + @Override + public boolean isValidFacing(final byte aSide) { + if (this.canAccessData()) { + return this.mMetaTileEntity.isFacingValid(aSide); + } + return false; + } + + @Override + public byte getBackFacing() { + return GT_Utility.getOppositeSide(this.mFacing); + } + + @Override + public byte getFrontFacing() { + return this.mFacing; + } + + @Override + public void setFrontFacing(final byte aFacing) { + if (this.isValidFacing(aFacing)) { + this.mFacing = aFacing; + this.mMetaTileEntity.onFacingChange(); + this.onMachineBlockUpdate(); + } + } + + @Override + public int getSizeInventory() { + if (this.canAccessData()) { + return this.mMetaTileEntity.getSizeInventory(); + } + return 0; + } + + @Override + public ItemStack getStackInSlot(final int aIndex) { + if (this.canAccessData()) { + return this.mMetaTileEntity.getStackInSlot(aIndex); + } + return null; + } + + @Override + public void setInventorySlotContents(final int aIndex, final ItemStack aStack) { + this.mInventoryChanged = true; + if (this.canAccessData()) { + this.mMetaTileEntity.setInventorySlotContents(aIndex, this.worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack)); + } + } + + @Override + public String getInventoryName() { + if (this.canAccessData()) { + return this.mMetaTileEntity.getInventoryName(); + } + if (GregTech_API.METATILEENTITIES[this.mID] != null) { + return GregTech_API.METATILEENTITIES[this.mID].getInventoryName(); + } + return ""; + } + + @Override + public int getInventoryStackLimit() { + if (this.canAccessData()) { + return this.mMetaTileEntity.getInventoryStackLimit(); + } + return 64; + } + + @Override + public void openInventory() { + if (this.canAccessData()) { + this.mMetaTileEntity.onOpenGUI(); + } + } + + @Override + public void closeInventory() { + if (this.canAccessData()) { + this.mMetaTileEntity.onCloseGUI(); + } + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer aPlayer) { + return this.canAccessData() && this.playerOwnsThis(aPlayer, false) && (this.mTickTimer > 40) && (this.getTileEntityOffset(0, 0, 0) == this) && (aPlayer.getDistanceSq(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5) < 64) && this.mMetaTileEntity.isAccessAllowed(aPlayer); + } + + @Override + public void validate() { + super.validate(); + this.mTickTimer = 0; + } + + @Override + public void invalidate() { + this.tileEntityInvalid = false; + if (this.canAccessData()) { + this.mMetaTileEntity.onRemoval(); + this.mMetaTileEntity.setBaseMetaTileEntity(null); + } + super.invalidate(); + } + + @Override + public void onChunkUnload() { + super.onChunkUnload(); + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public ItemStack getStackInSlotOnClosing(final int slot) { + final ItemStack stack = this.getStackInSlot(slot); + if (stack != null) { + this.setInventorySlotContents(slot, null); + } + return stack; + } + + @Override + public void onMachineBlockUpdate() { + if (this.canAccessData()) { + this.mMetaTileEntity.onMachineBlockUpdate(); + } + } + + @Override + public int getProgress() { + return this.canAccessData() ? this.mMetaTileEntity.getProgresstime() : 0; + } + + @Override + public int getMaxProgress() { + return this.canAccessData() ? this.mMetaTileEntity.maxProgresstime() : 0; + } + + @Override + public boolean increaseProgress(final int aProgressAmountInTicks) { + return this.canAccessData() ? this.mMetaTileEntity.increaseProgress(aProgressAmountInTicks) != aProgressAmountInTicks : false; + } + + @Override + public boolean hasThingsToDo() { + return this.getMaxProgress() > 0; + } + + @Override + public void enableWorking() { + if (!this.mWorks) { + this.mWorkUpdate = true; + } + this.mWorks = true; + } + + @Override + public void disableWorking() { + this.mWorks = false; + } + + @Override + public boolean isAllowedToWork() { + return this.mWorks; + } + + @Override + public boolean hasWorkJustBeenEnabled() { + return this.mWorkUpdate; + } + + @Override + public byte getWorkDataValue() { + return this.mWorkData; + } + + @Override + public void setWorkDataValue(final byte aValue) { + this.mWorkData = aValue; + } + + @Override + public int getMetaTileID() { + return this.mID; + } + + @Override + public int setMetaTileID(final short aID) { + return this.mID = aID; + } + + @Override + public boolean isActive() { + return this.mActive; + } + + @Override + public void setActive(final boolean aActive) { + this.mActive = aActive; + } + + @Override + public long getTimer() { + return this.mTickTimer; + } + + @Override + public boolean decreaseStoredEnergyUnits(final long aEnergy, final boolean aIgnoreTooLessEnergy) { + if (!this.canAccessData()) { + return false; + } + return this.mHasEnoughEnergy = this.decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy) || this.decreaseStoredSteam(aEnergy, false) || (aIgnoreTooLessEnergy && (this.decreaseStoredSteam(aEnergy, true))); + } + + @Override + public boolean increaseStoredEnergyUnits(final long aEnergy, final boolean aIgnoreTooMuchEnergy) { + if (!this.canAccessData()) { + return false; + } + if ((this.getStoredEU() < this.getEUCapacity()) || aIgnoreTooMuchEnergy) { + this.setStoredEU(this.mMetaTileEntity.getEUVar() + aEnergy); + return true; + } + return false; + } + + @Override + public boolean inputEnergyFrom(final byte aSide) { + if (aSide == 6) { + return true; + } + if (this.isServerSide()) { + return ((aSide >= 0) && (aSide < 6) ? this.mActiveEUInputs[aSide] : false) && !this.mReleaseEnergy; + } + return this.isEnergyInputSide(aSide); + } + + @Override + public boolean outputsEnergyTo(final byte aSide) { + if (aSide == 6) { + return true; + } + if (this.isServerSide()) { + return ((aSide >= 0) && (aSide < 6) ? this.mActiveEUOutputs[aSide] : false) || this.mReleaseEnergy; + } + return this.isEnergyOutputSide(aSide); + } + + @Override + public long getOutputAmperage() { + if (this.canAccessData() && this.mMetaTileEntity.isElectric()) { + return this.mMetaTileEntity.maxAmperesOut(); + } + return 0; + } + + @Override + public long getOutputVoltage() { + if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.mMetaTileEntity.isEnetOutput()) { + return this.mMetaTileEntity.maxEUOutput(); + } + return 0; + } + + @Override + public long getInputAmperage() { + if (this.canAccessData() && this.mMetaTileEntity.isElectric()) { + return this.mMetaTileEntity.maxAmperesIn(); + } + return 0; + } + + @Override + public long getInputVoltage() { + if (this.canAccessData() && this.mMetaTileEntity.isElectric()) { + return this.mMetaTileEntity.maxEUInput(); + } + return Integer.MAX_VALUE; + } + + @Override + public boolean increaseStoredSteam(final long aEnergy, final boolean aIgnoreTooMuchEnergy) { + if (!this.canAccessData()) { + return false; + } + if ((this.mMetaTileEntity.getSteamVar() < this.getSteamCapacity()) || aIgnoreTooMuchEnergy) { + this.setStoredSteam(this.mMetaTileEntity.getSteamVar() + aEnergy); + return true; + } + return false; + } + + @Override + public String[] getDescription() { + if (this.canAccessData()) { + return this.mMetaTileEntity.getDescription(); + } + return new String[0]; + } + + @Override + public boolean isValidSlot(final int aIndex) { + if (this.canAccessData()) { + return this.mMetaTileEntity.isValidSlot(aIndex); + } + return false; + } + + @Override + public long getUniversalEnergyStored() { + return Math.max(this.getStoredEU(), this.getStoredSteam()); + } + + @Override + public long getUniversalEnergyCapacity() { + return Math.max(this.getEUCapacity(), this.getSteamCapacity()); + } + + @Override + public long getStoredEU() { + if (this.canAccessData()) { + return Math.min(this.mMetaTileEntity.getEUVar(), this.getEUCapacity()); + } + return 0; + } + + @Override + public long getEUCapacity() { + if (this.canAccessData()) { + return this.mMetaTileEntity.maxEUStore(); + } + return 0; + } + + @Override + public long getStoredSteam() { + if (this.canAccessData()) { + return Math.min(this.mMetaTileEntity.getSteamVar(), this.getSteamCapacity()); + } + return 0; + } + + @Override + public long getSteamCapacity() { + if (this.canAccessData()) { + return this.mMetaTileEntity.maxSteamStore(); + } + return 0; + } + + private boolean isEnergyInputSide(final byte aSide) { + if ((aSide >= 0) && (aSide < 6)) { + if (!this.getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, this.getCoverIDAtSide(aSide), this.getCoverDataAtSide(aSide), this)) { + return false; + } + if (this.isInvalid() || this.mReleaseEnergy) { + return false; + } + if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.mMetaTileEntity.isEnetInput()) { + return this.mMetaTileEntity.isInputFacing(aSide); + } + } + return false; + } + + private boolean isEnergyOutputSide(final byte aSide) { + if ((aSide >= 0) && (aSide < 6)) { + if (!this.getCoverBehaviorAtSide(aSide).letsEnergyOut(aSide, this.getCoverIDAtSide(aSide), this.getCoverDataAtSide(aSide), this)) { + return false; + } + if (this.isInvalid() || this.mReleaseEnergy) { + return this.mReleaseEnergy; + } + if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.mMetaTileEntity.isEnetOutput()) { + return this.mMetaTileEntity.isOutputFacing(aSide); + } + } + return false; + } + + protected boolean hasValidMetaTileEntity() { + return (this.mMetaTileEntity != null) && (this.mMetaTileEntity.getBaseMetaTileEntity() == this); + } + + protected boolean canAccessData() { + return !this.isDead && this.hasValidMetaTileEntity(); + } + + public boolean setStoredEU(long aEnergy) { + if (!this.canAccessData()) { + return false; + } + if (aEnergy < 0) { + aEnergy = 0; + } + this.mMetaTileEntity.setEUVar(aEnergy); + return true; + } + + public boolean setStoredSteam(long aEnergy) { + if (!this.canAccessData()) { + return false; + } + if (aEnergy < 0) { + aEnergy = 0; + } + this.mMetaTileEntity.setSteamVar(aEnergy); + return true; + } + + public boolean decreaseStoredEU(final long aEnergy, final boolean aIgnoreTooLessEnergy) { + if (!this.canAccessData()) { + return false; + } + if (((this.mMetaTileEntity.getEUVar() - aEnergy) >= 0) || aIgnoreTooLessEnergy) { + this.setStoredEU(this.mMetaTileEntity.getEUVar() - aEnergy); + if (this.mMetaTileEntity.getEUVar() < 0) { + this.setStoredEU(0); + return false; + } + return true; + } + return false; + } + + public boolean decreaseStoredSteam(final long aEnergy, final boolean aIgnoreTooLessEnergy) { + if (!this.canAccessData()) { + return false; + } + if (((this.mMetaTileEntity.getSteamVar() - aEnergy) >= 0) || aIgnoreTooLessEnergy) { + this.setStoredSteam(this.mMetaTileEntity.getSteamVar() - aEnergy); + if (this.mMetaTileEntity.getSteamVar() < 0) { + this.setStoredSteam(0); + return false; + } + return true; + } + return false; + } + + public boolean playerOwnsThis(final EntityPlayer aPlayer, final boolean aCheckPrecicely) { + if (!this.canAccessData()) { + return false; + } + if (aCheckPrecicely || this.privateAccess() || this.mOwnerName.equals("")) { + if (this.mOwnerName.equals("") && this.isServerSide()) { + this.setOwnerName(aPlayer.getDisplayName()); + } else if (this.privateAccess() && !aPlayer.getDisplayName().equals("Player") && !this.mOwnerName.equals("Player") && !this.mOwnerName.equals(aPlayer.getDisplayName())) { + return false; + } + } + return true; + } + + public boolean privateAccess() { + if (!this.canAccessData()) { + return this.mLockUpgrade; + } + return this.mLockUpgrade || this.mMetaTileEntity.ownerControl(); + } + + public void doEnergyExplosion() { + if ((this.getUniversalEnergyCapacity() > 0) && (this.getUniversalEnergyStored() >= (this.getUniversalEnergyCapacity() / 5))) { + this.doExplosion(this.oOutput * (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() ? 4 : this.getUniversalEnergyStored() >= (this.getUniversalEnergyCapacity() / 2) ? 2 : 1)); + GT_Mod.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(this.mOwnerName), "electricproblems"); + } + } + + @Override + public void doExplosion(final long aAmount) { + if (this.canAccessData()) { + // This is only for Electric Machines + if (GregTech_API.sMachineWireFire && this.mMetaTileEntity.isElectric()) { + try { + this.mReleaseEnergy = true; + IEnergyConnected.Util.emitEnergyToNetwork(V[5], Math.max(1, this.getStoredEU() / V[5]), this); + } catch (final Exception e) {/* Fun Fact: all these "do nothing" Comments you see in my Code, are just there to let Eclipse shut up about the intended empty Brackets, but I need eclipse to yell at me in some of the regular Cases where I forget to add Code */} + } + this.mReleaseEnergy = false; + // Normal Explosion Code + this.mMetaTileEntity.onExplosion(); + this.mMetaTileEntity.doExplosion(aAmount); + } + } + + @Override + public ArrayList<ItemStack> getDrops() { + final ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, this.mID); + final NBTTagCompound tNBT = new NBTTagCompound(); + if ((this.mRecipeStuff != null) && !this.mRecipeStuff.hasNoTags()) { + tNBT.setTag("GT.CraftingComponents", this.mRecipeStuff); + } + if (this.mMuffler) { + tNBT.setBoolean("mMuffler", this.mMuffler); + } + if (this.mLockUpgrade) { + tNBT.setBoolean("mLockUpgrade", this.mLockUpgrade); + } + if (this.mSteamConverter) { + tNBT.setBoolean("mSteamConverter", this.mSteamConverter); + } + if (this.mColor > 0) { + tNBT.setByte("mColor", this.mColor); + } + if (this.mOtherUpgrades > 0) { + tNBT.setByte("mOtherUpgrades", this.mOtherUpgrades); + } + if (this.mStrongRedstone > 0) { + tNBT.setByte("mStrongRedstone", this.mStrongRedstone); + } + for (byte i = 0; i < this.mCoverSides.length; i++) { + if (this.mCoverSides[i] != 0) { + tNBT.setIntArray("mCoverData", this.mCoverData); + tNBT.setIntArray("mCoverSides", this.mCoverSides); + break; + } + } + if (this.hasValidMetaTileEntity()) { + this.mMetaTileEntity.setItemNBT(tNBT); + } + if (!tNBT.hasNoTags()) { + rStack.setTagCompound(tNBT); + } + return new ArrayList<>(Arrays.asList(rStack)); + } + + public int getUpgradeCount() { + return (this.mMuffler ? 1 : 0) + (this.mLockUpgrade ? 1 : 0) + (this.mSteamConverter ? 1 : 0) + this.mOtherUpgrades; + } + + @Override + public boolean onRightclick(final EntityPlayer aPlayer, final byte aSide, final float aX, final float aY, final float aZ) { + if (this.isClientSide()) { + if (this.getCoverBehaviorAtSide(aSide).onCoverRightclickClient(aSide, this, aPlayer, aX, aY, aZ)) { + return true; + } + if (!this.getCoverBehaviorAtSide(aSide).isGUIClickable(aSide, this.getCoverIDAtSide(aSide), this.getCoverDataAtSide(aSide), this)) { + return false; + } + } + if (this.isServerSide()) { + if (!this.privateAccess() || aPlayer.getDisplayName().equalsIgnoreCase(this.getOwnerName())) { + final ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); + if (tCurrentItem != null) { + if ((this.getColorization() >= 0) && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) { + tCurrentItem.func_150996_a(Items.bucket); + this.setColorization((byte) (this.getColorization() >= 16 ? -2 : -1)); + return true; + } + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) { + if (this.mMetaTileEntity.onWrenchRightClick(aSide, GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ), aPlayer, aX, aY, aZ)) { + GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); + GT_Utility.sendSoundToPlayers(this.worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, this.xCoord, this.yCoord, this.zCoord); + } + return true; + } + + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)) { + if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 200, aPlayer)) { + this.setCoverDataAtSide(aSide, this.getCoverBehaviorAtSide(aSide).onCoverScrewdriverclick(aSide, this.getCoverIDAtSide(aSide), this.getCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ)); + this.mMetaTileEntity.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + GT_Utility.sendSoundToPlayers(this.worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, this.xCoord, this.yCoord, this.zCoord); + } + return true; + } + + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sHardHammerList)) { + if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { + this.mInputDisabled = !this.mInputDisabled; + if (this.mInputDisabled) { + this.mOutputDisabled = !this.mOutputDisabled; + } + GT_Utility.sendChatToPlayer(aPlayer, "Auto-Input: " + (this.mInputDisabled ? "Disabled" : "Enabled") + " Auto-Output: " + (this.mOutputDisabled ? "Disabled" : "Enabled")); + GT_Utility.sendSoundToPlayers(this.worldObj, GregTech_API.sSoundList.get(1), 1.0F, -1, this.xCoord, this.yCoord, this.zCoord); + } + return true; + } + + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)) { + if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { + if (this.mWorks) { + this.disableWorking(); + } else { + this.enableWorking(); + } + GT_Utility.sendChatToPlayer(aPlayer, "Machine Processing: " + (this.isAllowedToWork() ? "Enabled" : "Disabled")); + GT_Utility.sendSoundToPlayers(this.worldObj, GregTech_API.sSoundList.get(101), 1.0F, -1, this.xCoord, this.yCoord, this.zCoord); + } + return true; + } + + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) { + final byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); + if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) { + this.mStrongRedstone ^= (1 << tSide); + GT_Utility.sendChatToPlayer(aPlayer, "Redstone Output at Side " + tSide + " set to: " + ((this.mStrongRedstone & (1 << tSide)) != 0 ? "Strong" : "Weak")); + GT_Utility.sendSoundToPlayers(this.worldObj, GregTech_API.sSoundList.get(103), 3.0F, -1, this.xCoord, this.yCoord, this.zCoord); + } + return true; + } + + if (this.getCoverIDAtSide(aSide) == 0) { + if (GregTech_API.sCovers.containsKey(new GT_ItemStack(tCurrentItem))) { + if (GregTech_API.getCoverBehavior(tCurrentItem).isCoverPlaceable(aSide, new GT_ItemStack(tCurrentItem), this) && this.mMetaTileEntity.allowCoverOnSide(aSide, new GT_ItemStack(tCurrentItem))) { + this.setCoverItemAtSide(aSide, tCurrentItem); + if (!aPlayer.capabilities.isCreativeMode) { + tCurrentItem.stackSize--; + } + GT_Utility.sendSoundToPlayers(this.worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, this.xCoord, this.yCoord, this.zCoord); + } + return true; + } + } else { + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)) { + if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) { + GT_Utility.sendSoundToPlayers(this.worldObj, GregTech_API.sSoundList.get(0), 1.0F, -1, this.xCoord, this.yCoord, this.zCoord); + this.dropCover(aSide, aSide, false); + } + return true; + } + } + } + + if (this.getCoverBehaviorAtSide(aSide).onCoverRightclick(aSide, this.getCoverIDAtSide(aSide), this.getCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ)) { + return true; + } + + if (!this.getCoverBehaviorAtSide(aSide).isGUIClickable(aSide, this.getCoverIDAtSide(aSide), this.getCoverDataAtSide(aSide), this)) { + return false; + } + + if (this.isUpgradable() && (aPlayer.inventory.getCurrentItem() != null)) {/* if (ItemList.Upgrade_SteamEngine.isStackEqual(aPlayer.inventory.getCurrentItem())) { if (addSteamEngineUpgrade()) { GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(3), 1.0F, -1, xCoord, yCoord, zCoord); @@ -1230,620 +1417,698 @@ public class GregtechBaseMetaTileEntityLossless extends BaseTileEntity implement } return true; }*/ - if (ItemList.Upgrade_Muffler.isStackEqual(aPlayer.inventory.getCurrentItem())) { - if (addMufflerUpgrade()) { - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(3), 1.0F, -1, xCoord, yCoord, zCoord); - if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--; - } - return true; - } - if (ItemList.Upgrade_Lock.isStackEqual(aPlayer.inventory.getCurrentItem())) { - if (isUpgradable() && !mLockUpgrade) { - mLockUpgrade = true; - setOwnerName(aPlayer.getDisplayName()); - GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(3), 1.0F, -1, xCoord, yCoord, zCoord); - if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--; - } - return true; - } - } - } - } - - try { - if (hasValidMetaTileEntity()) return mMetaTileEntity.onRightclick(this, aPlayer, aSide, aX, aY, aZ); - } catch (Throwable e) { - GT_Log.err.println("Encountered Exception while rightclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); - e.printStackTrace(GT_Log.err); - } - - return true; - } - - @Override - public void onLeftclick(EntityPlayer aPlayer) { - try { - if (aPlayer != null && hasValidMetaTileEntity()) mMetaTileEntity.onLeftclick(this, aPlayer); - } catch (Throwable e) { - GT_Log.err.println("Encountered Exception while leftclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); - e.printStackTrace(GT_Log.err); - } - } - - @Override - public boolean isDigitalChest() { - if (canAccessData()) return mMetaTileEntity.isDigitalChest(); - return false; - } - - @Override - public ItemStack[] getStoredItemData() { - if (canAccessData()) return mMetaTileEntity.getStoredItemData(); - return null; - } - - @Override - public void setItemCount(int aCount) { - if (canAccessData()) mMetaTileEntity.setItemCount(aCount); - } - - @Override - public int getMaxItemCount() { - if (canAccessData()) return mMetaTileEntity.getMaxItemCount(); - return 0; - } - - /** - * Can put aStack into Slot - */ - @Override - public boolean isItemValidForSlot(int aIndex, ItemStack aStack) { - return canAccessData() && mMetaTileEntity.isItemValidForSlot(aIndex, aStack); - } - - /** - * returns all valid Inventory Slots, no matter which Side (Unless it's covered). - * The Side Stuff is done in the following two Functions. - */ - @Override - public int[] getAccessibleSlotsFromSide(int aSide) { - if (canAccessData() && (getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), -1, this) || getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), -1, this))) - return mMetaTileEntity.getAccessibleSlotsFromSide(aSide); - return new int[0]; - } - - /** - * Can put aStack into Slot at Side - */ - @Override - public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - return canAccessData() && (mRunningThroughTick || !mInputDisabled) && getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), aIndex, this) && mMetaTileEntity.canInsertItem(aIndex, aStack, aSide); - } - - /** - * Can pull aStack out of Slot from Side - */ - @Override - public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { - return canAccessData() && (mRunningThroughTick || !mOutputDisabled) && getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), aIndex, this) && mMetaTileEntity.canExtractItem(aIndex, aStack, aSide); - } - - @Override - public boolean isUpgradable() { - return canAccessData() && getUpgradeCount() < 8; - } - - @Override - public byte getInternalInputRedstoneSignal(byte aSide) { - return (byte) (getCoverBehaviorAtSide(aSide).getRedstoneInput(aSide, getInputRedstoneSignal(aSide), getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) & 15); - } - - @Override - public byte getInputRedstoneSignal(byte aSide) { - return (byte) (worldObj.getIndirectPowerLevelTo(getOffsetX(aSide, 1), getOffsetY(aSide, 1), getOffsetZ(aSide, 1), aSide) & 15); - } - - @Override - public byte getOutputRedstoneSignal(byte aSide) { - return getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) ? mSidedRedstone[aSide] : 0; -// return (byte)(getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) || (mRedstone && getCoverBehaviorAtSide(aSide).letsRedstoneGoOut(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this))?mSidedRedstone[aSide]&15:0); - } - - @Override - public void setInternalOutputRedstoneSignal(byte aSide, byte aStrength) { - if (!getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this)) - setOutputRedstoneSignal(aSide, aStrength); - } - - @Override - public void setOutputRedstoneSignal(byte aSide, byte aStrength) { - aStrength = (byte) Math.min(Math.max(0, aStrength), 15); - if (aSide >= 0 && aSide < 6 && mSidedRedstone[aSide] != aStrength) { - mSidedRedstone[aSide] = aStrength; - issueBlockUpdate(); - } - } - - @Override - public boolean isSteamEngineUpgradable() { - return isUpgradable() && !hasSteamEngineUpgrade() && getSteamCapacity() > 0; - } - - @Override - public boolean addSteamEngineUpgrade() { - if (isSteamEngineUpgradable()) { - issueBlockUpdate(); - mSteamConverter = true; - return true; - } - return false; - } - - @Override - public boolean hasSteamEngineUpgrade() { - if (canAccessData() && mMetaTileEntity.isSteampowered()) return true; - return mSteamConverter; - } - - @Override - public boolean hasMufflerUpgrade() { - return mMuffler; - } - - @Override - public boolean isMufflerUpgradable() { - return isUpgradable() && !hasMufflerUpgrade(); - } - - @Override - public boolean addMufflerUpgrade() { - if (isMufflerUpgradable()) return mMuffler = true; - return false; - } - - @Override - public boolean hasInventoryBeenModified() { - return mInventoryChanged; - } - - @Override - public void setGenericRedstoneOutput(boolean aOnOff) { - mRedstone = aOnOff; - } - - @Override - public int getErrorDisplayID() { - return mDisplayErrorCode; - } - - @Override - public void setErrorDisplayID(int aErrorID) { - mDisplayErrorCode = aErrorID; - } - - @Override - public IMetaTileEntity getMetaTileEntity() { - return hasValidMetaTileEntity() ? mMetaTileEntity : null; - } - - @Override - public void setMetaTileEntity(IMetaTileEntity aMetaTileEntity) { - mMetaTileEntity = (MetaTileEntity) aMetaTileEntity; - } - - @Override - public GT_CoverBehavior getCoverBehaviorAtSide(byte aSide) { - return aSide >= 0 && aSide < mCoverBehaviors.length ? mCoverBehaviors[aSide] : GregTech_API.sNoBehavior; - } - - @Override - public void setCoverIDAtSide(byte aSide, int aID) { - if (aSide >= 0 && aSide < 6) { - mCoverSides[aSide] = aID; - mCoverData[aSide] = 0; - mCoverBehaviors[aSide] = GregTech_API.getCoverBehavior(aID); - issueCoverUpdate(aSide); - issueBlockUpdate(); - } - } - - @Override - public void setCoverItemAtSide(byte aSide, ItemStack aCover) { - GregTech_API.getCoverBehavior(aCover).placeCover(aSide, aCover, this); - } - - @Override - public int getCoverIDAtSide(byte aSide) { - if (aSide >= 0 && aSide < 6) return mCoverSides[aSide]; - return 0; - } - - @Override - public ItemStack getCoverItemAtSide(byte aSide) { - return GT_Utility.intToStack(getCoverIDAtSide(aSide)); - } - - @Override - public boolean canPlaceCoverIDAtSide(byte aSide, int aID) { - return getCoverIDAtSide(aSide) == 0; - } - - @Override - public boolean canPlaceCoverItemAtSide(byte aSide, ItemStack aCover) { - return getCoverIDAtSide(aSide) == 0; - } - - @Override - public void setCoverDataAtSide(byte aSide, int aData) { - if (aSide >= 0 && aSide < 6) mCoverData[aSide] = aData; - } - - @Override - public int getCoverDataAtSide(byte aSide) { - if (aSide >= 0 && aSide < 6) return mCoverData[aSide]; - return 0; - } - - public byte getLightValue() { - return mLightValue; - } - - @Override - public void setLightValue(byte aLightValue) { - mLightValue = (byte) (aLightValue & 15); - } - - @Override - public long getAverageElectricInput() { - int rEU = 0; - for (int tEU : mAverageEUInput) rEU += tEU; - return rEU / mAverageEUInput.length; - } - - @Override - public long getAverageElectricOutput() { - int rEU = 0; - for (int tEU : mAverageEUOutput) rEU += tEU; - return rEU / mAverageEUOutput.length; - } - - @Override - public boolean dropCover(byte aSide, byte aDroppedSide, boolean aForced) { - if (getCoverBehaviorAtSide(aSide).onCoverRemoval(aSide, getCoverIDAtSide(aSide), mCoverData[aSide], this, aForced) || aForced) { - ItemStack tStack = getCoverBehaviorAtSide(aSide).getDrop(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this); - if (tStack != null) { - tStack.setTagCompound(null); - EntityItem tEntity = new EntityItem(worldObj, getOffsetX(aDroppedSide, 1) + 0.5, getOffsetY(aDroppedSide, 1) + 0.5, getOffsetZ(aDroppedSide, 1) + 0.5, tStack); - tEntity.motionX = 0; - tEntity.motionY = 0; - tEntity.motionZ = 0; - worldObj.spawnEntityInWorld(tEntity); - } - setCoverIDAtSide(aSide, 0); - if (mMetaTileEntity.hasSidedRedstoneOutputBehavior()) { - setOutputRedstoneSignal(aSide, (byte) 0); - } else { - setOutputRedstoneSignal(aSide, (byte) 15); - } - return true; - } - return false; - } - - @Override - public String getOwnerName() { - if (GT_Utility.isStringInvalid(mOwnerName)) return "Player"; - return mOwnerName; - } - - @Override - public String setOwnerName(String aName) { - if (GT_Utility.isStringInvalid(aName)) return mOwnerName = "Player"; - return mOwnerName = aName; - } - - @Override - public byte getComparatorValue(byte aSide) { - return canAccessData() ? mMetaTileEntity.getComparatorValue(aSide) : 0; - } - - @Override - public byte getStrongOutputRedstoneSignal(byte aSide) { - return aSide >= 0 && aSide < 6 && (mStrongRedstone & (1 << aSide)) != 0 ? (byte) (mSidedRedstone[aSide] & 15) : 0; - } - - @Override - public void setStrongOutputRedstoneSignal(byte aSide, byte aStrength) { - mStrongRedstone |= (1 << aSide); - setOutputRedstoneSignal(aSide, aStrength); - } - - @Override - public ItemStack decrStackSize(int aIndex, int aAmount) { - if (canAccessData()) { - mInventoryChanged = true; - return mMetaTileEntity.decrStackSize(aIndex, aAmount); - } - return null; - } - - @Override - public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (!canAccessData() || !mMetaTileEntity.isElectric() || !inputEnergyFrom(aSide) || aAmperage <= 0 || aVoltage <= 0 || getStoredEU() >= getEUCapacity() || mMetaTileEntity.maxAmperesIn() <= mAcceptedAmperes) - return 0; - if (aVoltage > getInputVoltage()) { - doExplosion(aVoltage); - return 0; - } - if (increaseStoredEnergyUnits(aVoltage * (aAmperage = Math.min(aAmperage, Math.min(mMetaTileEntity.maxAmperesIn() - mAcceptedAmperes, 1 + ((getEUCapacity() - getStoredEU()) / aVoltage)))), true)) { - mAverageEUInput[mAverageEUInputIndex] += aVoltage * aAmperage; - mAcceptedAmperes += aAmperage; - return aAmperage; - } - return 0; - } - - @Override - public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (!canAccessData() || !mMetaTileEntity.isElectric() || !outputsEnergyTo(aSide) || getStoredEU() - (aVoltage * aAmperage) < mMetaTileEntity.getMinimumStoredEU()) - return false; - if (decreaseStoredEU(aVoltage * aAmperage, false)) { - mAverageEUOutput[mAverageEUOutputIndex] += aVoltage * aAmperage; - return true; - } - return false; - } - - @Override - public boolean acceptsRotationalEnergy(byte aSide) { - if (!canAccessData() || getCoverIDAtSide(aSide) != 0) return false; - return mMetaTileEntity.acceptsRotationalEnergy(aSide); - } - - @Override - public boolean injectRotationalEnergy(byte aSide, long aSpeed, long aEnergy) { - if (!canAccessData() || getCoverIDAtSide(aSide) != 0) return false; - return mMetaTileEntity.injectRotationalEnergy(aSide, aSpeed, aEnergy); - } - - @Override - public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mInputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid == null ? null : aFluid.getFluid(), this)))) - return mMetaTileEntity.fill(aSide, aFluid, doFill); - return 0; - } - - @Override - public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) { - if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid(), this)))) - return mMetaTileEntity.drain(aSide, maxDrain, doDrain); - return null; - } - - @Override - public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) { - if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid == null ? null : aFluid.getFluid(), this)))) - return mMetaTileEntity.drain(aSide, aFluid, doDrain); - return null; - } - - @Override - public boolean canFill(ForgeDirection aSide, Fluid aFluid) { - if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mInputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid, this)))) - return mMetaTileEntity.canFill(aSide, aFluid); - return false; - } - - @Override - public boolean canDrain(ForgeDirection aSide, Fluid aFluid) { - if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid, this)))) - return mMetaTileEntity.canDrain(aSide, aFluid); - return false; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - if (canAccessData() && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), null, this)) || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), null, this)))) - return mMetaTileEntity.getTankInfo(aSide); - return new FluidTankInfo[]{}; - } - - public double getOutputEnergyUnitsPerTick() { - return oOutput; - } - - public boolean isTeleporterCompatible(ForgeDirection aSide) { - return canAccessData() && mMetaTileEntity.isTeleporterCompatible(); - } - - public double demandedEnergyUnits() { - if (mReleaseEnergy || !canAccessData() || !mMetaTileEntity.isEnetInput()) return 0; - return getEUCapacity() - getStoredEU(); - } - - public double injectEnergyUnits(ForgeDirection aDirection, double aAmount) { - return injectEnergyUnits((byte) aDirection.ordinal(), (int) aAmount, 1) > 0 ? 0 : aAmount; - } - - public boolean acceptsEnergyFrom(TileEntity aEmitter, ForgeDirection aDirection) { - return inputEnergyFrom((byte) aDirection.ordinal()); - } - - public boolean emitsEnergyTo(TileEntity aReceiver, ForgeDirection aDirection) { - return outputsEnergyTo((byte) aDirection.ordinal()); - } - - public double getOfferedEnergy() { - return (canAccessData() && getStoredEU() - mMetaTileEntity.getMinimumStoredEU() >= oOutput) ? Math.max(0, oOutput) : 0; - } - - public void drawEnergy(double amount) { - mAverageEUOutput[mAverageEUOutputIndex] += amount; - decreaseStoredEU((int) amount, true); - } - - public int injectEnergy(ForgeDirection aForgeDirection, int aAmount) { - return injectEnergyUnits((byte) aForgeDirection.ordinal(), aAmount, 1) > 0 ? 0 : aAmount; - } - - public int addEnergy(int aEnergy) { - if (!canAccessData()) return 0; - if (aEnergy > 0) - increaseStoredEnergyUnits(aEnergy, true); - else - decreaseStoredEU(-aEnergy, true); - return (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getEUVar()); - } - - public boolean isAddedToEnergyNet() { - return false; - } - - public int demandsEnergy() { - if (mReleaseEnergy || !canAccessData() || !mMetaTileEntity.isEnetInput()) return 0; - return getCapacity() - getStored(); - } - - public int getCapacity() { - return (int) Math.min(Integer.MAX_VALUE, getEUCapacity()); - } - - public int getStored() { - return (int) Math.min(Integer.MAX_VALUE, Math.min(getStoredEU(), getCapacity())); - } - - public void setStored(int aEU) { - if (canAccessData()) setStoredEU(aEU); - } - - public int getMaxSafeInput() { - return (int) Math.min(Integer.MAX_VALUE, getInputVoltage()); - } - - public int getMaxEnergyOutput() { - if (mReleaseEnergy) return Integer.MAX_VALUE; - return getOutput(); - } - - public int getOutput() { - return (int) Math.min(Integer.MAX_VALUE, oOutput); - } - - public int injectEnergy(Direction aDirection, int aAmount) { - return injectEnergyUnits((byte) aDirection.toSideValue(), aAmount, 1) > 0 ? 0 : aAmount; - } - - public boolean isTeleporterCompatible(Direction aSide) { - return canAccessData() && mMetaTileEntity.isTeleporterCompatible(); - } - - public boolean acceptsEnergyFrom(TileEntity aReceiver, Direction aDirection) { - return inputEnergyFrom((byte) aDirection.toSideValue()); - } - - public boolean emitsEnergyTo(TileEntity aReceiver, Direction aDirection) { - return outputsEnergyTo((byte) aDirection.toSideValue()); - } - - @Override - public boolean isInvalidTileEntity() { - return isInvalid(); - } - - @Override - public boolean addStackToSlot(int aIndex, ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return true; - if (aIndex < 0 || aIndex >= getSizeInventory()) return false; - ItemStack tStack = getStackInSlot(aIndex); - if (GT_Utility.isStackInvalid(tStack)) { - setInventorySlotContents(aIndex, aStack); - return true; - } - aStack = GT_OreDictUnificator.get(aStack); - if (GT_Utility.areStacksEqual(tStack, aStack) && tStack.stackSize + aStack.stackSize <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) { - tStack.stackSize += aStack.stackSize; - return true; - } - return false; - } - - @Override - public boolean addStackToSlot(int aIndex, ItemStack aStack, int aAmount) { - return addStackToSlot(aIndex, GT_Utility.copyAmount(aAmount, aStack)); - } - - @Override - public byte getColorization() { - return (byte) (mColor - 1); - } - - @Override - public byte setColorization(byte aColor) { - if (aColor > 15 || aColor < -1) aColor = -1; - if (canAccessData()) mMetaTileEntity.onColorChangeServer(aColor); - return mColor = (byte) (aColor + 1); - } - - @Override - public float getBlastResistance(byte aSide) { - return canAccessData() ? Math.max(0, getMetaTileEntity().getExplosionResistance(aSide)) : 10.0F; - } - - @Override - public boolean isUniversalEnergyStored(long aEnergyAmount) { - if (getUniversalEnergyStored() >= aEnergyAmount) return true; - mHasEnoughEnergy = false; - return false; - } - - @Override - public String[] getInfoData() { - { - if (canAccessData()) return getMetaTileEntity().getInfoData(); - return new String[]{}; - } - } - - @Override - public void markDirty() { - super.markDirty(); - mInventoryChanged = true; - } - - @Override - public int getLightOpacity() { - return mMetaTileEntity == null ? getLightValue() > 0 ? 0 : 255 : mMetaTileEntity.getLightOpacity(); - } - - @Override - public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) { - mMetaTileEntity.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); - } - - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - return mMetaTileEntity.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); - } - - @Override - public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) { - mMetaTileEntity.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); - } - - - public ITexture[] getTexture(Block arg0, byte aSide) { - ITexture rIcon = getCoverTexture(aSide); - if (rIcon != null) return new ITexture[]{rIcon}; - if (hasValidMetaTileEntity()) - return mMetaTileEntity.getTexture(this, aSide, mFacing, (byte) (mColor - 1), mActive, getOutputRedstoneSignal(aSide) > 0); - return Textures.BlockIcons.ERROR_RENDERING; - } - - public ITexture[] getTexture(byte aSide) { - ITexture rIcon = getCoverTexture(aSide); - if (rIcon != null) return new ITexture[]{rIcon}; - if (hasValidMetaTileEntity()) - return mMetaTileEntity.getTexture(this, aSide, mFacing, (byte) (mColor - 1), mActive, getOutputRedstoneSignal(aSide) > 0); - return Textures.BlockIcons.ERROR_RENDERING; - } + if (ItemList.Upgrade_Muffler.isStackEqual(aPlayer.inventory.getCurrentItem())) { + if (this.addMufflerUpgrade()) { + GT_Utility.sendSoundToPlayers(this.worldObj, GregTech_API.sSoundList.get(3), 1.0F, -1, this.xCoord, this.yCoord, this.zCoord); + if (!aPlayer.capabilities.isCreativeMode) { + aPlayer.inventory.getCurrentItem().stackSize--; + } + } + return true; + } + if (ItemList.Upgrade_Lock.isStackEqual(aPlayer.inventory.getCurrentItem())) { + if (this.isUpgradable() && !this.mLockUpgrade) { + this.mLockUpgrade = true; + this.setOwnerName(aPlayer.getDisplayName()); + GT_Utility.sendSoundToPlayers(this.worldObj, GregTech_API.sSoundList.get(3), 1.0F, -1, this.xCoord, this.yCoord, this.zCoord); + if (!aPlayer.capabilities.isCreativeMode) { + aPlayer.inventory.getCurrentItem().stackSize--; + } + } + return true; + } + } + } + } + + try { + if (this.hasValidMetaTileEntity()) { + return this.mMetaTileEntity.onRightclick(this, aPlayer, aSide, aX, aY, aZ); + } + } catch (final Throwable e) { + GT_Log.err.println("Encountered Exception while rightclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); + e.printStackTrace(GT_Log.err); + } + + return true; + } + + @Override + public void onLeftclick(final EntityPlayer aPlayer) { + try { + if ((aPlayer != null) && this.hasValidMetaTileEntity()) { + this.mMetaTileEntity.onLeftclick(this, aPlayer); + } + } catch (final Throwable e) { + GT_Log.err.println("Encountered Exception while leftclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); + e.printStackTrace(GT_Log.err); + } + } + + @Override + public boolean isDigitalChest() { + if (this.canAccessData()) { + return this.mMetaTileEntity.isDigitalChest(); + } + return false; + } + + @Override + public ItemStack[] getStoredItemData() { + if (this.canAccessData()) { + return this.mMetaTileEntity.getStoredItemData(); + } + return null; + } + + @Override + public void setItemCount(final int aCount) { + if (this.canAccessData()) { + this.mMetaTileEntity.setItemCount(aCount); + } + } + + @Override + public int getMaxItemCount() { + if (this.canAccessData()) { + return this.mMetaTileEntity.getMaxItemCount(); + } + return 0; + } + + /** + * Can put aStack into Slot + */ + @Override + public boolean isItemValidForSlot(final int aIndex, final ItemStack aStack) { + return this.canAccessData() && this.mMetaTileEntity.isItemValidForSlot(aIndex, aStack); + } + + /** + * returns all valid Inventory Slots, no matter which Side (Unless it's covered). + * The Side Stuff is done in the following two Functions. + */ + @Override + public int[] getAccessibleSlotsFromSide(final int aSide) { + if (this.canAccessData() && (this.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, this.getCoverIDAtSide((byte) aSide), this.getCoverDataAtSide((byte) aSide), -1, this) || this.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, this.getCoverIDAtSide((byte) aSide), this.getCoverDataAtSide((byte) aSide), -1, this))) { + return this.mMetaTileEntity.getAccessibleSlotsFromSide(aSide); + } + return new int[0]; + } + + /** + * Can put aStack into Slot at Side + */ + @Override + public boolean canInsertItem(final int aIndex, final ItemStack aStack, final int aSide) { + return this.canAccessData() && (this.mRunningThroughTick || !this.mInputDisabled) && this.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, this.getCoverIDAtSide((byte) aSide), this.getCoverDataAtSide((byte) aSide), aIndex, this) && this.mMetaTileEntity.canInsertItem(aIndex, aStack, aSide); + } + + /** + * Can pull aStack out of Slot from Side + */ + @Override + public boolean canExtractItem(final int aIndex, final ItemStack aStack, final int aSide) { + return this.canAccessData() && (this.mRunningThroughTick || !this.mOutputDisabled) && this.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, this.getCoverIDAtSide((byte) aSide), this.getCoverDataAtSide((byte) aSide), aIndex, this) && this.mMetaTileEntity.canExtractItem(aIndex, aStack, aSide); + } + + @Override + public boolean isUpgradable() { + return this.canAccessData() && (this.getUpgradeCount() < 8); + } + + @Override + public byte getInternalInputRedstoneSignal(final byte aSide) { + return (byte) (this.getCoverBehaviorAtSide(aSide).getRedstoneInput(aSide, this.getInputRedstoneSignal(aSide), this.getCoverIDAtSide(aSide), this.getCoverDataAtSide(aSide), this) & 15); + } + + @Override + public byte getInputRedstoneSignal(final byte aSide) { + return (byte) (this.worldObj.getIndirectPowerLevelTo(this.getOffsetX(aSide, 1), this.getOffsetY(aSide, 1), this.getOffsetZ(aSide, 1), aSide) & 15); + } + + @Override + public byte getOutputRedstoneSignal(final byte aSide) { + return this.getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, this.getCoverIDAtSide(aSide), this.getCoverDataAtSide(aSide), this) ? this.mSidedRedstone[aSide] : 0; + // return (byte)(getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) || (mRedstone && getCoverBehaviorAtSide(aSide).letsRedstoneGoOut(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this))?mSidedRedstone[aSide]&15:0); + } + + @Override + public void setInternalOutputRedstoneSignal(final byte aSide, final byte aStrength) { + if (!this.getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, this.getCoverIDAtSide(aSide), this.getCoverDataAtSide(aSide), this)) { + this.setOutputRedstoneSignal(aSide, aStrength); + } + } + + @Override + public void setOutputRedstoneSignal(final byte aSide, byte aStrength) { + aStrength = (byte) Math.min(Math.max(0, aStrength), 15); + if ((aSide >= 0) && (aSide < 6) && (this.mSidedRedstone[aSide] != aStrength)) { + this.mSidedRedstone[aSide] = aStrength; + this.issueBlockUpdate(); + } + } + + @Override + public boolean isSteamEngineUpgradable() { + return this.isUpgradable() && !this.hasSteamEngineUpgrade() && (this.getSteamCapacity() > 0); + } + + @Override + public boolean addSteamEngineUpgrade() { + if (this.isSteamEngineUpgradable()) { + this.issueBlockUpdate(); + this.mSteamConverter = true; + return true; + } + return false; + } + + @Override + public boolean hasSteamEngineUpgrade() { + if (this.canAccessData() && this.mMetaTileEntity.isSteampowered()) { + return true; + } + return this.mSteamConverter; + } + + @Override + public boolean hasMufflerUpgrade() { + return this.mMuffler; + } + + @Override + public boolean isMufflerUpgradable() { + return this.isUpgradable() && !this.hasMufflerUpgrade(); + } + + @Override + public boolean addMufflerUpgrade() { + if (this.isMufflerUpgradable()) { + return this.mMuffler = true; + } + return false; + } + + @Override + public boolean hasInventoryBeenModified() { + return this.mInventoryChanged; + } + + @Override + public void setGenericRedstoneOutput(final boolean aOnOff) { + this.mRedstone = aOnOff; + } + + @Override + public int getErrorDisplayID() { + return this.mDisplayErrorCode; + } + + @Override + public void setErrorDisplayID(final int aErrorID) { + this.mDisplayErrorCode = aErrorID; + } + + @Override + public IMetaTileEntity getMetaTileEntity() { + return this.hasValidMetaTileEntity() ? this.mMetaTileEntity : null; + } + + @Override + public void setMetaTileEntity(final IMetaTileEntity aMetaTileEntity) { + this.mMetaTileEntity = (MetaTileEntity) aMetaTileEntity; + } + + @Override + public GT_CoverBehavior getCoverBehaviorAtSide(final byte aSide) { + return (aSide >= 0) && (aSide < this.mCoverBehaviors.length) ? this.mCoverBehaviors[aSide] : GregTech_API.sNoBehavior; + } + + @Override + public void setCoverIDAtSide(final byte aSide, final int aID) { + if ((aSide >= 0) && (aSide < 6)) { + this.mCoverSides[aSide] = aID; + this.mCoverData[aSide] = 0; + this.mCoverBehaviors[aSide] = GregTech_API.getCoverBehavior(aID); + this.issueCoverUpdate(aSide); + this.issueBlockUpdate(); + } + } + + @Override + public void setCoverItemAtSide(final byte aSide, final ItemStack aCover) { + GregTech_API.getCoverBehavior(aCover).placeCover(aSide, aCover, this); + } + + @Override + public int getCoverIDAtSide(final byte aSide) { + if ((aSide >= 0) && (aSide < 6)) { + return this.mCoverSides[aSide]; + } + return 0; + } + + @Override + public ItemStack getCoverItemAtSide(final byte aSide) { + return GT_Utility.intToStack(this.getCoverIDAtSide(aSide)); + } + + @Override + public boolean canPlaceCoverIDAtSide(final byte aSide, final int aID) { + return this.getCoverIDAtSide(aSide) == 0; + } + + @Override + public boolean canPlaceCoverItemAtSide(final byte aSide, final ItemStack aCover) { + return this.getCoverIDAtSide(aSide) == 0; + } + + @Override + public void setCoverDataAtSide(final byte aSide, final int aData) { + if ((aSide >= 0) && (aSide < 6)) { + this.mCoverData[aSide] = aData; + } + } + + @Override + public int getCoverDataAtSide(final byte aSide) { + if ((aSide >= 0) && (aSide < 6)) { + return this.mCoverData[aSide]; + } + return 0; + } + + public byte getLightValue() { + return this.mLightValue; + } + + @Override + public void setLightValue(final byte aLightValue) { + this.mLightValue = (byte) (aLightValue & 15); + } + + @Override + public long getAverageElectricInput() { + int rEU = 0; + for (final int tEU : this.mAverageEUInput) { + rEU += tEU; + } + return rEU / this.mAverageEUInput.length; + } + + @Override + public long getAverageElectricOutput() { + int rEU = 0; + for (final int tEU : this.mAverageEUOutput) { + rEU += tEU; + } + return rEU / this.mAverageEUOutput.length; + } + + @Override + public boolean dropCover(final byte aSide, final byte aDroppedSide, final boolean aForced) { + if (this.getCoverBehaviorAtSide(aSide).onCoverRemoval(aSide, this.getCoverIDAtSide(aSide), this.mCoverData[aSide], this, aForced) || aForced) { + final ItemStack tStack = this.getCoverBehaviorAtSide(aSide).getDrop(aSide, this.getCoverIDAtSide(aSide), this.getCoverDataAtSide(aSide), this); + if (tStack != null) { + tStack.setTagCompound(null); + final EntityItem tEntity = new EntityItem(this.worldObj, this.getOffsetX(aDroppedSide, 1) + 0.5, this.getOffsetY(aDroppedSide, 1) + 0.5, this.getOffsetZ(aDroppedSide, 1) + 0.5, tStack); + tEntity.motionX = 0; + tEntity.motionY = 0; + tEntity.motionZ = 0; + this.worldObj.spawnEntityInWorld(tEntity); + } + this.setCoverIDAtSide(aSide, 0); + if (this.mMetaTileEntity.hasSidedRedstoneOutputBehavior()) { + this.setOutputRedstoneSignal(aSide, (byte) 0); + } else { + this.setOutputRedstoneSignal(aSide, (byte) 15); + } + return true; + } + return false; + } + + @Override + public String getOwnerName() { + if (GT_Utility.isStringInvalid(this.mOwnerName)) { + return "Player"; + } + return this.mOwnerName; + } + + @Override + public String setOwnerName(final String aName) { + if (GT_Utility.isStringInvalid(aName)) { + return this.mOwnerName = "Player"; + } + return this.mOwnerName = aName; + } + + @Override + public byte getComparatorValue(final byte aSide) { + return this.canAccessData() ? this.mMetaTileEntity.getComparatorValue(aSide) : 0; + } + + @Override + public byte getStrongOutputRedstoneSignal(final byte aSide) { + return (aSide >= 0) && (aSide < 6) && ((this.mStrongRedstone & (1 << aSide)) != 0) ? (byte) (this.mSidedRedstone[aSide] & 15) : 0; + } + + @Override + public void setStrongOutputRedstoneSignal(final byte aSide, final byte aStrength) { + this.mStrongRedstone |= (1 << aSide); + this.setOutputRedstoneSignal(aSide, aStrength); + } + + @Override + public ItemStack decrStackSize(final int aIndex, final int aAmount) { + if (this.canAccessData()) { + this.mInventoryChanged = true; + return this.mMetaTileEntity.decrStackSize(aIndex, aAmount); + } + return null; + } + + @Override + public long injectEnergyUnits(final byte aSide, final long aVoltage, long aAmperage) { + if (!this.canAccessData() || !this.mMetaTileEntity.isElectric() || !this.inputEnergyFrom(aSide) || (aAmperage <= 0) || (aVoltage <= 0) || (this.getStoredEU() >= this.getEUCapacity()) || (this.mMetaTileEntity.maxAmperesIn() <= this.mAcceptedAmperes)) { + return 0; + } + if (aVoltage > this.getInputVoltage()) { + this.doExplosion(aVoltage); + return 0; + } + if (this.increaseStoredEnergyUnits(aVoltage * (aAmperage = Math.min(aAmperage, Math.min(this.mMetaTileEntity.maxAmperesIn() - this.mAcceptedAmperes, 1 + ((this.getEUCapacity() - this.getStoredEU()) / aVoltage)))), true)) { + this.mAverageEUInput[this.mAverageEUInputIndex] += aVoltage * aAmperage; + this.mAcceptedAmperes += aAmperage; + return aAmperage; + } + return 0; + } + + @Override + public boolean drainEnergyUnits(final byte aSide, final long aVoltage, final long aAmperage) { + if (!this.canAccessData() || !this.mMetaTileEntity.isElectric() || !this.outputsEnergyTo(aSide) || ((this.getStoredEU() - (aVoltage * aAmperage)) < this.mMetaTileEntity.getMinimumStoredEU())) { + return false; + } + if (this.decreaseStoredEU(aVoltage * aAmperage, false)) { + this.mAverageEUOutput[this.mAverageEUOutputIndex] += aVoltage * aAmperage; + return true; + } + return false; + } + + @Override + public boolean acceptsRotationalEnergy(final byte aSide) { + if (!this.canAccessData() || (this.getCoverIDAtSide(aSide) != 0)) { + return false; + } + return this.mMetaTileEntity.acceptsRotationalEnergy(aSide); + } + + @Override + public boolean injectRotationalEnergy(final byte aSide, final long aSpeed, final long aEnergy) { + if (!this.canAccessData() || (this.getCoverIDAtSide(aSide) != 0)) { + return false; + } + return this.mMetaTileEntity.injectRotationalEnergy(aSide, aSpeed, aEnergy); + } + + @Override + public int fill(final ForgeDirection aSide, final FluidStack aFluid, final boolean doFill) { + if ((this.mTickTimer > 5) && this.canAccessData() && (this.mRunningThroughTick || !this.mInputDisabled) && ((aSide == ForgeDirection.UNKNOWN) || (this.mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && this.getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), this.getCoverIDAtSide((byte) aSide.ordinal()), this.getCoverDataAtSide((byte) aSide.ordinal()), aFluid == null ? null : aFluid.getFluid(), this)))) { + return this.mMetaTileEntity.fill(aSide, aFluid, doFill); + } + return 0; + } + + @Override + public FluidStack drain(final ForgeDirection aSide, final int maxDrain, final boolean doDrain) { + if ((this.mTickTimer > 5) && this.canAccessData() && (this.mRunningThroughTick || !this.mOutputDisabled) && ((aSide == ForgeDirection.UNKNOWN) || (this.mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && this.getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), this.getCoverIDAtSide((byte) aSide.ordinal()), this.getCoverDataAtSide((byte) aSide.ordinal()), this.mMetaTileEntity.getFluid() == null ? null : this.mMetaTileEntity.getFluid().getFluid(), this)))) { + return this.mMetaTileEntity.drain(aSide, maxDrain, doDrain); + } + return null; + } + + @Override + public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) { + if ((this.mTickTimer > 5) && this.canAccessData() && (this.mRunningThroughTick || !this.mOutputDisabled) && ((aSide == ForgeDirection.UNKNOWN) || (this.mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && this.getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), this.getCoverIDAtSide((byte) aSide.ordinal()), this.getCoverDataAtSide((byte) aSide.ordinal()), aFluid == null ? null : aFluid.getFluid(), this)))) { + return this.mMetaTileEntity.drain(aSide, aFluid, doDrain); + } + return null; + } + + @Override + public boolean canFill(final ForgeDirection aSide, final Fluid aFluid) { + if ((this.mTickTimer > 5) && this.canAccessData() && (this.mRunningThroughTick || !this.mInputDisabled) && ((aSide == ForgeDirection.UNKNOWN) || (this.mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && this.getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), this.getCoverIDAtSide((byte) aSide.ordinal()), this.getCoverDataAtSide((byte) aSide.ordinal()), aFluid, this)))) { + return this.mMetaTileEntity.canFill(aSide, aFluid); + } + return false; + } + + @Override + public boolean canDrain(final ForgeDirection aSide, final Fluid aFluid) { + if ((this.mTickTimer > 5) && this.canAccessData() && (this.mRunningThroughTick || !this.mOutputDisabled) && ((aSide == ForgeDirection.UNKNOWN) || (this.mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && this.getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), this.getCoverIDAtSide((byte) aSide.ordinal()), this.getCoverDataAtSide((byte) aSide.ordinal()), aFluid, this)))) { + return this.mMetaTileEntity.canDrain(aSide, aFluid); + } + return false; + } + + @Override + public FluidTankInfo[] getTankInfo(final ForgeDirection aSide) { + if (this.canAccessData() && ((aSide == ForgeDirection.UNKNOWN) || (this.mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && this.getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), this.getCoverIDAtSide((byte) aSide.ordinal()), this.getCoverDataAtSide((byte) aSide.ordinal()), null, this)) || (this.mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && this.getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), this.getCoverIDAtSide((byte) aSide.ordinal()), this.getCoverDataAtSide((byte) aSide.ordinal()), null, this)))) { + return this.mMetaTileEntity.getTankInfo(aSide); + } + return new FluidTankInfo[]{}; + } + + public double getOutputEnergyUnitsPerTick() { + return this.oOutput; + } + + public boolean isTeleporterCompatible(final ForgeDirection aSide) { + return this.canAccessData() && this.mMetaTileEntity.isTeleporterCompatible(); + } + + public double demandedEnergyUnits() { + if (this.mReleaseEnergy || !this.canAccessData() || !this.mMetaTileEntity.isEnetInput()) { + return 0; + } + return this.getEUCapacity() - this.getStoredEU(); + } + + public double injectEnergyUnits(final ForgeDirection aDirection, final double aAmount) { + return this.injectEnergyUnits((byte) aDirection.ordinal(), (int) aAmount, 1) > 0 ? 0 : aAmount; + } + + public boolean acceptsEnergyFrom(final TileEntity aEmitter, final ForgeDirection aDirection) { + return this.inputEnergyFrom((byte) aDirection.ordinal()); + } + + public boolean emitsEnergyTo(final TileEntity aReceiver, final ForgeDirection aDirection) { + return this.outputsEnergyTo((byte) aDirection.ordinal()); + } + + public double getOfferedEnergy() { + return (this.canAccessData() && ((this.getStoredEU() - this.mMetaTileEntity.getMinimumStoredEU()) >= this.oOutput)) ? Math.max(0, this.oOutput) : 0; + } + + public void drawEnergy(final double amount) { + this.mAverageEUOutput[this.mAverageEUOutputIndex] += amount; + this.decreaseStoredEU((int) amount, true); + } + + public int injectEnergy(final ForgeDirection aForgeDirection, final int aAmount) { + return this.injectEnergyUnits((byte) aForgeDirection.ordinal(), aAmount, 1) > 0 ? 0 : aAmount; + } + + public int addEnergy(final int aEnergy) { + if (!this.canAccessData()) { + return 0; + } + if (aEnergy > 0) { + this.increaseStoredEnergyUnits(aEnergy, true); + } else { + this.decreaseStoredEU(-aEnergy, true); + } + return (int) Math.min(Integer.MAX_VALUE, this.mMetaTileEntity.getEUVar()); + } + + public boolean isAddedToEnergyNet() { + return false; + } + + public int demandsEnergy() { + if (this.mReleaseEnergy || !this.canAccessData() || !this.mMetaTileEntity.isEnetInput()) { + return 0; + } + return this.getCapacity() - this.getStored(); + } + + public int getCapacity() { + return (int) Math.min(Integer.MAX_VALUE, this.getEUCapacity()); + } + + public int getStored() { + return (int) Math.min(Integer.MAX_VALUE, Math.min(this.getStoredEU(), this.getCapacity())); + } + + public void setStored(final int aEU) { + if (this.canAccessData()) { + this.setStoredEU(aEU); + } + } + + public int getMaxSafeInput() { + return (int) Math.min(Integer.MAX_VALUE, this.getInputVoltage()); + } + + public int getMaxEnergyOutput() { + if (this.mReleaseEnergy) { + return Integer.MAX_VALUE; + } + return this.getOutput(); + } + + public int getOutput() { + return (int) Math.min(Integer.MAX_VALUE, this.oOutput); + } + + public int injectEnergy(final Direction aDirection, final int aAmount) { + return this.injectEnergyUnits((byte) aDirection.toSideValue(), aAmount, 1) > 0 ? 0 : aAmount; + } + + public boolean isTeleporterCompatible(final Direction aSide) { + return this.canAccessData() && this.mMetaTileEntity.isTeleporterCompatible(); + } + + public boolean acceptsEnergyFrom(final TileEntity aReceiver, final Direction aDirection) { + return this.inputEnergyFrom((byte) aDirection.toSideValue()); + } + + public boolean emitsEnergyTo(final TileEntity aReceiver, final Direction aDirection) { + return this.outputsEnergyTo((byte) aDirection.toSideValue()); + } + + @Override + public boolean isInvalidTileEntity() { + return this.isInvalid(); + } + + @Override + public boolean addStackToSlot(final int aIndex, ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) { + return true; + } + if ((aIndex < 0) || (aIndex >= this.getSizeInventory())) { + return false; + } + final ItemStack tStack = this.getStackInSlot(aIndex); + if (GT_Utility.isStackInvalid(tStack)) { + this.setInventorySlotContents(aIndex, aStack); + return true; + } + aStack = GT_OreDictUnificator.get(aStack); + if (GT_Utility.areStacksEqual(tStack, aStack) && ((tStack.stackSize + aStack.stackSize) <= Math.min(aStack.getMaxStackSize(), this.getInventoryStackLimit()))) { + tStack.stackSize += aStack.stackSize; + return true; + } + return false; + } + + @Override + public boolean addStackToSlot(final int aIndex, final ItemStack aStack, final int aAmount) { + return this.addStackToSlot(aIndex, GT_Utility.copyAmount(aAmount, aStack)); + } + + @Override + public byte getColorization() { + return (byte) (this.mColor - 1); + } + + @Override + public byte setColorization(byte aColor) { + if ((aColor > 15) || (aColor < -1)) { + aColor = -1; + } + if (this.canAccessData()) { + this.mMetaTileEntity.onColorChangeServer(aColor); + } + return this.mColor = (byte) (aColor + 1); + } + + @Override + public float getBlastResistance(final byte aSide) { + return this.canAccessData() ? Math.max(0, this.getMetaTileEntity().getExplosionResistance(aSide)) : 10.0F; + } + + @Override + public boolean isUniversalEnergyStored(final long aEnergyAmount) { + if (this.getUniversalEnergyStored() >= aEnergyAmount) { + return true; + } + this.mHasEnoughEnergy = false; + return false; + } + + @Override + public String[] getInfoData() { + { + if (this.canAccessData()) { + return this.getMetaTileEntity().getInfoData(); + } + return new String[]{}; + } + } + + @Override + public void markDirty() { + super.markDirty(); + this.mInventoryChanged = true; + } + + @Override + public int getLightOpacity() { + return this.mMetaTileEntity == null ? this.getLightValue() > 0 ? 0 : 255 : this.mMetaTileEntity.getLightOpacity(); + } + + @Override + public void addCollisionBoxesToList(final World aWorld, final int aX, final int aY, final int aZ, final AxisAlignedBB inputAABB, final List<AxisAlignedBB> outputAABB, final Entity collider) { + this.mMetaTileEntity.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(final World aWorld, final int aX, final int aY, final int aZ) { + return this.mMetaTileEntity.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + } + + @Override + public void onEntityCollidedWithBlock(final World aWorld, final int aX, final int aY, final int aZ, final Entity collider) { + this.mMetaTileEntity.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); + } + + + public ITexture[] getTexture(final Block arg0, final byte aSide) { + final ITexture rIcon = this.getCoverTexture(aSide); + if (rIcon != null) { + return new ITexture[]{rIcon}; + } + if (this.hasValidMetaTileEntity()) { + return this.mMetaTileEntity.getTexture(this, aSide, this.mFacing, (byte) (this.mColor - 1), this.mActive, this.getOutputRedstoneSignal(aSide) > 0); + } + return Textures.BlockIcons.ERROR_RENDERING; + } + + @Override + public ITexture[] getTexture(final byte aSide) { + final ITexture rIcon = this.getCoverTexture(aSide); + if (rIcon != null) { + return new ITexture[]{rIcon}; + } + if (this.hasValidMetaTileEntity()) { + return this.mMetaTileEntity.getTexture(this, aSide, this.mFacing, (byte) (this.mColor - 1), this.mActive, this.getOutputRedstoneSignal(aSide) > 0); + } + return Textures.BlockIcons.ERROR_RENDERING; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaPipeEntity_BaseSuperConductor.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaPipeEntity_BaseSuperConductor.java index e415205cc9..4f18d76ea5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaPipeEntity_BaseSuperConductor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaPipeEntity_BaseSuperConductor.java @@ -2,17 +2,19 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.lossles import static gregtech.api.enums.GT_Values.GT; import static gregtech.api.enums.GT_Values.V; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.*; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.texture.IIconRegister; @@ -27,8 +29,6 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -41,596 +41,623 @@ import cpw.mods.fml.relauncher.SideOnly; * "new GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");" */ public abstract class GregtechMetaPipeEntity_BaseSuperConductor implements IMetaTileEntity { - /** - * The Inventory of the MetaTileEntity. Amount of Slots can be larger than 256. HAYO! - */ - public final ItemStack[] mInventory; - /** - * This variable tells, which directions the Block is connected to. It is a Bitmask. - */ - public byte mConnections = 0; - /** - * Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and for getInvName. - */ - public String mName; - public boolean doTickProfilingInThisTick = true; - /** - * accessibility to this Field is no longer given, see below - */ - private IGregTechTileEntity mBaseMetaTileEntity; - - /** - * This registers your Machine at the List. - * Use only ID's larger than 2048, because i reserved these ones. - * See also the List in the API, as it has a Description containing all the reservations. - * - * @param aID the ID - * @example for Constructor overload. - * <p/> - * public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) { - * super(aID, mName, mNameRegional); - * } - */ - public GregtechMetaPipeEntity_BaseSuperConductor(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) { - if (GregTech_API.sPostloadStarted || !GregTech_API.sPreloadStarted) - throw new IllegalAccessError("This Constructor has to be called in the load Phase"); - if (GregTech_API.METATILEENTITIES[aID] == null) { - GregTech_API.METATILEENTITIES[aID] = this; - } else { - throw new IllegalArgumentException("MetaMachine-Slot Nr. " + aID + " is already occupied!"); - } - mName = aBasicName.replaceAll(" ", "_").toLowerCase(); - setBaseMetaTileEntity(new BaseMetaPipeEntity()); - getBaseMetaTileEntity().setMetaTileID((short) aID); - GT_LanguageManager.addStringLocalization("gt.blockmachines." + mName + ".name", aRegionalName); - mInventory = new ItemStack[aInvSlotCount]; - - if (GT.isClientSide()) { - ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID); - tStack.getItem().addInformation(tStack, null, new ArrayList<String>(), true); - } - } - - /** - * This is the normal Constructor. - */ - public GregtechMetaPipeEntity_BaseSuperConductor(String aName, int aInvSlotCount) { - mInventory = new ItemStack[aInvSlotCount]; - mName = aName; - } - - /** - * For Pipe Rendering - */ - public abstract float getThickNess(); - - /** - * For Pipe Rendering - */ - public abstract boolean renderInside(byte aSide); - - @Override - public IGregTechTileEntity getBaseMetaTileEntity() { - return mBaseMetaTileEntity; - } - - @Override - public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) { - if (mBaseMetaTileEntity != null && aBaseMetaTileEntity == null) { - mBaseMetaTileEntity.getMetaTileEntity().inValidate(); - mBaseMetaTileEntity.setMetaTileEntity(null); - } - mBaseMetaTileEntity = aBaseMetaTileEntity; - if (mBaseMetaTileEntity != null) { - mBaseMetaTileEntity.setMetaTileEntity(this); - } - } - - @Override - public ItemStack getStackForm(long aAmount) { - return new ItemStack(GregTech_API.sBlockMachines, (int) aAmount, getBaseMetaTileEntity().getMetaTileID()); - } - - @Override - public void onServerStart() {/*Do nothing*/} - - @Override - public void onWorldSave(File aSaveDirectory) {/*Do nothing*/} - - @Override - public void onWorldLoad(File aSaveDirectory) {/*Do nothing*/} - - @Override - public void onConfigLoad(GT_Config aConfig) {/*Do nothing*/} - - @Override - public void setItemNBT(NBTTagCompound aNBT) {/*Do nothing*/} - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) {/*Do nothing*/} - - @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { - return true; - } - - @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {/*Do nothing*/} - - @Override - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - return false; - } - - @Override - public void onExplosion() {/*Do nothing*/} - - @Override - public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {/*Do nothing*/} - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {/*Do nothing*/} - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {/*Do nothing*/} - - @Override - public void inValidate() {/*Do nothing*/} - - @Override - public void onRemoval() {/*Do nothing*/} - - @Override - public void initDefaultModes(NBTTagCompound aNBT) {/*Do nothing*/} - - /** - * When a GUI is opened - */ - public void onOpenGUI() {/*Do nothing*/} - - /** - * When a GUI is closed - */ - public void onCloseGUI() {/*Do nothing*/} - - /** - * a Player rightclicks the Machine - * Sneaky rightclicks are not getting passed to this! - */ - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { - return false; - } - - @Override - public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {/*Do nothing*/} - - @Override - public void onValueUpdate(byte aValue) {/*Do nothing*/} - - @Override - public byte getUpdateData() { - return 0; - } - - @Override - public void doSound(byte aIndex, double aX, double aY, double aZ) {/*Do nothing*/} - - @Override - public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {/*Do nothing*/} - - @Override - public void stopSoundLoop(byte aValue, double aX, double aY, double aZ) {/*Do nothing*/} - - @Override - public final void sendSound(byte aIndex) { - if (!getBaseMetaTileEntity().hasMufflerUpgrade()) getBaseMetaTileEntity().sendBlockEvent((byte) 4, aIndex); - } - - @Override - public final void sendLoopStart(byte aIndex) { - if (!getBaseMetaTileEntity().hasMufflerUpgrade()) getBaseMetaTileEntity().sendBlockEvent((byte) 5, aIndex); - } - - @Override - public final void sendLoopEnd(byte aIndex) { - if (!getBaseMetaTileEntity().hasMufflerUpgrade()) getBaseMetaTileEntity().sendBlockEvent((byte) 6, aIndex); - } - - @Override - public boolean isFacingValid(byte aFacing) { - return false; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; - } - - @Override - public boolean setStackToZeroInsteadOfNull(int aIndex) { - return false; - } - - @Override - public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) { - return aList; - } - - @Override - public boolean isLiquidInput(byte aSide) { - return true; - } - - @Override - public boolean isLiquidOutput(byte aSide) { - return true; - } - - /** - * gets the contained Liquid - */ - @Override - public FluidStack getFluid() { - return null; - } - - /** - * tries to fill this Tank - */ - @Override - public int fill(FluidStack resource, boolean doFill) { - return 0; - } - - /** - * tries to empty this Tank - */ - @Override - public FluidStack drain(int maxDrain, boolean doDrain) { - return null; - } - - /** - * Tank pressure - */ - public int getTankPressure() { - return 0; - } - - /** - * Liquid Capacity - */ - @Override - public int getCapacity() { - return 0; - } - - /** - * Progress this machine has already made - */ - public int getProgresstime() { - return 0; - } - - /** - * Progress this Machine has to do to produce something - */ - public int maxProgresstime() { - return 0; - } - - /** - * Increases the Progress, returns the overflown Progress. - */ - public int increaseProgress(int aProgress) { - return 0; - } - - @Override - public void onMachineBlockUpdate() {/*Do nothing*/} - - @Override - public void receiveClientEvent(byte aEventID, byte aValue) {/*Do nothing*/} - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public byte getComparatorValue(byte aSide) { - return 0; - } - - @Override - public boolean acceptsRotationalEnergy(byte aSide) { - return false; - } - - @Override - public boolean injectRotationalEnergy(byte aSide, long aSpeed, long aEnergy) { - return false; - } - - @Override - public String getSpecialVoltageToolTip() { - return null; - } - - @Override - public boolean isGivingInformation() { - return false; - } - - @Override - public String[] getInfoData() { - return new String[]{}; - } - - public boolean isDigitalChest() { - return false; - } - - public ItemStack[] getStoredItemData() { - return null; - } - - public void setItemCount(int aCount) {/*Do nothing*/} - - public int getMaxItemCount() { - return 0; - } - - @Override - public int getSizeInventory() { - return mInventory.length; - } - - @Override - public ItemStack getStackInSlot(int aIndex) { - if (aIndex >= 0 && aIndex < mInventory.length) return mInventory[aIndex]; - return null; - } - - @Override - public void setInventorySlotContents(int aIndex, ItemStack aStack) { - if (aIndex >= 0 && aIndex < mInventory.length) mInventory[aIndex] = aStack; - } - - @Override - public String getInventoryName() { - if (GregTech_API.METATILEENTITIES[getBaseMetaTileEntity().getMetaTileID()] != null) - return GregTech_API.METATILEENTITIES[getBaseMetaTileEntity().getMetaTileID()].getMetaName(); - return ""; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public boolean isItemValidForSlot(int aIndex, ItemStack aStack) { - return getBaseMetaTileEntity().isValidSlot(aIndex); - } - - @Override - public ItemStack decrStackSize(int aIndex, int aAmount) { - ItemStack tStack = getStackInSlot(aIndex), rStack = GT_Utility.copy(tStack); - if (tStack != null) { - if (tStack.stackSize <= aAmount) { - if (setStackToZeroInsteadOfNull(aIndex)) tStack.stackSize = 0; - else setInventorySlotContents(aIndex, null); - } else { - rStack = tStack.splitStack(aAmount); - if (tStack.stackSize == 0 && !setStackToZeroInsteadOfNull(aIndex)) - setInventorySlotContents(aIndex, null); - } - } - return rStack; - } - - @Override - public int[] getAccessibleSlotsFromSide(int aSide) { - ArrayList<Integer> tList = new ArrayList<Integer>(); - IGregTechTileEntity tTileEntity = getBaseMetaTileEntity(); - boolean tSkip = tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2, tTileEntity) || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2, tTileEntity); - for (int i = 0; i < getSizeInventory(); i++) - if (isValidSlot(i) && (tSkip || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), i, tTileEntity) || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), i, tTileEntity))) - tList.add(i); - int[] rArray = new int[tList.size()]; - for (int i = 0; i < rArray.length; i++) rArray[i] = tList.get(i); - return rArray; - } - - @Override - public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); - } - - @Override - public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { - return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); - } - - @Override - public boolean canFill(ForgeDirection aSide, Fluid aFluid) { - return fill(aSide, new FluidStack(aFluid, 1), false) == 1; - } - - @Override - public boolean canDrain(ForgeDirection aSide, Fluid aFluid) { - return drain(aSide, new FluidStack(aFluid, 1), false) != null; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[]{}; - return new FluidTankInfo[]{getInfo()}; - } - - public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - return fill(aFluid, doFill); - } - - @Override - public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - return fill_default(aSide, aFluid, doFill); - } - - @Override - public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) { - if (getFluid() != null && aFluid != null && getFluid().isFluidEqual(aFluid)) - return drain(aFluid.amount, doDrain); - return null; - } - - @Override - public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) { - return drain(maxDrain, doDrain); - } - - @Override - public int getFluidAmount() { - return 0; - } - - @Override - public FluidTankInfo getInfo() { - return new FluidTankInfo(this); - } - - @Override - public String getMetaName() { - return mName; - } - - @Override - public ItemStack getStackInSlotOnClosing(int i) { - return null; - } - - @Override - public boolean doTickProfilingMessageDuringThisTick() { - return doTickProfilingInThisTick; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - return false; - } - - @Override - public boolean connectsToItemPipe(byte aSide) { - return false; - } - - @Override - public void openInventory() { - // - } - - @Override - public void closeInventory() { - // - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - @Override - public float getExplosionResistance(byte aSide) { - return 10.0F; - } - - @Override - public ItemStack[] getRealInventory() { - return mInventory; - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public void markDirty() { - // - } - - @Override - public void onColorChangeServer(byte aColor) { - // - } - - @Override - public void onColorChangeClient(byte aColor) { - // - } - - public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - return 0; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean renderInInventory(Block aBlock, int aMeta, RenderBlocks aRenderer) { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean renderInWorld(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer) { - return false; - } - - @Override - public void doExplosion(long aExplosionPower) { - float tStrength = aExplosionPower < V[0] ? 1.0F : aExplosionPower < V[1] ? 2.0F : aExplosionPower < V[2] ? 3.0F : aExplosionPower < V[3] ? 4.0F : aExplosionPower < V[4] ? 5.0F : aExplosionPower < V[4] * 2 ? 6.0F : aExplosionPower < V[5] ? 7.0F : aExplosionPower < V[6] ? 8.0F : aExplosionPower < V[7] ? 9.0F : 10.0F; - int tX = getBaseMetaTileEntity().getXCoord(), tY = getBaseMetaTileEntity().getYCoord(), tZ = getBaseMetaTileEntity().getZCoord(); - World tWorld = getBaseMetaTileEntity().getWorld(); - tWorld.setBlock(tX, tY, tZ, Blocks.air); - if (GregTech_API.sMachineExplosions) - tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); - } - - @Override - public int getLightOpacity() { - return 0; - } - - @Override - public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) { - AxisAlignedBB axisalignedbb1 = getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); - if (axisalignedbb1 != null && inputAABB.intersectsWith(axisalignedbb1)) outputAABB.add(axisalignedbb1); - } - - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1); - } - - @Override - public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) { - // - } - - @Override - public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - // - } + /** + * The Inventory of the MetaTileEntity. Amount of Slots can be larger than 256. HAYO! + */ + public final ItemStack[] mInventory; + /** + * This variable tells, which directions the Block is connected to. It is a Bitmask. + */ + public byte mConnections = 0; + /** + * Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and for getInvName. + */ + public String mName; + public boolean doTickProfilingInThisTick = true; + /** + * accessibility to this Field is no longer given, see below + */ + private IGregTechTileEntity mBaseMetaTileEntity; + + /** + * This registers your Machine at the List. + * Use only ID's larger than 2048, because i reserved these ones. + * See also the List in the API, as it has a Description containing all the reservations. + * + * @param aID the ID + * @example for Constructor overload. + * <p/> + * public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) { + * super(aID, mName, mNameRegional); + * } + */ + public GregtechMetaPipeEntity_BaseSuperConductor(final int aID, final String aBasicName, final String aRegionalName, final int aInvSlotCount) { + if (GregTech_API.sPostloadStarted || !GregTech_API.sPreloadStarted) { + throw new IllegalAccessError("This Constructor has to be called in the load Phase"); + } + if (GregTech_API.METATILEENTITIES[aID] == null) { + GregTech_API.METATILEENTITIES[aID] = this; + } else { + throw new IllegalArgumentException("MetaMachine-Slot Nr. " + aID + " is already occupied!"); + } + this.mName = aBasicName.replaceAll(" ", "_").toLowerCase(); + this.setBaseMetaTileEntity(new BaseMetaPipeEntity()); + this.getBaseMetaTileEntity().setMetaTileID((short) aID); + GT_LanguageManager.addStringLocalization("gt.blockmachines." + this.mName + ".name", aRegionalName); + this.mInventory = new ItemStack[aInvSlotCount]; + + if (GT.isClientSide()) { + final ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID); + tStack.getItem().addInformation(tStack, null, new ArrayList<String>(), true); + } + } + + /** + * This is the normal Constructor. + */ + public GregtechMetaPipeEntity_BaseSuperConductor(final String aName, final int aInvSlotCount) { + this.mInventory = new ItemStack[aInvSlotCount]; + this.mName = aName; + } + + /** + * For Pipe Rendering + */ + public abstract float getThickNess(); + + /** + * For Pipe Rendering + */ + public abstract boolean renderInside(byte aSide); + + @Override + public IGregTechTileEntity getBaseMetaTileEntity() { + return this.mBaseMetaTileEntity; + } + + @Override + public void setBaseMetaTileEntity(final IGregTechTileEntity aBaseMetaTileEntity) { + if ((this.mBaseMetaTileEntity != null) && (aBaseMetaTileEntity == null)) { + this.mBaseMetaTileEntity.getMetaTileEntity().inValidate(); + this.mBaseMetaTileEntity.setMetaTileEntity(null); + } + this.mBaseMetaTileEntity = aBaseMetaTileEntity; + if (this.mBaseMetaTileEntity != null) { + this.mBaseMetaTileEntity.setMetaTileEntity(this); + } + } + + @Override + public ItemStack getStackForm(final long aAmount) { + return new ItemStack(GregTech_API.sBlockMachines, (int) aAmount, this.getBaseMetaTileEntity().getMetaTileID()); + } + + @Override + public void onServerStart() {/*Do nothing*/} + + @Override + public void onWorldSave(final File aSaveDirectory) {/*Do nothing*/} + + @Override + public void onWorldLoad(final File aSaveDirectory) {/*Do nothing*/} + + @Override + public void onConfigLoad(final GT_Config aConfig) {/*Do nothing*/} + + @Override + public void setItemNBT(final NBTTagCompound aNBT) {/*Do nothing*/} + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(final IIconRegister aBlockIconRegister) {/*Do nothing*/} + + @Override + public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aCoverID) { + return true; + } + + @Override + public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) {/*Do nothing*/} + + @Override + public boolean onWrenchRightClick(final byte aSide, final byte aWrenchingSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) { + return false; + } + + @Override + public void onExplosion() {/*Do nothing*/} + + @Override + public void onFirstTick(final IGregTechTileEntity aBaseMetaTileEntity) {/*Do nothing*/} + + @Override + public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {/*Do nothing*/} + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {/*Do nothing*/} + + @Override + public void inValidate() {/*Do nothing*/} + + @Override + public void onRemoval() {/*Do nothing*/} + + @Override + public void initDefaultModes(final NBTTagCompound aNBT) {/*Do nothing*/} + + /** + * When a GUI is opened + */ + public void onOpenGUI() {/*Do nothing*/} + + /** + * When a GUI is closed + */ + public void onCloseGUI() {/*Do nothing*/} + + /** + * a Player rightclicks the Machine + * Sneaky rightclicks are not getting passed to this! + */ + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer, final byte aSide, final float aX, final float aY, final float aZ) { + return false; + } + + @Override + public void onLeftclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {/*Do nothing*/} + + @Override + public void onValueUpdate(final byte aValue) {/*Do nothing*/} + + @Override + public byte getUpdateData() { + return 0; + } + + @Override + public void doSound(final byte aIndex, final double aX, final double aY, final double aZ) {/*Do nothing*/} + + @Override + public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) {/*Do nothing*/} + + @Override + public void stopSoundLoop(final byte aValue, final double aX, final double aY, final double aZ) {/*Do nothing*/} + + @Override + public final void sendSound(final byte aIndex) { + if (!this.getBaseMetaTileEntity().hasMufflerUpgrade()) { + this.getBaseMetaTileEntity().sendBlockEvent((byte) 4, aIndex); + } + } + + @Override + public final void sendLoopStart(final byte aIndex) { + if (!this.getBaseMetaTileEntity().hasMufflerUpgrade()) { + this.getBaseMetaTileEntity().sendBlockEvent((byte) 5, aIndex); + } + } + + @Override + public final void sendLoopEnd(final byte aIndex) { + if (!this.getBaseMetaTileEntity().hasMufflerUpgrade()) { + this.getBaseMetaTileEntity().sendBlockEvent((byte) 6, aIndex); + } + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return false; + } + + @Override + public boolean isAccessAllowed(final EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isValidSlot(final int aIndex) { + return true; + } + + @Override + public boolean setStackToZeroInsteadOfNull(final int aIndex) { + return false; + } + + @Override + public ArrayList<String> getSpecialDebugInfo(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer, final int aLogLevel, final ArrayList<String> aList) { + return aList; + } + + @Override + public boolean isLiquidInput(final byte aSide) { + return true; + } + + @Override + public boolean isLiquidOutput(final byte aSide) { + return true; + } + + /** + * gets the contained Liquid + */ + @Override + public FluidStack getFluid() { + return null; + } + + /** + * tries to fill this Tank + */ + @Override + public int fill(final FluidStack resource, final boolean doFill) { + return 0; + } + + /** + * tries to empty this Tank + */ + @Override + public FluidStack drain(final int maxDrain, final boolean doDrain) { + return null; + } + + /** + * Tank pressure + */ + public int getTankPressure() { + return 0; + } + + /** + * Liquid Capacity + */ + @Override + public int getCapacity() { + return 0; + } + + /** + * Progress this machine has already made + */ + public int getProgresstime() { + return 0; + } + + /** + * Progress this Machine has to do to produce something + */ + public int maxProgresstime() { + return 0; + } + + /** + * Increases the Progress, returns the overflown Progress. + */ + public int increaseProgress(final int aProgress) { + return 0; + } + + @Override + public void onMachineBlockUpdate() {/*Do nothing*/} + + @Override + public void receiveClientEvent(final byte aEventID, final byte aValue) {/*Do nothing*/} + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public byte getComparatorValue(final byte aSide) { + return 0; + } + + @Override + public boolean acceptsRotationalEnergy(final byte aSide) { + return false; + } + + @Override + public boolean injectRotationalEnergy(final byte aSide, final long aSpeed, final long aEnergy) { + return false; + } + + @Override + public String getSpecialVoltageToolTip() { + return null; + } + + @Override + public boolean isGivingInformation() { + return false; + } + + @Override + public String[] getInfoData() { + return new String[]{}; + } + + public boolean isDigitalChest() { + return false; + } + + public ItemStack[] getStoredItemData() { + return null; + } + + public void setItemCount(final int aCount) {/*Do nothing*/} + + public int getMaxItemCount() { + return 0; + } + + @Override + public int getSizeInventory() { + return this.mInventory.length; + } + + @Override + public ItemStack getStackInSlot(final int aIndex) { + if ((aIndex >= 0) && (aIndex < this.mInventory.length)) { + return this.mInventory[aIndex]; + } + return null; + } + + @Override + public void setInventorySlotContents(final int aIndex, final ItemStack aStack) { + if ((aIndex >= 0) && (aIndex < this.mInventory.length)) { + this.mInventory[aIndex] = aStack; + } + } + + @Override + public String getInventoryName() { + if (GregTech_API.METATILEENTITIES[this.getBaseMetaTileEntity().getMetaTileID()] != null) { + return GregTech_API.METATILEENTITIES[this.getBaseMetaTileEntity().getMetaTileID()].getMetaName(); + } + return ""; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isItemValidForSlot(final int aIndex, final ItemStack aStack) { + return this.getBaseMetaTileEntity().isValidSlot(aIndex); + } + + @Override + public ItemStack decrStackSize(final int aIndex, final int aAmount) { + final ItemStack tStack = this.getStackInSlot(aIndex); + ItemStack rStack = GT_Utility.copy(tStack); + if (tStack != null) { + if (tStack.stackSize <= aAmount) { + if (this.setStackToZeroInsteadOfNull(aIndex)) { + tStack.stackSize = 0; + } else { + this.setInventorySlotContents(aIndex, null); + } + } else { + rStack = tStack.splitStack(aAmount); + if ((tStack.stackSize == 0) && !this.setStackToZeroInsteadOfNull(aIndex)) { + this.setInventorySlotContents(aIndex, null); + } + } + } + return rStack; + } + + @Override + public int[] getAccessibleSlotsFromSide(final int aSide) { + final ArrayList<Integer> tList = new ArrayList<>(); + final IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity(); + final boolean tSkip = tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2, tTileEntity) || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2, tTileEntity); + for (int i = 0; i < this.getSizeInventory(); i++) { + if (this.isValidSlot(i) && (tSkip || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), i, tTileEntity) || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), i, tTileEntity))) { + tList.add(i); + } + } + final int[] rArray = new int[tList.size()]; + for (int i = 0; i < rArray.length; i++) { + rArray[i] = tList.get(i); + } + return rArray; + } + + @Override + public boolean canInsertItem(final int aIndex, final ItemStack aStack, final int aSide) { + return this.isValidSlot(aIndex) && (aStack != null) && (aIndex < this.mInventory.length) && ((this.mInventory[aIndex] == null) || GT_Utility.areStacksEqual(aStack, this.mInventory[aIndex])) && this.allowPutStack(this.getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); + } + + @Override + public boolean canExtractItem(final int aIndex, final ItemStack aStack, final int aSide) { + return this.isValidSlot(aIndex) && (aStack != null) && (aIndex < this.mInventory.length) && this.allowPullStack(this.getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); + } + + @Override + public boolean canFill(final ForgeDirection aSide, final Fluid aFluid) { + return this.fill(aSide, new FluidStack(aFluid, 1), false) == 1; + } + + @Override + public boolean canDrain(final ForgeDirection aSide, final Fluid aFluid) { + return this.drain(aSide, new FluidStack(aFluid, 1), false) != null; + } + + @Override + public FluidTankInfo[] getTankInfo(final ForgeDirection aSide) { + if ((this.getCapacity() <= 0) && !this.getBaseMetaTileEntity().hasSteamEngineUpgrade()) { + return new FluidTankInfo[]{}; + } + return new FluidTankInfo[]{this.getInfo()}; + } + + public int fill_default(final ForgeDirection aSide, final FluidStack aFluid, final boolean doFill) { + return this.fill(aFluid, doFill); + } + + @Override + public int fill(final ForgeDirection aSide, final FluidStack aFluid, final boolean doFill) { + return this.fill_default(aSide, aFluid, doFill); + } + + @Override + public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) { + if ((this.getFluid() != null) && (aFluid != null) && this.getFluid().isFluidEqual(aFluid)) { + return this.drain(aFluid.amount, doDrain); + } + return null; + } + + @Override + public FluidStack drain(final ForgeDirection aSide, final int maxDrain, final boolean doDrain) { + return this.drain(maxDrain, doDrain); + } + + @Override + public int getFluidAmount() { + return 0; + } + + @Override + public FluidTankInfo getInfo() { + return new FluidTankInfo(this); + } + + @Override + public String getMetaName() { + return this.mName; + } + + @Override + public ItemStack getStackInSlotOnClosing(final int i) { + return null; + } + + @Override + public boolean doTickProfilingMessageDuringThisTick() { + return this.doTickProfilingInThisTick; + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { + return false; + } + + @Override + public boolean connectsToItemPipe(final byte aSide) { + return false; + } + + @Override + public void openInventory() { + // + } + + @Override + public void closeInventory() { + // + } + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return null; + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return null; + } + + @Override + public float getExplosionResistance(final byte aSide) { + return 10.0F; + } + + @Override + public ItemStack[] getRealInventory() { + return this.mInventory; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public void markDirty() { + // + } + + @Override + public void onColorChangeServer(final byte aColor) { + // + } + + @Override + public void onColorChangeClient(final byte aColor) { + // + } + + public long injectEnergyUnits(final byte aSide, final long aVoltage, final long aAmperage) { + return 0; + } + + @Override + @SideOnly(Side.CLIENT) + public boolean renderInInventory(final Block aBlock, final int aMeta, final RenderBlocks aRenderer) { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public boolean renderInWorld(final IBlockAccess aWorld, final int aX, final int aY, final int aZ, final Block aBlock, final RenderBlocks aRenderer) { + return false; + } + + @Override + public void doExplosion(final long aExplosionPower) { + final float tStrength = aExplosionPower < V[0] ? 1.0F : aExplosionPower < V[1] ? 2.0F : aExplosionPower < V[2] ? 3.0F : aExplosionPower < V[3] ? 4.0F : aExplosionPower < V[4] ? 5.0F : aExplosionPower < (V[4] * 2) ? 6.0F : aExplosionPower < V[5] ? 7.0F : aExplosionPower < V[6] ? 8.0F : aExplosionPower < V[7] ? 9.0F : 10.0F; + final int tX = this.getBaseMetaTileEntity().getXCoord(), tY = this.getBaseMetaTileEntity().getYCoord(), tZ = this.getBaseMetaTileEntity().getZCoord(); + final World tWorld = this.getBaseMetaTileEntity().getWorld(); + tWorld.setBlock(tX, tY, tZ, Blocks.air); + if (GregTech_API.sMachineExplosions) { + tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); + } + } + + @Override + public int getLightOpacity() { + return 0; + } + + @Override + public void addCollisionBoxesToList(final World aWorld, final int aX, final int aY, final int aZ, final AxisAlignedBB inputAABB, final List<AxisAlignedBB> outputAABB, final Entity collider) { + final AxisAlignedBB axisalignedbb1 = this.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + if ((axisalignedbb1 != null) && inputAABB.intersectsWith(axisalignedbb1)) { + outputAABB.add(axisalignedbb1); + } + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(final World aWorld, final int aX, final int aY, final int aZ) { + return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1); + } + + @Override + public void onEntityCollidedWithBlock(final World aWorld, final int aX, final int aY, final int aZ, final Entity collider) { + // + } + + @Override + public void onCreated(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { + // + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLossless.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLossless.java index f62b8b69ff..bf22009b67 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLossless.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLossless.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.lossless; import static gregtech.api.enums.GT_Values.GT; + import gregtech.api.interfaces.ITexture; import gtPlusPlus.core.lib.CORE; @@ -9,54 +10,58 @@ public abstract class GregtechMetaTileEntityLossless extends MetaTileEntityLossl * Value between [0 - 9] to describe the Tier of this Machine. */ public final byte mTier; - + /** * A simple Description. */ public final String mDescription; - + /** * Contains all Textures used by this Block. */ public final ITexture[][][] mTextures; - - public GregtechMetaTileEntityLossless(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { + + public GregtechMetaTileEntityLossless(final int aID, final String aName, final String aNameRegional, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture... aTextures) { super(aID, aName, aNameRegional, aInvSlotCount); - mTier = (byte)Math.max(0, Math.min(aTier, 9)); - mDescription = aDescription; - + this.mTier = (byte)Math.max(0, Math.min(aTier, 9)); + this.mDescription = aDescription; + // must always be the last call! - if (GT.isClientSide()) mTextures = getTextureSet(aTextures); else mTextures = null; + if (GT.isClientSide()) { + this.mTextures = this.getTextureSet(aTextures); + } else { + this.mTextures = null; + } } - - public GregtechMetaTileEntityLossless(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + + public GregtechMetaTileEntityLossless(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) { super(aName, aInvSlotCount); - mTier = (byte)aTier; - mDescription = aDescription; - mTextures = aTextures; - + this.mTier = (byte)aTier; + this.mDescription = aDescription; + this.mTextures = aTextures; + } - + @Override public byte getTileEntityBaseType() { - return (byte)(Math.min(3, mTier<=0?0:1+((mTier-1) / 4))); + return (byte)(Math.min(3, this.mTier<=0?0:1+((this.mTier-1) / 4))); } - - @Override + + @Override public long getInputTier() { - return mTier; - } - - @Override + return this.mTier; + } + + @Override public long getOutputTier() { - return mTier; - } - + return this.mTier; + } + @Override public String[] getDescription() { - return new String[] {mDescription, CORE.GT_Tooltip}; + return new String[] {this.mDescription, CORE.GT_Tooltip}; } - + /** * Used Client Side to get a Texture Set for this Block. * Called after setting the Tier and the Description so that those two are accessible. diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLosslessBasicTank.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLosslessBasicTank.java index aee474d9bf..75c638c4ea 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLosslessBasicTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLosslessBasicTank.java @@ -18,234 +18,248 @@ import net.minecraftforge.fluids.FluidStack; */ public abstract class GregtechMetaTileEntityLosslessBasicTank extends GregtechMetaTileEntityLosslessTieredMachineBlock { - public FluidStack mFluid; + public FluidStack mFluid; - /** - * @param aInvSlotCount should be 3 - */ - public GregtechMetaTileEntityLosslessBasicTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { - super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); - } - - public GregtechMetaTileEntityLosslessBasicTank(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isValidSlot(int aIndex) { - return aIndex != getStackDisplaySlot(); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); - } - - public abstract boolean doesFillContainers(); - - public abstract boolean doesEmptyContainers(); - - public abstract boolean canTankBeFilled(); - - public abstract boolean canTankBeEmptied(); - - public abstract boolean displaysItemStack(); - - public abstract boolean displaysStackSize(); - - public int getInputSlot() { - return 0; - } - - public int getOutputSlot() { - return 1; - } - - public int getStackDisplaySlot() { - return 2; - } - - public boolean isFluidInputAllowed(FluidStack aFluid) { - return true; - } - - public boolean isFluidChangingAllowed() { - return true; - } - - public FluidStack getFillableStack() { - return mFluid; - } - - public FluidStack setFillableStack(FluidStack aFluid) { - mFluid = aFluid; - return mFluid; - } - - public FluidStack getDrainableStack() { - return mFluid; - } - - public FluidStack setDrainableStack(FluidStack aFluid) { - mFluid = aFluid; - return mFluid; - } - - public FluidStack getDisplayedFluid() { - return getDrainableStack(); - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_BasicTank(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicTank(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); - } - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (isFluidChangingAllowed() && getFillableStack() != null && getFillableStack().amount <= 0) - setFillableStack(null); - - if (displaysItemStack() && getStackDisplaySlot() >= 0 && getStackDisplaySlot() < mInventory.length) { - if (getDisplayedFluid() == null) { - if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot()], true, true)) - mInventory[getStackDisplaySlot()] = null; - } else { - mInventory[getStackDisplaySlot()] = GT_Utility.getFluidDisplayStack(getDisplayedFluid(), displaysStackSize()); - } - } - - if (doesEmptyContainers()) { - FluidStack tFluid = GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true); - if (tFluid != null && isFluidInputAllowed(tFluid)) { - if (getFillableStack() == null) { - if (isFluidInputAllowed(tFluid) && tFluid.amount <= getCapacity()) { - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) { - setFillableStack(tFluid.copy()); - aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); - } - } - } else { - if (tFluid.isFluidEqual(getFillableStack()) && tFluid.amount + getFillableStack().amount <= getCapacity()) { - if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) { - getFillableStack().amount += tFluid.amount; - aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); - } - } - } - } - } - - if (doesFillContainers()) { - ItemStack tOutput = GT_Utility.fillFluidContainer(getDrainableStack(), mInventory[getInputSlot()], false, true); - if (tOutput != null && aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tOutput, 1)) { - FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true); - aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); - if (tFluid != null) getDrainableStack().amount -= tFluid.amount; - if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) setDrainableStack(null); - } - } - } - } - - @Override - public FluidStack getFluid() { - return getDrainableStack(); - } - - @Override - public int getFluidAmount() { - return getDrainableStack() != null ? getDrainableStack().amount : 0; - } - - @Override - public int fill(FluidStack aFluid, boolean doFill) { - if (aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0 || !canTankBeFilled() || !isFluidInputAllowed(aFluid)) - return 0; - - if (getFillableStack() == null || getFillableStack().getFluid().getID() <= 0) { - if (aFluid.amount <= getCapacity()) { - if (doFill) { - setFillableStack(aFluid.copy()); - getBaseMetaTileEntity().markDirty(); - } - return aFluid.amount; - } - if (doFill) { - setFillableStack(aFluid.copy()); - getFillableStack().amount = getCapacity(); - getBaseMetaTileEntity().markDirty(); - } - return getCapacity(); - } - - if (!getFillableStack().isFluidEqual(aFluid)) - return 0; - - int space = getCapacity() - getFillableStack().amount; - if (aFluid.amount <= space) { - if (doFill) { - getFillableStack().amount += aFluid.amount; - getBaseMetaTileEntity().markDirty(); - } - return aFluid.amount; - } - if (doFill) - getFillableStack().amount = getCapacity(); - return space; - } - - @Override - public FluidStack drain(int maxDrain, boolean doDrain) { - if (getDrainableStack() == null || !canTankBeEmptied()) return null; - if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) { - setDrainableStack(null); - getBaseMetaTileEntity().markDirty(); - return null; - } - - int used = maxDrain; - if (getDrainableStack().amount < used) - used = getDrainableStack().amount; - - if (doDrain) { - getDrainableStack().amount -= used; - getBaseMetaTileEntity().markDirty(); - } - - FluidStack drained = getDrainableStack().copy(); - drained.amount = used; - - if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) { - setDrainableStack(null); - getBaseMetaTileEntity().markDirty(); - } - - return drained; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aIndex == getOutputSlot(); - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aIndex == getInputSlot(); - } + /** + * @param aInvSlotCount should be 3 + */ + public GregtechMetaTileEntityLosslessBasicTank(final int aID, final String aName, final String aNameRegional, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture... aTextures) { + super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); + } + + public GregtechMetaTileEntityLosslessBasicTank(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isValidSlot(final int aIndex) { + return aIndex != this.getStackDisplaySlot(); + } + + @Override + public void saveNBTData(final NBTTagCompound aNBT) { + if (this.mFluid != null) { + aNBT.setTag("mFluid", this.mFluid.writeToNBT(new NBTTagCompound())); + } + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + this.mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); + } + + public abstract boolean doesFillContainers(); + + public abstract boolean doesEmptyContainers(); + + public abstract boolean canTankBeFilled(); + + public abstract boolean canTankBeEmptied(); + + public abstract boolean displaysItemStack(); + + public abstract boolean displaysStackSize(); + + public int getInputSlot() { + return 0; + } + + public int getOutputSlot() { + return 1; + } + + public int getStackDisplaySlot() { + return 2; + } + + public boolean isFluidInputAllowed(final FluidStack aFluid) { + return true; + } + + public boolean isFluidChangingAllowed() { + return true; + } + + public FluidStack getFillableStack() { + return this.mFluid; + } + + public FluidStack setFillableStack(final FluidStack aFluid) { + this.mFluid = aFluid; + return this.mFluid; + } + + public FluidStack getDrainableStack() { + return this.mFluid; + } + + public FluidStack setDrainableStack(final FluidStack aFluid) { + this.mFluid = aFluid; + return this.mFluid; + } + + public FluidStack getDisplayedFluid() { + return this.getDrainableStack(); + } + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_BasicTank(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_BasicTank(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); + } + + @Override + public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if (this.isFluidChangingAllowed() && (this.getFillableStack() != null) && (this.getFillableStack().amount <= 0)) { + this.setFillableStack(null); + } + + if (this.displaysItemStack() && (this.getStackDisplaySlot() >= 0) && (this.getStackDisplaySlot() < this.mInventory.length)) { + if (this.getDisplayedFluid() == null) { + if (ItemList.Display_Fluid.isStackEqual(this.mInventory[this.getStackDisplaySlot()], true, true)) { + this.mInventory[this.getStackDisplaySlot()] = null; + } + } else { + this.mInventory[this.getStackDisplaySlot()] = GT_Utility.getFluidDisplayStack(this.getDisplayedFluid(), this.displaysStackSize()); + } + } + + if (this.doesEmptyContainers()) { + final FluidStack tFluid = GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true); + if ((tFluid != null) && this.isFluidInputAllowed(tFluid)) { + if (this.getFillableStack() == null) { + if (this.isFluidInputAllowed(tFluid) && (tFluid.amount <= this.getCapacity())) { + if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), 1)) { + this.setFillableStack(tFluid.copy()); + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + } + } + } else { + if (tFluid.isFluidEqual(this.getFillableStack()) && ((tFluid.amount + this.getFillableStack().amount) <= this.getCapacity())) { + if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), 1)) { + this.getFillableStack().amount += tFluid.amount; + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + } + } + } + } + } + + if (this.doesFillContainers()) { + final ItemStack tOutput = GT_Utility.fillFluidContainer(this.getDrainableStack(), this.mInventory[this.getInputSlot()], false, true); + if ((tOutput != null) && aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tOutput, 1)) { + final FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true); + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + if (tFluid != null) { + this.getDrainableStack().amount -= tFluid.amount; + } + if ((this.getDrainableStack().amount <= 0) && this.isFluidChangingAllowed()) { + this.setDrainableStack(null); + } + } + } + } + } + + @Override + public FluidStack getFluid() { + return this.getDrainableStack(); + } + + @Override + public int getFluidAmount() { + return this.getDrainableStack() != null ? this.getDrainableStack().amount : 0; + } + + @Override + public int fill(final FluidStack aFluid, final boolean doFill) { + if ((aFluid == null) || (aFluid.getFluid().getID() <= 0) || (aFluid.amount <= 0) || !this.canTankBeFilled() || !this.isFluidInputAllowed(aFluid)) { + return 0; + } + + if ((this.getFillableStack() == null) || (this.getFillableStack().getFluid().getID() <= 0)) { + if (aFluid.amount <= this.getCapacity()) { + if (doFill) { + this.setFillableStack(aFluid.copy()); + this.getBaseMetaTileEntity().markDirty(); + } + return aFluid.amount; + } + if (doFill) { + this.setFillableStack(aFluid.copy()); + this.getFillableStack().amount = this.getCapacity(); + this.getBaseMetaTileEntity().markDirty(); + } + return this.getCapacity(); + } + + if (!this.getFillableStack().isFluidEqual(aFluid)) { + return 0; + } + + final int space = this.getCapacity() - this.getFillableStack().amount; + if (aFluid.amount <= space) { + if (doFill) { + this.getFillableStack().amount += aFluid.amount; + this.getBaseMetaTileEntity().markDirty(); + } + return aFluid.amount; + } + if (doFill) { + this.getFillableStack().amount = this.getCapacity(); + } + return space; + } + + @Override + public FluidStack drain(final int maxDrain, final boolean doDrain) { + if ((this.getDrainableStack() == null) || !this.canTankBeEmptied()) { + return null; + } + if ((this.getDrainableStack().amount <= 0) && this.isFluidChangingAllowed()) { + this.setDrainableStack(null); + this.getBaseMetaTileEntity().markDirty(); + return null; + } + + int used = maxDrain; + if (this.getDrainableStack().amount < used) { + used = this.getDrainableStack().amount; + } + + if (doDrain) { + this.getDrainableStack().amount -= used; + this.getBaseMetaTileEntity().markDirty(); + } + + final FluidStack drained = this.getDrainableStack().copy(); + drained.amount = used; + + if ((this.getDrainableStack().amount <= 0) && this.isFluidChangingAllowed()) { + this.setDrainableStack(null); + this.getBaseMetaTileEntity().markDirty(); + } + + return drained; + } + + @Override + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return aIndex == this.getOutputSlot(); + } + + @Override + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return aIndex == this.getInputSlot(); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLosslessTieredMachineBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLosslessTieredMachineBlock.java index 7f4c1a4ed8..df33ec4ae1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLosslessTieredMachineBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLosslessTieredMachineBlock.java @@ -1,67 +1,71 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.lossless; import static gregtech.api.enums.GT_Values.GT; + import gregtech.api.interfaces.ITexture; import gregtech.api.metatileentity.MetaTileEntity; public abstract class GregtechMetaTileEntityLosslessTieredMachineBlock extends MetaTileEntity { - /** - * Value between [0 - 9] to describe the Tier of this Machine. - */ - public final byte mTier; + /** + * Value between [0 - 9] to describe the Tier of this Machine. + */ + public final byte mTier; - /** - * A simple Description. - */ - public final String mDescription; + /** + * A simple Description. + */ + public final String mDescription; - /** - * Contains all Textures used by this Block. - */ - public final ITexture[][][] mTextures; + /** + * Contains all Textures used by this Block. + */ + public final ITexture[][][] mTextures; - public GregtechMetaTileEntityLosslessTieredMachineBlock(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { - super(aID, aName, aNameRegional, aInvSlotCount); - mTier = (byte) Math.max(0, Math.min(aTier, 9)); - mDescription = aDescription; + public GregtechMetaTileEntityLosslessTieredMachineBlock(final int aID, final String aName, final String aNameRegional, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture... aTextures) { + super(aID, aName, aNameRegional, aInvSlotCount); + this.mTier = (byte) Math.max(0, Math.min(aTier, 9)); + this.mDescription = aDescription; - // must always be the last call! - if (GT.isClientSide()) mTextures = getTextureSet(aTextures); - else mTextures = null; - } + // must always be the last call! + if (GT.isClientSide()) { + this.mTextures = this.getTextureSet(aTextures); + } else { + this.mTextures = null; + } + } - public GregtechMetaTileEntityLosslessTieredMachineBlock(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { - super(aName, aInvSlotCount); - mTier = (byte) aTier; - mDescription = aDescription; - mTextures = aTextures; - } + public GregtechMetaTileEntityLosslessTieredMachineBlock(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aInvSlotCount); + this.mTier = (byte) aTier; + this.mDescription = aDescription; + this.mTextures = aTextures; + } - @Override - public byte getTileEntityBaseType() { - return (byte) (Math.min(3, mTier <= 0 ? 0 : 1 + ((mTier - 1) / 4))); - } + @Override + public byte getTileEntityBaseType() { + return (byte) (Math.min(3, this.mTier <= 0 ? 0 : 1 + ((this.mTier - 1) / 4))); + } - @Override - public long getInputTier() { - return mTier; - } + @Override + public long getInputTier() { + return this.mTier; + } - @Override - public long getOutputTier() { - return mTier; - } + @Override + public long getOutputTier() { + return this.mTier; + } - @Override - public String[] getDescription() { - return new String[]{mDescription}; - } + @Override + public String[] getDescription() { + return new String[]{this.mDescription}; + } - /** - * Used Client Side to get a Texture Set for this Block. - * Called after setting the Tier and the Description so that those two are accessible. - * - * @param aTextures is the optional Array you can give to the Constructor. - */ - public abstract ITexture[][][] getTextureSet(ITexture[] aTextures); + /** + * Used Client Side to get a Texture Set for this Block. + * Called after setting the Tier and the Description so that those two are accessible. + * + * @param aTextures is the optional Array you can give to the Constructor. + */ + public abstract ITexture[][][] getTextureSet(ITexture[] aTextures); }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/MetaTileEntityLossless.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/MetaTileEntityLossless.java index 58069a5650..8af73b2024 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/MetaTileEntityLossless.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/MetaTileEntityLossless.java @@ -2,16 +2,18 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.lossles import static gregtech.api.enums.GT_Values.GT; import static gregtech.api.enums.GT_Values.V; -import gregtech.api.GregTech_API; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.*; import java.io.File; import java.util.ArrayList; import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTech_API; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.util.*; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.texture.IIconRegister; @@ -26,8 +28,6 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.*; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -40,821 +40,850 @@ import cpw.mods.fml.relauncher.SideOnly; * "new GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");" */ public abstract class MetaTileEntityLossless implements IMetaTileEntity { - /** - * Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and for getInvName. - */ - public final String mName; - /** - * The Inventory of the MetaTileEntity. Amount of Slots can be larger than 256. HAYO! - */ - public final ItemStack[] mInventory; - public boolean doTickProfilingInThisTick = true; - /** - * accessibility to this Field is no longer given, see below - */ - private IGregTechTileEntity mBaseMetaTileEntity; - - /** - * This registers your Machine at the List. - * Use only ID's larger than 2048, because i reserved these ones. - * See also the List in the API, as it has a Description containing all the reservations. - * - * @param aID the ID - * @example for Constructor overload. - * <p/> - * public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) { - * super(aID, mName, mNameRegional); - * } - */ - public MetaTileEntityLossless(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) { - if (GregTech_API.sPostloadStarted || !GregTech_API.sPreloadStarted) - throw new IllegalAccessError("This Constructor has to be called in the load Phase"); - if (GregTech_API.METATILEENTITIES[aID] == null) { - GregTech_API.METATILEENTITIES[aID] = this; - } else { - throw new IllegalArgumentException("MetaMachine-Slot Nr. " + aID + " is already occupied!"); - } - mName = aBasicName.replaceAll(" ", "_").toLowerCase(); - setBaseMetaTileEntity(GregTech_API.constructBaseMetaTileEntity()); - getBaseMetaTileEntity().setMetaTileID((short) aID); - GT_LanguageManager.addStringLocalization("gt.blockmachines." + mName + ".name", aRegionalName); - mInventory = new ItemStack[aInvSlotCount]; - - if (GT.isClientSide()) { - ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID); - tStack.getItem().addInformation(tStack, null, new ArrayList<String>(), true); - } - } - - /** - * This is the normal Constructor. - */ - public MetaTileEntityLossless(String aName, int aInvSlotCount) { - mInventory = new ItemStack[aInvSlotCount]; - mName = aName; - } - - @Override - public IGregTechTileEntity getBaseMetaTileEntity() { - return mBaseMetaTileEntity; - } - - @Override - public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) { - if (mBaseMetaTileEntity != null && aBaseMetaTileEntity == null) { - mBaseMetaTileEntity.getMetaTileEntity().inValidate(); - mBaseMetaTileEntity.setMetaTileEntity(null); - } - mBaseMetaTileEntity = aBaseMetaTileEntity; - if (mBaseMetaTileEntity != null) { - mBaseMetaTileEntity.setMetaTileEntity(this); - } - } - - @Override - public ItemStack getStackForm(long aAmount) { - return new ItemStack(GregTech_API.sBlockMachines, (int) aAmount, getBaseMetaTileEntity().getMetaTileID()); - } - - public String getLocalName() { - return GT_LanguageManager.getTranslation("gt.blockmachines." + mName + ".name"); - } - - @Override - public void onServerStart() {/*Do nothing*/} - - @Override - public void onWorldSave(File aSaveDirectory) {/*Do nothing*/} - - @Override - public void onWorldLoad(File aSaveDirectory) {/*Do nothing*/} - - @Override - public void onConfigLoad(GT_Config aConfig) {/*Do nothing*/} - - @Override - public void setItemNBT(NBTTagCompound aNBT) {/*Do nothing*/} - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) {/*Do nothing*/} - - @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { - return true; - } - - @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {/*Do nothing*/} - - @Override - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (getBaseMetaTileEntity().isValidFacing(aWrenchingSide)) { - getBaseMetaTileEntity().setFrontFacing(aWrenchingSide); - return true; - } - return false; - } - - @Override - public void onExplosion() {/*Do nothing*/} - - @Override - public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {/*Do nothing*/} - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {/*Do nothing*/} - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {/*Do nothing*/} - - @Override - public void inValidate() {/*Do nothing*/} - - @Override - public void onRemoval() {/*Do nothing*/} - - @Override - public void initDefaultModes(NBTTagCompound aNBT) {/*Do nothing*/} - - /** - * When a GUI is opened - */ - public void onOpenGUI() {/*Do nothing*/} - - /** - * When a GUI is closed - */ - public void onCloseGUI() {/*Do nothing*/} - - /** - * a Player rightclicks the Machine - * Sneaky rightclicks are not getting passed to this! - */ - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - return false; - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { - return onRightclick(aBaseMetaTileEntity, aPlayer); - } - - @Override - public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {/*Do nothing*/} - - @Override - public void onValueUpdate(byte aValue) {/*Do nothing*/} - - @Override - public byte getUpdateData() { - return 0; - } - - @Override - public void doSound(byte aIndex, double aX, double aY, double aZ) {/*Do nothing*/} - - @Override - public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {/*Do nothing*/} - - @Override - public void stopSoundLoop(byte aValue, double aX, double aY, double aZ) {/*Do nothing*/} - - @Override - public final void sendSound(byte aIndex) { - if (!getBaseMetaTileEntity().hasMufflerUpgrade()) getBaseMetaTileEntity().sendBlockEvent((byte) 4, aIndex); - } - - @Override - public final void sendLoopStart(byte aIndex) { - if (!getBaseMetaTileEntity().hasMufflerUpgrade()) getBaseMetaTileEntity().sendBlockEvent((byte) 5, aIndex); - } - - @Override - public final void sendLoopEnd(byte aIndex) { - if (!getBaseMetaTileEntity().hasMufflerUpgrade()) getBaseMetaTileEntity().sendBlockEvent((byte) 6, aIndex); - } - - /** - * @return true if this Device emits Energy at all - */ - public boolean isElectric() { - return true; - } - - /** - * @return true if this Device emits Energy at all - */ - public boolean isPneumatic() { - return false; - } - - /** - * @return true if this Device emits Energy at all - */ - public boolean isSteampowered() { - return false; - } - - /** - * @return true if this Device emits Energy at all - */ - public boolean isEnetOutput() { - return false; - } - - /** - * @return true if this Device consumes Energy at all - */ - public boolean isEnetInput() { - return false; - } - - /** - * @return the amount of EU, which can be stored in this Device. Default is 0 EU. - */ - public long maxEUStore() { - return 0; - } - - /** - * @return the amount of EU/t, which can be accepted by this Device before it explodes. - */ - public long maxEUInput() { - return 0; - } - - /** - * @return the amount of EU/t, which can be outputted by this Device. - */ - public long maxEUOutput() { - return 0; - } - - /** - * @return the amount of E-net Impulses of the maxEUOutput size, which can be outputted by this Device. - * Default is 1 Pulse, this shouldn't be set to smaller Values than 1, as it won't output anything in that Case! - */ - public long maxAmperesOut() { - return 1; - } - - /** - * How many Amperes this Block can suck at max. Surpassing this value won't blow it up. - */ - public long maxAmperesIn() { - return 1; - } - - /** - * @return true if that Side is an Output. - */ - public boolean isOutputFacing(byte aSide) { - return false; - } - - /** - * @return true if that Side is an Input. - */ - public boolean isInputFacing(byte aSide) { - return false; - } - - /** - * @return true if Transformer Upgrades increase Packet Amount. - */ - public boolean isTransformingLowEnergy() { - return true; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return false; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return false; - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; - } - - @Override - public boolean setStackToZeroInsteadOfNull(int aIndex) { - return false; - } - - /** - * This is used to get the internal Energy. I use this for the IDSU. - */ - public long getEUVar() { - return ((GregtechBaseMetaTileEntityLossless) mBaseMetaTileEntity).mStoredEnergy; - } - - /** - * This is used to set the internal Energy to the given Parameter. I use this for the IDSU. - */ - public void setEUVar(long aEnergy) { - ((GregtechBaseMetaTileEntityLossless) mBaseMetaTileEntity).mStoredEnergy = aEnergy; - } - - /** - * This is used to get the internal Steam Energy. - */ - public long getSteamVar() { - return ((GregtechBaseMetaTileEntityLossless) mBaseMetaTileEntity).mStoredSteam; - } - - /** - * This is used to set the internal Steam Energy to the given Parameter. - */ - public void setSteamVar(long aSteam) { - ((GregtechBaseMetaTileEntityLossless) mBaseMetaTileEntity).mStoredSteam = aSteam; - } - - /** - * @return the amount of Steam, which can be stored in this Device. Default is 0 EU. - */ - public long maxSteamStore() { - return 0; - } - - /** - * @return the amount of EU, which this Device stores before starting to emit Energy. - * useful if you don't want to emit stored Energy until a certain Level is reached. - */ - public long getMinimumStoredEU() { - return 512; - } - - /** - * Determines the Tier of the Machine, used for de-charging Tools. - */ - public long getInputTier() { - return GT_Utility.getTier(getBaseMetaTileEntity().getInputVoltage()); - } - - /** - * Determines the Tier of the Machine, used for charging Tools. - */ - public long getOutputTier() { - return GT_Utility.getTier(getBaseMetaTileEntity().getOutputVoltage()); - } - - /** - * gets the first RechargerSlot - */ - public int rechargerSlotStartIndex() { - return 0; - } - - /** - * gets the amount of RechargerSlots - */ - public int rechargerSlotCount() { - return 0; - } - - /** - * gets the first DechargerSlot - */ - public int dechargerSlotStartIndex() { - return 0; - } - - /** - * gets the amount of DechargerSlots - */ - public int dechargerSlotCount() { - return 0; - } - - /** - * gets if this is protected from other Players per default or not - */ - public boolean ownerControl() { - return false; - } - - @Override - public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) { - return aList; - } - - @Override - public boolean isLiquidInput(byte aSide) { - return true; - } - - @Override - public boolean isLiquidOutput(byte aSide) { - return true; - } - - /** - * gets the contained Liquid - */ - @Override - public FluidStack getFluid() { - return null; - } - - /** - * tries to fill this Tank - */ - @Override - public int fill(FluidStack resource, boolean doFill) { - return 0; - } - - /** - * tries to empty this Tank - */ - @Override - public FluidStack drain(int maxDrain, boolean doDrain) { - return null; - } - - /** - * Tank pressure - */ - public int getTankPressure() { - return 0; - } - - /** - * Liquid Capacity - */ - @Override - public int getCapacity() { - return 0; - } - - @Override - public void onMachineBlockUpdate() {/*Do nothing*/} - - @Override - public void receiveClientEvent(byte aEventID, byte aValue) {/*Do nothing*/} - - @Override - public boolean isSimpleMachine() { - return false; - } - - /** - * If this accepts up to 4 Overclockers - */ - public boolean isOverclockerUpgradable() { - return false; - } - - /** - * If this accepts Transformer Upgrades - */ - public boolean isTransformerUpgradable() { - return false; - } - - /** - * Progress this machine has already made - */ - public int getProgresstime() { - return 0; - } - - /** - * Progress this Machine has to do to produce something - */ - public int maxProgresstime() { - return 0; - } - - /** - * Increases the Progress, returns the overflown Progress. - */ - public int increaseProgress(int aProgress) { - return 0; - } - - /** - * If this TileEntity makes use of Sided Redstone behaviors. - * Determines only, if the Output Redstone Array is getting filled with 0 for true, or 15 for false. - */ - public boolean hasSidedRedstoneOutputBehavior() { - return false; - } - - /** - * When the Facing gets changed. - */ - public void onFacingChange() {/*Do nothing*/} - - /** - * if the IC2 Teleporter can drain from this. - */ - public boolean isTeleporterCompatible() { - return isEnetOutput() && getBaseMetaTileEntity().getOutputVoltage() >= 128 && getBaseMetaTileEntity().getUniversalEnergyCapacity() >= 500000; - } - - /** - * Gets the Output for the comparator on the given Side - */ - @Override - public byte getComparatorValue(byte aSide) { - return 0; - } - - @Override - public boolean acceptsRotationalEnergy(byte aSide) { - return false; - } - - @Override - public boolean injectRotationalEnergy(byte aSide, long aSpeed, long aEnergy) { - return false; - } - - @Override - public String getSpecialVoltageToolTip() { - return null; - } - - @Override - public boolean isGivingInformation() { - return false; - } - - @Override - public String[] getInfoData() { - return new String[]{}; - } - - public boolean isDigitalChest() { - return false; - } - - public ItemStack[] getStoredItemData() { - return null; - } - - public void setItemCount(int aCount) {/*Do nothing*/} - - public int getMaxItemCount() { - return 0; - } - - @Override - public int getSizeInventory() { - return mInventory.length; - } - - @Override - public ItemStack getStackInSlot(int aIndex) { - if (aIndex >= 0 && aIndex < mInventory.length) return mInventory[aIndex]; - return null; - } - - @Override - public void setInventorySlotContents(int aIndex, ItemStack aStack) { - if (aIndex >= 0 && aIndex < mInventory.length) mInventory[aIndex] = aStack; - } - - @Override - public String getInventoryName() { - if (GregTech_API.METATILEENTITIES[getBaseMetaTileEntity().getMetaTileID()] != null) - return GregTech_API.METATILEENTITIES[getBaseMetaTileEntity().getMetaTileID()].getMetaName(); - return ""; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public boolean isItemValidForSlot(int aIndex, ItemStack aStack) { - return getBaseMetaTileEntity().isValidSlot(aIndex); - } - - @Override - public ItemStack decrStackSize(int aIndex, int aAmount) { - ItemStack tStack = getStackInSlot(aIndex), rStack = GT_Utility.copy(tStack); - if (tStack != null) { - if (tStack.stackSize <= aAmount) { - if (setStackToZeroInsteadOfNull(aIndex)) tStack.stackSize = 0; - else setInventorySlotContents(aIndex, null); - } else { - rStack = tStack.splitStack(aAmount); - if (tStack.stackSize == 0 && !setStackToZeroInsteadOfNull(aIndex)) - setInventorySlotContents(aIndex, null); - } - } - return rStack; - } - - @Override - public int[] getAccessibleSlotsFromSide(int aSide) { - ArrayList<Integer> tList = new ArrayList<Integer>(); - IGregTechTileEntity tTileEntity = getBaseMetaTileEntity(); - boolean tSkip = tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2, tTileEntity) || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2, tTileEntity); - for (int i = 0; i < getSizeInventory(); i++) - if (isValidSlot(i) && (tSkip || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), i, tTileEntity) || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), i, tTileEntity))) - tList.add(i); - int[] rArray = new int[tList.size()]; - for (int i = 0; i < rArray.length; i++) rArray[i] = tList.get(i); - return rArray; - } - - @Override - public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); - } - - @Override - public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { - return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); - } - - @Override - public boolean canFill(ForgeDirection aSide, Fluid aFluid) { - return fill(aSide, new FluidStack(aFluid, 1), false) == 1; - } - - @Override - public boolean canDrain(ForgeDirection aSide, Fluid aFluid) { - return drain(aSide, new FluidStack(aFluid, 1), false) != null; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { - if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[]{}; - return new FluidTankInfo[]{getInfo()}; - } - - public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - return fill(aFluid, doFill); - } - - @Override - public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - if (getBaseMetaTileEntity().hasSteamEngineUpgrade() && GT_ModHandler.isSteam(aFluid) && aFluid.amount > 1) { - int tSteam = (int) Math.min(Integer.MAX_VALUE, Math.min(aFluid.amount / 2, getBaseMetaTileEntity().getSteamCapacity() - getBaseMetaTileEntity().getStoredSteam())); - if (tSteam > 0) { - if (doFill) getBaseMetaTileEntity().increaseStoredSteam(tSteam, true); - return tSteam * 2; - } - } else { - return fill_default(aSide, aFluid, doFill); - } - return 0; - } - - @Override - public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) { - if (getFluid() != null && aFluid != null && getFluid().isFluidEqual(aFluid)) - return drain(aFluid.amount, doDrain); - return null; - } - - @Override - public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) { - return drain(maxDrain, doDrain); - } - - @Override - public int getFluidAmount() { - return 0; - } - - @Override - public FluidTankInfo getInfo() { - return new FluidTankInfo(this); - } - - @Override - public String getMetaName() { - return mName; - } - - @Override - public ItemStack getStackInSlotOnClosing(int i) { - return null; - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public boolean doTickProfilingMessageDuringThisTick() { - return doTickProfilingInThisTick; - } - - @Override - public void markDirty() { - // - } - - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - return false; - } - - @Override - public void openInventory() { - // - } - - @Override - public void closeInventory() { - // - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - @Override - public boolean connectsToItemPipe(byte aSide) { - return false; - } - - @Override - public float getExplosionResistance(byte aSide) { - return 10.0F; - } - - @Override - public ItemStack[] getRealInventory() { - return mInventory; - } - - @Override - public void onColorChangeServer(byte aColor) { - // - } - - @Override - public void onColorChangeClient(byte aColor) { - // - } - - @Override - @SideOnly(Side.CLIENT) - public boolean renderInInventory(Block aBlock, int aMeta, RenderBlocks aRenderer) { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean renderInWorld(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer) { - return false; - } - - @Override - public void doExplosion(long aExplosionPower) { - float tStrength = aExplosionPower < V[0] ? 1.0F : aExplosionPower < V[1] ? 2.0F : aExplosionPower < V[2] ? 3.0F : aExplosionPower < V[3] ? 4.0F : aExplosionPower < V[4] ? 5.0F : aExplosionPower < V[4] * 2 ? 6.0F : aExplosionPower < V[5] ? 7.0F : aExplosionPower < V[6] ? 8.0F : aExplosionPower < V[7] ? 9.0F : 10.0F; - int tX = getBaseMetaTileEntity().getXCoord(), tY = getBaseMetaTileEntity().getYCoord(), tZ = getBaseMetaTileEntity().getZCoord(); - World tWorld = getBaseMetaTileEntity().getWorld(); - GT_Utility.sendSoundToPlayers(tWorld, GregTech_API.sSoundList.get(209), 1.0F, -1, tX, tY, tZ); - tWorld.setBlock(tX, tY, tZ, Blocks.air); - if (GregTech_API.sMachineExplosions) - tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); - } - - @Override - public int getLightOpacity() { - return ((GregtechBaseMetaTileEntityLossless) getBaseMetaTileEntity()).getLightValue() > 0 ? 0 : 255; - } - - @Override - public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) { - AxisAlignedBB axisalignedbb1 = getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); - if (axisalignedbb1 != null && inputAABB.intersectsWith(axisalignedbb1)) outputAABB.add(axisalignedbb1); - } - - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1); - } - - @Override - public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) { - // - } - - @Override - public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - // - } + /** + * Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and for getInvName. + */ + public final String mName; + /** + * The Inventory of the MetaTileEntity. Amount of Slots can be larger than 256. HAYO! + */ + public final ItemStack[] mInventory; + public boolean doTickProfilingInThisTick = true; + /** + * accessibility to this Field is no longer given, see below + */ + private IGregTechTileEntity mBaseMetaTileEntity; + + /** + * This registers your Machine at the List. + * Use only ID's larger than 2048, because i reserved these ones. + * See also the List in the API, as it has a Description containing all the reservations. + * + * @param aID the ID + * @example for Constructor overload. + * <p/> + * public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) { + * super(aID, mName, mNameRegional); + * } + */ + public MetaTileEntityLossless(final int aID, final String aBasicName, final String aRegionalName, final int aInvSlotCount) { + if (GregTech_API.sPostloadStarted || !GregTech_API.sPreloadStarted) { + throw new IllegalAccessError("This Constructor has to be called in the load Phase"); + } + if (GregTech_API.METATILEENTITIES[aID] == null) { + GregTech_API.METATILEENTITIES[aID] = this; + } else { + throw new IllegalArgumentException("MetaMachine-Slot Nr. " + aID + " is already occupied!"); + } + this.mName = aBasicName.replaceAll(" ", "_").toLowerCase(); + this.setBaseMetaTileEntity(GregTech_API.constructBaseMetaTileEntity()); + this.getBaseMetaTileEntity().setMetaTileID((short) aID); + GT_LanguageManager.addStringLocalization("gt.blockmachines." + this.mName + ".name", aRegionalName); + this.mInventory = new ItemStack[aInvSlotCount]; + + if (GT.isClientSide()) { + final ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID); + tStack.getItem().addInformation(tStack, null, new ArrayList<String>(), true); + } + } + + /** + * This is the normal Constructor. + */ + public MetaTileEntityLossless(final String aName, final int aInvSlotCount) { + this.mInventory = new ItemStack[aInvSlotCount]; + this.mName = aName; + } + + @Override + public IGregTechTileEntity getBaseMetaTileEntity() { + return this.mBaseMetaTileEntity; + } + + @Override + public void setBaseMetaTileEntity(final IGregTechTileEntity aBaseMetaTileEntity) { + if ((this.mBaseMetaTileEntity != null) && (aBaseMetaTileEntity == null)) { + this.mBaseMetaTileEntity.getMetaTileEntity().inValidate(); + this.mBaseMetaTileEntity.setMetaTileEntity(null); + } + this.mBaseMetaTileEntity = aBaseMetaTileEntity; + if (this.mBaseMetaTileEntity != null) { + this.mBaseMetaTileEntity.setMetaTileEntity(this); + } + } + + @Override + public ItemStack getStackForm(final long aAmount) { + return new ItemStack(GregTech_API.sBlockMachines, (int) aAmount, this.getBaseMetaTileEntity().getMetaTileID()); + } + + public String getLocalName() { + return GT_LanguageManager.getTranslation("gt.blockmachines." + this.mName + ".name"); + } + + @Override + public void onServerStart() {/*Do nothing*/} + + @Override + public void onWorldSave(final File aSaveDirectory) {/*Do nothing*/} + + @Override + public void onWorldLoad(final File aSaveDirectory) {/*Do nothing*/} + + @Override + public void onConfigLoad(final GT_Config aConfig) {/*Do nothing*/} + + @Override + public void setItemNBT(final NBTTagCompound aNBT) {/*Do nothing*/} + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(final IIconRegister aBlockIconRegister) {/*Do nothing*/} + + @Override + public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aStack) { + return true; + } + + @Override + public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) {/*Do nothing*/} + + @Override + public boolean onWrenchRightClick(final byte aSide, final byte aWrenchingSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) { + if (this.getBaseMetaTileEntity().isValidFacing(aWrenchingSide)) { + this.getBaseMetaTileEntity().setFrontFacing(aWrenchingSide); + return true; + } + return false; + } + + @Override + public void onExplosion() {/*Do nothing*/} + + @Override + public void onFirstTick(final IGregTechTileEntity aBaseMetaTileEntity) {/*Do nothing*/} + + @Override + public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {/*Do nothing*/} + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {/*Do nothing*/} + + @Override + public void inValidate() {/*Do nothing*/} + + @Override + public void onRemoval() {/*Do nothing*/} + + @Override + public void initDefaultModes(final NBTTagCompound aNBT) {/*Do nothing*/} + + /** + * When a GUI is opened + */ + public void onOpenGUI() {/*Do nothing*/} + + /** + * When a GUI is closed + */ + public void onCloseGUI() {/*Do nothing*/} + + /** + * a Player rightclicks the Machine + * Sneaky rightclicks are not getting passed to this! + */ + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + return false; + } + + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer, final byte aSide, final float aX, final float aY, final float aZ) { + return this.onRightclick(aBaseMetaTileEntity, aPlayer); + } + + @Override + public void onLeftclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {/*Do nothing*/} + + @Override + public void onValueUpdate(final byte aValue) {/*Do nothing*/} + + @Override + public byte getUpdateData() { + return 0; + } + + @Override + public void doSound(final byte aIndex, final double aX, final double aY, final double aZ) {/*Do nothing*/} + + @Override + public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) {/*Do nothing*/} + + @Override + public void stopSoundLoop(final byte aValue, final double aX, final double aY, final double aZ) {/*Do nothing*/} + + @Override + public final void sendSound(final byte aIndex) { + if (!this.getBaseMetaTileEntity().hasMufflerUpgrade()) { + this.getBaseMetaTileEntity().sendBlockEvent((byte) 4, aIndex); + } + } + + @Override + public final void sendLoopStart(final byte aIndex) { + if (!this.getBaseMetaTileEntity().hasMufflerUpgrade()) { + this.getBaseMetaTileEntity().sendBlockEvent((byte) 5, aIndex); + } + } + + @Override + public final void sendLoopEnd(final byte aIndex) { + if (!this.getBaseMetaTileEntity().hasMufflerUpgrade()) { + this.getBaseMetaTileEntity().sendBlockEvent((byte) 6, aIndex); + } + } + + /** + * @return true if this Device emits Energy at all + */ + public boolean isElectric() { + return true; + } + + /** + * @return true if this Device emits Energy at all + */ + public boolean isPneumatic() { + return false; + } + + /** + * @return true if this Device emits Energy at all + */ + public boolean isSteampowered() { + return false; + } + + /** + * @return true if this Device emits Energy at all + */ + public boolean isEnetOutput() { + return false; + } + + /** + * @return true if this Device consumes Energy at all + */ + public boolean isEnetInput() { + return false; + } + + /** + * @return the amount of EU, which can be stored in this Device. Default is 0 EU. + */ + public long maxEUStore() { + return 0; + } + + /** + * @return the amount of EU/t, which can be accepted by this Device before it explodes. + */ + public long maxEUInput() { + return 0; + } + + /** + * @return the amount of EU/t, which can be outputted by this Device. + */ + public long maxEUOutput() { + return 0; + } + + /** + * @return the amount of E-net Impulses of the maxEUOutput size, which can be outputted by this Device. + * Default is 1 Pulse, this shouldn't be set to smaller Values than 1, as it won't output anything in that Case! + */ + public long maxAmperesOut() { + return 1; + } + + /** + * How many Amperes this Block can suck at max. Surpassing this value won't blow it up. + */ + public long maxAmperesIn() { + return 1; + } + + /** + * @return true if that Side is an Output. + */ + public boolean isOutputFacing(final byte aSide) { + return false; + } + + /** + * @return true if that Side is an Input. + */ + public boolean isInputFacing(final byte aSide) { + return false; + } + + /** + * @return true if Transformer Upgrades increase Packet Amount. + */ + public boolean isTransformingLowEnergy() { + return true; + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return false; + } + + @Override + public boolean isAccessAllowed(final EntityPlayer aPlayer) { + return false; + } + + @Override + public boolean isValidSlot(final int aIndex) { + return true; + } + + @Override + public boolean setStackToZeroInsteadOfNull(final int aIndex) { + return false; + } + + /** + * This is used to get the internal Energy. I use this for the IDSU. + */ + public long getEUVar() { + return ((GregtechBaseMetaTileEntityLossless) this.mBaseMetaTileEntity).mStoredEnergy; + } + + /** + * This is used to set the internal Energy to the given Parameter. I use this for the IDSU. + */ + public void setEUVar(final long aEnergy) { + ((GregtechBaseMetaTileEntityLossless) this.mBaseMetaTileEntity).mStoredEnergy = aEnergy; + } + + /** + * This is used to get the internal Steam Energy. + */ + public long getSteamVar() { + return ((GregtechBaseMetaTileEntityLossless) this.mBaseMetaTileEntity).mStoredSteam; + } + + /** + * This is used to set the internal Steam Energy to the given Parameter. + */ + public void setSteamVar(final long aSteam) { + ((GregtechBaseMetaTileEntityLossless) this.mBaseMetaTileEntity).mStoredSteam = aSteam; + } + + /** + * @return the amount of Steam, which can be stored in this Device. Default is 0 EU. + */ + public long maxSteamStore() { + return 0; + } + + /** + * @return the amount of EU, which this Device stores before starting to emit Energy. + * useful if you don't want to emit stored Energy until a certain Level is reached. + */ + public long getMinimumStoredEU() { + return 512; + } + + /** + * Determines the Tier of the Machine, used for de-charging Tools. + */ + public long getInputTier() { + return GT_Utility.getTier(this.getBaseMetaTileEntity().getInputVoltage()); + } + + /** + * Determines the Tier of the Machine, used for charging Tools. + */ + public long getOutputTier() { + return GT_Utility.getTier(this.getBaseMetaTileEntity().getOutputVoltage()); + } + + /** + * gets the first RechargerSlot + */ + public int rechargerSlotStartIndex() { + return 0; + } + + /** + * gets the amount of RechargerSlots + */ + public int rechargerSlotCount() { + return 0; + } + + /** + * gets the first DechargerSlot + */ + public int dechargerSlotStartIndex() { + return 0; + } + + /** + * gets the amount of DechargerSlots + */ + public int dechargerSlotCount() { + return 0; + } + + /** + * gets if this is protected from other Players per default or not + */ + public boolean ownerControl() { + return false; + } + + @Override + public ArrayList<String> getSpecialDebugInfo(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer, final int aLogLevel, final ArrayList<String> aList) { + return aList; + } + + @Override + public boolean isLiquidInput(final byte aSide) { + return true; + } + + @Override + public boolean isLiquidOutput(final byte aSide) { + return true; + } + + /** + * gets the contained Liquid + */ + @Override + public FluidStack getFluid() { + return null; + } + + /** + * tries to fill this Tank + */ + @Override + public int fill(final FluidStack resource, final boolean doFill) { + return 0; + } + + /** + * tries to empty this Tank + */ + @Override + public FluidStack drain(final int maxDrain, final boolean doDrain) { + return null; + } + + /** + * Tank pressure + */ + public int getTankPressure() { + return 0; + } + + /** + * Liquid Capacity + */ + @Override + public int getCapacity() { + return 0; + } + + @Override + public void onMachineBlockUpdate() {/*Do nothing*/} + + @Override + public void receiveClientEvent(final byte aEventID, final byte aValue) {/*Do nothing*/} + + @Override + public boolean isSimpleMachine() { + return false; + } + + /** + * If this accepts up to 4 Overclockers + */ + public boolean isOverclockerUpgradable() { + return false; + } + + /** + * If this accepts Transformer Upgrades + */ + public boolean isTransformerUpgradable() { + return false; + } + + /** + * Progress this machine has already made + */ + public int getProgresstime() { + return 0; + } + + /** + * Progress this Machine has to do to produce something + */ + public int maxProgresstime() { + return 0; + } + + /** + * Increases the Progress, returns the overflown Progress. + */ + public int increaseProgress(final int aProgress) { + return 0; + } + + /** + * If this TileEntity makes use of Sided Redstone behaviors. + * Determines only, if the Output Redstone Array is getting filled with 0 for true, or 15 for false. + */ + public boolean hasSidedRedstoneOutputBehavior() { + return false; + } + + /** + * When the Facing gets changed. + */ + public void onFacingChange() {/*Do nothing*/} + + /** + * if the IC2 Teleporter can drain from this. + */ + public boolean isTeleporterCompatible() { + return this.isEnetOutput() && (this.getBaseMetaTileEntity().getOutputVoltage() >= 128) && (this.getBaseMetaTileEntity().getUniversalEnergyCapacity() >= 500000); + } + + /** + * Gets the Output for the comparator on the given Side + */ + @Override + public byte getComparatorValue(final byte aSide) { + return 0; + } + + @Override + public boolean acceptsRotationalEnergy(final byte aSide) { + return false; + } + + @Override + public boolean injectRotationalEnergy(final byte aSide, final long aSpeed, final long aEnergy) { + return false; + } + + @Override + public String getSpecialVoltageToolTip() { + return null; + } + + @Override + public boolean isGivingInformation() { + return false; + } + + @Override + public String[] getInfoData() { + return new String[]{}; + } + + public boolean isDigitalChest() { + return false; + } + + public ItemStack[] getStoredItemData() { + return null; + } + + public void setItemCount(final int aCount) {/*Do nothing*/} + + public int getMaxItemCount() { + return 0; + } + + @Override + public int getSizeInventory() { + return this.mInventory.length; + } + + @Override + public ItemStack getStackInSlot(final int aIndex) { + if ((aIndex >= 0) && (aIndex < this.mInventory.length)) { + return this.mInventory[aIndex]; + } + return null; + } + + @Override + public void setInventorySlotContents(final int aIndex, final ItemStack aStack) { + if ((aIndex >= 0) && (aIndex < this.mInventory.length)) { + this.mInventory[aIndex] = aStack; + } + } + + @Override + public String getInventoryName() { + if (GregTech_API.METATILEENTITIES[this.getBaseMetaTileEntity().getMetaTileID()] != null) { + return GregTech_API.METATILEENTITIES[this.getBaseMetaTileEntity().getMetaTileID()].getMetaName(); + } + return ""; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isItemValidForSlot(final int aIndex, final ItemStack aStack) { + return this.getBaseMetaTileEntity().isValidSlot(aIndex); + } + + @Override + public ItemStack decrStackSize(final int aIndex, final int aAmount) { + final ItemStack tStack = this.getStackInSlot(aIndex); + ItemStack rStack = GT_Utility.copy(tStack); + if (tStack != null) { + if (tStack.stackSize <= aAmount) { + if (this.setStackToZeroInsteadOfNull(aIndex)) { + tStack.stackSize = 0; + } else { + this.setInventorySlotContents(aIndex, null); + } + } else { + rStack = tStack.splitStack(aAmount); + if ((tStack.stackSize == 0) && !this.setStackToZeroInsteadOfNull(aIndex)) { + this.setInventorySlotContents(aIndex, null); + } + } + } + return rStack; + } + + @Override + public int[] getAccessibleSlotsFromSide(final int aSide) { + final ArrayList<Integer> tList = new ArrayList<>(); + final IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity(); + final boolean tSkip = tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2, tTileEntity) || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2, tTileEntity); + for (int i = 0; i < this.getSizeInventory(); i++) { + if (this.isValidSlot(i) && (tSkip || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), i, tTileEntity) || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), i, tTileEntity))) { + tList.add(i); + } + } + final int[] rArray = new int[tList.size()]; + for (int i = 0; i < rArray.length; i++) { + rArray[i] = tList.get(i); + } + return rArray; + } + + @Override + public boolean canInsertItem(final int aIndex, final ItemStack aStack, final int aSide) { + return this.isValidSlot(aIndex) && (aStack != null) && (aIndex < this.mInventory.length) && ((this.mInventory[aIndex] == null) || GT_Utility.areStacksEqual(aStack, this.mInventory[aIndex])) && this.allowPutStack(this.getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); + } + + @Override + public boolean canExtractItem(final int aIndex, final ItemStack aStack, final int aSide) { + return this.isValidSlot(aIndex) && (aStack != null) && (aIndex < this.mInventory.length) && this.allowPullStack(this.getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack); + } + + @Override + public boolean canFill(final ForgeDirection aSide, final Fluid aFluid) { + return this.fill(aSide, new FluidStack(aFluid, 1), false) == 1; + } + + @Override + public boolean canDrain(final ForgeDirection aSide, final Fluid aFluid) { + return this.drain(aSide, new FluidStack(aFluid, 1), false) != null; + } + + @Override + public FluidTankInfo[] getTankInfo(final ForgeDirection aSide) { + if ((this.getCapacity() <= 0) && !this.getBaseMetaTileEntity().hasSteamEngineUpgrade()) { + return new FluidTankInfo[]{}; + } + return new FluidTankInfo[]{this.getInfo()}; + } + + public int fill_default(final ForgeDirection aSide, final FluidStack aFluid, final boolean doFill) { + return this.fill(aFluid, doFill); + } + + @Override + public int fill(final ForgeDirection aSide, final FluidStack aFluid, final boolean doFill) { + if (this.getBaseMetaTileEntity().hasSteamEngineUpgrade() && GT_ModHandler.isSteam(aFluid) && (aFluid.amount > 1)) { + final int tSteam = (int) Math.min(Integer.MAX_VALUE, Math.min(aFluid.amount / 2, this.getBaseMetaTileEntity().getSteamCapacity() - this.getBaseMetaTileEntity().getStoredSteam())); + if (tSteam > 0) { + if (doFill) { + this.getBaseMetaTileEntity().increaseStoredSteam(tSteam, true); + } + return tSteam * 2; + } + } else { + return this.fill_default(aSide, aFluid, doFill); + } + return 0; + } + + @Override + public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) { + if ((this.getFluid() != null) && (aFluid != null) && this.getFluid().isFluidEqual(aFluid)) { + return this.drain(aFluid.amount, doDrain); + } + return null; + } + + @Override + public FluidStack drain(final ForgeDirection aSide, final int maxDrain, final boolean doDrain) { + return this.drain(maxDrain, doDrain); + } + + @Override + public int getFluidAmount() { + return 0; + } + + @Override + public FluidTankInfo getInfo() { + return new FluidTankInfo(this); + } + + @Override + public String getMetaName() { + return this.mName; + } + + @Override + public ItemStack getStackInSlotOnClosing(final int i) { + return null; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public boolean doTickProfilingMessageDuringThisTick() { + return this.doTickProfilingInThisTick; + } + + @Override + public void markDirty() { + // + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { + return false; + } + + @Override + public void openInventory() { + // + } + + @Override + public void closeInventory() { + // + } + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return null; + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return null; + } + + @Override + public boolean connectsToItemPipe(final byte aSide) { + return false; + } + + @Override + public float getExplosionResistance(final byte aSide) { + return 10.0F; + } + + @Override + public ItemStack[] getRealInventory() { + return this.mInventory; + } + + @Override + public void onColorChangeServer(final byte aColor) { + // + } + + @Override + public void onColorChangeClient(final byte aColor) { + // + } + + @Override + @SideOnly(Side.CLIENT) + public boolean renderInInventory(final Block aBlock, final int aMeta, final RenderBlocks aRenderer) { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public boolean renderInWorld(final IBlockAccess aWorld, final int aX, final int aY, final int aZ, final Block aBlock, final RenderBlocks aRenderer) { + return false; + } + + @Override + public void doExplosion(final long aExplosionPower) { + final float tStrength = aExplosionPower < V[0] ? 1.0F : aExplosionPower < V[1] ? 2.0F : aExplosionPower < V[2] ? 3.0F : aExplosionPower < V[3] ? 4.0F : aExplosionPower < V[4] ? 5.0F : aExplosionPower < (V[4] * 2) ? 6.0F : aExplosionPower < V[5] ? 7.0F : aExplosionPower < V[6] ? 8.0F : aExplosionPower < V[7] ? 9.0F : 10.0F; + final int tX = this.getBaseMetaTileEntity().getXCoord(), tY = this.getBaseMetaTileEntity().getYCoord(), tZ = this.getBaseMetaTileEntity().getZCoord(); + final World tWorld = this.getBaseMetaTileEntity().getWorld(); + GT_Utility.sendSoundToPlayers(tWorld, GregTech_API.sSoundList.get(209), 1.0F, -1, tX, tY, tZ); + tWorld.setBlock(tX, tY, tZ, Blocks.air); + if (GregTech_API.sMachineExplosions) { + tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); + } + } + + @Override + public int getLightOpacity() { + return ((GregtechBaseMetaTileEntityLossless) this.getBaseMetaTileEntity()).getLightValue() > 0 ? 0 : 255; + } + + @Override + public void addCollisionBoxesToList(final World aWorld, final int aX, final int aY, final int aZ, final AxisAlignedBB inputAABB, final List<AxisAlignedBB> outputAABB, final Entity collider) { + final AxisAlignedBB axisalignedbb1 = this.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + if ((axisalignedbb1 != null) && inputAABB.intersectsWith(axisalignedbb1)) { + outputAABB.add(axisalignedbb1); + } + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(final World aWorld, final int aX, final int aY, final int aZ) { + return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1); + } + + @Override + public void onEntityCollidedWithBlock(final World aWorld, final int aX, final int aY, final int aZ, final Entity collider) { + // + } + + @Override + public void onCreated(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { + // + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java index 81318efce7..289da38d53 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java @@ -1,6 +1,9 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines; import static gregtech.api.enums.GT_Values.V; + +import java.util.UUID; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -10,9 +13,6 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.player.PlayerCache; import gtPlusPlus.core.util.player.PlayerUtils; - -import java.util.UUID; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -24,85 +24,89 @@ public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_Tiered //UnbreakableBlockManager Xasda = new UnbreakableBlockManager(); private boolean value_last = false, value_current = false; - public GregtechMetaSafeBlockBase(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { + public GregtechMetaSafeBlockBase(final int aID, final String aName, final String aNameRegional, final int aTier, final int aInvSlotCount, final String aDescription) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); } - public GregtechMetaSafeBlockBase(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GregtechMetaSafeBlockBase(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[6][17][]; - ITexture tIcon = getOverlayIcon(), tOut = new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_QCHEST), tUp = new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT); + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + final ITexture[][][] rTextures = new ITexture[6][17][]; + final ITexture tIcon = this.getOverlayIcon(), tOut = new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_QCHEST), tUp = new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT); for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tUp, tIcon}; //Back - rTextures[1][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tIcon}; // Right, Strangely The top side as well when facing East? - rTextures[2][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tIcon}; // Top And Bottom, When Facing South (What the hell?) - rTextures[3][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tIcon}; // Left, Top if facing West and Bottom if facing east? - rTextures[4][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tIcon}; // Top and Bottom when Facing North.. - rTextures[5][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tOut}; // Front + rTextures[0][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tUp, tIcon}; //Back + rTextures[1][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon}; // Right, Strangely The top side as well when facing East? + rTextures[2][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon}; // Top And Bottom, When Facing South (What the hell?) + rTextures[3][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon}; // Left, Top if facing West and Bottom if facing east? + rTextures[4][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon}; // Top and Bottom when Facing North.. + rTextures[5][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tOut}; // Front } return rTextures; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) return mTextures[5][aColorIndex + 1]; - if (GT_Utility.getOppositeSide(aSide) == aFacing) return mTextures[0][aColorIndex + 1]; + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + if (aSide == aFacing) { + return this.mTextures[5][aColorIndex + 1]; + } + if (GT_Utility.getOppositeSide(aSide) == aFacing) { + return this.mTextures[0][aColorIndex + 1]; + } switch (aFacing) { case 0: - return mTextures[4][aColorIndex + 1]; + return this.mTextures[4][aColorIndex + 1]; case 1: - return mTextures[2][aColorIndex + 1]; + return this.mTextures[2][aColorIndex + 1]; case 2: switch (aSide) { case 0: - return mTextures[2][aColorIndex + 1]; + return this.mTextures[2][aColorIndex + 1]; case 1: - return mTextures[2][aColorIndex + 1]; + return this.mTextures[2][aColorIndex + 1]; case 4: - return mTextures[1][aColorIndex + 1]; + return this.mTextures[1][aColorIndex + 1]; case 5: - return mTextures[3][aColorIndex + 1]; + return this.mTextures[3][aColorIndex + 1]; } case 3: switch (aSide) { case 0: - return mTextures[4][aColorIndex + 1]; + return this.mTextures[4][aColorIndex + 1]; case 1: - return mTextures[4][aColorIndex + 1]; + return this.mTextures[4][aColorIndex + 1]; case 4: - return mTextures[3][aColorIndex + 1]; + return this.mTextures[3][aColorIndex + 1]; case 5: - return mTextures[1][aColorIndex + 1]; + return this.mTextures[1][aColorIndex + 1]; } case 4: switch (aSide) { case 0: - return mTextures[3][aColorIndex + 1]; + return this.mTextures[3][aColorIndex + 1]; case 1: - return mTextures[1][aColorIndex + 1]; + return this.mTextures[1][aColorIndex + 1]; case 2: - return mTextures[3][aColorIndex + 1]; + return this.mTextures[3][aColorIndex + 1]; case 3: - return mTextures[1][aColorIndex + 1]; + return this.mTextures[1][aColorIndex + 1]; } case 5: switch (aSide) { case 0: - return mTextures[1][aColorIndex + 1]; + return this.mTextures[1][aColorIndex + 1]; case 1: - return mTextures[3][aColorIndex + 1]; + return this.mTextures[3][aColorIndex + 1]; case 2: - return mTextures[1][aColorIndex + 1]; + return this.mTextures[1][aColorIndex + 1]; case 3: - return mTextures[3][aColorIndex + 1]; + return this.mTextures[3][aColorIndex + 1]; } } - return mTextures[5][aColorIndex + 1]; + return this.mTextures[5][aColorIndex + 1]; } @Override @@ -111,12 +115,12 @@ public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_Tiered } @Override - public boolean isValidSlot(int aIndex) { - return aIndex < mInventory.length - 1; + public boolean isValidSlot(final int aIndex) { + return aIndex < (this.mInventory.length - 1); } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return true; } @@ -131,13 +135,13 @@ public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_Tiered } @Override - public boolean isInputFacing(byte aSide) { - return !isOutputFacing(aSide); + public boolean isInputFacing(final byte aSide) { + return !this.isOutputFacing(aSide); } @Override - public boolean isOutputFacing(byte aSide) { - return getBaseMetaTileEntity().getBackFacing() == aSide; + public boolean isOutputFacing(final byte aSide) { + return this.getBaseMetaTileEntity().getBackFacing() == aSide; } @Override @@ -152,17 +156,17 @@ public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_Tiered @Override public long maxEUStore() { - return 512 + V[mTier] * 50; + return 512 + (V[this.mTier] * 50); } @Override public long maxEUInput() { - return V[mTier]; + return V[this.mTier]; } @Override public long maxEUOutput() { - return bOutput ? V[mTier] : 0; + return this.bOutput ? V[this.mTier] : 0; } @Override @@ -176,55 +180,55 @@ public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_Tiered } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { + public boolean isAccessAllowed(final EntityPlayer aPlayer) { return true; } public abstract ITexture getOverlayIcon(); @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - //Utils.LOG_WARNING("Clicky Clicky."); + if (aBaseMetaTileEntity.isClientSide()) { + //Utils.LOG_WARNING("Clicky Clicky."); return true; } if (aPlayer != null) { - UUID tempUUID = aPlayer.getUniqueID(); + final UUID tempUUID = aPlayer.getUniqueID(); /*if (!aPlayer.worldObj.isRemote){ //PlayerCache.appendParamChanges(aPlayer.getDisplayName(), aPlayer.getUniqueID().toString()); }*/ //Utils.LOG_INFO("test"); - if (ownerUUID == null){ + if (this.ownerUUID == null){ Utils.LOG_INFO("No owner yet for this block."); } else { //Utils.LOG_INFO("test"); - Utils.LOG_INFO("Current Owner: "+PlayerCache.lookupPlayerByUUID(ownerUUID)+" - UUID: "+ownerUUID); + Utils.LOG_INFO("Current Owner: "+PlayerCache.lookupPlayerByUUID(this.ownerUUID)+" - UUID: "+this.ownerUUID); } Utils.LOG_WARNING("Is ownerUUID Null"); - if (ownerUUID == null){ + if (this.ownerUUID == null){ Utils.LOG_WARNING("OwnerUUID is Null, let's set it."); Utils.LOG_WARNING("Accessing Players UUID is: "+tempUUID); - ownerUUID = tempUUID; + this.ownerUUID = tempUUID; //Utils.messagePlayer(aPlayer, "Owner of this safe, now set. Try accessing it again."); - Utils.LOG_WARNING("Block Owner is now set to: "+ownerUUID); + Utils.LOG_WARNING("Block Owner is now set to: "+this.ownerUUID); } Utils.LOG_WARNING("No, it is not."); Utils.LOG_WARNING("Checking ownerUUID."); - if (ownerUUID != null){ + if (this.ownerUUID != null){ Utils.LOG_WARNING("ownerUUID != Null, if accessor == owner."); Utils.LOG_WARNING("Accessing is: "+PlayerCache.lookupPlayerByUUID(tempUUID)); - if (ownerUUID.equals(tempUUID)){ - Utils.LOG_WARNING("Owner's UUID: "+ownerUUID); + if (this.ownerUUID.equals(tempUUID)){ + Utils.LOG_WARNING("Owner's UUID: "+this.ownerUUID); aBaseMetaTileEntity.openGUI(aPlayer); //Utils.LOG_WARNING("GUI should now be open for you sir."); } else { PlayerUtils.messagePlayer(aPlayer, "Access Denied, This does not belong to you."); - PlayerUtils.messagePlayer(aPlayer, "it is owned by: "+PlayerCache.lookupPlayerByUUID(ownerUUID)); - Utils.LOG_WARNING("Expecting Player : "+PlayerCache.lookupPlayerByUUID(ownerUUID)); + PlayerUtils.messagePlayer(aPlayer, "it is owned by: "+PlayerCache.lookupPlayerByUUID(this.ownerUUID)); + Utils.LOG_WARNING("Expecting Player : "+PlayerCache.lookupPlayerByUUID(this.ownerUUID)); Utils.LOG_ERROR("Access Denied."); return true; } @@ -243,41 +247,45 @@ public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_Tiered } @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setBoolean("bUnbreakable", bUnbreakable); - aNBT.setBoolean("bOutput", bOutput); - aNBT.setBoolean("bRedstoneIfFull", bRedstoneIfFull); - aNBT.setInteger("mTargetStackSize", mTargetStackSize); - if (ownerUUID != null) - aNBT.setString("ownerUUID", ownerUUID.toString()); + public void saveNBTData(final NBTTagCompound aNBT) { + aNBT.setBoolean("bUnbreakable", this.bUnbreakable); + aNBT.setBoolean("bOutput", this.bOutput); + aNBT.setBoolean("bRedstoneIfFull", this.bRedstoneIfFull); + aNBT.setInteger("mTargetStackSize", this.mTargetStackSize); + if (this.ownerUUID != null) { + aNBT.setString("ownerUUID", this.ownerUUID.toString()); + } } @Override - public void loadNBTData(NBTTagCompound aNBT) { - bUnbreakable = aNBT.getBoolean("bUnbreakable"); - bOutput = aNBT.getBoolean("bOutput"); - bRedstoneIfFull = aNBT.getBoolean("bRedstoneIfFull"); - mTargetStackSize = aNBT.getInteger("mTargetStackSize"); - if (aNBT.hasKey("ownerUUID")) - ownerUUID = UUID.fromString(aNBT.getString("ownerUUID")); + public void loadNBTData(final NBTTagCompound aNBT) { + this.bUnbreakable = aNBT.getBoolean("bUnbreakable"); + this.bOutput = aNBT.getBoolean("bOutput"); + this.bRedstoneIfFull = aNBT.getBoolean("bRedstoneIfFull"); + this.mTargetStackSize = aNBT.getInteger("mTargetStackSize"); + if (aNBT.hasKey("ownerUUID")) { + this.ownerUUID = UUID.fromString(aNBT.getString("ownerUUID")); + } } @Override - public void setItemNBT(NBTTagCompound aNBT) { + public void setItemNBT(final NBTTagCompound aNBT) { super.setItemNBT(aNBT); - if (mTargetStackSize > 0) aNBT.setInteger("mTargetStackSize", mTargetStackSize); + if (this.mTargetStackSize > 0) { + aNBT.setInteger("mTargetStackSize", this.mTargetStackSize); + } } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTimer) { /*if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isUniversalEnergyStored(getMinimumStoredEU()) && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() || aTimer % 200 == 0 || mSuccess > 0)) { */ - if (aBaseMetaTileEntity.isServerSide() && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() || aTimer % 200 == 0 || mSuccess > 0)) { - value_last = value_current; - value_current = bUnbreakable; - if (value_last != value_current){ + if (aBaseMetaTileEntity.isServerSide() && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() || ((aTimer % 200) == 0) || (this.mSuccess > 0))) { + this.value_last = this.value_current; + this.value_current = this.bUnbreakable; + if (this.value_last != this.value_current){ Utils.LOG_WARNING("VALUE CHANGE - Ticking for a moment."); - if (bUnbreakable == true){ + if (this.bUnbreakable == true){ //Xasda.setmTileEntity((BaseMetaTileEntity) aBaseMetaTileEntity); //Utils.LOG_ERROR("Safe is Indestructible."); this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()).setResistance(Float.MAX_VALUE); @@ -288,23 +296,23 @@ public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_Tiered //Utils.LOG_ERROR("Safe is not Indestructible."); this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()).setResistance(1F); this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()).setHardness(2); - + } } else { - + } - + } } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return aSide != aBaseMetaTileEntity.getBackFacing(); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaTreeFarmerBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaTreeFarmerBase.java index 9ebf6b3a2d..45c2cd7303 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaTreeFarmerBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaTreeFarmerBase.java @@ -13,35 +13,35 @@ public abstract class GregtechMetaTreeFarmerBase extends GT_MetaTileEntity_Tiere public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bUnbreakable = false; public int mSuccess = 0, mTargetStackSize = 0; - public GregtechMetaTreeFarmerBase(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { + public GregtechMetaTreeFarmerBase(final int aID, final String aName, final String aNameRegional, final int aTier, final int aInvSlotCount, final String aDescription) { super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); } - public GregtechMetaTreeFarmerBase(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { + public GregtechMetaTreeFarmerBase(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[10][17][]; + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + final ITexture[][][] rTextures = new ITexture[10][17][]; for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = getFront(i); - rTextures[1][i + 1] = getBack(i); - rTextures[2][i + 1] = getBottom(i); - rTextures[3][i + 1] = getTop(i); - rTextures[4][i + 1] = getSides(i); - rTextures[5][i + 1] = getFrontActive(i); - rTextures[6][i + 1] = getBackActive(i); - rTextures[7][i + 1] = getBottomActive(i); - rTextures[8][i + 1] = getTopActive(i); - rTextures[9][i + 1] = getSidesActive(i); + rTextures[0][i + 1] = this.getFront(i); + rTextures[1][i + 1] = this.getBack(i); + rTextures[2][i + 1] = this.getBottom(i); + rTextures[3][i + 1] = this.getTop(i); + rTextures[4][i + 1] = this.getSides(i); + rTextures[5][i + 1] = this.getFrontActive(i); + rTextures[6][i + 1] = this.getBackActive(i); + rTextures[7][i + 1] = this.getBottomActive(i); + rTextures[8][i + 1] = this.getTopActive(i); + rTextures[9][i + 1] = this.getSidesActive(i); } return rTextures; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; } @Override @@ -50,12 +50,12 @@ public abstract class GregtechMetaTreeFarmerBase extends GT_MetaTileEntity_Tiere } @Override - public boolean isValidSlot(int aIndex) { + public boolean isValidSlot(final int aIndex) { return false; } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return true; } @@ -70,13 +70,13 @@ public abstract class GregtechMetaTreeFarmerBase extends GT_MetaTileEntity_Tiere } @Override - public boolean isInputFacing(byte aSide) { - return !isOutputFacing(aSide); + public boolean isInputFacing(final byte aSide) { + return !this.isOutputFacing(aSide); } @Override - public boolean isOutputFacing(byte aSide) { - return getBaseMetaTileEntity().getBackFacing() == aSide; + public boolean isOutputFacing(final byte aSide) { + return this.getBaseMetaTileEntity().getBackFacing() == aSide; } @Override @@ -115,7 +115,7 @@ public abstract class GregtechMetaTreeFarmerBase extends GT_MetaTileEntity_Tiere } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { + public boolean isAccessAllowed(final EntityPlayer aPlayer) { return false; } @@ -123,52 +123,52 @@ public abstract class GregtechMetaTreeFarmerBase extends GT_MetaTileEntity_Tiere @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } - public ITexture[] getFront(byte aColor) { + public ITexture[] getFront(final byte aColor) { return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)}; } - public ITexture[] getBack(byte aColor) { + public ITexture[] getBack(final byte aColor) { return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)}; } - public ITexture[] getBottom(byte aColor) { + public ITexture[] getBottom(final byte aColor) { return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log)}; } - public ITexture[] getTop(byte aColor) { + public ITexture[] getTop(final byte aColor) { return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Podzol)}; } - public ITexture[] getSides(byte aColor) { + public ITexture[] getSides(final byte aColor) { return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)}; } - public ITexture[] getFrontActive(byte aColor) { - return getFront(aColor); + public ITexture[] getFrontActive(final byte aColor) { + return this.getFront(aColor); } - public ITexture[] getBackActive(byte aColor) { - return getBack(aColor); + public ITexture[] getBackActive(final byte aColor) { + return this.getBack(aColor); } - public ITexture[] getBottomActive(byte aColor) { - return getBottom(aColor); + public ITexture[] getBottomActive(final byte aColor) { + return this.getBottom(aColor); } - public ITexture[] getTopActive(byte aColor) { - return getTop(aColor); + public ITexture[] getTopActive(final byte aColor) { + return this.getTop(aColor); } - public ITexture[] getSidesActive(byte aColor) { - return getSides(aColor); + public ITexture[] getSidesActive(final byte aColor) { + return this.getSides(aColor); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/creative/GregtechMetaCreativeEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/creative/GregtechMetaCreativeEnergyBuffer.java index e2ec5aa0c8..a26dc2c1b6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/creative/GregtechMetaCreativeEnergyBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/creative/GregtechMetaCreativeEnergyBuffer.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.creative; import static gregtech.api.enums.GT_Values.V; + import gregtech.api.enums.Textures; import gregtech.api.gui.*; import gregtech.api.interfaces.ITexture; @@ -20,68 +21,68 @@ import net.minecraft.util.EnumChatFormatting; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! - * + * * This is the main construct for my Basic Machines such as the Automatic Extractor * Extend this class to make a simple Machine */ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { - public GregtechMetaCreativeEnergyBuffer(String aName, int aTier, - String aDescription, ITexture[][][] aTextures, int aSlotCount) { + public GregtechMetaCreativeEnergyBuffer(final String aName, final int aTier, + final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) { super(aName, aTier, aDescription, aTextures, aSlotCount); // TODO Auto-generated constructor stub } - public GregtechMetaCreativeEnergyBuffer(int aID, String aName, - String aNameRegional, int aTier, String aDescription, int aSlotCount) { + public GregtechMetaCreativeEnergyBuffer(final int aID, final String aName, + final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) { super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount); } @Override public String[] getDescription() { - return new String[] {mDescription, "Added by: " + EnumChatFormatting.DARK_GREEN+"Alkalus"}; + return new String[] {this.mDescription, "Added by: " + EnumChatFormatting.DARK_GREEN+"Alkalus"}; } /* * MACHINE_STEEL_SIDE */ @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[2][17][]; + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + final ITexture[][][] rTextures = new ITexture[2][17][]; for (byte i = -1; i < 16; i++) { rTextures[0][i + 1] = new ITexture[] { new GT_RenderedTexture( Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT) }; rTextures[1][i + 1] = new ITexture[] { new GT_RenderedTexture( Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT), - mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] - : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] }; + this.mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] + : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] }; } return rTextures; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, byte aFacing, byte aColorIndex, boolean aActive, - boolean aRedstone) { - return mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1]; + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, + final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, + final boolean aRedstone) { + return this.mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1]; } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaCreativeEnergyBuffer(mName, mTier, mDescription, - mTextures, mInventory.length); + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaCreativeEnergyBuffer(this.mName, this.mTier, this.mDescription, + this.mTextures, this.mInventory.length); } @Override public boolean isSimpleMachine() {return false;} @Override public boolean isElectric() {return true;} - @Override public boolean isValidSlot(int aIndex) {return true;} - @Override public boolean isFacingValid(byte aFacing) {return true;} + @Override public boolean isValidSlot(final int aIndex) {return true;} + @Override public boolean isFacingValid(final byte aFacing) {return true;} @Override public boolean isEnetInput() {return true;} @Override public boolean isEnetOutput() {return true;} - @Override public boolean isInputFacing(byte aSide) {return aSide!=getBaseMetaTileEntity().getFrontFacing();} - @Override public boolean isOutputFacing(byte aSide) {return aSide==getBaseMetaTileEntity().getFrontFacing();} + @Override public boolean isInputFacing(final byte aSide) {return aSide!=this.getBaseMetaTileEntity().getFrontFacing();} + @Override public boolean isOutputFacing(final byte aSide) {return aSide==this.getBaseMetaTileEntity().getFrontFacing();} @Override public boolean isTeleporterCompatible() {return false;} @Override @@ -96,45 +97,45 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { @Override public long maxEUInput() { - return V[mTier]; + return V[this.mTier]; } @Override public long maxEUOutput() { - return V[mTier]; + return V[this.mTier]; } @Override public long maxAmperesIn() { - return mChargeableCount * 16; + return this.mChargeableCount * 16; } @Override public long maxAmperesOut() { - return mChargeableCount * 16; + return this.mChargeableCount * 16; } @Override public int rechargerSlotStartIndex() {return 0;} @Override public int dechargerSlotStartIndex() {return 0;} - @Override public int rechargerSlotCount() {return mCharge?mInventory.length:0;} - @Override public int dechargerSlotCount() {return mDecharge?mInventory.length:0;} + @Override public int rechargerSlotCount() {return this.mCharge?this.mInventory.length:0;} + @Override public int dechargerSlotCount() {return this.mDecharge?this.mInventory.length:0;} @Override public int getProgresstime() {return Integer.MAX_VALUE;} - @Override public int maxProgresstime() {return (int)getBaseMetaTileEntity().getUniversalEnergyCapacity();} - @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;} + @Override public int maxProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyCapacity();} + @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;} @Override - public void saveNBTData(NBTTagCompound aNBT) { + public void saveNBTData(final NBTTagCompound aNBT) { // } @Override - public void loadNBTData(NBTTagCompound aNBT) { + public void loadNBTData(final NBTTagCompound aNBT) { // } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, - IGregTechTileEntity aBaseMetaTileEntity) { - switch (mInventory.length) { + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, + final IGregTechTileEntity aBaseMetaTileEntity) { + switch (this.mInventory.length) { case 1: return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity); case 4: return new GT_Container_2by2(aPlayerInventory, aBaseMetaTileEntity); case 9: return new GT_Container_3by3(aPlayerInventory, aBaseMetaTileEntity); @@ -144,38 +145,42 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, - IGregTechTileEntity aBaseMetaTileEntity) { - switch (mInventory.length) { - case 1: return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); - case 4: return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); - case 9: return new GT_GUIContainer_3by3(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); - case 16: return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, + final IGregTechTileEntity aBaseMetaTileEntity) { + switch (this.mInventory.length) { + case 1: return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); + case 4: return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); + case 9: return new GT_GUIContainer_3by3(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); + case 16: return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); } - return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); + return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { this.getBaseMetaTileEntity().increaseStoredEnergyUnits(Integer.MAX_VALUE, true); if (aBaseMetaTileEntity.isServerSide()) { - mCharge = aBaseMetaTileEntity.getStoredEU() / 2 > aBaseMetaTileEntity - .getEUCapacity() / 3; - mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3; - mBatteryCount = 1; - mChargeableCount = 1; - this.getBaseMetaTileEntity().increaseStoredEnergyUnits(mMax, true); - for (ItemStack tStack : mInventory) if (GT_ModHandler.isElectricItem(tStack, mTier)) { - if (GT_ModHandler.isChargerItem(tStack)) mBatteryCount++; - mChargeableCount++; + this.mCharge = (aBaseMetaTileEntity.getStoredEU() / 2) > (aBaseMetaTileEntity + .getEUCapacity() / 3); + this.mDecharge = aBaseMetaTileEntity.getStoredEU() < (aBaseMetaTileEntity.getEUCapacity() / 3); + this.mBatteryCount = 1; + this.mChargeableCount = 1; + this.getBaseMetaTileEntity().increaseStoredEnergyUnits(this.mMax, true); + for (final ItemStack tStack : this.mInventory) { + if (GT_ModHandler.isElectricItem(tStack, this.mTier)) { + if (GT_ModHandler.isChargerItem(tStack)) { + this.mBatteryCount++; + } + this.mChargeableCount++; + } } } } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { if(GT_ModHandler.isElectricItem(aStack)&&aStack.getUnlocalizedName().startsWith("gt.metaitem.01.")){ - String name = aStack.getUnlocalizedName(); + final String name = aStack.getUnlocalizedName(); if(name.equals("gt.metaitem.01.32510")|| name.equals("gt.metaitem.01.32511")|| name.equals("gt.metaitem.01.32520")|| @@ -189,7 +194,7 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { if(!GT_Utility.isStackValid(aStack)){ return false; } @@ -201,15 +206,15 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { @Override public long[] getStoredEnergy(){ - long tScale = getBaseMetaTileEntity().getEUCapacity(); - long tStored = getBaseMetaTileEntity().getStoredEU(); + long tScale = this.getBaseMetaTileEntity().getEUCapacity(); + long tStored = this.getBaseMetaTileEntity().getStoredEU(); this.setEUVar(Long.MAX_VALUE); - if (mInventory != null) { - for (ItemStack aStack : mInventory) { + if (this.mInventory != null) { + for (final ItemStack aStack : this.mInventory) { if (GT_ModHandler.isElectricItem(aStack)) { if (aStack.getItem() instanceof GT_MetaBase_Item) { - Long[] stats = ((GT_MetaBase_Item) aStack.getItem()) + final Long[] stats = ((GT_MetaBase_Item) aStack.getItem()) .getElectricStats(aStack); if (stats != null) { tScale = tScale + stats[0]; @@ -238,18 +243,18 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { @Override public String[] getInfoData() { - count++; - if(mMax==0||count%20==0){ - long[] tmp = getStoredEnergy(); - mStored=tmp[0]; - mMax=tmp[1]; + this.count++; + if((this.mMax==0)||((this.count%20)==0)){ + final long[] tmp = this.getStoredEnergy(); + this.mStored=tmp[0]; + this.mMax=tmp[1]; } return new String[] { - getLocalName(), + this.getLocalName(), "THIS IS A CREATIVE ITEM - FOR TESTING", - GT_Utility.formatNumbers(mStored)+" EU /", - GT_Utility.formatNumbers(mMax)+" EU"}; + GT_Utility.formatNumbers(this.mStored)+" EU /", + GT_Utility.formatNumbers(this.mMax)+" EU"}; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java index 56a48602c9..6c229b5055 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java @@ -5,23 +5,23 @@ import gtPlusPlus.core.lib.CORE; import net.minecraftforge.fluids.Fluid; public class GregtechFluid extends Fluid implements Runnable { - public final String mTextureName; - private final short[] mRGBa; + public final String mTextureName; + private final short[] mRGBa; - public GregtechFluid(String aName, String aTextureName, short[] aRGBa) { - super(aName); - mRGBa = aRGBa; - mTextureName = aTextureName; - GregTech_API.sGTBlockIconload.add(this); - } + public GregtechFluid(final String aName, final String aTextureName, final short[] aRGBa) { + super(aName); + this.mRGBa = aRGBa; + this.mTextureName = aTextureName; + GregTech_API.sGTBlockIconload.add(this); + } - @Override - public int getColor() { - return (Math.max(0, Math.min(255, mRGBa[0])) << 16) | (Math.max(0, Math.min(255, mRGBa[1])) << 8) | Math.max(0, Math.min(255, mRGBa[2])); - } + @Override + public int getColor() { + return (Math.max(0, Math.min(255, this.mRGBa[0])) << 16) | (Math.max(0, Math.min(255, this.mRGBa[1])) << 8) | Math.max(0, Math.min(255, this.mRGBa[2])); + } - @Override - public void run() { - setIcons(GregTech_API.sBlockIcons.registerIcon(CORE.MODID+ ":" + "fluids/fluid." + mTextureName)); - } + @Override + public void run() { + this.setIcons(GregTech_API.sBlockIcons.registerIcon(CORE.MODID+ ":" + "fluids/fluid." + this.mTextureName)); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java index f5a1a2d04f..0a5351afdc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java @@ -1,126 +1,142 @@ package gtPlusPlus.xmod.gregtech.api.objects; +import java.util.*; + import gregtech.api.objects.GT_ArrayList; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; - -import java.util.*; - import net.minecraft.item.ItemStack; public class GregtechItemData { - private static final GregtechMaterialStack[] EMPTY_GT_MaterialStack_ARRAY = new GregtechMaterialStack[0]; - - public final List<Object> mExtraData = new GT_ArrayList<Object>(false, 1); - public final GregtechOrePrefixes mPrefix; - public final GregtechMaterialStack mMaterial; - public final GregtechMaterialStack[] mByProducts; - public boolean mBlackListed = false; - public ItemStack mUnificationTarget = null; - - public GregtechItemData(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, boolean aBlackListed) { - mPrefix = aPrefix; - mMaterial = aMaterial == null ? null : new GregtechMaterialStack(aMaterial, aPrefix.mMaterialAmount); - mBlackListed = aBlackListed; - mByProducts = aPrefix.mSecondaryMaterial == null || aPrefix.mSecondaryMaterial.mMaterial == null ? EMPTY_GT_MaterialStack_ARRAY : new GregtechMaterialStack[]{aPrefix.mSecondaryMaterial.clone()}; - } - - public GregtechItemData(GregtechOrePrefixes aPrefix, GT_Materials aMaterial) { - this(aPrefix, aMaterial, false); - } - - public GregtechItemData(GregtechMaterialStack aMaterial, GregtechMaterialStack... aByProducts) { - mPrefix = null; - mMaterial = aMaterial.mMaterial == null ? null : aMaterial.clone(); - mBlackListed = true; - if (aByProducts == null) { - mByProducts = EMPTY_GT_MaterialStack_ARRAY; - } else { - GregtechMaterialStack[] tByProducts = aByProducts.length < 1 ? EMPTY_GT_MaterialStack_ARRAY : new GregtechMaterialStack[aByProducts.length]; - int j = 0; - for (int i = 0; i < aByProducts.length; i++) - if (aByProducts[i] != null && aByProducts[i].mMaterial != null) - tByProducts[j++] = aByProducts[i].clone(); - mByProducts = j > 0 ? new GregtechMaterialStack[j] : EMPTY_GT_MaterialStack_ARRAY; - for (int i = 0; i < mByProducts.length; i++) mByProducts[i] = tByProducts[i]; - } - } - - public GregtechItemData(GT_Materials aMaterial, long aAmount, GregtechMaterialStack... aByProducts) { - this(new GregtechMaterialStack(aMaterial, aAmount), aByProducts); - } - - public GregtechItemData(GT_Materials aMaterial, long aAmount, GT_Materials aByProduct, long aByProductAmount) { - this(new GregtechMaterialStack(aMaterial, aAmount), new GregtechMaterialStack(aByProduct, aByProductAmount)); - } - - public GregtechItemData(GregtechItemData... aData) { - mPrefix = null; - mBlackListed = true; - - ArrayList<GregtechMaterialStack> aList = new ArrayList<GregtechMaterialStack>(), rList = new ArrayList<GregtechMaterialStack>(); - - for (GregtechItemData tData : aData) - if (tData != null) { - if (tData.hasValidMaterialData() && tData.mMaterial.mAmount > 0) aList.add(tData.mMaterial.clone()); - for (GregtechMaterialStack tMaterial : tData.mByProducts) - if (tMaterial.mAmount > 0) aList.add(tMaterial.clone()); - } - - for (GregtechMaterialStack aMaterial : aList) { - boolean temp = true; - for (GregtechMaterialStack tMaterial : rList) - if (aMaterial.mMaterial == tMaterial.mMaterial) { - tMaterial.mAmount += aMaterial.mAmount; - temp = false; - break; - } - if (temp) rList.add(aMaterial.clone()); - } - - Collections.sort(rList, new Comparator<GregtechMaterialStack>() { - @Override - public int compare(GregtechMaterialStack a, GregtechMaterialStack b) { - return a.mAmount == b.mAmount ? 0 : a.mAmount > b.mAmount ? -1 : +1; - } - }); - - if (rList.isEmpty()) { - mMaterial = null; - } else { - mMaterial = rList.get(0); - rList.remove(0); - } - - mByProducts = rList.toArray(new GregtechMaterialStack[rList.size()]); - } - - public boolean hasValidPrefixMaterialData() { - return mPrefix != null && mMaterial != null && mMaterial.mMaterial != null; - } - - public boolean hasValidPrefixData() { - return mPrefix != null; - } - - public boolean hasValidMaterialData() { - return mMaterial != null && mMaterial.mMaterial != null; - } - - public ArrayList<GregtechMaterialStack> getAllGT_MaterialStacks() { - ArrayList<GregtechMaterialStack> rList = new ArrayList(); - if (hasValidMaterialData()) rList.add(mMaterial); - rList.addAll(Arrays.asList(mByProducts)); - return rList; - } - - public GregtechMaterialStack getByProduct(int aIndex) { - return aIndex >= 0 && aIndex < mByProducts.length ? mByProducts[aIndex] : null; - } - - @Override - public String toString() { - if (mPrefix == null || mMaterial == null || mMaterial.mMaterial == null) return ""; - return mPrefix.name() + mMaterial.mMaterial.name(); - } + private static final GregtechMaterialStack[] EMPTY_GT_MaterialStack_ARRAY = new GregtechMaterialStack[0]; + + public final List<Object> mExtraData = new GT_ArrayList<>(false, 1); + public final GregtechOrePrefixes mPrefix; + public final GregtechMaterialStack mMaterial; + public final GregtechMaterialStack[] mByProducts; + public boolean mBlackListed = false; + public ItemStack mUnificationTarget = null; + + public GregtechItemData(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final boolean aBlackListed) { + this.mPrefix = aPrefix; + this.mMaterial = aMaterial == null ? null : new GregtechMaterialStack(aMaterial, aPrefix.mMaterialAmount); + this.mBlackListed = aBlackListed; + this.mByProducts = (aPrefix.mSecondaryMaterial == null) || (aPrefix.mSecondaryMaterial.mMaterial == null) ? EMPTY_GT_MaterialStack_ARRAY : new GregtechMaterialStack[]{aPrefix.mSecondaryMaterial.clone()}; + } + + public GregtechItemData(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial) { + this(aPrefix, aMaterial, false); + } + + public GregtechItemData(final GregtechMaterialStack aMaterial, final GregtechMaterialStack... aByProducts) { + this.mPrefix = null; + this.mMaterial = aMaterial.mMaterial == null ? null : aMaterial.clone(); + this.mBlackListed = true; + if (aByProducts == null) { + this.mByProducts = EMPTY_GT_MaterialStack_ARRAY; + } else { + final GregtechMaterialStack[] tByProducts = aByProducts.length < 1 ? EMPTY_GT_MaterialStack_ARRAY : new GregtechMaterialStack[aByProducts.length]; + int j = 0; + for (int i = 0; i < aByProducts.length; i++) { + if ((aByProducts[i] != null) && (aByProducts[i].mMaterial != null)) { + tByProducts[j++] = aByProducts[i].clone(); + } + } + this.mByProducts = j > 0 ? new GregtechMaterialStack[j] : EMPTY_GT_MaterialStack_ARRAY; + for (int i = 0; i < this.mByProducts.length; i++) { + this.mByProducts[i] = tByProducts[i]; + } + } + } + + public GregtechItemData(final GT_Materials aMaterial, final long aAmount, final GregtechMaterialStack... aByProducts) { + this(new GregtechMaterialStack(aMaterial, aAmount), aByProducts); + } + + public GregtechItemData(final GT_Materials aMaterial, final long aAmount, final GT_Materials aByProduct, final long aByProductAmount) { + this(new GregtechMaterialStack(aMaterial, aAmount), new GregtechMaterialStack(aByProduct, aByProductAmount)); + } + + public GregtechItemData(final GregtechItemData... aData) { + this.mPrefix = null; + this.mBlackListed = true; + + final ArrayList<GregtechMaterialStack> aList = new ArrayList<>(), rList = new ArrayList<>(); + + for (final GregtechItemData tData : aData) { + if (tData != null) { + if (tData.hasValidMaterialData() && (tData.mMaterial.mAmount > 0)) { + aList.add(tData.mMaterial.clone()); + } + for (final GregtechMaterialStack tMaterial : tData.mByProducts) { + if (tMaterial.mAmount > 0) { + aList.add(tMaterial.clone()); + } + } + } + } + + for (final GregtechMaterialStack aMaterial : aList) { + boolean temp = true; + for (final GregtechMaterialStack tMaterial : rList) { + if (aMaterial.mMaterial == tMaterial.mMaterial) { + tMaterial.mAmount += aMaterial.mAmount; + temp = false; + break; + } + } + if (temp) { + rList.add(aMaterial.clone()); + } + } + + Collections.sort(rList, new Comparator<GregtechMaterialStack>() { + @Override + public int compare(final GregtechMaterialStack a, final GregtechMaterialStack b) { + return a.mAmount == b.mAmount ? 0 : a.mAmount > b.mAmount ? -1 : +1; + } + }); + + if (rList.isEmpty()) { + this.mMaterial = null; + } else { + this.mMaterial = rList.get(0); + rList.remove(0); + } + + this.mByProducts = rList.toArray(new GregtechMaterialStack[rList.size()]); + } + + public boolean hasValidPrefixMaterialData() { + return (this.mPrefix != null) && (this.mMaterial != null) && (this.mMaterial.mMaterial != null); + } + + public boolean hasValidPrefixData() { + return this.mPrefix != null; + } + + public boolean hasValidMaterialData() { + return (this.mMaterial != null) && (this.mMaterial.mMaterial != null); + } + + public ArrayList<GregtechMaterialStack> getAllGT_MaterialStacks() { + final ArrayList<GregtechMaterialStack> rList = new ArrayList(); + if (this.hasValidMaterialData()) { + rList.add(this.mMaterial); + } + rList.addAll(Arrays.asList(this.mByProducts)); + return rList; + } + + public GregtechMaterialStack getByProduct(final int aIndex) { + return (aIndex >= 0) && (aIndex < this.mByProducts.length) ? this.mByProducts[aIndex] : null; + } + + @Override + public String toString() { + if ((this.mPrefix == null) || (this.mMaterial == null) || (this.mMaterial.mMaterial == null)) { + return ""; + } + return this.mPrefix.name() + this.mMaterial.mMaterial.name(); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java index 245db1745f..6ec5907256 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/GregtechMaterialStack.java @@ -3,40 +3,47 @@ package gtPlusPlus.xmod.gregtech.api.objects; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; public class GregtechMaterialStack implements Cloneable { - public long mAmount; - public GT_Materials mMaterial; - - public GregtechMaterialStack(GT_Materials aMaterial, long aAmount) { - mMaterial = aMaterial == null ? GT_Materials._NULL : aMaterial; - mAmount = aAmount; - } - - public GregtechMaterialStack copy(long aAmount) { - return new GregtechMaterialStack(mMaterial, aAmount); - } - - @Override - public GregtechMaterialStack clone() { - return new GregtechMaterialStack(mMaterial, mAmount); - } - - @Override - public boolean equals(Object aObject) { - if (aObject == this) return true; - if (aObject == null) return false; - if (aObject instanceof GT_Materials) return aObject == mMaterial; - if (aObject instanceof GregtechMaterialStack) - return ((GregtechMaterialStack) aObject).mMaterial == mMaterial && (mAmount < 0 || ((GregtechMaterialStack) aObject).mAmount < 0 || ((GregtechMaterialStack) aObject).mAmount == mAmount); - return false; - } - - @Override - public String toString() { - return (mMaterial.mMaterialList.size() > 1 && mAmount > 1 ? "(" : "") + mMaterial.getToolTip(true) + (mMaterial.mMaterialList.size() > 1 && mAmount > 1 ? ")" : "") + (mAmount > 1 ? mAmount : ""); - } - - @Override - public int hashCode() { - return mMaterial.hashCode(); - } + public long mAmount; + public GT_Materials mMaterial; + + public GregtechMaterialStack(final GT_Materials aMaterial, final long aAmount) { + this.mMaterial = aMaterial == null ? GT_Materials._NULL : aMaterial; + this.mAmount = aAmount; + } + + public GregtechMaterialStack copy(final long aAmount) { + return new GregtechMaterialStack(this.mMaterial, aAmount); + } + + @Override + public GregtechMaterialStack clone() { + return new GregtechMaterialStack(this.mMaterial, this.mAmount); + } + + @Override + public boolean equals(final Object aObject) { + if (aObject == this) { + return true; + } + if (aObject == null) { + return false; + } + if (aObject instanceof GT_Materials) { + return aObject == this.mMaterial; + } + if (aObject instanceof GregtechMaterialStack) { + return (((GregtechMaterialStack) aObject).mMaterial == this.mMaterial) && ((this.mAmount < 0) || (((GregtechMaterialStack) aObject).mAmount < 0) || (((GregtechMaterialStack) aObject).mAmount == this.mAmount)); + } + return false; + } + + @Override + public String toString() { + return ((this.mMaterial.mMaterialList.size() > 1) && (this.mAmount > 1) ? "(" : "") + this.mMaterial.getToolTip(true) + ((this.mMaterial.mMaterialList.size() > 1) && (this.mAmount > 1) ? ")" : "") + (this.mAmount > 1 ? this.mAmount : ""); + } + + @Override + public int hashCode() { + return this.mMaterial.hashCode(); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/XSTR.java b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/XSTR.java index da3df32d3a..2a7684f20f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/XSTR.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/XSTR.java @@ -35,189 +35,189 @@ import java.util.concurrent.atomic.AtomicLong; */ public class XSTR extends Random { - private static final long serialVersionUID = 6208727693524452904L; - private long seed; - private long last; - private static final long GAMMA = 0x9e3779b97f4a7c15L; - private static final int PROBE_INCREMENT = 0x9e3779b9; - private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL; - private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) - private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) + private static final long serialVersionUID = 6208727693524452904L; + private long seed; + private long last; + private static final long GAMMA = 0x9e3779b97f4a7c15L; + private static final int PROBE_INCREMENT = 0x9e3779b9; + private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL; + private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) + private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) - /* + /* MODIFIED BY: Robotia Modification: Implemented Random class seed generator - */ - /** - * Creates a new pseudo random number generator. The seed is initialized to - * the current time, as if by - * <code>setSeed(System.currentTimeMillis());</code>. - */ - public XSTR() { - this(seedUniquifier() ^ System.nanoTime()); - } - private static final AtomicLong seedUniquifier - = new AtomicLong(8682522807148012L); + */ + /** + * Creates a new pseudo random number generator. The seed is initialized to + * the current time, as if by + * <code>setSeed(System.currentTimeMillis());</code>. + */ + public XSTR() { + this(seedUniquifier() ^ System.nanoTime()); + } + private static final AtomicLong seedUniquifier + = new AtomicLong(8682522807148012L); - private static long seedUniquifier() { - // L'Ecuyer, "Tables of Linear Congruential Generators of - // Different Sizes and Good Lattice Structure", 1999 - for (;;) { - long current = seedUniquifier.get(); - long next = current * 181783497276652981L; - if (seedUniquifier.compareAndSet(current, next)) { - return next; - } - } - } + private static long seedUniquifier() { + // L'Ecuyer, "Tables of Linear Congruential Generators of + // Different Sizes and Good Lattice Structure", 1999 + for (;;) { + final long current = seedUniquifier.get(); + final long next = current * 181783497276652981L; + if (seedUniquifier.compareAndSet(current, next)) { + return next; + } + } + } - /** - * Creates a new pseudo random number generator, starting with the specified - * seed, using <code>setSeed(seed);</code>. - * - * @param seed the initial seed - */ - public XSTR(long seed) { - this.seed = seed; - } - @Override + /** + * Creates a new pseudo random number generator, starting with the specified + * seed, using <code>setSeed(seed);</code>. + * + * @param seed the initial seed + */ + public XSTR(final long seed) { + this.seed = seed; + } + @Override public boolean nextBoolean() { - return next(1) != 0; - } + return this.next(1) != 0; + } - @Override + @Override public double nextDouble() { - return (((long)(next(26)) << 27) + next(27)) * DOUBLE_UNIT; - } - /** - * Returns the current state of the seed, can be used to clone the object - * - * @return the current seed - */ - public synchronized long getSeed() { - return seed; - } + return (((long)(this.next(26)) << 27) + this.next(27)) * DOUBLE_UNIT; + } + /** + * Returns the current state of the seed, can be used to clone the object + * + * @return the current seed + */ + public synchronized long getSeed() { + return this.seed; + } - /** - * Sets the seed for this pseudo random number generator. As described - * above, two instances of the same random class, starting with the same - * seed, produce the same results, if the same methods are called. - * - * @param seed the new seed - */ - @Override - public synchronized void setSeed(long seed) { - this.seed = seed; - } + /** + * Sets the seed for this pseudo random number generator. As described + * above, two instances of the same random class, starting with the same + * seed, produce the same results, if the same methods are called. + * + * @param seed the new seed + */ + @Override + public synchronized void setSeed(final long seed) { + this.seed = seed; + } - /** - * @return Returns an XSRandom object with the same state as the original - */ - @Override - public XSTR clone() { - return new XSTR(getSeed()); - } + /** + * @return Returns an XSRandom object with the same state as the original + */ + @Override + public XSTR clone() { + return new XSTR(this.getSeed()); + } - /** - * Implementation of George Marsaglia's elegant Xorshift random generator - * 30% faster and better quality than the built-in java.util.random see also - * see http://www.javamex.com/tutorials/random_numbers/xorshift.shtml - * - * @param nbits - * @return - */ - @Override - public int next(int nbits) { - long x = seed; - x ^= (x << 21); - x ^= (x >>> 35); - x ^= (x << 4); - seed = x; - x &= ((1L << nbits) - 1); - return (int) x; - } - boolean haveNextNextGaussian = false; - double nextNextGaussian = 0; - @Override + /** + * Implementation of George Marsaglia's elegant Xorshift random generator + * 30% faster and better quality than the built-in java.util.random see also + * see http://www.javamex.com/tutorials/random_numbers/xorshift.shtml + * + * @param nbits + * @return + */ + @Override + public int next(final int nbits) { + long x = this.seed; + x ^= (x << 21); + x ^= (x >>> 35); + x ^= (x << 4); + this.seed = x; + x &= ((1L << nbits) - 1); + return (int) x; + } + boolean haveNextNextGaussian = false; + double nextNextGaussian = 0; + @Override synchronized public double nextGaussian() { - // See Knuth, ACP, Section 3.4.1 Algorithm C. - if (haveNextNextGaussian) { - haveNextNextGaussian = false; - return nextNextGaussian; - } + // See Knuth, ACP, Section 3.4.1 Algorithm C. + if (this.haveNextNextGaussian) { + this.haveNextNextGaussian = false; + return this.nextNextGaussian; + } double v1, v2, s; do { - v1 = 2 * nextDouble() - 1; // between -1 and 1 - v2 = 2 * nextDouble() - 1; // between -1 and 1 - s = v1 * v1 + v2 * v2; - } while (s >= 1 || s == 0); - double multiplier = StrictMath.sqrt(-2 * StrictMath.log(s)/s); - nextNextGaussian = v2 * multiplier; - haveNextNextGaussian = true; + v1 = (2 * this.nextDouble()) - 1; // between -1 and 1 + v2 = (2 * this.nextDouble()) - 1; // between -1 and 1 + s = (v1 * v1) + (v2 * v2); + } while ((s >= 1) || (s == 0)); + final double multiplier = StrictMath.sqrt((-2 * StrictMath.log(s))/s); + this.nextNextGaussian = v2 * multiplier; + this.haveNextNextGaussian = true; return v1 * multiplier; - } - /** - * Returns a pseudorandom, uniformly distributed {@code int} value between 0 - * (inclusive) and the specified value (exclusive), drawn from this random - * number generator's sequence. The general contract of {@code nextInt} is - * that one {@code int} value in the specified range is pseudorandomly - * generated and returned. All {@code bound} possible {@code int} values are - * produced with (approximately) equal probability. The method - * {@code nextInt(int bound)} is implemented by class {@code Random} as if - * by: - * <pre> {@code - * public int nextInt(int bound) { - * if (bound <= 0) - * throw new IllegalArgumentException("bound must be positive"); - * - * if ((bound & -bound) == bound) // i.e., bound is a power of 2 - * return (int)((bound * (long)next(31)) >> 31); - * - * int bits, val; - * do { - * bits = next(31); - * val = bits % bound; - * } while (bits - val + (bound-1) < 0); - * return val; - * }}</pre> - * - * <p>The hedge "approx - * imately" is used in the foregoing description only because the next - * method is only approximately an unbiased source of independently chosen - * bits. If it were a perfect source of randomly chosen bits, then the - * algorithm shown would choose {@code int} values from the stated range - * with perfect uniformity. - * <p> - * The algorithm is slightly tricky. It rejects values that would result in - * an uneven distribution (due to the fact that 2^31 is not divisible by n). - * The probability of a value being rejected depends on n. The worst case is - * n=2^30+1, for which the probability of a reject is 1/2, and the expected - * number of iterations before the loop terminates is 2. - * <p> - * The algorithm treats the case where n is a power of two specially: it - * returns the correct number of high-order bits from the underlying - * pseudo-random number generator. In the absence of special treatment, the - * correct number of <i>low-order</i> bits would be returned. Linear - * congruential pseudo-random number generators such as the one implemented - * by this class are known to have short periods in the sequence of values - * of their low-order bits. Thus, this special case greatly increases the - * length of the sequence of values returned by successive calls to this - * method if n is a small power of two. - * - * @param bound the upper bound (exclusive). Must be positive. - * @return the next pseudorandom, uniformly distributed {@code int} value - * between zero (inclusive) and {@code bound} (exclusive) from this random - * number generator's sequence - * @throws IllegalArgumentException if bound is not positive - * @since 1.2 - */ - @Override - public int nextInt(int bound) { - //if (bound <= 0) { - //throw new RuntimeException("BadBound"); - //} + } + /** + * Returns a pseudorandom, uniformly distributed {@code int} value between 0 + * (inclusive) and the specified value (exclusive), drawn from this random + * number generator's sequence. The general contract of {@code nextInt} is + * that one {@code int} value in the specified range is pseudorandomly + * generated and returned. All {@code bound} possible {@code int} values are + * produced with (approximately) equal probability. The method + * {@code nextInt(int bound)} is implemented by class {@code Random} as if + * by: + * <pre> {@code + * public int nextInt(int bound) { + * if (bound <= 0) + * throw new IllegalArgumentException("bound must be positive"); + * + * if ((bound & -bound) == bound) // i.e., bound is a power of 2 + * return (int)((bound * (long)next(31)) >> 31); + * + * int bits, val; + * do { + * bits = next(31); + * val = bits % bound; + * } while (bits - val + (bound-1) < 0); + * return val; + * }}</pre> + * + * <p>The hedge "approx + * imately" is used in the foregoing description only because the next + * method is only approximately an unbiased source of independently chosen + * bits. If it were a perfect source of randomly chosen bits, then the + * algorithm shown would choose {@code int} values from the stated range + * with perfect uniformity. + * <p> + * The algorithm is slightly tricky. It rejects values that would result in + * an uneven distribution (due to the fact that 2^31 is not divisible by n). + * The probability of a value being rejected depends on n. The worst case is + * n=2^30+1, for which the probability of a reject is 1/2, and the expected + * number of iterations before the loop terminates is 2. + * <p> + * The algorithm treats the case where n is a power of two specially: it + * returns the correct number of high-order bits from the underlying + * pseudo-random number generator. In the absence of special treatment, the + * correct number of <i>low-order</i> bits would be returned. Linear + * congruential pseudo-random number generators such as the one implemented + * by this class are known to have short periods in the sequence of values + * of their low-order bits. Thus, this special case greatly increases the + * length of the sequence of values returned by successive calls to this + * method if n is a small power of two. + * + * @param bound the upper bound (exclusive). Must be positive. + * @return the next pseudorandom, uniformly distributed {@code int} value + * between zero (inclusive) and {@code bound} (exclusive) from this random + * number generator's sequence + * @throws IllegalArgumentException if bound is not positive + * @since 1.2 + */ + @Override + public int nextInt(final int bound) { + //if (bound <= 0) { + //throw new RuntimeException("BadBound"); + //} - /*int r = next(31); + /*int r = next(31); int m = bound - 1; if ((bound & m) == 0) // i.e., bound is a power of 2 { @@ -229,37 +229,38 @@ public class XSTR extends Random { ; } return r;*/ - //speedup, new nextInt ~+40% - last = seed ^ (seed << 21); - last ^= (last >>> 35); - last ^= (last << 4); - seed = last; - int out = (int) last % bound; - return (out < 0) ? -out : out; - } - @Override + //speedup, new nextInt ~+40% + this.last = this.seed ^ (this.seed << 21); + this.last ^= (this.last >>> 35); + this.last ^= (this.last << 4); + this.seed = this.last; + final int out = (int) this.last % bound; + return (out < 0) ? -out : out; + } + @Override public int nextInt() { - return next(32); - } + return this.next(32); + } - @Override + @Override public float nextFloat() { - return next(24) * FLOAT_UNIT; - } + return this.next(24) * FLOAT_UNIT; + } - @Override + @Override public long nextLong() { - // it's okay that the bottom word remains signed. - return ((long)(next(32)) << 32) + next(32); - } + // it's okay that the bottom word remains signed. + return ((long)(this.next(32)) << 32) + this.next(32); + } - @Override - public void nextBytes(byte[] bytes_arr) { - for (int iba = 0, lenba = bytes_arr.length; iba < lenba; ) { - for (int rndba = nextInt(), - nba = Math.min(lenba - iba, Integer.SIZE/Byte.SIZE); - nba-- > 0; rndba >>= Byte.SIZE) - bytes_arr[iba++] = (byte)rndba; + @Override + public void nextBytes(final byte[] bytes_arr) { + for (int iba = 0, lenba = bytes_arr.length; iba < lenba; ) { + for (int rndba = this.nextInt(), + nba = Math.min(lenba - iba, Integer.SIZE/Byte.SIZE); + nba-- > 0; rndba >>= Byte.SIZE) { + bytes_arr[iba++] = (byte)rndba; + } } - } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/recipe/ProcessingSkookumChoocherToolRecipes.java b/src/Java/gtPlusPlus/xmod/gregtech/api/recipe/ProcessingSkookumChoocherToolRecipes.java index 6fa3ca3f7d..d5f846fc53 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/recipe/ProcessingSkookumChoocherToolRecipes.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/recipe/ProcessingSkookumChoocherToolRecipes.java @@ -7,12 +7,12 @@ import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import net.minecraft.item.ItemStack; public class ProcessingSkookumChoocherToolRecipes implements IOreRecipeRegistrator { - public ProcessingSkookumChoocherToolRecipes() { - //GregtechOrePrefixes.toolSkookumChoocher.add(this); - } + public ProcessingSkookumChoocherToolRecipes() { + //GregtechOrePrefixes.toolSkookumChoocher.add(this); + } - @Override - public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { - GT_ModHandler.addShapelessCraftingRecipe(MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(7734, 1, aMaterial, aMaterial, null), new Object[]{aOreDictName, OrePrefixes.stick.get(aMaterial), OrePrefixes.screw.get(aMaterial), ToolDictNames.craftingToolScrewdriver}); - } + @Override + public void registerOre(final OrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, final String aModName, final ItemStack aStack) { + GT_ModHandler.addShapelessCraftingRecipe(MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(7734, 1, aMaterial, aMaterial, null), new Object[]{aOreDictName, OrePrefixes.stick.get(aMaterial), OrePrefixes.screw.get(aMaterial), ToolDictNames.craftingToolScrewdriver}); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechOreDictUnificator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechOreDictUnificator.java index cac28917ef..18d5c06f72 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechOreDictUnificator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechOreDictUnificator.java @@ -1,6 +1,11 @@ package gtPlusPlus.xmod.gregtech.api.util; import static gregtech.api.enums.GT_Values.*; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map.Entry; + import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.objects.GT_HashSet; @@ -11,10 +16,6 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.objects.GregtechItemData; import gtPlusPlus.xmod.gregtech.api.objects.GregtechMaterialStack; - -import java.util.*; -import java.util.Map.Entry; - import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -29,331 +30,438 @@ import net.minecraftforge.oredict.OreDictionary; * P.S. It is intended to be named "Unificator" and not "Unifier", because that sounds more awesome. */ public class GregtechOreDictUnificator { - private static final HashMap<String, ItemStack> sName2StackMap = new HashMap<String, ItemStack>(); - private static final HashMap<GT_ItemStack, GregtechItemData> sItemStack2DataMap = new HashMap<GT_ItemStack, GregtechItemData>(); - private static final GT_HashSet<GT_ItemStack> sNoUnificationList = new GT_HashSet<GT_ItemStack>(); - public static volatile int VERSION = 508; - private static int isRegisteringOre = 0, isAddingOre = 0; - private static boolean mRunThroughTheList = true; - - static { - GregTech_API.sItemStackMappings.add(sItemStack2DataMap); - } - - /** - * The Blacklist just prevents the Item from being unificated into something else. - * Useful if you have things like the Industrial Diamond, which is better than regular Diamond, but also usable in absolutely all Diamond Recipes. - */ - public static void addToBlacklist(ItemStack aStack) { - if (GT_Utility.isStackValid(aStack) && !GT_Utility.isStackInList(aStack, sNoUnificationList)) - sNoUnificationList.add(aStack); - } - - public static boolean isBlacklisted(ItemStack aStack) { - return GT_Utility.isStackInList(aStack, sNoUnificationList); - } - - public static void add(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, ItemStack aStack) { - set(aPrefix, aMaterial, aStack, false, false); - } - - public static void set(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, ItemStack aStack) { - set(aPrefix, aMaterial, aStack, true, false); - } - - public static void set(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, ItemStack aStack, boolean aOverwrite, boolean aAlreadyRegistered) { - if (aMaterial == null || aPrefix == null || GT_Utility.isStackInvalid(aStack) || Items.feather.getDamage(aStack) == W) - return; - isAddingOre++; - aStack = GT_Utility.copyAmount(1, aStack); - if (!aAlreadyRegistered) registerOre(aPrefix.get(aMaterial), aStack); - addAssociation(aPrefix, aMaterial, aStack, isBlacklisted(aStack)); - if (aOverwrite || GT_Utility.isStackInvalid(sName2StackMap.get(aPrefix.get(aMaterial).toString()))) - sName2StackMap.put(aPrefix.get(aMaterial).toString(), aStack); - isAddingOre--; - } - - public static ItemStack getFirstOre(Object aName, long aAmount) { - if (GT_Utility.isStringInvalid(aName)) return null; - ItemStack tStack = sName2StackMap.get(aName.toString()); - if (GT_Utility.isStackValid(tStack)) return GT_Utility.copyAmount(aAmount, tStack); - return GT_Utility.copyAmount(aAmount, getOres(aName).toArray()); - } - - public static ItemStack get(Object aName, long aAmount) { - return get(aName, null, aAmount, true, true); - } - - public static ItemStack get(Object aName, ItemStack aReplacement, long aAmount) { - return get(aName, aReplacement, aAmount, true, true); - } - - public static ItemStack get(GregtechOrePrefixes aPrefix, Object aMaterial, long aAmount) { - return get(aPrefix, aMaterial, null, aAmount); - } - - public static ItemStack get(GregtechOrePrefixes aPrefix, Object aMaterial, ItemStack aReplacement, long aAmount) { - return get(aPrefix.get(aMaterial), aReplacement, aAmount, false, true); - } - - public static ItemStack get(Object aName, ItemStack aReplacement, long aAmount, boolean aMentionPossibleTypos, boolean aNoInvalidAmounts) { - if (aNoInvalidAmounts && aAmount < 1) return null; - if (!sName2StackMap.containsKey(aName.toString()) && aMentionPossibleTypos) - GT_Log.err.println("Unknown Key for Unification, Typo? " + aName); - return GT_Utility.copyAmount(aAmount, sName2StackMap.get(aName.toString()), getFirstOre(aName, aAmount), aReplacement); - } - - public static ItemStack[] setStackArray(boolean aUseBlackList, ItemStack... aStacks) { - for (int i = 0; i < aStacks.length; i++) aStacks[i] = get(aUseBlackList, GT_Utility.copy(aStacks[i])); - return aStacks; - } - - public static ItemStack[] getStackArray(boolean aUseBlackList, Object... aStacks) { - ItemStack[] rStacks = new ItemStack[aStacks.length]; - for (int i = 0; i < aStacks.length; i++) rStacks[i] = get(aUseBlackList, GT_Utility.copy(aStacks[i])); - return rStacks; - } - - public static ItemStack setStack(ItemStack aStack) { - return setStack(true, aStack); - } - - public static ItemStack setStack(boolean aUseBlackList, ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return aStack; - ItemStack tStack = get(aUseBlackList, aStack); - if (GT_Utility.areStacksEqual(aStack, tStack)) return aStack; - aStack.func_150996_a(tStack.getItem()); - Items.feather.setDamage(aStack, Items.feather.getDamage(tStack)); - return aStack; - } - - public static ItemStack get(ItemStack aStack) { - return get(true, aStack); - } - - public static ItemStack get(boolean aUseBlackList, ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return null; - GregtechItemData tPrefixMaterial = getAssociation(aStack); - ItemStack rStack = null; - if (tPrefixMaterial == null || !tPrefixMaterial.hasValidPrefixMaterialData() || (aUseBlackList && tPrefixMaterial.mBlackListed)) - return GT_Utility.copy(aStack); - if (aUseBlackList && !GregTech_API.sUnificationEntriesRegistered && isBlacklisted(aStack)) { - tPrefixMaterial.mBlackListed = true; - return GT_Utility.copy(aStack); - } - if (tPrefixMaterial.mUnificationTarget == null) - tPrefixMaterial.mUnificationTarget = sName2StackMap.get(tPrefixMaterial.toString()); - rStack = tPrefixMaterial.mUnificationTarget; - if (GT_Utility.isStackInvalid(rStack)) return GT_Utility.copy(aStack); - assert rStack != null; - rStack.setTagCompound(aStack.getTagCompound()); - return GT_Utility.copyAmount(aStack.stackSize, rStack); - } - - public static void addItemData(ItemStack aStack, GregtechItemData aData) { - if (GT_Utility.isStackValid(aStack) && getItemData(aStack) == null && aData != null) setItemData(aStack, aData); - } - - public static void setItemData(ItemStack aStack, GregtechItemData aData) { - if (GT_Utility.isStackInvalid(aStack) || aData == null) return; - GregtechItemData tData = getItemData(aStack); - if (tData == null || !tData.hasValidPrefixMaterialData()) { - if (tData != null) for (Object tObject : tData.mExtraData) - if (!aData.mExtraData.contains(tObject)) aData.mExtraData.add(tObject); - if (aStack.stackSize > 1) { - if (aData.mMaterial != null) aData.mMaterial.mAmount /= aStack.stackSize; - for (GregtechMaterialStack tMaterial : aData.mByProducts) tMaterial.mAmount /= aStack.stackSize; - aStack = GT_Utility.copyAmount(1, aStack); - } - sItemStack2DataMap.put(new GT_ItemStack(aStack), aData); - if (aData.hasValidMaterialData()) { - long tValidMaterialAmount = aData.mMaterial.mMaterial.contains(SubTag.NO_RECYCLING) ? 0 : aData.mMaterial.mAmount >= 0 ? aData.mMaterial.mAmount : M; - for (GregtechMaterialStack tMaterial : aData.mByProducts) - tValidMaterialAmount += tMaterial.mMaterial.contains(SubTag.NO_RECYCLING) ? 0 : tMaterial.mAmount >= 0 ? tMaterial.mAmount : M; - if (tValidMaterialAmount < M) GT_ModHandler.addToRecyclerBlackList(aStack); - } - if (mRunThroughTheList) { - if (GregTech_API.sLoadStarted) { - mRunThroughTheList = false; - for (Entry<GT_ItemStack, GregtechItemData> tEntry : sItemStack2DataMap.entrySet()) - if (!tEntry.getValue().hasValidPrefixData() || tEntry.getValue().mPrefix.mAllowNormalRecycling) - GregtechRecipeRegistrator.registerMaterialRecycling(tEntry.getKey().toStack(), tEntry.getValue()); - } - } else { - if (!aData.hasValidPrefixData() || aData.mPrefix.mAllowNormalRecycling) - GregtechRecipeRegistrator.registerMaterialRecycling(aStack, aData); - } - } else { - for (Object tObject : aData.mExtraData) - if (!tData.mExtraData.contains(tObject)) tData.mExtraData.add(tObject); - } - } - - public static void addAssociation(GregtechOrePrefixes aPrefix, GT_Materials aMaterial, ItemStack aStack, boolean aBlackListed) { - if (aPrefix == null || aMaterial == null || GT_Utility.isStackInvalid(aStack)) return; - if (Items.feather.getDamage(aStack) == W) for (byte i = 0; i < 16; i++) - setItemData(GT_Utility.copyAmountAndMetaData(1, i, aStack), new GregtechItemData(aPrefix, aMaterial, aBlackListed)); - setItemData(aStack, new GregtechItemData(aPrefix, aMaterial, aBlackListed)); - } - - public static GregtechItemData getItemData(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return null; - GregtechItemData rData = sItemStack2DataMap.get(new GT_ItemStack(aStack)); - if (rData == null) rData = sItemStack2DataMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W, aStack))); - return rData; - } - - public static GregtechItemData getAssociation(ItemStack aStack) { - GregtechItemData rData = getItemData(aStack); - return rData != null && rData.hasValidPrefixMaterialData() ? rData : null; - } - - public static boolean isItemStackInstanceOf(ItemStack aStack, Object aName) { - if (GT_Utility.isStringInvalid(aName) || GT_Utility.isStackInvalid(aStack)) return false; - for (ItemStack tOreStack : getOres(aName.toString())) - if (GT_Utility.areStacksEqual(tOreStack, aStack, true)) return true; - return false; - } - - public static boolean isItemStackDye(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return false; - for (Dyes tDye : Dyes.VALUES) if (isItemStackInstanceOf(aStack, tDye.toString())) return true; - return false; - } - - public static boolean registerOre(GregtechOrePrefixes aPrefix, Object aMaterial, ItemStack aStack) { - return registerOre(aPrefix.get(aMaterial), aStack); - } - - public static boolean registerOre(Object aName, ItemStack aStack) { - if (aName == null || GT_Utility.isStackInvalid(aStack)) return false; - String tName = aName.toString(); - if (GT_Utility.isStringInvalid(tName)) return false; - ArrayList<ItemStack> tList = getOres(tName); - for (int i = 0; i < tList.size(); i++) if (GT_Utility.areStacksEqual(tList.get(i), aStack, true)) return false; - isRegisteringOre++; - OreDictionary.registerOre(tName, GT_Utility.copyAmount(1, aStack)); - isRegisteringOre--; - return true; - } - - public static boolean isRegisteringOres() { - return isRegisteringOre > 0; - } - - public static boolean isAddingOres() { - return isAddingOre > 0; - } - - public static void resetUnificationEntries() { - for (GregtechItemData tPrefixMaterial : sItemStack2DataMap.values()) tPrefixMaterial.mUnificationTarget = null; - } - - public static ItemStack getGem(GregtechMaterialStack aMaterial) { - return aMaterial == null ? null : getGem(aMaterial.mMaterial, aMaterial.mAmount); - } - - public static ItemStack getGem(GT_Materials aMaterial, OrePrefixes aPrefix) { - return aMaterial == null ? null : getGem(aMaterial, aPrefix.mMaterialAmount); - } - - public static ItemStack getGem(GT_Materials aMaterial, long aMaterialAmount) { - ItemStack rStack = null; - if (((aMaterialAmount >= M) || aMaterialAmount >= M * 32)) - rStack = get(GregtechOrePrefixes.gem, aMaterial, aMaterialAmount / M); - if (rStack == null && (((aMaterialAmount * 2) % M == 0) || aMaterialAmount >= M * 16)) - rStack = get(GregtechOrePrefixes.gemFlawed, aMaterial, (aMaterialAmount * 2) / M); - if (rStack == null && (((aMaterialAmount * 4) >= M))) - rStack = get(GregtechOrePrefixes.gemChipped, aMaterial, (aMaterialAmount * 4) / M); - return rStack; - } - - public static ItemStack getDust(GregtechMaterialStack aMaterial) { - return aMaterial == null ? null : getDust(aMaterial.mMaterial, aMaterial.mAmount); - } - - public static ItemStack getDust(GT_Materials aMaterial, OrePrefixes aPrefix) { - return aMaterial == null ? null : getDust(aMaterial, aPrefix.mMaterialAmount); - } - - public static ItemStack getDust(GT_Materials aMaterial, long aMaterialAmount) { - if (aMaterialAmount <= 0) return null; - ItemStack rStack = null; - if (((aMaterialAmount % M == 0) || aMaterialAmount >= M * 16)) - rStack = get(GregtechOrePrefixes.dust, aMaterial, aMaterialAmount / M); - if (rStack == null && (((aMaterialAmount * 4) % M == 0) || aMaterialAmount >= M * 8)) - rStack = get(GregtechOrePrefixes.dustSmall, aMaterial, (aMaterialAmount * 4) / M); - if (rStack == null && (((aMaterialAmount * 9) >= M))) - rStack = get(GregtechOrePrefixes.dustTiny, aMaterial, (aMaterialAmount * 9) / M); - return rStack; - } - - public static ItemStack getIngot(GregtechMaterialStack aMaterial) { - return aMaterial == null ? null : getIngot(aMaterial.mMaterial, aMaterial.mAmount); - } - - public static ItemStack getIngot(GT_Materials aMaterial, OrePrefixes aPrefix) { - return aMaterial == null ? null : getIngot(aMaterial, aPrefix.mMaterialAmount); - } - - public static ItemStack getIngot(GT_Materials aMaterial, long aMaterialAmount) { - if (aMaterialAmount <= 0) return null; - ItemStack rStack = null; - if (((aMaterialAmount % (M * 9) == 0 && aMaterialAmount / (M * 9) > 1) || aMaterialAmount >= M * 72)) - rStack = get(GregtechOrePrefixes.block, aMaterial, aMaterialAmount / (M * 9)); - if (rStack == null && ((aMaterialAmount % M == 0) || aMaterialAmount >= M * 8)) - rStack = get(GregtechOrePrefixes.ingot, aMaterial, aMaterialAmount / M); - if (rStack == null && (((aMaterialAmount * 9) >= M))) - rStack = get(GregtechOrePrefixes.nugget, aMaterial, (aMaterialAmount * 9) / M); - return rStack; - } - - public static ItemStack getIngotOrDust(GT_Materials aMaterial, long aMaterialAmount) { - if (aMaterialAmount <= 0) return null; - ItemStack rStack = getIngot(aMaterial, aMaterialAmount); - if (rStack == null) rStack = getDust(aMaterial, aMaterialAmount); - return rStack; - } - - public static ItemStack getIngotOrDust(GregtechMaterialStack aMaterial) { - ItemStack rStack = getIngot(aMaterial); - if(aMaterial!=null&&aMaterial.mMaterial!=null)rStack = getDust(aMaterial); - if (rStack == null) rStack = getDust(aMaterial); - return rStack; - } - - public static ItemStack getDustOrIngot(GT_Materials aMaterial, long aMaterialAmount) { - if (aMaterialAmount <= 0) return null; - ItemStack rStack = getDust(aMaterial, aMaterialAmount); - if (rStack == null) rStack = getIngot(aMaterial, aMaterialAmount); - return rStack; - } - - public static ItemStack getDustOrIngot(GregtechMaterialStack aMaterial) { - ItemStack rStack = getDust(aMaterial); - if (rStack == null) rStack = getIngot(aMaterial); - return rStack; - } - - /** - * @return a Copy of the OreDictionary.getOres() List - */ - public static ArrayList<ItemStack> getOres(OrePrefixes aPrefix, Object aMaterial) { - return getOres(aPrefix.get(aMaterial)); - } - - /** - * @return a Copy of the OreDictionary.getOres() List - */ - public static ArrayList<ItemStack> getOres(Object aOreName) { - String aName = aOreName == null ? E : aOreName.toString(); - ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); - if (GT_Utility.isStringValid(aName)) rList.addAll(OreDictionary.getOres(aName)); - return rList; - } - - public static void registerRecipes(OreDictEventContainer tOre) { + private static final HashMap<String, ItemStack> sName2StackMap = new HashMap<>(); + private static final HashMap<GT_ItemStack, GregtechItemData> sItemStack2DataMap = new HashMap<>(); + private static final GT_HashSet<GT_ItemStack> sNoUnificationList = new GT_HashSet<>(); + public static volatile int VERSION = 508; + private static int isRegisteringOre = 0, isAddingOre = 0; + private static boolean mRunThroughTheList = true; + + static { + GregTech_API.sItemStackMappings.add(sItemStack2DataMap); + } + + /** + * The Blacklist just prevents the Item from being unificated into something else. + * Useful if you have things like the Industrial Diamond, which is better than regular Diamond, but also usable in absolutely all Diamond Recipes. + */ + public static void addToBlacklist(final ItemStack aStack) { + if (GT_Utility.isStackValid(aStack) && !GT_Utility.isStackInList(aStack, sNoUnificationList)) { + sNoUnificationList.add(aStack); + } + } + + public static boolean isBlacklisted(final ItemStack aStack) { + return GT_Utility.isStackInList(aStack, sNoUnificationList); + } + + public static void add(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final ItemStack aStack) { + set(aPrefix, aMaterial, aStack, false, false); + } + + public static void set(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final ItemStack aStack) { + set(aPrefix, aMaterial, aStack, true, false); + } + + public static void set(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, ItemStack aStack, final boolean aOverwrite, final boolean aAlreadyRegistered) { + if ((aMaterial == null) || (aPrefix == null) || GT_Utility.isStackInvalid(aStack) || (Items.feather.getDamage(aStack) == W)) { + return; + } + isAddingOre++; + aStack = GT_Utility.copyAmount(1, aStack); + if (!aAlreadyRegistered) { + registerOre(aPrefix.get(aMaterial), aStack); + } + addAssociation(aPrefix, aMaterial, aStack, isBlacklisted(aStack)); + if (aOverwrite || GT_Utility.isStackInvalid(sName2StackMap.get(aPrefix.get(aMaterial).toString()))) { + sName2StackMap.put(aPrefix.get(aMaterial).toString(), aStack); + } + isAddingOre--; + } + + public static ItemStack getFirstOre(final Object aName, final long aAmount) { + if (GT_Utility.isStringInvalid(aName)) { + return null; + } + final ItemStack tStack = sName2StackMap.get(aName.toString()); + if (GT_Utility.isStackValid(tStack)) { + return GT_Utility.copyAmount(aAmount, tStack); + } + return GT_Utility.copyAmount(aAmount, getOres(aName).toArray()); + } + + public static ItemStack get(final Object aName, final long aAmount) { + return get(aName, null, aAmount, true, true); + } + + public static ItemStack get(final Object aName, final ItemStack aReplacement, final long aAmount) { + return get(aName, aReplacement, aAmount, true, true); + } + + public static ItemStack get(final GregtechOrePrefixes aPrefix, final Object aMaterial, final long aAmount) { + return get(aPrefix, aMaterial, null, aAmount); + } + + public static ItemStack get(final GregtechOrePrefixes aPrefix, final Object aMaterial, final ItemStack aReplacement, final long aAmount) { + return get(aPrefix.get(aMaterial), aReplacement, aAmount, false, true); + } + + public static ItemStack get(final Object aName, final ItemStack aReplacement, final long aAmount, final boolean aMentionPossibleTypos, final boolean aNoInvalidAmounts) { + if (aNoInvalidAmounts && (aAmount < 1)) { + return null; + } + if (!sName2StackMap.containsKey(aName.toString()) && aMentionPossibleTypos) { + GT_Log.err.println("Unknown Key for Unification, Typo? " + aName); + } + return GT_Utility.copyAmount(aAmount, sName2StackMap.get(aName.toString()), getFirstOre(aName, aAmount), aReplacement); + } + + public static ItemStack[] setStackArray(final boolean aUseBlackList, final ItemStack... aStacks) { + for (int i = 0; i < aStacks.length; i++) { + aStacks[i] = get(aUseBlackList, GT_Utility.copy(aStacks[i])); + } + return aStacks; + } + + public static ItemStack[] getStackArray(final boolean aUseBlackList, final Object... aStacks) { + final ItemStack[] rStacks = new ItemStack[aStacks.length]; + for (int i = 0; i < aStacks.length; i++) { + rStacks[i] = get(aUseBlackList, GT_Utility.copy(aStacks[i])); + } + return rStacks; + } + + public static ItemStack setStack(final ItemStack aStack) { + return setStack(true, aStack); + } + + public static ItemStack setStack(final boolean aUseBlackList, final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) { + return aStack; + } + final ItemStack tStack = get(aUseBlackList, aStack); + if (GT_Utility.areStacksEqual(aStack, tStack)) { + return aStack; + } + aStack.func_150996_a(tStack.getItem()); + Items.feather.setDamage(aStack, Items.feather.getDamage(tStack)); + return aStack; + } + + public static ItemStack get(final ItemStack aStack) { + return get(true, aStack); + } + + public static ItemStack get(final boolean aUseBlackList, final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) { + return null; + } + final GregtechItemData tPrefixMaterial = getAssociation(aStack); + ItemStack rStack = null; + if ((tPrefixMaterial == null) || !tPrefixMaterial.hasValidPrefixMaterialData() || (aUseBlackList && tPrefixMaterial.mBlackListed)) { + return GT_Utility.copy(aStack); + } + if (aUseBlackList && !GregTech_API.sUnificationEntriesRegistered && isBlacklisted(aStack)) { + tPrefixMaterial.mBlackListed = true; + return GT_Utility.copy(aStack); + } + if (tPrefixMaterial.mUnificationTarget == null) { + tPrefixMaterial.mUnificationTarget = sName2StackMap.get(tPrefixMaterial.toString()); + } + rStack = tPrefixMaterial.mUnificationTarget; + if (GT_Utility.isStackInvalid(rStack)) { + return GT_Utility.copy(aStack); + } + assert rStack != null; + rStack.setTagCompound(aStack.getTagCompound()); + return GT_Utility.copyAmount(aStack.stackSize, rStack); + } + + public static void addItemData(final ItemStack aStack, final GregtechItemData aData) { + if (GT_Utility.isStackValid(aStack) && (getItemData(aStack) == null) && (aData != null)) { + setItemData(aStack, aData); + } + } + + public static void setItemData(ItemStack aStack, final GregtechItemData aData) { + if (GT_Utility.isStackInvalid(aStack) || (aData == null)) { + return; + } + final GregtechItemData tData = getItemData(aStack); + if ((tData == null) || !tData.hasValidPrefixMaterialData()) { + if (tData != null) { + for (final Object tObject : tData.mExtraData) { + if (!aData.mExtraData.contains(tObject)) { + aData.mExtraData.add(tObject); + } + } + } + if (aStack.stackSize > 1) { + if (aData.mMaterial != null) { + aData.mMaterial.mAmount /= aStack.stackSize; + } + for (final GregtechMaterialStack tMaterial : aData.mByProducts) { + tMaterial.mAmount /= aStack.stackSize; + } + aStack = GT_Utility.copyAmount(1, aStack); + } + sItemStack2DataMap.put(new GT_ItemStack(aStack), aData); + if (aData.hasValidMaterialData()) { + long tValidMaterialAmount = aData.mMaterial.mMaterial.contains(SubTag.NO_RECYCLING) ? 0 : aData.mMaterial.mAmount >= 0 ? aData.mMaterial.mAmount : M; + for (final GregtechMaterialStack tMaterial : aData.mByProducts) { + tValidMaterialAmount += tMaterial.mMaterial.contains(SubTag.NO_RECYCLING) ? 0 : tMaterial.mAmount >= 0 ? tMaterial.mAmount : M; + } + if (tValidMaterialAmount < M) { + GT_ModHandler.addToRecyclerBlackList(aStack); + } + } + if (mRunThroughTheList) { + if (GregTech_API.sLoadStarted) { + mRunThroughTheList = false; + for (final Entry<GT_ItemStack, GregtechItemData> tEntry : sItemStack2DataMap.entrySet()) { + if (!tEntry.getValue().hasValidPrefixData() || tEntry.getValue().mPrefix.mAllowNormalRecycling) { + GregtechRecipeRegistrator.registerMaterialRecycling(tEntry.getKey().toStack(), tEntry.getValue()); + } + } + } + } else { + if (!aData.hasValidPrefixData() || aData.mPrefix.mAllowNormalRecycling) { + GregtechRecipeRegistrator.registerMaterialRecycling(aStack, aData); + } + } + } else { + for (final Object tObject : aData.mExtraData) { + if (!tData.mExtraData.contains(tObject)) { + tData.mExtraData.add(tObject); + } + } + } + } + + public static void addAssociation(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final ItemStack aStack, final boolean aBlackListed) { + if ((aPrefix == null) || (aMaterial == null) || GT_Utility.isStackInvalid(aStack)) { + return; + } + if (Items.feather.getDamage(aStack) == W) { + for (byte i = 0; i < 16; i++) { + setItemData(GT_Utility.copyAmountAndMetaData(1, i, aStack), new GregtechItemData(aPrefix, aMaterial, aBlackListed)); + } + } + setItemData(aStack, new GregtechItemData(aPrefix, aMaterial, aBlackListed)); + } + + public static GregtechItemData getItemData(final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) { + return null; + } + GregtechItemData rData = sItemStack2DataMap.get(new GT_ItemStack(aStack)); + if (rData == null) { + rData = sItemStack2DataMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W, aStack))); + } + return rData; + } + + public static GregtechItemData getAssociation(final ItemStack aStack) { + final GregtechItemData rData = getItemData(aStack); + return (rData != null) && rData.hasValidPrefixMaterialData() ? rData : null; + } + + public static boolean isItemStackInstanceOf(final ItemStack aStack, final Object aName) { + if (GT_Utility.isStringInvalid(aName) || GT_Utility.isStackInvalid(aStack)) { + return false; + } + for (final ItemStack tOreStack : getOres(aName.toString())) { + if (GT_Utility.areStacksEqual(tOreStack, aStack, true)) { + return true; + } + } + return false; + } + + public static boolean isItemStackDye(final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) { + return false; + } + for (final Dyes tDye : Dyes.VALUES) { + if (isItemStackInstanceOf(aStack, tDye.toString())) { + return true; + } + } + return false; + } + + public static boolean registerOre(final GregtechOrePrefixes aPrefix, final Object aMaterial, final ItemStack aStack) { + return registerOre(aPrefix.get(aMaterial), aStack); + } + + public static boolean registerOre(final Object aName, final ItemStack aStack) { + if ((aName == null) || GT_Utility.isStackInvalid(aStack)) { + return false; + } + final String tName = aName.toString(); + if (GT_Utility.isStringInvalid(tName)) { + return false; + } + final ArrayList<ItemStack> tList = getOres(tName); + for (int i = 0; i < tList.size(); i++) { + if (GT_Utility.areStacksEqual(tList.get(i), aStack, true)) { + return false; + } + } + isRegisteringOre++; + OreDictionary.registerOre(tName, GT_Utility.copyAmount(1, aStack)); + isRegisteringOre--; + return true; + } + + public static boolean isRegisteringOres() { + return isRegisteringOre > 0; + } + + public static boolean isAddingOres() { + return isAddingOre > 0; + } + + public static void resetUnificationEntries() { + for (final GregtechItemData tPrefixMaterial : sItemStack2DataMap.values()) { + tPrefixMaterial.mUnificationTarget = null; + } + } + + public static ItemStack getGem(final GregtechMaterialStack aMaterial) { + return aMaterial == null ? null : getGem(aMaterial.mMaterial, aMaterial.mAmount); + } + + public static ItemStack getGem(final GT_Materials aMaterial, final OrePrefixes aPrefix) { + return aMaterial == null ? null : getGem(aMaterial, aPrefix.mMaterialAmount); + } + + public static ItemStack getGem(final GT_Materials aMaterial, final long aMaterialAmount) { + ItemStack rStack = null; + if (((aMaterialAmount >= M) || (aMaterialAmount >= (M * 32)))) { + rStack = get(GregtechOrePrefixes.gem, aMaterial, aMaterialAmount / M); + } + if ((rStack == null) && ((((aMaterialAmount * 2) % M) == 0) || (aMaterialAmount >= (M * 16)))) { + rStack = get(GregtechOrePrefixes.gemFlawed, aMaterial, (aMaterialAmount * 2) / M); + } + if ((rStack == null) && (((aMaterialAmount * 4) >= M))) { + rStack = get(GregtechOrePrefixes.gemChipped, aMaterial, (aMaterialAmount * 4) / M); + } + return rStack; + } + + public static ItemStack getDust(final GregtechMaterialStack aMaterial) { + return aMaterial == null ? null : getDust(aMaterial.mMaterial, aMaterial.mAmount); + } + + public static ItemStack getDust(final GT_Materials aMaterial, final OrePrefixes aPrefix) { + return aMaterial == null ? null : getDust(aMaterial, aPrefix.mMaterialAmount); + } + + public static ItemStack getDust(final GT_Materials aMaterial, final long aMaterialAmount) { + if (aMaterialAmount <= 0) { + return null; + } + ItemStack rStack = null; + if ((((aMaterialAmount % M) == 0) || (aMaterialAmount >= (M * 16)))) { + rStack = get(GregtechOrePrefixes.dust, aMaterial, aMaterialAmount / M); + } + if ((rStack == null) && ((((aMaterialAmount * 4) % M) == 0) || (aMaterialAmount >= (M * 8)))) { + rStack = get(GregtechOrePrefixes.dustSmall, aMaterial, (aMaterialAmount * 4) / M); + } + if ((rStack == null) && (((aMaterialAmount * 9) >= M))) { + rStack = get(GregtechOrePrefixes.dustTiny, aMaterial, (aMaterialAmount * 9) / M); + } + return rStack; + } + + public static ItemStack getIngot(final GregtechMaterialStack aMaterial) { + return aMaterial == null ? null : getIngot(aMaterial.mMaterial, aMaterial.mAmount); + } + + public static ItemStack getIngot(final GT_Materials aMaterial, final OrePrefixes aPrefix) { + return aMaterial == null ? null : getIngot(aMaterial, aPrefix.mMaterialAmount); + } + + public static ItemStack getIngot(final GT_Materials aMaterial, final long aMaterialAmount) { + if (aMaterialAmount <= 0) { + return null; + } + ItemStack rStack = null; + if (((((aMaterialAmount % (M * 9)) == 0) && ((aMaterialAmount / (M * 9)) > 1)) || (aMaterialAmount >= (M * 72)))) { + rStack = get(GregtechOrePrefixes.block, aMaterial, aMaterialAmount / (M * 9)); + } + if ((rStack == null) && (((aMaterialAmount % M) == 0) || (aMaterialAmount >= (M * 8)))) { + rStack = get(GregtechOrePrefixes.ingot, aMaterial, aMaterialAmount / M); + } + if ((rStack == null) && (((aMaterialAmount * 9) >= M))) { + rStack = get(GregtechOrePrefixes.nugget, aMaterial, (aMaterialAmount * 9) / M); + } + return rStack; + } + + public static ItemStack getIngotOrDust(final GT_Materials aMaterial, final long aMaterialAmount) { + if (aMaterialAmount <= 0) { + return null; + } + ItemStack rStack = getIngot(aMaterial, aMaterialAmount); + if (rStack == null) { + rStack = getDust(aMaterial, aMaterialAmount); + } + return rStack; + } + + public static ItemStack getIngotOrDust(final GregtechMaterialStack aMaterial) { + ItemStack rStack = getIngot(aMaterial); + if((aMaterial!=null)&&(aMaterial.mMaterial!=null)) { + rStack = getDust(aMaterial); + } + if (rStack == null) { + rStack = getDust(aMaterial); + } + return rStack; + } + + public static ItemStack getDustOrIngot(final GT_Materials aMaterial, final long aMaterialAmount) { + if (aMaterialAmount <= 0) { + return null; + } + ItemStack rStack = getDust(aMaterial, aMaterialAmount); + if (rStack == null) { + rStack = getIngot(aMaterial, aMaterialAmount); + } + return rStack; + } + + public static ItemStack getDustOrIngot(final GregtechMaterialStack aMaterial) { + ItemStack rStack = getDust(aMaterial); + if (rStack == null) { + rStack = getIngot(aMaterial); + } + return rStack; + } + + /** + * @return a Copy of the OreDictionary.getOres() List + */ + public static ArrayList<ItemStack> getOres(final OrePrefixes aPrefix, final Object aMaterial) { + return getOres(aPrefix.get(aMaterial)); + } + + /** + * @return a Copy of the OreDictionary.getOres() List + */ + public static ArrayList<ItemStack> getOres(final Object aOreName) { + final String aName = aOreName == null ? E : aOreName.toString(); + final ArrayList<ItemStack> rList = new ArrayList<>(); + if (GT_Utility.isStringValid(aName)) { + rList.addAll(OreDictionary.getOres(aName)); + } + return rList; + } + + public static void registerRecipes(final OreDictEventContainer tOre) { // TODO Auto-generated method stub - + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechRecipeRegistrator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechRecipeRegistrator.java index 48c8db0596..fe82fbd148 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechRecipeRegistrator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/util/GregtechRecipeRegistrator.java @@ -1,6 +1,9 @@ package gtPlusPlus.xmod.gregtech.api.util; import static gregtech.api.enums.GT_Values.*; + +import java.util.*; + import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.enums.TC_Aspects.TC_AspectStack; @@ -12,9 +15,6 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.objects.GregtechItemData; import gtPlusPlus.xmod.gregtech.api.objects.GregtechMaterialStack; - -import java.util.*; - import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -23,303 +23,345 @@ import net.minecraft.item.ItemStack; * Class for Automatic Recipe registering. */ public class GregtechRecipeRegistrator { - /** - * List of GT_Materials, which are used in the Creation of Sticks. All Rod GT_Materials are automatically added to this List. - */ - public static final List<GT_Materials> sRodMaterialList = new ArrayList<GT_Materials>(); - private static final ItemStack sMt1 = new ItemStack(Blocks.dirt, 1, 0), sMt2 = new ItemStack(Blocks.dirt, 1, 0); - private static final String s_H = "h", s_F = "f", s_I = "I", s_P = "P", s_R = "R"; - private static final ItemStack[][] - sShapes1 = new ItemStack[][]{ - {sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1, null}, - {sMt1, null, sMt1, sMt1, null, sMt1, sMt1, sMt1, sMt1}, - {null, sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1}, - {sMt1, sMt1, sMt1, sMt1, null, sMt1, null, null, null}, - {sMt1, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1}, - {sMt1, sMt1, sMt1, sMt1, null, sMt1, sMt1, null, sMt1}, - {null, null, null, sMt1, null, sMt1, sMt1, null, sMt1}, - {null, sMt1, null, null, sMt1, null, null, sMt2, null}, - {sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2, null}, - {null, sMt1, null, null, sMt2, null, null, sMt2, null}, - {sMt1, sMt1, null, sMt1, sMt2, null, null, sMt2, null}, - {null, sMt1, sMt1, null, sMt2, sMt1, null, sMt2, null}, - {sMt1, sMt1, null, null, sMt2, null, null, sMt2, null}, - {null, sMt1, sMt1, null, sMt2, null, null, sMt2, null}, - {null, sMt1, null, sMt1, null, null, null, sMt1, sMt2}, - {null, sMt1, null, null, null, sMt1, sMt2, sMt1, null}, - {null, sMt1, null, sMt1, null, sMt1, null, null, sMt2}, - {null, sMt1, null, sMt1, null, sMt1, sMt2, null, null}, - {null, sMt2, null, null, sMt1, null, null, sMt1, null}, - {null, sMt2, null, null, sMt2, null, sMt1, sMt1, sMt1}, - {null, sMt2, null, null, sMt2, null, null, sMt1, null}, - {null, sMt2, null, sMt1, sMt2, null, sMt1, sMt1, null}, - {null, sMt2, null, null, sMt2, sMt1, null, sMt1, sMt1}, - {null, sMt2, null, null, sMt2, null, sMt1, sMt1, null}, - {sMt1, null, null, null, sMt2, null, null, null, sMt2}, - {null, null, sMt1, null, sMt2, null, sMt2, null, null}, - {sMt1, null, null, null, sMt2, null, null, null, null}, - {null, null, sMt1, null, sMt2, null, null, null, null}, - {sMt1, sMt2, null, null, null, null, null, null, null}, - {sMt2, sMt1, null, null, null, null, null, null, null}, - {sMt1, null, null, sMt2, null, null, null, null, null}, - {sMt2, null, null, sMt1, null, null, null, null, null}, - {sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, null, sMt2, null}, - {sMt1, sMt1, null, sMt1, sMt1, sMt2, sMt1, sMt1, null}, - {null, sMt1, sMt1, sMt2, sMt1, sMt1, null, sMt1, sMt1}, - {null, sMt2, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1}, - {sMt1, sMt1, sMt1, sMt1, sMt2, sMt1, null, sMt2, null}, - {sMt1, sMt1, null, sMt1, sMt2, sMt2, sMt1, sMt1, null}, - {null, sMt1, sMt1, sMt2, sMt2, sMt1, null, sMt1, sMt1}, - {null, sMt2, null, sMt1, sMt2, sMt1, sMt1, sMt1, sMt1}, - {sMt1, null, null, null, sMt1, null, null, null, null}, - {null, sMt1, null, sMt1, null, null, null, null, null}, - {sMt1, sMt1, null, sMt2, null, sMt1, sMt2, null, null}, - {null, sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2} - }; - private static final String[][] sShapesA = new String[][]{ - null, - null, - null, - {"Helmet", s_P + s_P + s_P, s_P + s_H + s_P}, - {"ChestPlate", s_P + s_H + s_P, s_P + s_P + s_P, s_P + s_P + s_P}, - {"Pants", s_P + s_P + s_P, s_P + s_H + s_P, s_P + " " + s_P}, - {"Boots", s_P + " " + s_P, s_P + s_H + s_P}, - {"Sword", " " + s_P + " ", s_F + s_P + s_H, " " + s_R + " "}, - {"Pickaxe", s_P + s_I + s_I, s_F + s_R + s_H, " " + s_R + " "}, - {"Shovel", s_F + s_P + s_H, " " + s_R + " ", " " + s_R + " "}, - {"Axe", s_P + s_I + s_H, s_P + s_R + " ", s_F + s_R + " "}, - {"Axe", s_P + s_I + s_H, s_P + s_R + " ", s_F + s_R + " "}, - {"Hoe", s_P + s_I + s_H, s_F + s_R + " ", " " + s_R + " "}, - {"Hoe", s_P + s_I + s_H, s_F + s_R + " ", " " + s_R + " "}, - {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, - {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, - {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, - {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, - {"Sword", " " + s_R + " ", s_F + s_P + s_H, " " + s_P + " "}, - {"Pickaxe", " " + s_R + " ", s_F + s_R + s_H, s_P + s_I + s_I}, - {"Shovel", " " + s_R + " ", " " + s_R + " ", s_F + s_P + s_H}, - {"Axe", s_F + s_R + " ", s_P + s_R + " ", s_P + s_I + s_H}, - {"Axe", s_F + s_R + " ", s_P + s_R + " ", s_P + s_I + s_H}, - {"Hoe", " " + s_R + " ", s_F + s_R + " ", s_P + s_I + s_H}, - {"Hoe", " " + s_R + " ", s_F + s_R + " ", s_P + s_I + s_H}, - {"Spear", s_P + s_H + " ", s_F + s_R + " ", " " + " " + s_R}, - {"Spear", s_P + s_H + " ", s_F + s_R + " ", " " + " " + s_R}, - {"Knive", s_H + s_P, s_R + s_F}, - {"Knive", s_F + s_H, s_P + s_R}, - {"Knive", s_F + s_H, s_P + s_R}, - {"Knive", s_P + s_F, s_R + s_H}, - {"Knive", s_P + s_F, s_R + s_H}, - null, - null, - null, - null, - {"WarAxe", s_P + s_P + s_P, s_P + s_R + s_P, s_F + s_R + s_H}, - null, - null, - null, - {"Shears", s_H + s_P, s_P + s_F}, - {"Shears", s_H + s_P, s_P + s_F}, - {"Scythe", s_I + s_P + s_H, s_R + s_F + s_P, s_R + " " + " "}, - {"Scythe", s_H + s_P + s_I, s_P + s_F + s_R, " " + " " + s_R} - }; - public static volatile int VERSION = 508; - - public static void registerMaterialRecycling(ItemStack aStack, GT_Materials aMaterial, long aMaterialAmount, GregtechMaterialStack aByproduct) { - if (GT_Utility.isStackInvalid(aStack)) return; - if (aByproduct != null) { - aByproduct = aByproduct.clone(); - aByproduct.mAmount /= aStack.stackSize; - } - GregtechOreDictUnificator.addItemData(GT_Utility.copyAmount(1, aStack), new GregtechItemData(aMaterial, aMaterialAmount / aStack.stackSize, aByproduct)); - } - - public static void registerMaterialRecycling(ItemStack aStack, GregtechItemData aData) { - if (GT_Utility.isStackInvalid(aStack) || GT_Utility.areStacksEqual(new ItemStack(Items.blaze_rod), aStack) || aData == null || !aData.hasValidMaterialData() || aData.mMaterial.mAmount <= 0 || GT_Utility.getFluidForFilledItem(aStack, false) != null) - return; - registerReverseMacerating(GT_Utility.copyAmount(1, aStack), aData, aData.mPrefix == null); - registerReverseSmelting(GT_Utility.copyAmount(1, aStack), aData.mMaterial.mMaterial, aData.mMaterial.mAmount, true); - registerReverseFluidSmelting(GT_Utility.copyAmount(1, aStack), aData.mMaterial.mMaterial, aData.mMaterial.mAmount, aData.getByProduct(0)); - registerReverseArcSmelting(GT_Utility.copyAmount(1, aStack), aData); - } - - /** - * @param aStack the stack to be recycled. - * @param aMaterial the Material. - * @param aMaterialAmount the amount of it in Material Units. - */ - public static void registerReverseFluidSmelting(ItemStack aStack, GT_Materials aMaterial, long aMaterialAmount, GregtechMaterialStack aByproduct) { - if (aStack == null || aMaterial == null || aMaterial.mSmeltInto.mStandardMoltenFluid == null || !aMaterial.contains(SubTag.SMELTING_TO_FLUID) || (L * aMaterialAmount) / (M * aStack.stackSize) <= 0) - return; - RA.addFluidSmelterRecipe(GT_Utility.copyAmount(1, aStack), aByproduct == null ? null : aByproduct.mMaterial.contains(SubTag.NO_SMELTING) || !aByproduct.mMaterial.contains(SubTag.METAL) ? aByproduct.mMaterial.contains(SubTag.FLAMMABLE) ? GregtechOreDictUnificator.getDust(GT_Materials._NULL, aByproduct.mAmount / 2) : aByproduct.mMaterial.contains(SubTag.UNBURNABLE) ? GregtechOreDictUnificator.getDustOrIngot(aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount) : null : GregtechOreDictUnificator.getIngotOrDust(aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount), aMaterial.mSmeltInto.getMolten((L * aMaterialAmount) / (M * aStack.stackSize)), 10000, (int) Math.max(1, (24 * aMaterialAmount) / M), Math.max(8, (int) Math.sqrt(2 * aMaterial.mSmeltInto.mStandardMoltenFluid.getTemperature()))); - } - - /** - * @param aStack the stack to be recycled. - * @param aMaterial the Material. - * @param aMaterialAmount the amount of it in Material Units. - * @param aAllowAlloySmelter if it is allowed to be recycled inside the Alloy Smelter. - */ - public static void registerReverseSmelting(ItemStack aStack, GT_Materials aMaterial, long aMaterialAmount, boolean aAllowAlloySmelter) { - if (aStack == null || aMaterial == null || aMaterialAmount <= 0 || aMaterial.contains(SubTag.NO_SMELTING) || (aMaterialAmount > M && aMaterial.contains(SubTag.METAL))) - return; - aMaterialAmount /= aStack.stackSize; - - if (aAllowAlloySmelter) - CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(GT_Utility.copyAmount(1, aStack), GregtechOreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount)); - else - GT_ModHandler.addSmeltingRecipe(GT_Utility.copyAmount(1, aStack), GregtechOreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount)); - } - - public static void registerReverseArcSmelting(ItemStack aStack, GregtechItemData aData) { - if (aStack == null || aData == null) return; - aData = new GregtechItemData(aData); - - if (!aData.hasValidMaterialData()) return; - - for (GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) { - if (tMaterial.mMaterial.contains(SubTag.UNBURNABLE)) { - tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mArcSmeltInto; - continue; - } - if (tMaterial.mMaterial.contains(SubTag.EXPLOSIVE)) { - tMaterial.mAmount /= 4; - continue; - } - if (tMaterial.mMaterial.contains(SubTag.FLAMMABLE)) { - tMaterial.mAmount /= 2; - continue; - } - if (tMaterial.mMaterial.contains(SubTag.NO_SMELTING)) { - tMaterial.mAmount = 0; - continue; - } - if (tMaterial.mMaterial.contains(SubTag.METAL)) { - tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mArcSmeltInto; - continue; - } - tMaterial.mAmount = 0; - } - - aData = new GregtechItemData(aData); - - if (aData.mByProducts.length > 3) for (GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) - - aData = new GregtechItemData(aData); - - if (!aData.hasValidMaterialData()) return; - - long tAmount = 0; - for (GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) - tAmount += tMaterial.mAmount * tMaterial.mMaterial.getMass(); - - RA.addArcFurnaceRecipe(aStack, new ItemStack[]{GregtechOreDictUnificator.getIngotOrDust(aData.mMaterial), GregtechOreDictUnificator.getIngotOrDust(aData.getByProduct(0)), GregtechOreDictUnificator.getIngotOrDust(aData.getByProduct(1)), GregtechOreDictUnificator.getIngotOrDust(aData.getByProduct(2))}, null, (int) Math.max(16, tAmount / M), 96); - } - - public static void registerReverseMacerating(ItemStack aStack, GregtechItemData aData, boolean aAllowHammer) { - if (aStack == null || aData == null) return; - aData = new GregtechItemData(aData); - - if (!aData.hasValidMaterialData()) return; - - for (GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) - tMaterial.mMaterial = tMaterial.mMaterial.mMacerateInto; - - aData = new GregtechItemData(aData); - - if (!aData.hasValidMaterialData()) return; - - long tAmount = 0; - for (GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) - tAmount += tMaterial.mAmount * tMaterial.mMaterial.getMass(); - - RA.addPulveriserRecipe(aStack, new ItemStack[]{GregtechOreDictUnificator.getDust(aData.mMaterial), GregtechOreDictUnificator.getDust(aData.getByProduct(0)), GregtechOreDictUnificator.getDust(aData.getByProduct(1)), GregtechOreDictUnificator.getDust(aData.getByProduct(2))}, null, (int) Math.max(16, tAmount / M), 4); - - if (aAllowHammer) for (GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) - if (tMaterial.mMaterial.contains(SubTag.CRYSTAL) && !tMaterial.mMaterial.contains(SubTag.METAL)) { - if (RA.addForgeHammerRecipe(GT_Utility.copyAmount(1, aStack), GregtechOreDictUnificator.getDust(aData.mMaterial), 200, 32)) - break; - } - ItemStack tDust = GregtechOreDictUnificator.getDust(aData.mMaterial); - if (tDust != null && GT_ModHandler.addPulverisationRecipe(GT_Utility.copyAmount(1, aStack), tDust, GregtechOreDictUnificator.getDust(aData.getByProduct(0)), 100, GregtechOreDictUnificator.getDust(aData.getByProduct(1)), 100, true)) { - if (GregTech_API.sThaumcraftCompat != null) - GregTech_API.sThaumcraftCompat.addCrucibleRecipe(IThaumcraftCompat.ADVANCEDENTROPICPROCESSING, aStack, tDust, Arrays.asList(new TC_AspectStack(TC_Aspects.PERDITIO, Math.max(1, (aData.mMaterial.mAmount * 2) / M)))); - } - } - - /** - * You give this Function a Material and it will scan almost everything for adding recycling Recipes - * - * @param aMat a Material, for example an Ingot or a Gem. - * @param aOutput the Dust you usually get from macerating aMat - * @param aRecipeReplacing allows to replace the Recipe with a Plate variant - */ - public static synchronized void registerUsagesForGT_Materials(ItemStack aMat, String aPlate, boolean aRecipeReplacing) { - if (aMat == null) return; - aMat = GT_Utility.copy(aMat); - ItemStack tStack; - GregtechItemData aItemData = GregtechOreDictUnificator.getItemData(aMat); - if (aItemData == null || aItemData.mPrefix != GregtechOrePrefixes.ingot) aPlate = null; - if (aPlate != null && GregtechOreDictUnificator.getFirstOre(aPlate, 1) == null) aPlate = null; - - sMt1.func_150996_a(aMat.getItem()); - sMt1.stackSize = 1; - Items.feather.setDamage(sMt1, Items.feather.getDamage(aMat)); - - sMt2.func_150996_a(new ItemStack(Blocks.dirt).getItem()); - sMt2.stackSize = 1; - Items.feather.setDamage(sMt2, 0); - - for (ItemStack[] tRecipe : sShapes1) { - int tAmount1 = 0; - for (ItemStack tMat : tRecipe) { - if (tMat == sMt1) tAmount1++; - } - if (aItemData != null && aItemData.hasValidPrefixMaterialData()) - for (ItemStack tCrafted : GT_ModHandler.getRecipeOutputs(tRecipe)) { - GregtechOreDictUnificator.addItemData(tCrafted, new GregtechItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tAmount1)); - } - } - - for (GT_Materials tMaterial : sRodMaterialList) { - ItemStack tMt2 = GregtechOreDictUnificator.get(GregtechOrePrefixes.stick, tMaterial, 1); - if (tMt2 != null) { - sMt2.func_150996_a(tMt2.getItem()); - sMt2.stackSize = 1; - Items.feather.setDamage(sMt2, Items.feather.getDamage(tMt2)); - - for (int i = 0; i < sShapes1.length; i++) { - ItemStack[] tRecipe = sShapes1[i]; - - int tAmount1 = 0, tAmount2 = 0; - for (ItemStack tMat : tRecipe) { - if (tMat == sMt1) tAmount1++; - if (tMat == sMt2) tAmount2++; - } - for (ItemStack tCrafted : GT_ModHandler.getVanillyToolRecipeOutputs(tRecipe)) { - if (aItemData != null && aItemData.hasValidPrefixMaterialData()) - GregtechOreDictUnificator.addItemData(tCrafted, new GregtechItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tAmount1, new GregtechMaterialStack(tMaterial, OrePrefixes.stick.mMaterialAmount * tAmount2))); - - if (aRecipeReplacing && aPlate != null && sShapesA[i] != null && sShapesA[i].length > 1) { - assert aItemData != null; - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.recipereplacements, aItemData.mMaterial.mMaterial + "." + sShapesA[i][0], true)) { - if (null != (tStack = GT_ModHandler.removeRecipe(tRecipe))) { - switch (sShapesA[i].length) { - case 2: - GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); - break; - case 3: - GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], sShapesA[i][2], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); - break; - default: - GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], sShapesA[i][2], sShapesA[i][3], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); - break; - } - } - } - } - } - } - } - } - } + /** + * List of GT_Materials, which are used in the Creation of Sticks. All Rod GT_Materials are automatically added to this List. + */ + public static final List<GT_Materials> sRodMaterialList = new ArrayList<>(); + private static final ItemStack sMt1 = new ItemStack(Blocks.dirt, 1, 0), sMt2 = new ItemStack(Blocks.dirt, 1, 0); + private static final String s_H = "h", s_F = "f", s_I = "I", s_P = "P", s_R = "R"; + private static final ItemStack[][] + sShapes1 = new ItemStack[][]{ + {sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1, null}, + {sMt1, null, sMt1, sMt1, null, sMt1, sMt1, sMt1, sMt1}, + {null, sMt1, null, sMt1, sMt1, sMt1, sMt1, null, sMt1}, + {sMt1, sMt1, sMt1, sMt1, null, sMt1, null, null, null}, + {sMt1, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1}, + {sMt1, sMt1, sMt1, sMt1, null, sMt1, sMt1, null, sMt1}, + {null, null, null, sMt1, null, sMt1, sMt1, null, sMt1}, + {null, sMt1, null, null, sMt1, null, null, sMt2, null}, + {sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2, null}, + {null, sMt1, null, null, sMt2, null, null, sMt2, null}, + {sMt1, sMt1, null, sMt1, sMt2, null, null, sMt2, null}, + {null, sMt1, sMt1, null, sMt2, sMt1, null, sMt2, null}, + {sMt1, sMt1, null, null, sMt2, null, null, sMt2, null}, + {null, sMt1, sMt1, null, sMt2, null, null, sMt2, null}, + {null, sMt1, null, sMt1, null, null, null, sMt1, sMt2}, + {null, sMt1, null, null, null, sMt1, sMt2, sMt1, null}, + {null, sMt1, null, sMt1, null, sMt1, null, null, sMt2}, + {null, sMt1, null, sMt1, null, sMt1, sMt2, null, null}, + {null, sMt2, null, null, sMt1, null, null, sMt1, null}, + {null, sMt2, null, null, sMt2, null, sMt1, sMt1, sMt1}, + {null, sMt2, null, null, sMt2, null, null, sMt1, null}, + {null, sMt2, null, sMt1, sMt2, null, sMt1, sMt1, null}, + {null, sMt2, null, null, sMt2, sMt1, null, sMt1, sMt1}, + {null, sMt2, null, null, sMt2, null, sMt1, sMt1, null}, + {sMt1, null, null, null, sMt2, null, null, null, sMt2}, + {null, null, sMt1, null, sMt2, null, sMt2, null, null}, + {sMt1, null, null, null, sMt2, null, null, null, null}, + {null, null, sMt1, null, sMt2, null, null, null, null}, + {sMt1, sMt2, null, null, null, null, null, null, null}, + {sMt2, sMt1, null, null, null, null, null, null, null}, + {sMt1, null, null, sMt2, null, null, null, null, null}, + {sMt2, null, null, sMt1, null, null, null, null, null}, + {sMt1, sMt1, sMt1, sMt1, sMt1, sMt1, null, sMt2, null}, + {sMt1, sMt1, null, sMt1, sMt1, sMt2, sMt1, sMt1, null}, + {null, sMt1, sMt1, sMt2, sMt1, sMt1, null, sMt1, sMt1}, + {null, sMt2, null, sMt1, sMt1, sMt1, sMt1, sMt1, sMt1}, + {sMt1, sMt1, sMt1, sMt1, sMt2, sMt1, null, sMt2, null}, + {sMt1, sMt1, null, sMt1, sMt2, sMt2, sMt1, sMt1, null}, + {null, sMt1, sMt1, sMt2, sMt2, sMt1, null, sMt1, sMt1}, + {null, sMt2, null, sMt1, sMt2, sMt1, sMt1, sMt1, sMt1}, + {sMt1, null, null, null, sMt1, null, null, null, null}, + {null, sMt1, null, sMt1, null, null, null, null, null}, + {sMt1, sMt1, null, sMt2, null, sMt1, sMt2, null, null}, + {null, sMt1, sMt1, sMt1, null, sMt2, null, null, sMt2} + }; + private static final String[][] sShapesA = new String[][]{ + null, + null, + null, + {"Helmet", s_P + s_P + s_P, s_P + s_H + s_P}, + {"ChestPlate", s_P + s_H + s_P, s_P + s_P + s_P, s_P + s_P + s_P}, + {"Pants", s_P + s_P + s_P, s_P + s_H + s_P, s_P + " " + s_P}, + {"Boots", s_P + " " + s_P, s_P + s_H + s_P}, + {"Sword", " " + s_P + " ", s_F + s_P + s_H, " " + s_R + " "}, + {"Pickaxe", s_P + s_I + s_I, s_F + s_R + s_H, " " + s_R + " "}, + {"Shovel", s_F + s_P + s_H, " " + s_R + " ", " " + s_R + " "}, + {"Axe", s_P + s_I + s_H, s_P + s_R + " ", s_F + s_R + " "}, + {"Axe", s_P + s_I + s_H, s_P + s_R + " ", s_F + s_R + " "}, + {"Hoe", s_P + s_I + s_H, s_F + s_R + " ", " " + s_R + " "}, + {"Hoe", s_P + s_I + s_H, s_F + s_R + " ", " " + s_R + " "}, + {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, + {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, + {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, + {"Sickle", " " + s_P + " ", s_P + s_F + " ", s_H + s_P + s_R}, + {"Sword", " " + s_R + " ", s_F + s_P + s_H, " " + s_P + " "}, + {"Pickaxe", " " + s_R + " ", s_F + s_R + s_H, s_P + s_I + s_I}, + {"Shovel", " " + s_R + " ", " " + s_R + " ", s_F + s_P + s_H}, + {"Axe", s_F + s_R + " ", s_P + s_R + " ", s_P + s_I + s_H}, + {"Axe", s_F + s_R + " ", s_P + s_R + " ", s_P + s_I + s_H}, + {"Hoe", " " + s_R + " ", s_F + s_R + " ", s_P + s_I + s_H}, + {"Hoe", " " + s_R + " ", s_F + s_R + " ", s_P + s_I + s_H}, + {"Spear", s_P + s_H + " ", s_F + s_R + " ", " " + " " + s_R}, + {"Spear", s_P + s_H + " ", s_F + s_R + " ", " " + " " + s_R}, + {"Knive", s_H + s_P, s_R + s_F}, + {"Knive", s_F + s_H, s_P + s_R}, + {"Knive", s_F + s_H, s_P + s_R}, + {"Knive", s_P + s_F, s_R + s_H}, + {"Knive", s_P + s_F, s_R + s_H}, + null, + null, + null, + null, + {"WarAxe", s_P + s_P + s_P, s_P + s_R + s_P, s_F + s_R + s_H}, + null, + null, + null, + {"Shears", s_H + s_P, s_P + s_F}, + {"Shears", s_H + s_P, s_P + s_F}, + {"Scythe", s_I + s_P + s_H, s_R + s_F + s_P, s_R + " " + " "}, + {"Scythe", s_H + s_P + s_I, s_P + s_F + s_R, " " + " " + s_R} + }; + public static volatile int VERSION = 508; + + public static void registerMaterialRecycling(final ItemStack aStack, final GT_Materials aMaterial, final long aMaterialAmount, GregtechMaterialStack aByproduct) { + if (GT_Utility.isStackInvalid(aStack)) { + return; + } + if (aByproduct != null) { + aByproduct = aByproduct.clone(); + aByproduct.mAmount /= aStack.stackSize; + } + GregtechOreDictUnificator.addItemData(GT_Utility.copyAmount(1, aStack), new GregtechItemData(aMaterial, aMaterialAmount / aStack.stackSize, aByproduct)); + } + + public static void registerMaterialRecycling(final ItemStack aStack, final GregtechItemData aData) { + if (GT_Utility.isStackInvalid(aStack) || GT_Utility.areStacksEqual(new ItemStack(Items.blaze_rod), aStack) || (aData == null) || !aData.hasValidMaterialData() || (aData.mMaterial.mAmount <= 0) || (GT_Utility.getFluidForFilledItem(aStack, false) != null)) { + return; + } + registerReverseMacerating(GT_Utility.copyAmount(1, aStack), aData, aData.mPrefix == null); + registerReverseSmelting(GT_Utility.copyAmount(1, aStack), aData.mMaterial.mMaterial, aData.mMaterial.mAmount, true); + registerReverseFluidSmelting(GT_Utility.copyAmount(1, aStack), aData.mMaterial.mMaterial, aData.mMaterial.mAmount, aData.getByProduct(0)); + registerReverseArcSmelting(GT_Utility.copyAmount(1, aStack), aData); + } + + /** + * @param aStack the stack to be recycled. + * @param aMaterial the Material. + * @param aMaterialAmount the amount of it in Material Units. + */ + public static void registerReverseFluidSmelting(final ItemStack aStack, final GT_Materials aMaterial, final long aMaterialAmount, final GregtechMaterialStack aByproduct) { + if ((aStack == null) || (aMaterial == null) || (aMaterial.mSmeltInto.mStandardMoltenFluid == null) || !aMaterial.contains(SubTag.SMELTING_TO_FLUID) || (((L * aMaterialAmount) / (M * aStack.stackSize)) <= 0)) { + return; + } + RA.addFluidSmelterRecipe(GT_Utility.copyAmount(1, aStack), aByproduct == null ? null : aByproduct.mMaterial.contains(SubTag.NO_SMELTING) || !aByproduct.mMaterial.contains(SubTag.METAL) ? aByproduct.mMaterial.contains(SubTag.FLAMMABLE) ? GregtechOreDictUnificator.getDust(GT_Materials._NULL, aByproduct.mAmount / 2) : aByproduct.mMaterial.contains(SubTag.UNBURNABLE) ? GregtechOreDictUnificator.getDustOrIngot(aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount) : null : GregtechOreDictUnificator.getIngotOrDust(aByproduct.mMaterial.mSmeltInto, aByproduct.mAmount), aMaterial.mSmeltInto.getMolten((L * aMaterialAmount) / (M * aStack.stackSize)), 10000, (int) Math.max(1, (24 * aMaterialAmount) / M), Math.max(8, (int) Math.sqrt(2 * aMaterial.mSmeltInto.mStandardMoltenFluid.getTemperature()))); + } + + /** + * @param aStack the stack to be recycled. + * @param aMaterial the Material. + * @param aMaterialAmount the amount of it in Material Units. + * @param aAllowAlloySmelter if it is allowed to be recycled inside the Alloy Smelter. + */ + public static void registerReverseSmelting(final ItemStack aStack, final GT_Materials aMaterial, long aMaterialAmount, final boolean aAllowAlloySmelter) { + if ((aStack == null) || (aMaterial == null) || (aMaterialAmount <= 0) || aMaterial.contains(SubTag.NO_SMELTING) || ((aMaterialAmount > M) && aMaterial.contains(SubTag.METAL))) { + return; + } + aMaterialAmount /= aStack.stackSize; + + if (aAllowAlloySmelter) { + CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(GT_Utility.copyAmount(1, aStack), GregtechOreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount)); + } else { + GT_ModHandler.addSmeltingRecipe(GT_Utility.copyAmount(1, aStack), GregtechOreDictUnificator.getIngot(aMaterial.mSmeltInto, aMaterialAmount)); + } + } + + public static void registerReverseArcSmelting(final ItemStack aStack, GregtechItemData aData) { + if ((aStack == null) || (aData == null)) { + return; + } + aData = new GregtechItemData(aData); + + if (!aData.hasValidMaterialData()) { + return; + } + + for (final GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) { + if (tMaterial.mMaterial.contains(SubTag.UNBURNABLE)) { + tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mArcSmeltInto; + continue; + } + if (tMaterial.mMaterial.contains(SubTag.EXPLOSIVE)) { + tMaterial.mAmount /= 4; + continue; + } + if (tMaterial.mMaterial.contains(SubTag.FLAMMABLE)) { + tMaterial.mAmount /= 2; + continue; + } + if (tMaterial.mMaterial.contains(SubTag.NO_SMELTING)) { + tMaterial.mAmount = 0; + continue; + } + if (tMaterial.mMaterial.contains(SubTag.METAL)) { + tMaterial.mMaterial = tMaterial.mMaterial.mSmeltInto.mArcSmeltInto; + continue; + } + tMaterial.mAmount = 0; + } + + aData = new GregtechItemData(aData); + + if (aData.mByProducts.length > 3) { + for (final GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) { + aData = new GregtechItemData(aData); + } + } + + if (!aData.hasValidMaterialData()) { + return; + } + + long tAmount = 0; + for (final GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) { + tAmount += tMaterial.mAmount * tMaterial.mMaterial.getMass(); + } + + RA.addArcFurnaceRecipe(aStack, new ItemStack[]{GregtechOreDictUnificator.getIngotOrDust(aData.mMaterial), GregtechOreDictUnificator.getIngotOrDust(aData.getByProduct(0)), GregtechOreDictUnificator.getIngotOrDust(aData.getByProduct(1)), GregtechOreDictUnificator.getIngotOrDust(aData.getByProduct(2))}, null, (int) Math.max(16, tAmount / M), 96); + } + + public static void registerReverseMacerating(final ItemStack aStack, GregtechItemData aData, final boolean aAllowHammer) { + if ((aStack == null) || (aData == null)) { + return; + } + aData = new GregtechItemData(aData); + + if (!aData.hasValidMaterialData()) { + return; + } + + for (final GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) { + tMaterial.mMaterial = tMaterial.mMaterial.mMacerateInto; + } + + aData = new GregtechItemData(aData); + + if (!aData.hasValidMaterialData()) { + return; + } + + long tAmount = 0; + for (final GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) { + tAmount += tMaterial.mAmount * tMaterial.mMaterial.getMass(); + } + + RA.addPulveriserRecipe(aStack, new ItemStack[]{GregtechOreDictUnificator.getDust(aData.mMaterial), GregtechOreDictUnificator.getDust(aData.getByProduct(0)), GregtechOreDictUnificator.getDust(aData.getByProduct(1)), GregtechOreDictUnificator.getDust(aData.getByProduct(2))}, null, (int) Math.max(16, tAmount / M), 4); + + if (aAllowHammer) { + for (final GregtechMaterialStack tMaterial : aData.getAllGT_MaterialStacks()) { + if (tMaterial.mMaterial.contains(SubTag.CRYSTAL) && !tMaterial.mMaterial.contains(SubTag.METAL)) { + if (RA.addForgeHammerRecipe(GT_Utility.copyAmount(1, aStack), GregtechOreDictUnificator.getDust(aData.mMaterial), 200, 32)) { + break; + } + } + } + } + final ItemStack tDust = GregtechOreDictUnificator.getDust(aData.mMaterial); + if ((tDust != null) && GT_ModHandler.addPulverisationRecipe(GT_Utility.copyAmount(1, aStack), tDust, GregtechOreDictUnificator.getDust(aData.getByProduct(0)), 100, GregtechOreDictUnificator.getDust(aData.getByProduct(1)), 100, true)) { + if (GregTech_API.sThaumcraftCompat != null) { + GregTech_API.sThaumcraftCompat.addCrucibleRecipe(IThaumcraftCompat.ADVANCEDENTROPICPROCESSING, aStack, tDust, Arrays.asList(new TC_AspectStack(TC_Aspects.PERDITIO, Math.max(1, (aData.mMaterial.mAmount * 2) / M)))); + } + } + } + + /** + * You give this Function a Material and it will scan almost everything for adding recycling Recipes + * + * @param aMat a Material, for example an Ingot or a Gem. + * @param aOutput the Dust you usually get from macerating aMat + * @param aRecipeReplacing allows to replace the Recipe with a Plate variant + */ + public static synchronized void registerUsagesForGT_Materials(ItemStack aMat, String aPlate, final boolean aRecipeReplacing) { + if (aMat == null) { + return; + } + aMat = GT_Utility.copy(aMat); + ItemStack tStack; + final GregtechItemData aItemData = GregtechOreDictUnificator.getItemData(aMat); + if ((aItemData == null) || (aItemData.mPrefix != GregtechOrePrefixes.ingot)) { + aPlate = null; + } + if ((aPlate != null) && (GregtechOreDictUnificator.getFirstOre(aPlate, 1) == null)) { + aPlate = null; + } + + sMt1.func_150996_a(aMat.getItem()); + sMt1.stackSize = 1; + Items.feather.setDamage(sMt1, Items.feather.getDamage(aMat)); + + sMt2.func_150996_a(new ItemStack(Blocks.dirt).getItem()); + sMt2.stackSize = 1; + Items.feather.setDamage(sMt2, 0); + + for (final ItemStack[] tRecipe : sShapes1) { + int tAmount1 = 0; + for (final ItemStack tMat : tRecipe) { + if (tMat == sMt1) { + tAmount1++; + } + } + if ((aItemData != null) && aItemData.hasValidPrefixMaterialData()) { + for (final ItemStack tCrafted : GT_ModHandler.getRecipeOutputs(tRecipe)) { + GregtechOreDictUnificator.addItemData(tCrafted, new GregtechItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tAmount1)); + } + } + } + + for (final GT_Materials tMaterial : sRodMaterialList) { + final ItemStack tMt2 = GregtechOreDictUnificator.get(GregtechOrePrefixes.stick, tMaterial, 1); + if (tMt2 != null) { + sMt2.func_150996_a(tMt2.getItem()); + sMt2.stackSize = 1; + Items.feather.setDamage(sMt2, Items.feather.getDamage(tMt2)); + + for (int i = 0; i < sShapes1.length; i++) { + final ItemStack[] tRecipe = sShapes1[i]; + + int tAmount1 = 0, tAmount2 = 0; + for (final ItemStack tMat : tRecipe) { + if (tMat == sMt1) { + tAmount1++; + } + if (tMat == sMt2) { + tAmount2++; + } + } + for (final ItemStack tCrafted : GT_ModHandler.getVanillyToolRecipeOutputs(tRecipe)) { + if ((aItemData != null) && aItemData.hasValidPrefixMaterialData()) { + GregtechOreDictUnificator.addItemData(tCrafted, new GregtechItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tAmount1, new GregtechMaterialStack(tMaterial, OrePrefixes.stick.mMaterialAmount * tAmount2))); + } + + if (aRecipeReplacing && (aPlate != null) && (sShapesA[i] != null) && (sShapesA[i].length > 1)) { + assert aItemData != null; + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.recipereplacements, aItemData.mMaterial.mMaterial + "." + sShapesA[i][0], true)) { + if (null != (tStack = GT_ModHandler.removeRecipe(tRecipe))) { + switch (sShapesA[i].length) { + case 2: + GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); + break; + case 3: + GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], sShapesA[i][2], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); + break; + default: + GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], sShapesA[i][2], sShapesA[i][3], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); + break; + } + } + } + } + } + } + } + } + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index b5ffac8e07..e5c9cace94 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -1,34 +1,33 @@ package gtPlusPlus.xmod.gregtech.common; -import gregtech.api.GregTech_API; -import gtPlusPlus.core.util.Utils; - import java.util.ArrayList; import java.util.List; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraftforge.oredict.OreDictionary; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTech_API; +import gtPlusPlus.core.util.Utils; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraftforge.oredict.OreDictionary; public class Meta_GT_Proxy { - - public static List<Runnable> GT_BlockIconload = new ArrayList<Runnable>(); - public static List<Runnable> GT_ItemIconload = new ArrayList<Runnable>(); - + + public static List<Runnable> GT_BlockIconload = new ArrayList<>(); + public static List<Runnable> GT_ItemIconload = new ArrayList<>(); + @SideOnly(Side.CLIENT) - public static IIconRegister sBlockIcons, sItemIcons; + public static IIconRegister sBlockIcons, sItemIcons; - public Meta_GT_Proxy() { + public Meta_GT_Proxy() { Utils.LOG_INFO("GT_PROXY - initialized."); - for (String tOreName : OreDictionary.getOreNames()) { - + for (final String tOreName : OreDictionary.getOreNames()) { + } - } + } public static boolean areWeUsingGregtech5uExperimental(){ - int version = GregTech_API.VERSION; - if (version == 508 || version == 507){ + final int version = GregTech_API.VERSION; + if ((version == 508) || (version == 507)){ return false; } else if (version == 509){ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java index c7d6dcbbba..b0b0313316 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.blocks; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.util.GT_LanguageManager; @@ -9,37 +11,35 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.CasingTextureHandler; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class GregtechMetaCasingBlocks extends GregtechMetaCasingBlocksAbstract { public final static int GTID = 57; - - CasingTextureHandler TextureHandler = new CasingTextureHandler(); + + CasingTextureHandler TextureHandler = new CasingTextureHandler(); public GregtechMetaCasingBlocks() { super(GregtechMetaCasingItems.class, "miscutils.blockcasings", GT_Material_Casings.INSTANCE); for (byte i = 0; i < 16; i = (byte) (i + 1)) { Textures.BlockIcons.CASING_BLOCKS[GTID + i] = new GT_CopiedBlockTexture(this, 6, i); } - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Centrifuge Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Structural Coke Oven Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Heat Resistant Coke Oven Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Heat Proof Coke Oven Casing"); //60 - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Material Press Machine Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Electrolyzer Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Wire Factory Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Maceration Stack Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Matter Generation Coil"); //65 - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Matter Fabricator Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Iron Plated Bricks"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Multitank Exterior Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Hastelloy-N Reactor Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".13.name", "Zeron-100 Reactor Shielding"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".14.name", "Blast Smelter Heat Containment Coil "); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".15.name", "Blast Smelter Casing Block"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Centrifuge Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Structural Coke Oven Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Heat Resistant Coke Oven Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Heat Proof Coke Oven Casing"); //60 + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Material Press Machine Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Electrolyzer Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Wire Factory Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Maceration Stack Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Matter Generation Coil"); //65 + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Matter Fabricator Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Iron Plated Bricks"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Multitank Exterior Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Hastelloy-N Reactor Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Zeron-100 Reactor Shielding"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Blast Smelter Heat Containment Coil "); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Blast Smelter Casing Block"); GregtechItemList.Casing_Centrifuge1.set(new ItemStack(this, 1, 0)); GregtechItemList.Casing_CokeOven.set(new ItemStack(this, 1, 1)); GregtechItemList.Casing_CokeOven_Coil1.set(new ItemStack(this, 1, 2)); @@ -55,21 +55,21 @@ extends GregtechMetaCasingBlocksAbstract { GregtechItemList.Casing_Reactor_I.set(new ItemStack(this, 1, 12)); GregtechItemList.Casing_Reactor_II.set(new ItemStack(this, 1, 13)); GregtechItemList.Casing_Coil_BlastSmelter.set(new ItemStack(this, 1, 14)); - GregtechItemList.Casing_BlastSmelter.set(new ItemStack(this, 1, 15)); + GregtechItemList.Casing_BlastSmelter.set(new ItemStack(this, 1, 15)); } @Override - public IIcon getIcon(int aSide, int aMeta) { //Texture ID's. case 0 == ID[57] - return TextureHandler.getIcon(aSide, aMeta); + public IIcon getIcon(final int aSide, final int aMeta) { //Texture ID's. case 0 == ID[57] + return CasingTextureHandler.getIcon(aSide, aMeta); } - + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) { - GregtechMetaCasingBlocks i = this; - return TextureHandler.handleCasingsGT(aWorld, xCoord, yCoord, zCoord, aSide, i); + public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide) { + final GregtechMetaCasingBlocks i = this; + return CasingTextureHandler.handleCasingsGT(aWorld, xCoord, yCoord, zCoord, aSide, i); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java index 2a0717af5d..c0134e576f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java @@ -13,30 +13,30 @@ public class GregtechMetaCasingBlocks2 extends GregtechMetaCasingBlocksAbstract { public final static int GTID = 73; - - CasingTextureHandler2 TextureHandler = new CasingTextureHandler2(); + + CasingTextureHandler2 TextureHandler = new CasingTextureHandler2(); public GregtechMetaCasingBlocks2() { super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.2", GT_Material_Casings.INSTANCE); for (byte i = 0; i < 16; i = (byte) (i + 1)) { Textures.BlockIcons.CASING_BLOCKS[GTID + i] = new GT_CopiedBlockTexture(this, 6, i); } - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Structural Glass Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Hastelloy-N Sealant Block"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Hastelloy-X Structural Block"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Incoloy-DS Fluid Containment Block"); //76 - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Placeholder Casing"); //IS A PLACEHOLDER DO NOT CHANGE - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Placeholder Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Incoloy Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Placeholder Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Incoloy Casing"); //65 - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Placeholder Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Placeholder Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Placeholder Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Placeholder Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".13.name", "Placeholder Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".14.name", "Placeholder Casing "); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".15.name", "Placeholder Casing "); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Structural Glass Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Hastelloy-N Sealant Block"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Hastelloy-X Structural Block"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Incoloy-DS Fluid Containment Block"); //76 + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Placeholder Casing"); //IS A PLACEHOLDER DO NOT CHANGE + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Placeholder Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Incoloy Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Placeholder Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Incoloy Casing"); //65 + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Placeholder Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Placeholder Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Placeholder Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Placeholder Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Placeholder Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Placeholder Casing "); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Placeholder Casing "); GregtechItemList.Casing_StructuralGlass.set(new ItemStack(this, 1, 0)); GregtechItemList.Casing_Refinery_External.set(new ItemStack(this, 1, 1)); GregtechItemList.Casing_Refinery_Structural.set(new ItemStack(this, 1, 2)); @@ -52,11 +52,11 @@ extends GregtechMetaCasingBlocksAbstract { GregtechItemList.Casing_PlaceHolder12.set(new ItemStack(this, 1, 12)); GregtechItemList.Casing_PlaceHolder13.set(new ItemStack(this, 1, 13)); GregtechItemList.Casing_PlaceHolder14.set(new ItemStack(this, 1, 14)); - GregtechItemList.Casing_PlaceHolder15.set(new ItemStack(this, 1, 15)); + GregtechItemList.Casing_PlaceHolder15.set(new ItemStack(this, 1, 15)); } @Override - public IIcon getIcon(int aSide, int aMeta) { //Texture ID's. case 0 == ID[57] - return TextureHandler.getIcon(aSide, aMeta); + public IIcon getIcon(final int aSide, final int aMeta) { //Texture ID's. case 0 == ID[57] + return CasingTextureHandler2.getIcon(aSide, aMeta); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java index 5909c0386a..f13dde9325 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java @@ -1,13 +1,14 @@ package gtPlusPlus.xmod.gregtech.common.blocks; +import java.util.List; +import java.util.Random; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.util.GT_LanguageManager; import gregtech.common.blocks.GT_Block_Casings_Abstract; import gtPlusPlus.core.creative.AddToCreativeTab; - -import java.util.List; -import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -19,123 +20,121 @@ import net.minecraft.item.*; import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public abstract class GregtechMetaCasingBlocksAbstract - extends GT_Block_Casings_Abstract { - public GregtechMetaCasingBlocksAbstract(Class<? extends ItemBlock> aItemClass, String aName, Material aMaterial) { - super(aItemClass, aName, aMaterial); - setStepSound(soundTypeMetal); - setCreativeTab(AddToCreativeTab.tabMachines); - GregTech_API.registerMachineBlock(this, -1); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + 32767 + ".name", "Any Sub Block of this"); - } - - @Override - public String getHarvestTool(int aMeta) { - return "wrench"; - } - - @Override - public int getHarvestLevel(int aMeta) { - return 2; - } - - @Override - public float getBlockHardness(World aWorld, int aX, int aY, int aZ) { - return Blocks.iron_block.getBlockHardness(aWorld, aX, aY, aZ); - } - - @Override - public float getExplosionResistance(Entity aTNT) { - return Blocks.iron_block.getExplosionResistance(aTNT); - } - - @Override +extends GT_Block_Casings_Abstract { + public GregtechMetaCasingBlocksAbstract(final Class<? extends ItemBlock> aItemClass, final String aName, final Material aMaterial) { + super(aItemClass, aName, aMaterial); + this.setStepSound(soundTypeMetal); + this.setCreativeTab(AddToCreativeTab.tabMachines); + GregTech_API.registerMachineBlock(this, -1); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + "." + 32767 + ".name", "Any Sub Block of this"); + } + + @Override + public String getHarvestTool(final int aMeta) { + return "wrench"; + } + + @Override + public int getHarvestLevel(final int aMeta) { + return 2; + } + + @Override + public float getBlockHardness(final World aWorld, final int aX, final int aY, final int aZ) { + return Blocks.iron_block.getBlockHardness(aWorld, aX, aY, aZ); + } + + @Override + public float getExplosionResistance(final Entity aTNT) { + return Blocks.iron_block.getExplosionResistance(aTNT); + } + + @Override protected boolean canSilkHarvest() { - return false; - } + return false; + } - @Override - public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { - if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { - GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); - } - } + @Override + public void onBlockAdded(final World aWorld, final int aX, final int aY, final int aZ) { + if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { + GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); + } + } - @Override + @Override public String getUnlocalizedName() { - return this.mUnlocalizedName; - } + return this.mUnlocalizedName; + } - @Override + @Override public String getLocalizedName() { - return StatCollector.translateToLocal(this.mUnlocalizedName + ".name"); - } + return StatCollector.translateToLocal(this.mUnlocalizedName + ".name"); + } - @Override - public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) { - return false; - } + @Override + public boolean canBeReplacedByLeaves(final IBlockAccess aWorld, final int aX, final int aY, final int aZ) { + return false; + } - @Override - public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) { - return true; - } + @Override + public boolean isNormalCube(final IBlockAccess aWorld, final int aX, final int aY, final int aZ) { + return true; + } - @Override + @Override public boolean renderAsNormalBlock() { - return true; - } + return true; + } - @Override + @Override public boolean isOpaqueCube() { - return true; - } - - @Override - public void breakBlock(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMetaData) { - if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { - GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); - } - } - - @Override - public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) { - return false; - } - - @Override - public int damageDropped(int par1) { - return par1; - } - - @Override - public int getDamageValue(World par1World, int par2, int par3, int par4) { - return par1World.getBlockMetadata(par2, par3, par4); - } - - @Override - public int quantityDropped(Random par1Random) { - return 1; - } - - @Override - public Item getItemDropped(int par1, Random par2Random, int par3) { - return Item.getItemFromBlock(this); - } - - @Override + return true; + } + + @Override + public void breakBlock(final World aWorld, final int aX, final int aY, final int aZ, final Block aBlock, final int aMetaData) { + if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { + GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); + } + } + + @Override + public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { + return false; + } + + @Override + public int damageDropped(final int par1) { + return par1; + } + + @Override + public int getDamageValue(final World par1World, final int par2, final int par3, final int par4) { + return par1World.getBlockMetadata(par2, par3, par4); + } + + @Override + public int quantityDropped(final Random par1Random) { + return 1; + } + + @Override + public Item getItemDropped(final int par1, final Random par2Random, final int par3) { + return Item.getItemFromBlock(this); + } + + @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister aIconRegister) { - } + public void registerBlockIcons(final IIconRegister aIconRegister) { + } - @Override + @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - for (int i = 0; i < 16; i++) { - aList.add(new ItemStack(aItem, 1, i)); - } - } + public void getSubBlocks(final Item aItem, final CreativeTabs par2CreativeTabs, final List aList) { + for (int i = 0; i < 16; i++) { + aList.add(new ItemStack(aItem, 1, i)); + } + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingItems.java index 957a12bc14..de51cb164b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingItems.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingItems.java @@ -3,8 +3,8 @@ package gtPlusPlus.xmod.gregtech.common.blocks; import net.minecraft.block.Block; public class GregtechMetaCasingItems - extends GregtechMetaItemCasingsAbstract { - public GregtechMetaCasingItems(Block par1) { - super(par1); - } +extends GregtechMetaItemCasingsAbstract { + public GregtechMetaCasingItems(final Block par1) { + super(par1); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasings1.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasings1.java index 02ef1b9ca6..7fb344a4ec 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasings1.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasings1.java @@ -8,14 +8,14 @@ import net.minecraft.item.ItemStack; public class GregtechMetaItemCasings1 extends GregtechMetaItemCasingsAbstract { - public GregtechMetaItemCasings1(Block par1) { + public GregtechMetaItemCasings1(final Block par1) { super(par1); } @Override - public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList, final boolean aF3_H) { super.addInformation(aStack, aPlayer, aList, aF3_H); - switch (getDamage(aStack)) { + switch (this.getDamage(aStack)) { case 0: aList.add(this.mCasing_Centrifuge); break; @@ -30,7 +30,7 @@ extends GregtechMetaItemCasingsAbstract { break; default: aList.add(this.mCasing_CokeCoil2); - break; + break; } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasingsAbstract.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasingsAbstract.java index 6387d52c21..78906a6c36 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasingsAbstract.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaItemCasingsAbstract.java @@ -1,9 +1,8 @@ package gtPlusPlus.xmod.gregtech.common.blocks; -import gregtech.api.util.GT_LanguageManager; - import java.util.List; +import gregtech.api.util.GT_LanguageManager; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -19,27 +18,27 @@ extends ItemBlock { protected final String mNoMobsToolTip = GT_LanguageManager.addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block"); protected final String mNoTileEntityToolTip = GT_LanguageManager.addStringLocalization("gt.notileentityinthisblock", "This is NOT a TileEntity!"); - public GregtechMetaItemCasingsAbstract(Block par1) { + public GregtechMetaItemCasingsAbstract(final Block par1) { super(par1); - setMaxDamage(0); - setHasSubtypes(true); + this.setMaxDamage(0); + this.setHasSubtypes(true); //setCreativeTab(AddToCreativeTab.tabMachines); } @Override - public int getMetadata(int aMeta) { + public int getMetadata(final int aMeta) { return aMeta; } @Override - public String getUnlocalizedName(ItemStack aStack) { - return this.field_150939_a.getUnlocalizedName() + "." + getDamage(aStack); + public String getUnlocalizedName(final ItemStack aStack) { + return this.field_150939_a.getUnlocalizedName() + "." + this.getDamage(aStack); } @Override - public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { - super.addInformation(aStack, aPlayer, aList, aF3_H); - switch (getDamage(aStack)) { + public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList, final boolean aF3_H) { + super.addInformation(aStack, aPlayer, aList, aF3_H); + switch (this.getDamage(aStack)) { case 0: //aList.add(this.mCasing_Centrifuge); break; @@ -53,7 +52,7 @@ extends ItemBlock { //aList.add(this.mCasing_CokeCoil2); break; default: - break; + break; } aList.add(this.mNoMobsToolTip); aList.add(this.mNoTileEntityToolTip); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java index d50ce9a4c5..23db3bb755 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/fluid/GregtechFluidHandler.java @@ -36,14 +36,14 @@ public class GregtechFluidHandler { if (!LoadedMods.ThermalFoundation){ - Utils.LOG_INFO("Adding in our own GT versions of Thermal Foundation Fluids"); + Utils.LOG_INFO("Adding in our own GT versions of Thermal Foundation Fluids"); FluidUtils.addFluid("cryotheum", "Gelid Cryotheum", GT_Materials.Cryotheum, 4, -1200, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.Cryotheum, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000); FluidUtils.addFluid("pyrotheum", "Blazing Pyrotheum", GT_Materials.Pyrotheum, 4, 4000, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.Pyrotheum, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000); } if (LoadedMods.IndustrialCraft2){ - Utils.LOG_INFO("Adding in GT Fluids for various nuclear related content."); - + Utils.LOG_INFO("Adding in GT Fluids for various nuclear related content."); + FluidUtils.addFluid("hydrofluoricAcid", "Hydrofluoric Acid", GT_Materials.HydrofluoricAcid, 1, 120, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.HydrofluoricAcid, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000); generateIC2FluidCell("HydrofluoricAcid"); @@ -67,7 +67,7 @@ public class GregtechFluidHandler { //Check for IHL Hydrogen Chloride - if (!LoadedMods.IHL || ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenChloride", 1) == null){ + if (!LoadedMods.IHL || (ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenChloride", 1) == null)){ if (FluidUtils.getFluidStack("hydrogenchloride", 1) == null){ if (LoadedMods.IHL){ Utils.LOG_INFO("IHL Loaded but hydrogen chloride could not be found for some reason. How about we add our own."); @@ -79,7 +79,7 @@ public class GregtechFluidHandler { generateIC2FluidCell("HydrogenChloride"); } } - + FluidUtils.addFluid("sulfuricLithium", "Sulfuric Lithium Mix", GT_Materials.SulfuricLithium, 4, 280, GT_OreDictUnificator.get(OrePrefixes.cell, GT_Materials.SulfuricLithium, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000); generateIC2FluidCell("SulfuricLithium"); @@ -100,7 +100,7 @@ public class GregtechFluidHandler { } } - private static void generateIC2FluidCell(String fluidNameWithCaps){ + private static void generateIC2FluidCell(final String fluidNameWithCaps){ Utils.LOG_INFO("Adding a Cell for "+fluidNameWithCaps); if (LoadedMods.IndustrialCraft2){ Utils.createInternalNameAndFluidCell(fluidNameWithCaps); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java index 5b4571b057..5c29b020bf 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java @@ -11,17 +11,17 @@ public class CasingTextureHandler { //private static final TexturesGregtech58 gregtech58 = new TexturesGregtech58(); private static final TexturesCentrifugeMultiblock gregtechX = new TexturesCentrifugeMultiblock(); - public static IIcon getIcon(int aSide, int aMeta) { //Texture ID's. case 0 == ID[57] + public static IIcon getIcon(final int aSide, final int aMeta) { //Texture ID's. case 0 == ID[57] if ((aMeta >= 0) && (aMeta < 16)) { switch (aMeta) { - //Centrifuge - case 0: + //Centrifuge + case 0: return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon(); //Coke Oven Frame case 1: return TexturesGtBlock.Casing_Material_Tantalloy61.getIcon(); //Coke Oven Casing Tier 1 - case 2: + case 2: return Textures.BlockIcons.MACHINE_CASING_FIREBOX_BRONZE.getIcon(); //Coke Oven Casing Tier 2 case 3: @@ -46,20 +46,20 @@ public class CasingTextureHandler { return TexturesGtBlock.Casing_Machine_Dimensional_Adv.getIcon(); //Iron Blast Fuance Textures case 10: - return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon(); + return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon(); //Multitank Exterior Casing case 11: - return TexturesGtBlock.Casing_Material_Grisium.getIcon(); + return TexturesGtBlock.Casing_Material_Grisium.getIcon(); //Reactor Casing I case 12: - return TexturesGtBlock.Casing_Material_Stellite.getIcon(); + return TexturesGtBlock.Casing_Material_Stellite.getIcon(); //Reactor Casing II case 13: - return TexturesGtBlock.Casing_Material_Zeron100.getIcon(); + return TexturesGtBlock.Casing_Material_Zeron100.getIcon(); case 14: return TexturesGtBlock.Casing_Staballoy_Firebox.getIcon(); case 15: - return TexturesGtBlock.Casing_Material_ZirconiumCarbide.getIcon(); + return TexturesGtBlock.Casing_Material_ZirconiumCarbide.getIcon(); default: return Textures.BlockIcons.MACHINE_CASING_RADIOACTIVEHAZARD.getIcon(); @@ -70,7 +70,7 @@ public class CasingTextureHandler { } - public static IIcon handleCasingsGT(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide, GregtechMetaCasingBlocks thisBlock) { + public static IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) { /*if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ return gregtech59.handleCasingsGT59(aWorld, xCoord, yCoord, zCoord, aSide, thisBlock); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java index 7bf0ea4644..839786790a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java @@ -4,61 +4,61 @@ import net.minecraft.util.IIcon; public class CasingTextureHandler2 { - public static IIcon getIcon(int aSide, int aMeta) { //Texture ID's. case 0 == ID[57] + public static IIcon getIcon(final int aSide, final int aMeta) { //Texture ID's. case 0 == ID[57] if ((aMeta >= 0) && (aMeta < 16)) { switch (aMeta) { - //Centrifuge - case 0: + //Centrifuge + case 0: return TexturesGtBlock.Casing_Machine_Dimensional_Adv.getIcon(); //Coke Oven Frame case 1: return TexturesGtBlock.Casing_Material_HastelloyX.getIcon(); //Coke Oven Casing Tier 1 - case 2: + case 2: return TexturesGtBlock.Casing_Material_HastelloyN.getIcon(); //Coke Oven Casing Tier 2 - case 3: + case 3: return TexturesGtBlock.Casing_Material_Fluid_IncoloyDS.getIcon(); //Material Press Casings - case 4: + case 4: return TexturesGtBlock.Casing_Machine_Farm_Manager.getIcon(); //Electrolyzer Casings - case 5: + case 5: return TexturesGtBlock._PlaceHolder.getIcon(); //Broken Blue Fusion Casings - case 6: + case 6: return TexturesGtBlock._PlaceHolder.getIcon(); //Maceration Stack Casings - case 7: + case 7: return TexturesGtBlock._PlaceHolder.getIcon(); //Broken Pink Fusion Casings - case 8: + case 8: return TexturesGtBlock._PlaceHolder.getIcon(); //Matter Fabricator Casings - case 9: + case 9: return TexturesGtBlock._PlaceHolder.getIcon(); //Iron Blast Fuance Textures - case 10: - return TexturesGtBlock._PlaceHolder.getIcon(); + case 10: + return TexturesGtBlock._PlaceHolder.getIcon(); //Multitank Exterior Casing - case 11: - return TexturesGtBlock._PlaceHolder.getIcon(); + case 11: + return TexturesGtBlock._PlaceHolder.getIcon(); //Reactor Casing I - case 12: + case 12: return TexturesGtBlock._PlaceHolder.getIcon(); //Reactor Casing II - case 13: + case 13: + return TexturesGtBlock._PlaceHolder.getIcon(); + case 14: return TexturesGtBlock._PlaceHolder.getIcon(); - case 14: + case 15: return TexturesGtBlock._PlaceHolder.getIcon(); - case 15: - return TexturesGtBlock._PlaceHolder.getIcon(); - default: + default: return TexturesGtBlock.Overlay_UU_Matter.getIcon(); } - } + } return TexturesGtBlock._PlaceHolder.getIcon(); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java index c23824913e..ab55f89c9e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java @@ -11,7 +11,7 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; public class TexturesCentrifugeMultiblock { - + private static CustomIcon GT8_1_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE1"); private static CustomIcon GT8_1 = new CustomIcon("iconsets/LARGECENTRIFUGE1"); private static CustomIcon GT8_2_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE2"); @@ -72,126 +72,126 @@ public class TexturesCentrifugeMultiblock { frontFaceActive_6, frontFaceActive_7, frontFaceActive_8 - }; - - public IIcon handleCasingsGT(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide, GregtechMetaCasingBlocks thisBlock) { - return handleCasingsGT58(aWorld, xCoord, yCoord, zCoord, aSide, thisBlock); + }; + + public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) { + return this.handleCasingsGT58(aWorld, xCoord, yCoord, zCoord, aSide, thisBlock); } - public IIcon handleCasingsGT58(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide, GregtechMetaCasingBlocks thisBlock) { - int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); + public IIcon handleCasingsGT58(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) { + final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); if (((tMeta != 6) && (tMeta != 8) && (tMeta != 0))) { return CasingTextureHandler.getIcon(aSide, tMeta); } - int tStartIndex = tMeta == 6 ? 1 : 13; + final int tStartIndex = tMeta == 6 ? 1 : 13; if (tMeta == 0) { if ((aSide == 2) || (aSide == 3)) { TileEntity tTileEntity; IMetaTileEntity tMetaTileEntity; if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[0].getIcon(); + return this.CENTRIFUGE_ACTIVE[0].getIcon(); } - return CENTRIFUGE[0].getIcon(); + return this.CENTRIFUGE[0].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[3].getIcon(); + return this.CENTRIFUGE_ACTIVE[3].getIcon(); } - return CENTRIFUGE[3].getIcon(); + return this.CENTRIFUGE[3].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[6].getIcon(); + return this.CENTRIFUGE_ACTIVE[6].getIcon(); } - return CENTRIFUGE[6].getIcon(); + return this.CENTRIFUGE[6].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[1].getIcon(); + return this.CENTRIFUGE_ACTIVE[1].getIcon(); } - return CENTRIFUGE[1].getIcon(); + return this.CENTRIFUGE[1].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[7].getIcon(); + return this.CENTRIFUGE_ACTIVE[7].getIcon(); } - return CENTRIFUGE[7].getIcon(); + return this.CENTRIFUGE[7].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[8].getIcon(); + return this.CENTRIFUGE_ACTIVE[8].getIcon(); } - return CENTRIFUGE[8].getIcon(); + return this.CENTRIFUGE[8].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[5].getIcon(); + return this.CENTRIFUGE_ACTIVE[5].getIcon(); } - return CENTRIFUGE[5].getIcon(); + return this.CENTRIFUGE[5].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[2].getIcon(); + return this.CENTRIFUGE_ACTIVE[2].getIcon(); } - return CENTRIFUGE[2].getIcon(); + return this.CENTRIFUGE[2].getIcon(); } } else if ((aSide == 4) || (aSide == 5)) { TileEntity tTileEntity; Object tMetaTileEntity; if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[0].getIcon(); + return this.CENTRIFUGE_ACTIVE[0].getIcon(); } - return CENTRIFUGE[0].getIcon(); + return this.CENTRIFUGE[0].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[3].getIcon(); + return this.CENTRIFUGE_ACTIVE[3].getIcon(); } - return CENTRIFUGE[3].getIcon(); + return this.CENTRIFUGE[3].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[6].getIcon(); + return this.CENTRIFUGE_ACTIVE[6].getIcon(); } - return CENTRIFUGE[6].getIcon(); + return this.CENTRIFUGE[6].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[1].getIcon(); + return this.CENTRIFUGE_ACTIVE[1].getIcon(); } - return CENTRIFUGE[1].getIcon(); + return this.CENTRIFUGE[1].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[7].getIcon(); + return this.CENTRIFUGE_ACTIVE[7].getIcon(); } - return CENTRIFUGE[7].getIcon(); + return this.CENTRIFUGE[7].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[8].getIcon(); + return this.CENTRIFUGE_ACTIVE[8].getIcon(); } - return CENTRIFUGE[8].getIcon(); + return this.CENTRIFUGE[8].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[5].getIcon(); + return this.CENTRIFUGE_ACTIVE[5].getIcon(); } - return CENTRIFUGE[5].getIcon(); + return this.CENTRIFUGE[5].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return CENTRIFUGE_ACTIVE[2].getIcon(); + return this.CENTRIFUGE_ACTIVE[2].getIcon(); } - return CENTRIFUGE[2].getIcon(); + return this.CENTRIFUGE[2].getIcon(); } } return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); } - boolean[] tConnectedSides = {(aWorld.getBlock(xCoord, yCoord - 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord - 1, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord + 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord + 1, zCoord) == tMeta), (aWorld.getBlock(xCoord + 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord + 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord + 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord + 1) == tMeta), (aWorld.getBlock(xCoord - 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord - 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord - 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord - 1) == tMeta)}; + final boolean[] tConnectedSides = {(aWorld.getBlock(xCoord, yCoord - 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord - 1, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord + 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord + 1, zCoord) == tMeta), (aWorld.getBlock(xCoord + 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord + 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord + 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord + 1) == tMeta), (aWorld.getBlock(xCoord - 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord - 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord - 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord - 1) == tMeta)}; switch (aSide) { case 0: if (tConnectedSides[0]) { @@ -437,5 +437,5 @@ public class TexturesCentrifugeMultiblock { } return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); } - + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech58.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech58.java index 2fdfc0587c..03684d4775 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech58.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech58.java @@ -71,127 +71,127 @@ public class TexturesGregtech58 { frontFaceActive_6, frontFaceActive_7, frontFaceActive_8 - }; + }; - public IIcon handleCasingsGT(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide, GregtechMetaCasingBlocks thisBlock) { - return handleCasingsGT58(aWorld, xCoord, yCoord, zCoord, aSide, thisBlock); + public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) { + return this.handleCasingsGT58(aWorld, xCoord, yCoord, zCoord, aSide, thisBlock); } - public IIcon handleCasingsGT58(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide, GregtechMetaCasingBlocks thisBlock) { - int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); + public IIcon handleCasingsGT58(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) { + final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); if (((tMeta != 6) && (tMeta != 8) && (tMeta != 0))) { return CasingTextureHandler.getIcon(aSide, tMeta); } - int tStartIndex = tMeta == 6 ? 1 : 13; + final int tStartIndex = tMeta == 6 ? 1 : 13; if (tMeta == 0) { if ((aSide == 2) || (aSide == 3)) { TileEntity tTileEntity; IMetaTileEntity tMetaTileEntity; if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[0].getIcon(); + return this.TURBINE_ACTIVE[0].getIcon(); } - return TURBINE[0].getIcon(); + return this.TURBINE[0].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[3].getIcon(); + return this.TURBINE_ACTIVE[3].getIcon(); } - return TURBINE[3].getIcon(); + return this.TURBINE[3].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[6].getIcon(); + return this.TURBINE_ACTIVE[6].getIcon(); } - return TURBINE[6].getIcon(); + return this.TURBINE[6].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[1].getIcon(); + return this.TURBINE_ACTIVE[1].getIcon(); } - return TURBINE[1].getIcon(); + return this.TURBINE[1].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[7].getIcon(); + return this.TURBINE_ACTIVE[7].getIcon(); } - return TURBINE[7].getIcon(); + return this.TURBINE[7].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[8].getIcon(); + return this.TURBINE_ACTIVE[8].getIcon(); } - return TURBINE[8].getIcon(); + return this.TURBINE[8].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[5].getIcon(); + return this.TURBINE_ACTIVE[5].getIcon(); } - return TURBINE[5].getIcon(); + return this.TURBINE[5].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[2].getIcon(); + return this.TURBINE_ACTIVE[2].getIcon(); } - return TURBINE[2].getIcon(); + return this.TURBINE[2].getIcon(); } } else if ((aSide == 4) || (aSide == 5)) { TileEntity tTileEntity; Object tMetaTileEntity; if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[0].getIcon(); + return this.TURBINE_ACTIVE[0].getIcon(); } - return TURBINE[0].getIcon(); + return this.TURBINE[0].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[3].getIcon(); + return this.TURBINE_ACTIVE[3].getIcon(); } - return TURBINE[3].getIcon(); + return this.TURBINE[3].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[6].getIcon(); + return this.TURBINE_ACTIVE[6].getIcon(); } - return TURBINE[6].getIcon(); + return this.TURBINE[6].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[1].getIcon(); + return this.TURBINE_ACTIVE[1].getIcon(); } - return TURBINE[1].getIcon(); + return this.TURBINE[1].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[7].getIcon(); + return this.TURBINE_ACTIVE[7].getIcon(); } - return TURBINE[7].getIcon(); + return this.TURBINE[7].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[8].getIcon(); + return this.TURBINE_ACTIVE[8].getIcon(); } - return TURBINE[8].getIcon(); + return this.TURBINE[8].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[5].getIcon(); + return this.TURBINE_ACTIVE[5].getIcon(); } - return TURBINE[5].getIcon(); + return this.TURBINE[5].getIcon(); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[2].getIcon(); + return this.TURBINE_ACTIVE[2].getIcon(); } - return TURBINE[2].getIcon(); + return this.TURBINE[2].getIcon(); } } return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); } - boolean[] tConnectedSides = {(aWorld.getBlock(xCoord, yCoord - 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord - 1, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord + 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord + 1, zCoord) == tMeta), (aWorld.getBlock(xCoord + 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord + 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord + 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord + 1) == tMeta), (aWorld.getBlock(xCoord - 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord - 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord - 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord - 1) == tMeta)}; + final boolean[] tConnectedSides = {(aWorld.getBlock(xCoord, yCoord - 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord - 1, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord + 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord + 1, zCoord) == tMeta), (aWorld.getBlock(xCoord + 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord + 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord + 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord + 1) == tMeta), (aWorld.getBlock(xCoord - 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord - 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord - 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord - 1) == tMeta)}; switch (aSide) { case 0: if (tConnectedSides[0]) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech59.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech59.java index 84de389827..60ecef1ecd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech59.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGregtech59.java @@ -10,7 +10,7 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; public class TexturesGregtech59 { - + private static Textures.BlockIcons.CustomIcon GT8_1_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST_ACTIVE1"); private static Textures.BlockIcons.CustomIcon GT8_1 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST1"); private static Textures.BlockIcons.CustomIcon GT8_2_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST_ACTIVE2"); @@ -29,7 +29,7 @@ public class TexturesGregtech59 { private static Textures.BlockIcons.CustomIcon GT8_8 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST8"); private static Textures.BlockIcons.CustomIcon GT8_9_Active = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST_ACTIVE9"); private static Textures.BlockIcons.CustomIcon GT8_9 = new Textures.BlockIcons.CustomIcon("iconsets/LARGETURBINE_ST9"); - + private static Textures.BlockIcons.CustomIcon frontFace_0 = (GT8_1); private static Textures.BlockIcons.CustomIcon frontFaceActive_0 = (GT8_1_Active); private static Textures.BlockIcons.CustomIcon frontFace_1 = (GT8_2); @@ -48,7 +48,7 @@ public class TexturesGregtech59 { private static Textures.BlockIcons.CustomIcon frontFaceActive_7 = (GT8_8_Active); private static Textures.BlockIcons.CustomIcon frontFace_8 = (GT8_9); private static Textures.BlockIcons.CustomIcon frontFaceActive_8 = (GT8_9_Active); - + Textures.BlockIcons.CustomIcon[] TURBINE = new Textures.BlockIcons.CustomIcon[]{ frontFace_0, frontFace_1, @@ -59,384 +59,384 @@ public class TexturesGregtech59 { frontFace_6, frontFace_7, frontFace_8 - }; - + }; + Textures.BlockIcons.CustomIcon[] TURBINE_ACTIVE = new Textures.BlockIcons.CustomIcon[]{ - frontFaceActive_0, - frontFaceActive_1, - frontFaceActive_2, - frontFaceActive_3, - frontFaceActive_4, - frontFaceActive_5, - frontFaceActive_6, - frontFaceActive_7, - frontFaceActive_8 - }; - - - public IIcon handleCasingsGT(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide, GregtechMetaCasingBlocks thisBlock) { - return handleCasingsGT59(aWorld, xCoord, yCoord, zCoord, aSide, thisBlock); - } + frontFaceActive_0, + frontFaceActive_1, + frontFaceActive_2, + frontFaceActive_3, + frontFaceActive_4, + frontFaceActive_5, + frontFaceActive_6, + frontFaceActive_7, + frontFaceActive_8 + }; -public IIcon handleCasingsGT59(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide, GregtechMetaCasingBlocks thisBlock) { - int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); - if (((tMeta != 6) && (tMeta != 8) && (tMeta != 0))) { - return CasingTextureHandler.getIcon(aSide, tMeta); + public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) { + return this.handleCasingsGT59(aWorld, xCoord, yCoord, zCoord, aSide, thisBlock); } - int tStartIndex = tMeta == 6 ? 1 : 13; - if (tMeta == 0) { - if ((aSide == 2) || (aSide == 3)) { - TileEntity tTileEntity; - IMetaTileEntity tMetaTileEntity; - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[0].getIcon(); + + + public IIcon handleCasingsGT59(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) { + final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); + if (((tMeta != 6) && (tMeta != 8) && (tMeta != 0))) { + return CasingTextureHandler.getIcon(aSide, tMeta); + } + final int tStartIndex = tMeta == 6 ? 1 : 13; + if (tMeta == 0) { + if ((aSide == 2) || (aSide == 3)) { + TileEntity tTileEntity; + IMetaTileEntity tMetaTileEntity; + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[0].getIcon(); + } + return this.TURBINE[0].getIcon(); } - return TURBINE[0].getIcon(); - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[3].getIcon(); + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[3].getIcon(); + } + return this.TURBINE[3].getIcon(); } - return TURBINE[3].getIcon(); - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[6].getIcon(); + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[6].getIcon(); + } + return this.TURBINE[6].getIcon(); } - return TURBINE[6].getIcon(); - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[1].getIcon(); + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[1].getIcon(); + } + return this.TURBINE[1].getIcon(); } - return TURBINE[1].getIcon(); - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[7].getIcon(); + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[7].getIcon(); + } + return this.TURBINE[7].getIcon(); } - return TURBINE[7].getIcon(); - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[8].getIcon(); + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[8].getIcon(); + } + return this.TURBINE[8].getIcon(); } - return TURBINE[8].getIcon(); - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[5].getIcon(); + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[5].getIcon(); + } + return this.TURBINE[5].getIcon(); } - return TURBINE[5].getIcon(); - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[2].getIcon(); + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[2].getIcon(); + } + return this.TURBINE[2].getIcon(); } - return TURBINE[2].getIcon(); - } - } else if ((aSide == 4) || (aSide == 5)) { - TileEntity tTileEntity; - Object tMetaTileEntity; - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[0].getIcon(); + } else if ((aSide == 4) || (aSide == 5)) { + TileEntity tTileEntity; + Object tMetaTileEntity; + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[0].getIcon(); + } + return this.TURBINE[0].getIcon(); } - return TURBINE[0].getIcon(); - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[3].getIcon(); + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[3].getIcon(); + } + return this.TURBINE[3].getIcon(); } - return TURBINE[3].getIcon(); - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[6].getIcon(); + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[6].getIcon(); + } + return this.TURBINE[6].getIcon(); } - return TURBINE[6].getIcon(); - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[1].getIcon(); + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[1].getIcon(); + } + return this.TURBINE[1].getIcon(); } - return TURBINE[1].getIcon(); - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[7].getIcon(); + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[7].getIcon(); + } + return this.TURBINE[7].getIcon(); } - return TURBINE[7].getIcon(); - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[8].getIcon(); + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[8].getIcon(); + } + return this.TURBINE[8].getIcon(); } - return TURBINE[8].getIcon(); - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[5].getIcon(); + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[5].getIcon(); + } + return this.TURBINE[5].getIcon(); } - return TURBINE[5].getIcon(); - } - if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (((IGregTechTileEntity) tTileEntity).isActive()) { - return TURBINE_ACTIVE[2].getIcon(); + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { + if (((IGregTechTileEntity) tTileEntity).isActive()) { + return this.TURBINE_ACTIVE[2].getIcon(); + } + return this.TURBINE[2].getIcon(); } - return TURBINE[2].getIcon(); } + return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); } - return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); - } - boolean[] tConnectedSides = {(aWorld.getBlock(xCoord, yCoord - 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord - 1, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord + 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord + 1, zCoord) == tMeta), (aWorld.getBlock(xCoord + 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord + 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord + 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord + 1) == tMeta), (aWorld.getBlock(xCoord - 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord - 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord - 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord - 1) == tMeta)}; - switch (aSide) { - case 0: - if (tConnectedSides[0]) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); - } - if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); - } - if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); - } - if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); - } - if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); - } - if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); - } - if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); - } - if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); - } - if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); - } - if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); - } - if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); - } - if ((!tConnectedSides[4]) && (!tConnectedSides[2])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); - } - if ((!tConnectedSides[5]) && (!tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); - } - case 1: - if (tConnectedSides[1]) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); - } - if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); - } - if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); - } - if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); - } - if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); - } - if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); - } - if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); - } - if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); - } - if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); - } - if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); - } - if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); - } - if ((!tConnectedSides[2]) && (!tConnectedSides[4])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); - } - if ((!tConnectedSides[3]) && (!tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); - } - case 2: - if (tConnectedSides[5]) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); - } - if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); - } - if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); - } - if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); - } - if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); - } - if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); - } - if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); - } - if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); - } - if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); - } - if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); - } - if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); - } - if ((!tConnectedSides[2]) && (!tConnectedSides[4])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); - } - if ((!tConnectedSides[0]) && (!tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); - } - case 3: - if (tConnectedSides[3]) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); - } - if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); - } - if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); - } - if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); - } - if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); - } - if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); - } - if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); - } - if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); - } - if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); - } - if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); - } - if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); - } - if ((!tConnectedSides[2]) && (!tConnectedSides[4])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); - } - if ((!tConnectedSides[0]) && (!tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); - } - case 4: - if (tConnectedSides[4]) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); - } - if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); - } - if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); - } - if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); - } - if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); - } - if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); - } - if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); - } - if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); - } - if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); - } - if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); - } - if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); - } - if ((!tConnectedSides[0]) && (!tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); - } - if ((!tConnectedSides[3]) && (!tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); - } - case 5: - if (tConnectedSides[2]) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); - } - if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); - } - if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); - } - if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); - } - if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); - } - if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); - } - if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); - } - if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); - } - if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); - } - if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); - } - if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); - } - if ((!tConnectedSides[0]) && (!tConnectedSides[1])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); - } - if ((!tConnectedSides[3]) && (!tConnectedSides[5])) { - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); + final boolean[] tConnectedSides = {(aWorld.getBlock(xCoord, yCoord - 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord - 1, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord + 1, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord + 1, zCoord) == tMeta), (aWorld.getBlock(xCoord + 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord + 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord + 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord + 1) == tMeta), (aWorld.getBlock(xCoord - 1, yCoord, zCoord) == thisBlock) && (aWorld.getBlockMetadata(xCoord - 1, yCoord, zCoord) == tMeta), (aWorld.getBlock(xCoord, yCoord, zCoord - 1) == thisBlock) && (aWorld.getBlockMetadata(xCoord, yCoord, zCoord - 1) == tMeta)}; + switch (aSide) { + case 0: + if (tConnectedSides[0]) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); + } + if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); + } + if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); + } + if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); + } + if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); + } + if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); + } + if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((!tConnectedSides[4]) && (!tConnectedSides[2])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); + } + if ((!tConnectedSides[5]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); + } + case 1: + if (tConnectedSides[1]) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); + } + if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); + } + if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); + } + if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); + } + if ((tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); + } + if ((tConnectedSides[4]) && (tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); + } + if ((!tConnectedSides[4]) && (tConnectedSides[5]) && (tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); + } + if ((!tConnectedSides[4]) && (!tConnectedSides[5]) && (!tConnectedSides[2]) && (!tConnectedSides[3])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((!tConnectedSides[2]) && (!tConnectedSides[4])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); + } + if ((!tConnectedSides[3]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); + } + case 2: + if (tConnectedSides[5]) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); + } + if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); + } + if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); + } + if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); + } + if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); + } + if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); + } + if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((!tConnectedSides[2]) && (!tConnectedSides[4])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); + } + case 3: + if (tConnectedSides[3]) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); + } + if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); + } + if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); + } + if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); + } + if ((tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); + } + if ((tConnectedSides[2]) && (tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); + } + if ((!tConnectedSides[2]) && (tConnectedSides[0]) && (tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); + } + if ((!tConnectedSides[2]) && (!tConnectedSides[0]) && (!tConnectedSides[4]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((!tConnectedSides[2]) && (!tConnectedSides[4])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); + } + case 4: + if (tConnectedSides[4]) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); + } + if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); + } + if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); + } + if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); + } + if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); + } + if ((!tConnectedSides[3]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); + } + case 5: + if (tConnectedSides[2]) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 6)].getIcon(); + } + if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 5)].getIcon(); + } + if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 2)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 3)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 4)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 11)].getIcon(); + } + if ((tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 8)].getIcon(); + } + if ((tConnectedSides[0]) && (tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 9)].getIcon(); + } + if ((!tConnectedSides[0]) && (tConnectedSides[3]) && (tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 10)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[3]) && (!tConnectedSides[1]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); + } + if ((!tConnectedSides[0]) && (!tConnectedSides[1])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 0)].getIcon(); + } + if ((!tConnectedSides[3]) && (!tConnectedSides[5])) { + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 1)].getIcon(); + } + break; } - break; + return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); } - return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); -} - - + + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index e2882a6e47..880813b392 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -18,15 +18,15 @@ public class TexturesGtBlock { protected IIcon mIcon; protected String mIconName; - public CustomIcon(String aIconName) { - mIconName = aIconName; - Utils.LOG_WARNING("Constructing a Custom Texture. " + mIconName); + public CustomIcon(final String aIconName) { + this.mIconName = aIconName; + Utils.LOG_WARNING("Constructing a Custom Texture. " + this.mIconName); GregTech_API.sGTBlockIconload.add(this); } @Override public IIcon getIcon() { - return mIcon; + return this.mIcon; } @Override @@ -36,7 +36,7 @@ public class TexturesGtBlock { @Override public void run() { - mIcon = GregTech_API.sBlockIcons.registerIcon(CORE.MODID + ":" + mIconName); + this.mIcon = GregTech_API.sBlockIcons.registerIcon(CORE.MODID + ":" + this.mIconName); Utils.LOG_WARNING("FIND ME _ Processing texture: "+this.getTextureFile().getResourcePath()); } @@ -50,139 +50,139 @@ public class TexturesGtBlock { /* * Add Some Custom Textures below. * I am not sure whether or not I need to declare them as such, but better to be safe than sorry. - * Right? + * Right? */ //PlaceHolder Texture - private static final CustomIcon Internal_PlaceHolder = new CustomIcon("TileEntities/_PlaceHolder"); + private static final CustomIcon Internal_PlaceHolder = new CustomIcon("TileEntities/_PlaceHolder"); public static final CustomIcon _PlaceHolder = Internal_PlaceHolder; //Machine Casings //Simple - private static final CustomIcon Internal_Casing_Machine_Simple_Top = new CustomIcon("TileEntities/machine_top"); + private static final CustomIcon Internal_Casing_Machine_Simple_Top = new CustomIcon("TileEntities/machine_top"); public static final CustomIcon Casing_Machine_Simple_Top = Internal_Casing_Machine_Simple_Top; - private static final CustomIcon Internal_Casing_Machine_Simple_Bottom = new CustomIcon("TileEntities/machine_bottom"); + private static final CustomIcon Internal_Casing_Machine_Simple_Bottom = new CustomIcon("TileEntities/machine_bottom"); public static final CustomIcon Casing_Machine_Simple_Bottom = Internal_Casing_Machine_Simple_Bottom; //Advanced and Ultra - private static final CustomIcon Internal_Casing_Machine_Advanced = new CustomIcon("TileEntities/high_adv_machine"); + private static final CustomIcon Internal_Casing_Machine_Advanced = new CustomIcon("TileEntities/high_adv_machine"); public static final CustomIcon Casing_Machine_Advanced = Internal_Casing_Machine_Advanced; - private static final CustomIcon Internal_Casing_Machine_Ultra = new CustomIcon("TileEntities/adv_machine_lesu"); + private static final CustomIcon Internal_Casing_Machine_Ultra = new CustomIcon("TileEntities/adv_machine_lesu"); public static final CustomIcon Casing_Machine_Ultra = Internal_Casing_Machine_Ultra; //Dimensional - Non Overlay - private static final CustomIcon Internal_Casing_Machine_Dimensional = new CustomIcon("TileEntities/adv_machine_dimensional"); + private static final CustomIcon Internal_Casing_Machine_Dimensional = new CustomIcon("TileEntities/adv_machine_dimensional"); public static final CustomIcon Casing_Machine_Dimensional = Internal_Casing_Machine_Dimensional; - private static final CustomIcon Internal_Casing_Machine_Dimensional_Adv = new CustomIcon("TileEntities/high_adv_machine_dimensional"); + private static final CustomIcon Internal_Casing_Machine_Dimensional_Adv = new CustomIcon("TileEntities/high_adv_machine_dimensional"); public static final CustomIcon Casing_Machine_Dimensional_Adv = Internal_Casing_Machine_Dimensional_Adv; //Material Casings - private static final CustomIcon Internal_Casing_Tantalloy61 = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TANTALLOY61"); + private static final CustomIcon Internal_Casing_Tantalloy61 = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TANTALLOY61"); public static final CustomIcon Casing_Material_Tantalloy61 = Internal_Casing_Tantalloy61; - private static final CustomIcon Internal_Casing_MaragingSteel = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_MARAGINGSTEEL"); + private static final CustomIcon Internal_Casing_MaragingSteel = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_MARAGINGSTEEL"); public static final CustomIcon Casing_Material_MaragingSteel = Internal_Casing_MaragingSteel; - private static final CustomIcon Internal_Casing_Stellite = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_STELLITE"); + private static final CustomIcon Internal_Casing_Stellite = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_STELLITE"); public static final CustomIcon Casing_Material_Stellite = Internal_Casing_Stellite; - private static final CustomIcon Internal_Casing_Talonite = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TALONITE"); + private static final CustomIcon Internal_Casing_Talonite = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TALONITE"); public static final CustomIcon Casing_Material_Talonite = Internal_Casing_Talonite; - private static final CustomIcon Internal_Casing_Tumbaga = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TUMBAGA"); + private static final CustomIcon Internal_Casing_Tumbaga = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TUMBAGA"); public static final CustomIcon Casing_Material_Tumbaga = Internal_Casing_Tumbaga; - private static final CustomIcon Internal_Casing_Zeron100 = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_ZERON100"); + private static final CustomIcon Internal_Casing_Zeron100 = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_ZERON100"); public static final CustomIcon Casing_Material_Zeron100 = Internal_Casing_Zeron100; - private static final CustomIcon Internal_Casing_Potin = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_POTIN"); + private static final CustomIcon Internal_Casing_Potin = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_POTIN"); public static final CustomIcon Casing_Material_Potin = Internal_Casing_Potin; - private static final CustomIcon Internal_Casing_Grisium = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_GRISIUM"); + private static final CustomIcon Internal_Casing_Grisium = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_GRISIUM"); public static final CustomIcon Casing_Material_Grisium = Internal_Casing_Grisium; - private static final CustomIcon Internal_Casing_Incoloy020 = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_INCOLOY_020"); + private static final CustomIcon Internal_Casing_Incoloy020 = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_INCOLOY_020"); public static final CustomIcon Casing_Material_Incoloy020 = Internal_Casing_Incoloy020; - private static final CustomIcon Internal_Casing_IncoloyDS = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_INCOLOY_DS"); + private static final CustomIcon Internal_Casing_IncoloyDS = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_INCOLOY_DS"); public static final CustomIcon Casing_Material_IncoloyDS = Internal_Casing_IncoloyDS; - private static final CustomIcon Internal_Casing_IncoloyMA956 = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_INCOLOY_MA956"); + private static final CustomIcon Internal_Casing_IncoloyMA956 = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_INCOLOY_MA956"); public static final CustomIcon Casing_Material_IncoloyMA956 = Internal_Casing_IncoloyMA956; - private static final CustomIcon Internal_Casing_ZirconiumCarbide = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_ZIRCONIUM_CARBIDE"); + private static final CustomIcon Internal_Casing_ZirconiumCarbide = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_ZIRCONIUM_CARBIDE"); public static final CustomIcon Casing_Material_ZirconiumCarbide = Internal_Casing_ZirconiumCarbide; - private static final CustomIcon Internal_Casing_HastelloyX = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_HASTELLOY_X"); + private static final CustomIcon Internal_Casing_HastelloyX = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_HASTELLOY_X"); public static final CustomIcon Casing_Material_HastelloyX = Internal_Casing_HastelloyX; - private static final CustomIcon Internal_Casing_HastelloyN = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_HASTELLOY_N"); + private static final CustomIcon Internal_Casing_HastelloyN = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_HASTELLOY_N"); public static final CustomIcon Casing_Material_HastelloyN = Internal_Casing_HastelloyN; - private static final CustomIcon Internal_Casing_Fluid_IncoloyDS = new CustomIcon("TileEntities/MACHINE_CASING_FLUID_INCOLOY_DS"); + private static final CustomIcon Internal_Casing_Fluid_IncoloyDS = new CustomIcon("TileEntities/MACHINE_CASING_FLUID_INCOLOY_DS"); public static final CustomIcon Casing_Material_Fluid_IncoloyDS = Internal_Casing_Fluid_IncoloyDS; //Material Machine/Firebox Casings - private static final CustomIcon Internal_Casing_Staballoy_Firebox = new CustomIcon("TileEntities/MACHINE_CASING_FIREBOX_STABALLOY"); + private static final CustomIcon Internal_Casing_Staballoy_Firebox = new CustomIcon("TileEntities/MACHINE_CASING_FIREBOX_STABALLOY"); public static final CustomIcon Casing_Staballoy_Firebox = Internal_Casing_Staballoy_Firebox; - //Misc Casings - private static final CustomIcon Internal_Casing_Machine_Redstone_Off = new CustomIcon("TileEntities/cover_redstone_conductor"); + //Misc Casings + private static final CustomIcon Internal_Casing_Machine_Redstone_Off = new CustomIcon("TileEntities/cover_redstone_conductor"); public static final CustomIcon Casing_Machine_Redstone_Off = Internal_Casing_Machine_Redstone_Off; - private static final CustomIcon Internal_Casing_Machine_Redstone_On = new CustomIcon("TileEntities/cover_redstone_emitter"); + private static final CustomIcon Internal_Casing_Machine_Redstone_On = new CustomIcon("TileEntities/cover_redstone_emitter"); public static final CustomIcon Casing_Machine_Redstone_On = Internal_Casing_Machine_Redstone_On; //MACHINE_CASING_FARM_MANAGER_STRUCTURAL //Farm Manager Casings - private static final CustomIcon Internal_Casing_Machine_Farm_Manager = new CustomIcon("TileEntities/MACHINE_CASING_FARM_MANAGER_STRUCTURAL"); + private static final CustomIcon Internal_Casing_Machine_Farm_Manager = new CustomIcon("TileEntities/MACHINE_CASING_FARM_MANAGER_STRUCTURAL"); public static final CustomIcon Casing_Machine_Farm_Manager = Internal_Casing_Machine_Farm_Manager; //Acacia_Log - private static final CustomIcon Internal_Casing_Machine_Acacia_Log = new CustomIcon("TileEntities/log_acacia_top"); + private static final CustomIcon Internal_Casing_Machine_Acacia_Log = new CustomIcon("TileEntities/log_acacia_top"); public static final CustomIcon Casing_Machine_Acacia_Log = Internal_Casing_Machine_Acacia_Log; //Podzol Top - private static final CustomIcon Internal_Casing_Machine_Podzol = new CustomIcon("TileEntities/dirt_podzol_top"); + private static final CustomIcon Internal_Casing_Machine_Podzol = new CustomIcon("TileEntities/dirt_podzol_top"); public static final CustomIcon Casing_Machine_Podzol = Internal_Casing_Machine_Podzol; //Overlays //Fan Textures - private static final CustomIcon Internal_Overlay_Machine_Vent = new CustomIcon("TileEntities/machine_top_vent_rotating"); + private static final CustomIcon Internal_Overlay_Machine_Vent = new CustomIcon("TileEntities/machine_top_vent_rotating"); public static final CustomIcon Overlay_Machine_Vent = Internal_Overlay_Machine_Vent; - private static final CustomIcon Internal_Overlay_Machine_Vent_Fast = new CustomIcon("TileEntities/machine_top_vent_rotating_fast"); + private static final CustomIcon Internal_Overlay_Machine_Vent_Fast = new CustomIcon("TileEntities/machine_top_vent_rotating_fast"); public static final CustomIcon Overlay_Machine_Vent_Fast = Internal_Overlay_Machine_Vent_Fast; - private static final CustomIcon Internal_Overlay_Machine_Vent_Adv = new CustomIcon("TileEntities/adv_machine_vent_rotating"); + private static final CustomIcon Internal_Overlay_Machine_Vent_Adv = new CustomIcon("TileEntities/adv_machine_vent_rotating"); public static final CustomIcon Overlay_Machine_Vent_Adv = Internal_Overlay_Machine_Vent_Adv; //Speaker Texture - private static final CustomIcon Internal_Overlay_Machine_Sound = new CustomIcon("TileEntities/audio_out"); + private static final CustomIcon Internal_Overlay_Machine_Sound = new CustomIcon("TileEntities/audio_out"); public static final CustomIcon Overlay_Machine_Sound = Internal_Overlay_Machine_Sound; - private static final CustomIcon Internal_Overlay_Machine_Sound_Active = new CustomIcon("TileEntities/audio_out_active"); + private static final CustomIcon Internal_Overlay_Machine_Sound_Active = new CustomIcon("TileEntities/audio_out_active"); public static final CustomIcon Overlay_Machine_Sound_Active = Internal_Overlay_Machine_Sound_Active; //Diesel Engines - private static final CustomIcon Internal_Overlay_Machine_Diesel_Vertical = new CustomIcon("TileEntities/machine_top_dieselmotor"); + private static final CustomIcon Internal_Overlay_Machine_Diesel_Vertical = new CustomIcon("TileEntities/machine_top_dieselmotor"); public static final CustomIcon Overlay_Machine_Diesel_Vertical = Internal_Overlay_Machine_Diesel_Vertical; - private static final CustomIcon Internal_Overlay_Machine_Diesel_Horizontal = new CustomIcon("TileEntities/machine_top_dieselmotor2"); + private static final CustomIcon Internal_Overlay_Machine_Diesel_Horizontal = new CustomIcon("TileEntities/machine_top_dieselmotor2"); public static final CustomIcon Overlay_Machine_Diesel_Horizontal = Internal_Overlay_Machine_Diesel_Horizontal; - private static final CustomIcon Internal_Overlay_Machine_Diesel_Vertical_Active = new CustomIcon("TileEntities/machine_top_dieselmotor_active"); + private static final CustomIcon Internal_Overlay_Machine_Diesel_Vertical_Active = new CustomIcon("TileEntities/machine_top_dieselmotor_active"); public static final CustomIcon Overlay_Machine_Diesel_Vertical_Active = Internal_Overlay_Machine_Diesel_Vertical_Active; - private static final CustomIcon Internal_Overlay_Machine_Diesel_Horizontal_Active = new CustomIcon("TileEntities/machine_top_dieselmotor2_active"); + private static final CustomIcon Internal_Overlay_Machine_Diesel_Horizontal_Active = new CustomIcon("TileEntities/machine_top_dieselmotor2_active"); public static final CustomIcon Overlay_Machine_Diesel_Horizontal_Active = Internal_Overlay_Machine_Diesel_Horizontal_Active; //Computer Screens - private static final CustomIcon Internal_Casing_Machine_Screen_1 = new CustomIcon("TileEntities/adv_machine_screen_random1"); + private static final CustomIcon Internal_Casing_Machine_Screen_1 = new CustomIcon("TileEntities/adv_machine_screen_random1"); public static final CustomIcon Casing_Machine_Screen_1 = Internal_Casing_Machine_Screen_1; - private static final CustomIcon Internal_Casing_Machine_Screen_2 = new CustomIcon("TileEntities/adv_machine_screen_random2"); + private static final CustomIcon Internal_Casing_Machine_Screen_2 = new CustomIcon("TileEntities/adv_machine_screen_random2"); public static final CustomIcon Casing_Machine_Screen_2 = Internal_Casing_Machine_Screen_2; - private static final CustomIcon Internal_Casing_Machine_Screen_3 = new CustomIcon("TileEntities/adv_machine_screen_random3"); + private static final CustomIcon Internal_Casing_Machine_Screen_3 = new CustomIcon("TileEntities/adv_machine_screen_random3"); public static final CustomIcon Casing_Machine_Screen_3 = Internal_Casing_Machine_Screen_3; - private static final CustomIcon Internal_Casing_Machine_Screen_Frequency = new CustomIcon("TileEntities/adv_machine_screen_frequency"); + private static final CustomIcon Internal_Casing_Machine_Screen_Frequency = new CustomIcon("TileEntities/adv_machine_screen_frequency"); public static final CustomIcon Casing_Machine_Screen_Frequency = Internal_Casing_Machine_Screen_Frequency; - private static final CustomIcon Internal_Overlay_Machine_Screen_Logo = new CustomIcon("TileEntities/adv_machine_screen_logo"); + private static final CustomIcon Internal_Overlay_Machine_Screen_Logo = new CustomIcon("TileEntities/adv_machine_screen_logo"); public static final CustomIcon Overlay_Machine_Screen_Logo = Internal_Overlay_Machine_Screen_Logo; //Crafting Overlays - private static final CustomIcon Internal_Overlay_Crafting_Bronze = new CustomIcon("TileEntities/bronze_top_crafting"); + private static final CustomIcon Internal_Overlay_Crafting_Bronze = new CustomIcon("TileEntities/bronze_top_crafting"); public static final CustomIcon Overlay_Crafting_Bronze = Internal_Overlay_Crafting_Bronze; - private static final CustomIcon Internal_Overlay_Crafting_Steel = new CustomIcon("TileEntities/cover_crafting"); + private static final CustomIcon Internal_Overlay_Crafting_Steel = new CustomIcon("TileEntities/cover_crafting"); public static final CustomIcon Overlay_Crafting_Steel = Internal_Overlay_Crafting_Steel; //Dimensional - private static final CustomIcon Internal_Overlay_Machine_Dimensional_Blue = new CustomIcon("TileEntities/adv_machine_dimensional_cover_blue"); + private static final CustomIcon Internal_Overlay_Machine_Dimensional_Blue = new CustomIcon("TileEntities/adv_machine_dimensional_cover_blue"); public static final CustomIcon Overlay_Machine_Dimensional_Blue = Internal_Overlay_Machine_Dimensional_Blue; - private static final CustomIcon Internal_Overlay_Machine_Dimensional_Orange = new CustomIcon("TileEntities/adv_machine_dimensional_cover_orange"); + private static final CustomIcon Internal_Overlay_Machine_Dimensional_Orange = new CustomIcon("TileEntities/adv_machine_dimensional_cover_orange"); public static final CustomIcon Overlay_Machine_Dimensional_Orange = Internal_Overlay_Machine_Dimensional_Orange; //Icons - private static final CustomIcon Internal_Overlay_MatterFab = new CustomIcon("TileEntities/adv_machine_matterfab"); + private static final CustomIcon Internal_Overlay_MatterFab = new CustomIcon("TileEntities/adv_machine_matterfab"); public static final CustomIcon Overlay_MatterFab = Internal_Overlay_MatterFab; - private static final CustomIcon Internal_Overlay_MatterFab_Active = new CustomIcon("TileEntities/adv_machine_matterfab_active"); + private static final CustomIcon Internal_Overlay_MatterFab_Active = new CustomIcon("TileEntities/adv_machine_matterfab_active"); public static final CustomIcon Overlay_MatterFab_Active = Internal_Overlay_MatterFab_Active; - private static final CustomIcon Internal_Overlay_Oil = new CustomIcon("TileEntities/adv_machine_oil"); + private static final CustomIcon Internal_Overlay_Oil = new CustomIcon("TileEntities/adv_machine_oil"); public static final CustomIcon Overlay_Oil = Internal_Overlay_Oil; - private static final CustomIcon Internal_Overlay_UU_Matter = new CustomIcon("TileEntities/adv_machine_uum"); + private static final CustomIcon Internal_Overlay_UU_Matter = new CustomIcon("TileEntities/adv_machine_uum"); public static final CustomIcon Overlay_UU_Matter = Internal_Overlay_UU_Matter; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java index 1b3af3a842..31a95560da 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java @@ -11,49 +11,49 @@ import net.minecraft.util.ResourceLocation; public final class TexturesGtTools { public final static CustomIcon SKOOKUM_CHOOCHER = new CustomIcon("iconsets/SKOOKUMCHOOCHER"); - - - - - - - - - - - - + + + + + + + + + + + + public final static class CustomIcon implements IIconContainer, Runnable { - protected IIcon mIcon, mOverlay; - protected final String mIconName; - - public CustomIcon(final String aIconName) { - mIconName = aIconName; - Utils.LOG_INFO("Constructing a Custom Texture. " + mIconName); - GregTech_API.sGTItemIconload.add(this); - } - - @Override - public IIcon getIcon() { - return mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return mOverlay; - } - - @Override - public void run() { - mIcon = GregTech_API.sItemIcons.registerIcon(CORE.MODID + ":" + mIconName); - //Utils.LOG_INFO("Registering a Custom Texture. "+mIcon.g); - mOverlay = GregTech_API.sItemIcons.registerIcon(CORE.MODID + ":" + mIconName + "_OVERLAY"); - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationItemsTexture; - } - } + protected IIcon mIcon, mOverlay; + protected final String mIconName; + + public CustomIcon(final String aIconName) { + this.mIconName = aIconName; + Utils.LOG_INFO("Constructing a Custom Texture. " + this.mIconName); + GregTech_API.sGTItemIconload.add(this); + } + + @Override + public IIcon getIcon() { + return this.mIcon; + } + + @Override + public IIcon getOverlayIcon() { + return this.mOverlay; + } + + @Override + public void run() { + this.mIcon = GregTech_API.sItemIcons.registerIcon(CORE.MODID + ":" + this.mIconName); + //Utils.LOG_INFO("Registering a Custom Texture. "+mIcon.g); + this.mOverlay = GregTech_API.sItemIcons.registerIcon(CORE.MODID + ":" + this.mIconName + "_OVERLAY"); + } + + @Override + public ResourceLocation getTextureFile() { + return TextureMap.locationItemsTexture; + } + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java index ba2dc9053c..fcde96042c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java @@ -1,6 +1,8 @@ package gtPlusPlus.xmod.gregtech.common.helpers; import static gtPlusPlus.core.lib.CORE.configSwitches.enableTreeFarmerParticles; + +import cpw.mods.fml.common.eventhandler.Event.Result; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -23,7 +25,6 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.BonemealEvent; import net.minecraftforge.fluids.FluidStack; -import cpw.mods.fml.common.eventhandler.Event.Result; public class TreeFarmHelper { @@ -32,7 +33,7 @@ public class TreeFarmHelper { public static final FluidStack fertT3 = FluidUtils.getFluidStack("fluid.un32fertiliser", 1); public static ITexture[][][] getTextureSet() { - ITexture[][][] rTextures = new ITexture[10][17][]; + final ITexture[][][] rTextures = new ITexture[10][17][]; for (byte i = -1; i < 16; i++) { rTextures[0][i + 1] = TreeFarmHelper.getFront(i); rTextures[1][i + 1] = TreeFarmHelper.getBack(i); @@ -88,8 +89,8 @@ public class TreeFarmHelper { return getSides(aColor); } - public static boolean applyBonemeal(EntityPlayer player, World world, int intX, int intY, int intZ, short multiplier){ - Block block = world.getBlock(intX, intY, intZ); + public static boolean applyBonemeal(final EntityPlayer player, final World world, final int intX, final int intY, final int intZ, final short multiplier){ + final Block block = world.getBlock(intX, intY, intZ); int roll; @@ -97,15 +98,15 @@ public class TreeFarmHelper { if (multiplier==1){ roll = MathUtils.randInt(1, 15); - rollNeeded = 15; + rollNeeded = 15; } else if (multiplier==2){ roll = MathUtils.randInt(1, 10); - rollNeeded = 10; + rollNeeded = 10; } else { roll = MathUtils.randInt(1, 5); - rollNeeded = 5; + rollNeeded = 5; } if (roll != rollNeeded){ @@ -118,7 +119,7 @@ public class TreeFarmHelper { world.playAuxSFX(2005, intX, intY, intZ, 0); } } - BonemealEvent event = new BonemealEvent(player, world, block, intX, intY, intZ); + final BonemealEvent event = new BonemealEvent(player, world, block, intX, intY, intZ); if (MinecraftForge.EVENT_BUS.post(event)){ Utils.LOG_MACHINE_INFO("Not sure why this returned false"); return false; @@ -130,13 +131,13 @@ public class TreeFarmHelper { return true; } if (block instanceof IGrowable){ - IGrowable igrowable = (IGrowable)block; + final IGrowable igrowable = (IGrowable)block; if (igrowable.func_149851_a(world, intX, intY, intZ, world.isRemote)){ if (!world.isRemote){ if (igrowable.func_149852_a(world, CORE.RANDOM, intX, intY, intZ)){ igrowable.func_149853_b(world, CORE.RANDOM, intX, intY, intZ); } - } + } return true; } } @@ -146,53 +147,57 @@ public class TreeFarmHelper { public static boolean cleanUp(final IGregTechTileEntity aBaseMetaTileEntity){ Utils.LOG_MACHINE_INFO("called cleanUp()"); int cleanedUp = 0; - final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 11; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 11; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 11; - + for (int h=1;h<175;h++){ - for (int i = -11; i <= 11; i++) { - for (int j = -11; j <= 11; j++) { + for (int i = -11; i <= 11; i++) { + for (int j = -11; j <= 11; j++) { - Block testBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + final Block testBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - if + if (( - (i == -8 || i == 8) || - (i == -9 || i == 9) || - (i == -10 || i == 10) || - (i == -11 || i == 11) + ((i == -8) || (i == 8)) || + ((i == -9) || (i == 9)) || + ((i == -10) || (i == 10)) || + ((i == -11) || (i == 11)) ) - && + && ( - (j == -8 || j == 8) || - (j == -9 || j == 9) || - (j == -10 || j == 10) || - (j == -11 || j == 11) - )){ - - if (!testBlock.getUnlocalizedName().toLowerCase().contains("air") || !testBlock.getUnlocalizedName().toLowerCase().contains("pumpkin")) - Utils.LOG_INFO("5:"+testBlock.getUnlocalizedName()); - else aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord()+xDir+i, aBaseMetaTileEntity.getYCoord()+h, aBaseMetaTileEntity.getZCoord()+zDir+j, Blocks.bookshelf); + ((j == -8) || (j == 8)) || + ((j == -9) || (j == 9)) || + ((j == -10) || (j == 10)) || + ((j == -11) || (j == 11)) + )){ + + if (!testBlock.getUnlocalizedName().toLowerCase().contains("air") || !testBlock.getUnlocalizedName().toLowerCase().contains("pumpkin")) { + Utils.LOG_INFO("5:"+testBlock.getUnlocalizedName()); + } else { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord()+xDir+i, aBaseMetaTileEntity.getYCoord()+h, aBaseMetaTileEntity.getZCoord()+zDir+j, Blocks.bookshelf); + } } //If not in the middle - don't know how else to check this one without lots of != if ( - i != 7 && i != -7 && j != 7 && j != -7 && - i != 6 && i != -6 && j != 6 && j != -6 && - i != 5 && i != -5 && j != 5 && j != -5 && - i != 4 && i != -4 && j != 4 && j != -4 && - i != 3 && i != -3 && j != 3 && j != -3 && - i != 2 && i != -2 && j != 2 && j != -2 && - i != 1 && i != -1 && j != 1 && j != -1 && - i != 0 && j != 0 + (i != 7) && (i != -7) && (j != 7) && (j != -7) && + (i != 6) && (i != -6) && (j != 6) && (j != -6) && + (i != 5) && (i != -5) && (j != 5) && (j != -5) && + (i != 4) && (i != -4) && (j != 4) && (j != -4) && + (i != 3) && (i != -3) && (j != 3) && (j != -3) && + (i != 2) && (i != -2) && (j != 2) && (j != -2) && + (i != 1) && (i != -1) && (j != 1) && (j != -1) && + (i != 0) && (j != 0) ){ - - if (!testBlock.getUnlocalizedName().toLowerCase().contains("air") || !testBlock.getUnlocalizedName().toLowerCase().contains("pumpkin")) - Utils.LOG_INFO("0:"+testBlock.getUnlocalizedName()); - else aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord()+xDir+i, aBaseMetaTileEntity.getYCoord()+h, aBaseMetaTileEntity.getZCoord()+zDir+j, Blocks.melon_block); - + + if (!testBlock.getUnlocalizedName().toLowerCase().contains("air") || !testBlock.getUnlocalizedName().toLowerCase().contains("pumpkin")) { + Utils.LOG_INFO("0:"+testBlock.getUnlocalizedName()); + } else { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord()+xDir+i, aBaseMetaTileEntity.getYCoord()+h, aBaseMetaTileEntity.getZCoord()+zDir+j, Blocks.melon_block); + } + if (TreefarmManager.isLeaves(testBlock) || TreefarmManager.isWoodLog(testBlock)){ Utils.LOG_INFO("1:"+testBlock.getUnlocalizedName()); @@ -208,7 +213,7 @@ public class TreeFarmHelper { else { //Utils.LOG_INFO("2:"+testBlock.getUnlocalizedName()); } - } + } else { //Utils.LOG_INFO("1"); } @@ -219,12 +224,12 @@ public class TreeFarmHelper { } } Utils.LOG_MACHINE_INFO("cleaning up | "+cleanedUp ); - return true; + return true; } public static SAWTOOL isCorrectMachinePart(final ItemStack aStack) { if (aStack != null){ - if (aStack.getItem() instanceof GT_MetaGenerated_Item_02 || aStack.getItem() instanceof GT_MetaGenerated_Tool){ + if ((aStack.getItem() instanceof GT_MetaGenerated_Item_02) || (aStack.getItem() instanceof GT_MetaGenerated_Tool)){ if (OrePrefixes.craftingTool.contains(aStack)){ if (aStack.getDisplayName().toLowerCase().contains("saw")){ if (aStack.getItemDamage() == 10){ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java index 0ba848a90d..aa687bfe71 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.items; import static gtPlusPlus.core.util.Utils.getTcAspectStack; + import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; @@ -10,189 +11,190 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.common.covers.*; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.gregtech.api.enums.*; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_X32; import net.minecraft.item.EnumAction; public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { - public MetaGeneratedGregtechItems INSTANCE; - - public MetaGeneratedGregtechItems() { - super("MU-metaitem.01", new OrePrefixes[]{null}); - INSTANCE = this; - int tLastID = 0; - - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - Utils.LOG_INFO("Gregtech 5.09 not found, using fallback components. (I like how I have to add compat to something I added first and had stolen.)"); - GregtechItemList.Electric_Pump_LuV.set(addItem(tLastID = 0, "Electric Pump (LuV)", "163920 L/sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)})); - GregtechItemList.Electric_Pump_ZPM.set(addItem(tLastID = 1, "Electric Pump (ZPM)", "655680 L/sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.ITER, 2L), getTcAspectStack(TC_Aspects.AQUA, 2L)})); - GregtechItemList.Electric_Pump_UV.set(addItem(tLastID = 2, "Electric Pump (UV)", "2622720 L/sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.ITER, 4L), getTcAspectStack(TC_Aspects.AQUA, 4L)})); - GregtechItemList.Electric_Pump_MAX.set(addItem(tLastID = 3, "Electric Pump (MAX)", "10490880 L/sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.ITER, 8L), getTcAspectStack(TC_Aspects.AQUA, 8L)})); - GregTech_API.registerCover(GregtechItemList.Electric_Pump_LuV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(8196)); - GregTech_API.registerCover(GregtechItemList.Electric_Pump_ZPM.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[6][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(32768)); - GregTech_API.registerCover(GregtechItemList.Electric_Pump_UV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[7][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(131072)); - GregTech_API.registerCover(GregtechItemList.Electric_Pump_MAX.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(524288)); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.Tin), Character.valueOf('S'), OrePrefixes.screw.get(Materials.Tin), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Tin), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.Bronze)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.Bronze), Character.valueOf('S'), OrePrefixes.screw.get(Materials.Bronze), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.AnyCopper), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.Steel)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.Steel), Character.valueOf('S'), OrePrefixes.screw.get(Materials.Steel), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Gold), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.StainlessSteel)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.StainlessSteel), Character.valueOf('S'), OrePrefixes.screw.get(Materials.StainlessSteel), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Aluminium), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.Titanium)}); - tLastID = 4; - GregtechItemList.Electric_Motor_LuV.set(addItem(tLastID = 4, "Electric Motor (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.MOTUS, 1L)})); - GregtechItemList.Electric_Motor_ZPM.set(addItem(tLastID = 5, "Electric Motor (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.MOTUS, 2L)})); - GregtechItemList.Electric_Motor_UV.set(addItem(tLastID = 6, "Electric Motor (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.MOTUS, 4L)})); - GregtechItemList.Electric_Motor_MAX.set(addItem(tLastID = 7, "Electric Motor (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.MOTUS, 8L)})); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.IronMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.AnyIron), Character.valueOf('W'), OrePrefixes.wireGt01.get(Materials.AnyCopper), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.SteelMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.Aluminium), Character.valueOf('W'), OrePrefixes.wireGt01.get(Materials.Electrum), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Silver)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.SteelMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.StainlessSteel), Character.valueOf('W'), OrePrefixes.wireGt02.get(Materials.Cupronickel), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.NeodymiumMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.Titanium), Character.valueOf('W'), OrePrefixes.wireGt02.get(Materials.TungstenSteel), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Nichrome)}); - - tLastID = 8; - GregtechItemList.Conveyor_Module_LuV.set(addItem(tLastID = 8, "Conveyor Module (LuV)", "1 Stack every 20 secs (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L)})); - GregtechItemList.Conveyor_Module_ZPM.set(addItem(tLastID = 9, "Conveyor Module (ZPM)", "1 Stack every 5 secs (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.ITER, 2L)})); - GregtechItemList.Conveyor_Module_UV.set(addItem(tLastID = 10, "Conveyor Module (UV)", "1 Stack every 1 sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.ITER, 4L)})); - GregtechItemList.Conveyor_Module_MAX.set(addItem(tLastID = 11, "Conveyor Module (MAX)", "1 Stack every 1/5 sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.ITER, 8L)})); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.AnyCopper), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Aluminium), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)}); - GregTech_API.registerCover(GregtechItemList.Conveyor_Module_LuV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(400)); - GregTech_API.registerCover(GregtechItemList.Conveyor_Module_ZPM.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(100)); - GregTech_API.registerCover(GregtechItemList.Conveyor_Module_UV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[3][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(20)); - GregTech_API.registerCover(GregtechItemList.Conveyor_Module_MAX.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(4)); - tLastID = 12; - GregtechItemList.Electric_Piston_LuV.set(addItem(tLastID = 12, "Electric Piston (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.MOTUS, 1L)})); - GregtechItemList.Electric_Piston_ZPM.set(addItem(tLastID = 13, "Electric Piston (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.MOTUS, 2L)})); - GregtechItemList.Electric_Piston_UV.set(addItem(tLastID = 14, "Electric Piston (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.MOTUS, 4L)})); - GregtechItemList.Electric_Piston_MAX.set(addItem(tLastID = 15, "Electric Piston (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 16L), getTcAspectStack(TC_Aspects.MOTUS, 8L)})); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.Steel), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Steel), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.Steel), Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.Aluminium), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Aluminium), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.Aluminium), Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.AnyCopper)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.StainlessSteel), Character.valueOf('S'), OrePrefixes.stick.get(Materials.StainlessSteel), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.StainlessSteel), Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.Titanium), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Titanium), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.Titanium), Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Aluminium)}); - tLastID = 16; - GregtechItemList.Robot_Arm_LuV.set(addItem(tLastID = 16, "Robot Arm (LuV)", "Inserts into specific Slots (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.MOTUS, 1L), Utils.getTcAspectStack("COGNITIO", 1L)})); - GregtechItemList.Robot_Arm_ZPM.set(addItem(tLastID = 17, "Robot Arm (ZPM)", "Inserts into specific Slots (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.MOTUS, 2L), getTcAspectStack("COGNITIO", 2L)})); - GregtechItemList.Robot_Arm_UV.set(addItem(tLastID = 18, "Robot Arm (UV)", "Inserts into specific Slots (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.MOTUS, 4L), getTcAspectStack("COGNITIO", 4L)})); - GregtechItemList.Robot_Arm_MAX.set(addItem(tLastID = 19, "Robot Arm (MAX)", "Inserts into specific Slots (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 16L), getTcAspectStack(TC_Aspects.MOTUS, 8L), getTcAspectStack("COGNITIO", 8L)})); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.Steel), Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('P'), GregtechItemList.Electric_Piston_LuV, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.Aluminium), Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('P'), GregtechItemList.Electric_Piston_ZPM, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Good), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.AnyCopper)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.StainlessSteel), Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('P'), GregtechItemList.Electric_Piston_UV, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.Titanium), Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('P'), GregtechItemList.Electric_Piston_MAX, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Aluminium)}); - GregTech_API.registerCover(GregtechItemList.Robot_Arm_LuV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(400)); - GregTech_API.registerCover(GregtechItemList.Robot_Arm_ZPM.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(100)); - GregTech_API.registerCover(GregtechItemList.Robot_Arm_UV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[3][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(20)); - GregTech_API.registerCover(GregtechItemList.Robot_Arm_MAX.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(4)); - tLastID = 20; - GregtechItemList.Field_Generator_LuV.set(addItem(tLastID = 20, "Field Generator (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.TUTAMEN, 1L)})); - GregtechItemList.Field_Generator_ZPM.set(addItem(tLastID = 21, "Field Generator (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.TUTAMEN, 2L)})); - GregtechItemList.Field_Generator_UV.set(addItem(tLastID = 22, "Field Generator (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.TUTAMEN, 4L)})); - GregtechItemList.Field_Generator_MAX.set(addItem(tLastID = 23, "Field Generator (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 16L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.TUTAMEN, 8L)})); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.EnderPearl), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('W'), OrePrefixes.wireGt01.get(Materials.Osmium)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.EnderEye), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Good), Character.valueOf('W'), OrePrefixes.wireGt02.get(Materials.Osmium)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.NetherStar), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('W'), OrePrefixes.wireGt04.get(Materials.Osmium)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.NetherStar), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Osmium)}); - tLastID = 24; - GregtechItemList.Emitter_LuV.set(addItem(tLastID = 24, "Emitter (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.LUX, 1L)})); - GregtechItemList.Emitter_ZPM.set(addItem(tLastID = 25, "Emitter (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.LUX, 2L)})); - GregtechItemList.Emitter_UV.set(addItem(tLastID = 26, "Emitter (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.LUX, 4L)})); - GregtechItemList.Emitter_MAX.set(addItem(tLastID = 27, "Emitter (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.LUX, 8L)})); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Quartzite), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Brass), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Tin)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.NetherQuartz), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Electrum), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Good), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.AnyCopper)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Emerald), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Chrome), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Gold)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.EnderPearl), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Platinum), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Aluminium)}); - tLastID = 28; - GregtechItemList.Sensor_LuV.set(addItem(tLastID = 28, "Sensor (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.SENSUS, 1L)})); - GregtechItemList.Sensor_ZPM.set(addItem(tLastID = 29, "Sensor (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.SENSUS, 2L)})); - GregtechItemList.Sensor_UV.set(addItem(tLastID = 30, "Sensor (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.SENSUS, 4L)})); - GregtechItemList.Sensor_MAX.set(addItem(tLastID = 31, "Sensor (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.SENSUS, 8L)})); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Quartzite), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Brass), Character.valueOf('P'), OrePrefixes.plate.get(Materials.Steel), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.NetherQuartz), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Electrum), Character.valueOf('P'), OrePrefixes.plate.get(Materials.Aluminium), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Good)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Emerald), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Chrome), Character.valueOf('P'), OrePrefixes.plate.get(Materials.StainlessSteel), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced)}); - //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.EnderPearl), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Platinum), Character.valueOf('P'), OrePrefixes.plate.get(Materials.Titanium), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Elite)}); - - } - - else { - GregtechItemList.Electric_Pump_MAX.set(addItem(tLastID = 3, "Electric Pump (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.ITER, 8L), getTcAspectStack(TC_Aspects.AQUA, 8L)})); - GregtechItemList.Electric_Motor_MAX.set(addItem(tLastID = 7, "Electric Motor (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.MOTUS, 8L)})); - GregtechItemList.Conveyor_Module_MAX.set(addItem(tLastID = 11, "Conveyor Module (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.ITER, 8L)})); - GregtechItemList.Electric_Piston_MAX.set(addItem(tLastID = 15, "Electric Piston (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 16L), getTcAspectStack(TC_Aspects.MOTUS, 8L)})); - GregtechItemList.Robot_Arm_MAX.set(addItem(tLastID = 19, "Robot Arm (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 16L), getTcAspectStack(TC_Aspects.MOTUS, 8L), getTcAspectStack("COGNITIO", 8L)})); - GregtechItemList.Field_Generator_MAX.set(addItem(tLastID = 23, "Field Generator (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 16L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.TUTAMEN, 8L)})); - GregtechItemList.Emitter_MAX.set(addItem(tLastID = 27, "Emitter (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.LUX, 8L)})); - GregtechItemList.Sensor_MAX.set(addItem(tLastID = 31, "Sensor (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.SENSUS, 8L)})); - - } - - GregtechItemList.Circuit_IV.set(addItem(tLastID = 704, "Symbiotic Circuit (IV)", "A Symbiotic Data Processor", new Object[]{GregtechOrePrefixes.circuit.get(GT_Materials.Symbiotic)})); - GregtechItemList.Circuit_LuV.set(addItem(tLastID = 705, "Neutronic Circuit (LuV)", "A Neutron Particle Processor", new Object[]{GregtechOrePrefixes.circuit.get(GT_Materials.Neutronic)})); - GregtechItemList.Circuit_ZPM.set(addItem(tLastID = 706, "Quantum Circuit (ZPM)", "A Singlularity Processor", new Object[]{GregtechOrePrefixes.circuit.get(GT_Materials.Quantum)})); - GregtechItemList.Circuit_Board_IV.set(addItem(tLastID = 710, "IV Circuit Board", "An IV Voltage Rated Circuit Board", new Object[0])); - GregtechItemList.Circuit_Board_LuV.set(addItem(tLastID = 711, "LuV Circuit Board", "An LuV Voltage Rated Circuit Board", new Object[0])); - GregtechItemList.Circuit_Board_ZPM.set(addItem(tLastID = 712, "ZPM Processor Board", "A ZPM Voltage Rated Processor Board", new Object[0])); - GregtechItemList.Circuit_Parts_Crystal_Chip_IV.set(addItem(tLastID = 713, "(IV) Energized Crystal Chip", "Needed for Circuits", new Object[0])); - GregtechItemList.Circuit_Parts_Crystal_Chip_LuV.set(addItem(tLastID = 714, "(LuV) Neutron based Microchip", "Needed for Circuits", new Object[0])); - GregtechItemList.Circuit_Parts_Crystal_Chip_ZPM.set(addItem(tLastID = 715, "(ZPM) Quantum Chip", "Needed for Circuits", new Object[0])); - GregtechItemList.Circuit_Parts_IV.set(addItem(tLastID = 716, "(IV) Energized Circuit Parts", "Circuit Parts", new Object[0])); - GregtechItemList.Circuit_Parts_LuV.set(addItem(tLastID = 717, "(LuV) Neutron-based Circuit Parts", "Circuit Parts", new Object[0])); - GregtechItemList.Circuit_Parts_ZPM.set(addItem(tLastID = 718, "(ZPM) Quantum Circuit Parts", "Circuit Parts", new Object[0])); - GregtechItemList.Circuit_Parts_Wiring_IV.set(addItem(tLastID = 719, "Etched IV Voltage Wiring", "Part of Circuit Boards", new Object[0])); - GregtechItemList.Circuit_Parts_Wiring_LuV.set(addItem(tLastID = 720, "Etched LuV Voltage Wiring", "Part of Circuit Boards", new Object[0])); - GregtechItemList.Circuit_Parts_Wiring_ZPM.set(addItem(tLastID = 721, "Etched ZPM Voltage Wiring", "Part of Circuit Boards", new Object[0])); - - - - - //Extruder Shape - GregtechItemList.Shape_Extruder_WindmillShaft.set(addItem(tLastID = 40, "Extruder Shape (Shaft)", "Extruder Shape for making Windmill Shafts", new Object[0])); - - - //Batteries - GregtechItemList.Battery_RE_EV_Sodium.set(addItem(tLastID = 50, "Quad Cell Sodium Battery", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.METALLUM, 2L), getTcAspectStack(TC_Aspects.POTENTIA, 2L)})); - setElectricStats(32000 + tLastID, 3200000L, GT_Values.V[4], 4L, -3L, true); - - GregtechItemList.Battery_RE_EV_Cadmium.set(addItem(tLastID = 52, "Quad Cell Cadmium Battery", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.METALLUM, 1L), getTcAspectStack(TC_Aspects.POTENTIA, 1L)})); - setElectricStats(32000 + tLastID, 4800000L, GT_Values.V[4], 4L, -3L, true); - - GregtechItemList.Battery_RE_EV_Lithium.set(addItem(tLastID = 54, "Quad Cell Lithium Battery", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 3L), getTcAspectStack(TC_Aspects.METALLUM, 3L), getTcAspectStack(TC_Aspects.POTENTIA, 3L)})); - setElectricStats(32000 + tLastID, 6400000L, GT_Values.V[4], 4L, -3L, true); - - /*GregtechItemList.Battery_RE_EV_Sodium.set(addItem(tLastID = 50, "Quad Cell Acid Battery", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.METALLUM, 1L), getTcAspectStack(TC_Aspects.POTENTIA, 1L)})); + public MetaGeneratedGregtechItems INSTANCE; + + public MetaGeneratedGregtechItems() { + super("MU-metaitem.01", new OrePrefixes[]{null}); + this.INSTANCE = this; + int tLastID = 0; + + if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ + Utils.LOG_INFO("Gregtech 5.09 not found, using fallback components. (I like how I have to add compat to something I added first and had stolen.)"); + GregtechItemList.Electric_Pump_LuV.set(this.addItem(tLastID = 0, "Electric Pump (LuV)", "163920 L/sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L), getTcAspectStack(TC_Aspects.AQUA, 1L)})); + GregtechItemList.Electric_Pump_ZPM.set(this.addItem(tLastID = 1, "Electric Pump (ZPM)", "655680 L/sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.ITER, 2L), getTcAspectStack(TC_Aspects.AQUA, 2L)})); + GregtechItemList.Electric_Pump_UV.set(this.addItem(tLastID = 2, "Electric Pump (UV)", "2622720 L/sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.ITER, 4L), getTcAspectStack(TC_Aspects.AQUA, 4L)})); + GregtechItemList.Electric_Pump_MAX.set(this.addItem(tLastID = 3, "Electric Pump (MAX)", "10490880 L/sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.ITER, 8L), getTcAspectStack(TC_Aspects.AQUA, 8L)})); + GregTech_API.registerCover(GregtechItemList.Electric_Pump_LuV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(8196)); + GregTech_API.registerCover(GregtechItemList.Electric_Pump_ZPM.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[6][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(32768)); + GregTech_API.registerCover(GregtechItemList.Electric_Pump_UV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[7][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(131072)); + GregTech_API.registerCover(GregtechItemList.Electric_Pump_MAX.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(524288)); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.Tin), Character.valueOf('S'), OrePrefixes.screw.get(Materials.Tin), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Tin), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.Bronze)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.Bronze), Character.valueOf('S'), OrePrefixes.screw.get(Materials.Bronze), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.AnyCopper), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.Steel)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.Steel), Character.valueOf('S'), OrePrefixes.screw.get(Materials.Steel), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Gold), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.StainlessSteel)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.StainlessSteel), Character.valueOf('S'), OrePrefixes.screw.get(Materials.StainlessSteel), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Aluminium), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.Titanium)}); + tLastID = 4; + GregtechItemList.Electric_Motor_LuV.set(this.addItem(tLastID = 4, "Electric Motor (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.MOTUS, 1L)})); + GregtechItemList.Electric_Motor_ZPM.set(this.addItem(tLastID = 5, "Electric Motor (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.MOTUS, 2L)})); + GregtechItemList.Electric_Motor_UV.set(this.addItem(tLastID = 6, "Electric Motor (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.MOTUS, 4L)})); + GregtechItemList.Electric_Motor_MAX.set(this.addItem(tLastID = 7, "Electric Motor (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.MOTUS, 8L)})); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.IronMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.AnyIron), Character.valueOf('W'), OrePrefixes.wireGt01.get(Materials.AnyCopper), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.SteelMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.Aluminium), Character.valueOf('W'), OrePrefixes.wireGt01.get(Materials.Electrum), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Silver)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.SteelMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.StainlessSteel), Character.valueOf('W'), OrePrefixes.wireGt02.get(Materials.Cupronickel), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.NeodymiumMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.Titanium), Character.valueOf('W'), OrePrefixes.wireGt02.get(Materials.TungstenSteel), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Nichrome)}); + + tLastID = 8; + GregtechItemList.Conveyor_Module_LuV.set(this.addItem(tLastID = 8, "Conveyor Module (LuV)", "1 Stack every 20 secs (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.ITER, 1L)})); + GregtechItemList.Conveyor_Module_ZPM.set(this.addItem(tLastID = 9, "Conveyor Module (ZPM)", "1 Stack every 5 secs (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.ITER, 2L)})); + GregtechItemList.Conveyor_Module_UV.set(this.addItem(tLastID = 10, "Conveyor Module (UV)", "1 Stack every 1 sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.ITER, 4L)})); + GregtechItemList.Conveyor_Module_MAX.set(this.addItem(tLastID = 11, "Conveyor Module (MAX)", "1 Stack every 1/5 sec (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.ITER, 8L)})); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.AnyCopper), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Aluminium), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)}); + GregTech_API.registerCover(GregtechItemList.Conveyor_Module_LuV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(400)); + GregTech_API.registerCover(GregtechItemList.Conveyor_Module_ZPM.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(100)); + GregTech_API.registerCover(GregtechItemList.Conveyor_Module_UV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[3][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(20)); + GregTech_API.registerCover(GregtechItemList.Conveyor_Module_MAX.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(4)); + tLastID = 12; + GregtechItemList.Electric_Piston_LuV.set(this.addItem(tLastID = 12, "Electric Piston (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.MOTUS, 1L)})); + GregtechItemList.Electric_Piston_ZPM.set(this.addItem(tLastID = 13, "Electric Piston (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.MOTUS, 2L)})); + GregtechItemList.Electric_Piston_UV.set(this.addItem(tLastID = 14, "Electric Piston (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.MOTUS, 4L)})); + GregtechItemList.Electric_Piston_MAX.set(this.addItem(tLastID = 15, "Electric Piston (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 16L), getTcAspectStack(TC_Aspects.MOTUS, 8L)})); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.Steel), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Steel), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.Steel), Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.Aluminium), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Aluminium), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.Aluminium), Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.AnyCopper)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.StainlessSteel), Character.valueOf('S'), OrePrefixes.stick.get(Materials.StainlessSteel), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.StainlessSteel), Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.Titanium), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Titanium), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.Titanium), Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Aluminium)}); + tLastID = 16; + GregtechItemList.Robot_Arm_LuV.set(this.addItem(tLastID = 16, "Robot Arm (LuV)", "Inserts into specific Slots (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.MOTUS, 1L), Utils.getTcAspectStack("COGNITIO", 1L)})); + GregtechItemList.Robot_Arm_ZPM.set(this.addItem(tLastID = 17, "Robot Arm (ZPM)", "Inserts into specific Slots (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.MOTUS, 2L), getTcAspectStack("COGNITIO", 2L)})); + GregtechItemList.Robot_Arm_UV.set(this.addItem(tLastID = 18, "Robot Arm (UV)", "Inserts into specific Slots (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.MOTUS, 4L), getTcAspectStack("COGNITIO", 4L)})); + GregtechItemList.Robot_Arm_MAX.set(this.addItem(tLastID = 19, "Robot Arm (MAX)", "Inserts into specific Slots (as Cover)", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 16L), getTcAspectStack(TC_Aspects.MOTUS, 8L), getTcAspectStack("COGNITIO", 8L)})); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.Steel), Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('P'), GregtechItemList.Electric_Piston_LuV, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.Aluminium), Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('P'), GregtechItemList.Electric_Piston_ZPM, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Good), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.AnyCopper)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.StainlessSteel), Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('P'), GregtechItemList.Electric_Piston_UV, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.Titanium), Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('P'), GregtechItemList.Electric_Piston_MAX, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Aluminium)}); + GregTech_API.registerCover(GregtechItemList.Robot_Arm_LuV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(400)); + GregTech_API.registerCover(GregtechItemList.Robot_Arm_ZPM.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(100)); + GregTech_API.registerCover(GregtechItemList.Robot_Arm_UV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[3][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(20)); + GregTech_API.registerCover(GregtechItemList.Robot_Arm_MAX.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(4)); + tLastID = 20; + GregtechItemList.Field_Generator_LuV.set(this.addItem(tLastID = 20, "Field Generator (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.TUTAMEN, 1L)})); + GregtechItemList.Field_Generator_ZPM.set(this.addItem(tLastID = 21, "Field Generator (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.TUTAMEN, 2L)})); + GregtechItemList.Field_Generator_UV.set(this.addItem(tLastID = 22, "Field Generator (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.TUTAMEN, 4L)})); + GregtechItemList.Field_Generator_MAX.set(this.addItem(tLastID = 23, "Field Generator (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 16L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.TUTAMEN, 8L)})); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.EnderPearl), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('W'), OrePrefixes.wireGt01.get(Materials.Osmium)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.EnderEye), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Good), Character.valueOf('W'), OrePrefixes.wireGt02.get(Materials.Osmium)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.NetherStar), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('W'), OrePrefixes.wireGt04.get(Materials.Osmium)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.NetherStar), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Osmium)}); + tLastID = 24; + GregtechItemList.Emitter_LuV.set(this.addItem(tLastID = 24, "Emitter (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.LUX, 1L)})); + GregtechItemList.Emitter_ZPM.set(this.addItem(tLastID = 25, "Emitter (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.LUX, 2L)})); + GregtechItemList.Emitter_UV.set(this.addItem(tLastID = 26, "Emitter (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.LUX, 4L)})); + GregtechItemList.Emitter_MAX.set(this.addItem(tLastID = 27, "Emitter (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.LUX, 8L)})); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Quartzite), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Brass), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Tin)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.NetherQuartz), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Electrum), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Good), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.AnyCopper)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Emerald), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Chrome), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Gold)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.EnderPearl), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Platinum), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Aluminium)}); + tLastID = 28; + GregtechItemList.Sensor_LuV.set(this.addItem(tLastID = 28, "Sensor (LuV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L), getTcAspectStack(TC_Aspects.SENSUS, 1L)})); + GregtechItemList.Sensor_ZPM.set(this.addItem(tLastID = 29, "Sensor (ZPM)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.MACHINA, 2L), getTcAspectStack(TC_Aspects.SENSUS, 2L)})); + GregtechItemList.Sensor_UV.set(this.addItem(tLastID = 30, "Sensor (UV)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 4L), getTcAspectStack(TC_Aspects.MACHINA, 4L), getTcAspectStack(TC_Aspects.SENSUS, 4L)})); + GregtechItemList.Sensor_MAX.set(this.addItem(tLastID = 31, "Sensor (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.SENSUS, 8L)})); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Quartzite), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Brass), Character.valueOf('P'), OrePrefixes.plate.get(Materials.Steel), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.NetherQuartz), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Electrum), Character.valueOf('P'), OrePrefixes.plate.get(Materials.Aluminium), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Good)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Emerald), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Chrome), Character.valueOf('P'), OrePrefixes.plate.get(Materials.StainlessSteel), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.EnderPearl), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Platinum), Character.valueOf('P'), OrePrefixes.plate.get(Materials.Titanium), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Elite)}); + + } + + else { + GregtechItemList.Electric_Pump_MAX.set(this.addItem(tLastID = 3, "Electric Pump (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.ITER, 8L), getTcAspectStack(TC_Aspects.AQUA, 8L)})); + GregtechItemList.Electric_Motor_MAX.set(this.addItem(tLastID = 7, "Electric Motor (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.MOTUS, 8L)})); + GregtechItemList.Conveyor_Module_MAX.set(this.addItem(tLastID = 11, "Conveyor Module (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.ITER, 8L)})); + GregtechItemList.Electric_Piston_MAX.set(this.addItem(tLastID = 15, "Electric Piston (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 16L), getTcAspectStack(TC_Aspects.MOTUS, 8L)})); + GregtechItemList.Robot_Arm_MAX.set(this.addItem(tLastID = 19, "Robot Arm (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 16L), getTcAspectStack(TC_Aspects.MOTUS, 8L), getTcAspectStack("COGNITIO", 8L)})); + GregtechItemList.Field_Generator_MAX.set(this.addItem(tLastID = 23, "Field Generator (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 16L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.TUTAMEN, 8L)})); + GregtechItemList.Emitter_MAX.set(this.addItem(tLastID = 27, "Emitter (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.LUX, 8L)})); + GregtechItemList.Sensor_MAX.set(this.addItem(tLastID = 31, "Sensor (MAX)", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.MACHINA, 8L), getTcAspectStack(TC_Aspects.SENSUS, 8L)})); + + } + + GregtechItemList.Circuit_IV.set(this.addItem(tLastID = 704, "Symbiotic Circuit (IV)", "A Symbiotic Data Processor", new Object[]{GregtechOrePrefixes.circuit.get(GT_Materials.Symbiotic)})); + GregtechItemList.Circuit_LuV.set(this.addItem(tLastID = 705, "Neutronic Circuit (LuV)", "A Neutron Particle Processor", new Object[]{GregtechOrePrefixes.circuit.get(GT_Materials.Neutronic)})); + GregtechItemList.Circuit_ZPM.set(this.addItem(tLastID = 706, "Quantum Circuit (ZPM)", "A Singlularity Processor", new Object[]{GregtechOrePrefixes.circuit.get(GT_Materials.Quantum)})); + GregtechItemList.Circuit_Board_IV.set(this.addItem(tLastID = 710, "IV Circuit Board", "An IV Voltage Rated Circuit Board", new Object[0])); + GregtechItemList.Circuit_Board_LuV.set(this.addItem(tLastID = 711, "LuV Circuit Board", "An LuV Voltage Rated Circuit Board", new Object[0])); + GregtechItemList.Circuit_Board_ZPM.set(this.addItem(tLastID = 712, "ZPM Processor Board", "A ZPM Voltage Rated Processor Board", new Object[0])); + GregtechItemList.Circuit_Parts_Crystal_Chip_IV.set(this.addItem(tLastID = 713, "(IV) Energized Crystal Chip", "Needed for Circuits", new Object[0])); + GregtechItemList.Circuit_Parts_Crystal_Chip_LuV.set(this.addItem(tLastID = 714, "(LuV) Neutron based Microchip", "Needed for Circuits", new Object[0])); + GregtechItemList.Circuit_Parts_Crystal_Chip_ZPM.set(this.addItem(tLastID = 715, "(ZPM) Quantum Chip", "Needed for Circuits", new Object[0])); + GregtechItemList.Circuit_Parts_IV.set(this.addItem(tLastID = 716, "(IV) Energized Circuit Parts", "Circuit Parts", new Object[0])); + GregtechItemList.Circuit_Parts_LuV.set(this.addItem(tLastID = 717, "(LuV) Neutron-based Circuit Parts", "Circuit Parts", new Object[0])); + GregtechItemList.Circuit_Parts_ZPM.set(this.addItem(tLastID = 718, "(ZPM) Quantum Circuit Parts", "Circuit Parts", new Object[0])); + GregtechItemList.Circuit_Parts_Wiring_IV.set(this.addItem(tLastID = 719, "Etched IV Voltage Wiring", "Part of Circuit Boards", new Object[0])); + GregtechItemList.Circuit_Parts_Wiring_LuV.set(this.addItem(tLastID = 720, "Etched LuV Voltage Wiring", "Part of Circuit Boards", new Object[0])); + GregtechItemList.Circuit_Parts_Wiring_ZPM.set(this.addItem(tLastID = 721, "Etched ZPM Voltage Wiring", "Part of Circuit Boards", new Object[0])); + + + + + //Extruder Shape + GregtechItemList.Shape_Extruder_WindmillShaft.set(this.addItem(tLastID = 40, "Extruder Shape (Shaft)", "Extruder Shape for making Windmill Shafts", new Object[0])); + + + //Batteries + GregtechItemList.Battery_RE_EV_Sodium.set(this.addItem(tLastID = 50, "Quad Cell Sodium Battery", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 2L), getTcAspectStack(TC_Aspects.METALLUM, 2L), getTcAspectStack(TC_Aspects.POTENTIA, 2L)})); + this.setElectricStats(32000 + tLastID, 3200000L, GT_Values.V[4], 4L, -3L, true); + + GregtechItemList.Battery_RE_EV_Cadmium.set(this.addItem(tLastID = 52, "Quad Cell Cadmium Battery", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.METALLUM, 1L), getTcAspectStack(TC_Aspects.POTENTIA, 1L)})); + this.setElectricStats(32000 + tLastID, 4800000L, GT_Values.V[4], 4L, -3L, true); + + GregtechItemList.Battery_RE_EV_Lithium.set(this.addItem(tLastID = 54, "Quad Cell Lithium Battery", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 3L), getTcAspectStack(TC_Aspects.METALLUM, 3L), getTcAspectStack(TC_Aspects.POTENTIA, 3L)})); + this.setElectricStats(32000 + tLastID, 6400000L, GT_Values.V[4], 4L, -3L, true); + + /*GregtechItemList.Battery_RE_EV_Sodium.set(addItem(tLastID = 50, "Quad Cell Acid Battery", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.METALLUM, 1L), getTcAspectStack(TC_Aspects.POTENTIA, 1L)})); setElectricStats(32000 + tLastID, 5000000L, GT_Values.V[2], 4L, -3L, true); GregtechItemList.Battery_RE_EV_Sodium.set(addItem(tLastID = 50, "Quad Cell Mercury Battery", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.METALLUM, 1L), getTcAspectStack(TC_Aspects.POTENTIA, 1L)})); setElectricStats(32000 + tLastID, 5000000L, GT_Values.V[2], 4L, -3L, true);*/ - - - //FOOOOOOOOOOOOOOD - GregtechItemList.Food_Baked_Raisin_Bread.set(addItem(tLastID = 60, "Raisin Bread", "Extra Raisins, Just for ImQ009", new Object[]{new GT_FoodStat(5, 0.5F, EnumAction.eat, null, false, true, false, new int[0]), getTcAspectStack(TC_Aspects.CORPUS, 1L), getTcAspectStack(TC_Aspects.FAMES, 1L), getTcAspectStack(TC_Aspects.IGNIS, 1L)})); - - - - GregtechItemList.Fluid_Cell_144L.set(addItem(tLastID = 61, "144L Invar Fluid Cell", "Holds exactly one dust worth of liquid.", new Object[]{new ItemData(Materials.Invar, OrePrefixes.plate.mMaterialAmount * 8L + 4L * OrePrefixes.ring.mMaterialAmount, new MaterialStack[0]), getTcAspectStack(TC_Aspects.VACUOS, 2L), getTcAspectStack(TC_Aspects.AQUA, 1L)})); - setFluidContainerStats(32000 + tLastID, 144L, 64L); - - GregtechItemList.Fluid_Cell_36L.set(addItem(tLastID = 62, "36L Brass Fluid Cell", "Holds exactly one small dust worth of liquid.", new Object[]{new ItemData(Materials.Brass, OrePrefixes.plate.mMaterialAmount * 8L + 4L * OrePrefixes.ring.mMaterialAmount, new MaterialStack[0]), getTcAspectStack(TC_Aspects.VACUOS, 2L), getTcAspectStack(TC_Aspects.AQUA, 1L)})); - setFluidContainerStats(32000 + tLastID, 36L, 64L); - - GregtechItemList.Fluid_Cell_16L.set(addItem(tLastID = 63, "16L Bronze Fluid Cell", "Holds exactly one tiny dust / nugget worth of liquid.", new Object[]{new ItemData(Materials.Bronze, OrePrefixes.plate.mMaterialAmount * 8L + 4L * OrePrefixes.ring.mMaterialAmount, new MaterialStack[0]), getTcAspectStack(TC_Aspects.VACUOS, 2L), getTcAspectStack(TC_Aspects.AQUA, 1L)})); - setFluidContainerStats(32000 + tLastID, 16L, 64L); - - GregtechItemList.Fluid_Cell_1L.set(addItem(tLastID = 64, "1L Wrought Iron Fluid Cell", "Holds exactly one litre worth of liquid.", new Object[]{new ItemData(Materials.WroughtIron, OrePrefixes.plate.mMaterialAmount * 8L + 4L * OrePrefixes.ring.mMaterialAmount, new MaterialStack[0]), getTcAspectStack(TC_Aspects.VACUOS, 2L), getTcAspectStack(TC_Aspects.AQUA, 1L)})); - setFluidContainerStats(32000 + tLastID, 1L, 64L); - - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.WroughtIron, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.WroughtIron, 2L), GregtechItemList.Fluid_Cell_1L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Bronze, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Bronze, 2L), GregtechItemList.Fluid_Cell_16L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Brass, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Brass, 2L), GregtechItemList.Fluid_Cell_36L.get(1L, new Object[0]), 75, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Invar, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Invar, 2L), GregtechItemList.Fluid_Cell_144L.get(1L, new Object[0]), 75, 32); - - } - else { - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.WroughtIron, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.WroughtIron, 4L), GregtechItemList.Fluid_Cell_1L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Bronze, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Bronze, 4L), GregtechItemList.Fluid_Cell_16L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Brass, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Brass, 4L), GregtechItemList.Fluid_Cell_36L.get(1L, new Object[0]), 75, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Invar, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Invar, 4L), GregtechItemList.Fluid_Cell_144L.get(1L, new Object[0]), 75, 32); - } - } + + + //FOOOOOOOOOOOOOOD + GregtechItemList.Food_Baked_Raisin_Bread.set(this.addItem(tLastID = 60, "Raisin Bread", "Extra Raisins, Just for ImQ009", new Object[]{new GT_FoodStat(5, 0.5F, EnumAction.eat, null, false, true, false, new int[0]), getTcAspectStack(TC_Aspects.CORPUS, 1L), getTcAspectStack(TC_Aspects.FAMES, 1L), getTcAspectStack(TC_Aspects.IGNIS, 1L)})); + + + + GregtechItemList.Fluid_Cell_144L.set(this.addItem(tLastID = 61, "144L Invar Fluid Cell", "Holds exactly one dust worth of liquid.", new Object[]{new ItemData(Materials.Invar, (OrePrefixes.plate.mMaterialAmount * 8L) + (4L * OrePrefixes.ring.mMaterialAmount), new MaterialStack[0]), getTcAspectStack(TC_Aspects.VACUOS, 2L), getTcAspectStack(TC_Aspects.AQUA, 1L)})); + this.setFluidContainerStats(32000 + tLastID, 144L, 64L); + + GregtechItemList.Fluid_Cell_36L.set(this.addItem(tLastID = 62, "36L Brass Fluid Cell", "Holds exactly one small dust worth of liquid.", new Object[]{new ItemData(Materials.Brass, (OrePrefixes.plate.mMaterialAmount * 8L) + (4L * OrePrefixes.ring.mMaterialAmount), new MaterialStack[0]), getTcAspectStack(TC_Aspects.VACUOS, 2L), getTcAspectStack(TC_Aspects.AQUA, 1L)})); + this.setFluidContainerStats(32000 + tLastID, 36L, 64L); + + GregtechItemList.Fluid_Cell_16L.set(this.addItem(tLastID = 63, "16L Bronze Fluid Cell", "Holds exactly one tiny dust / nugget worth of liquid.", new Object[]{new ItemData(Materials.Bronze, (OrePrefixes.plate.mMaterialAmount * 8L) + (4L * OrePrefixes.ring.mMaterialAmount), new MaterialStack[0]), getTcAspectStack(TC_Aspects.VACUOS, 2L), getTcAspectStack(TC_Aspects.AQUA, 1L)})); + this.setFluidContainerStats(32000 + tLastID, 16L, 64L); + + GregtechItemList.Fluid_Cell_1L.set(this.addItem(tLastID = 64, "1L Wrought Iron Fluid Cell", "Holds exactly one litre worth of liquid.", new Object[]{new ItemData(Materials.WroughtIron, (OrePrefixes.plate.mMaterialAmount * 8L) + (4L * OrePrefixes.ring.mMaterialAmount), new MaterialStack[0]), getTcAspectStack(TC_Aspects.VACUOS, 2L), getTcAspectStack(TC_Aspects.AQUA, 1L)})); + this.setFluidContainerStats(32000 + tLastID, 1L, 64L); + + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.WroughtIron, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.WroughtIron, 2L), GregtechItemList.Fluid_Cell_1L.get(1L, new Object[0]), 50, 32); + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Bronze, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Bronze, 2L), GregtechItemList.Fluid_Cell_16L.get(1L, new Object[0]), 50, 32); + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Brass, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Brass, 2L), GregtechItemList.Fluid_Cell_36L.get(1L, new Object[0]), 75, 32); + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Invar, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Invar, 2L), GregtechItemList.Fluid_Cell_144L.get(1L, new Object[0]), 75, 32); + + } + else { + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.WroughtIron, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.WroughtIron, 4L), GregtechItemList.Fluid_Cell_1L.get(1L, new Object[0]), 50, 32); + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Bronze, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Bronze, 4L), GregtechItemList.Fluid_Cell_16L.get(1L, new Object[0]), 50, 32); + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Brass, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Brass, 4L), GregtechItemList.Fluid_Cell_36L.get(1L, new Object[0]), 75, 32); + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Invar, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Invar, 4L), GregtechItemList.Fluid_Cell_144L.get(1L, new Object[0]), 75, 32); + } + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java index d5bd4c134c..5ddb67b6d3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java @@ -14,18 +14,18 @@ public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool { public MetaGeneratedGregtechTools() { super("plusplus.metatool.01"); - INSTANCE = this; + INSTANCE = this; GregTech_API.registerTool( - addTool( + this.addTool( SKOOKUM_CHOOCHER, "Skookum Choocher", - "Can Really Chooch. Does a Skookum job at Hammering and Wrenching stuff.", + "Can Really Chooch. Does a Skookum job at Hammering and Wrenching stuff.", new TOOL_Gregtech_Choocher(), new Object[]{GregtechToolDictNames.craftingToolSkookumChoocher, - ToolDictNames.craftingToolHardHammer, - ToolDictNames.craftingToolWrench, - new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), - new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), - new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)}), - GregTech_API.sWrenchList); + ToolDictNames.craftingToolHardHammer, + ToolDictNames.craftingToolWrench, + new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)}), + GregTech_API.sWrenchList); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java index fcd991583b..7335ce1bf7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java @@ -1,12 +1,11 @@ package gtPlusPlus.xmod.gregtech.common.items.behaviours; +import java.util.List; + import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.util.GT_LanguageManager; import gregtech.common.items.behaviors.Behaviour_None; import gregtech.common.items.behaviors.Behaviour_Wrench; - -import java.util.List; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -16,8 +15,8 @@ extends Behaviour_None { private boolean isWrench = true; private final Behaviour_Wrench wrench = new Behaviour_Wrench(150); private final Behaviour_Prospecting_Ex prospecting = new Behaviour_Prospecting_Ex(10, 1250); - private String mTooltip1 = GT_LanguageManager.addStringLocalization("gt.behaviour.choochering1", "Current tool mode: "); - private String mTooltip2 = GT_LanguageManager.addStringLocalization("gt.behaviour.choochering2", "Change tool mode using Shift+Rightclick."); + private final String mTooltip1 = GT_LanguageManager.addStringLocalization("gt.behaviour.choochering1", "Current tool mode: "); + private final String mTooltip2 = GT_LanguageManager.addStringLocalization("gt.behaviour.choochering2", "Change tool mode using Shift+Rightclick."); private final String mTooltipH = GT_LanguageManager.addStringLocalization("gt.behaviour.prospectingEx", "Usable for Prospecting large areas."); private final String mTooltipW = GT_LanguageManager.addStringLocalization("gt.behaviour.wrench", "Rotates Blocks on Rightclick."); @@ -26,39 +25,39 @@ extends Behaviour_None { } @Override - public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) { if (aWorld.isRemote) { return false; } if (aPlayer.isSneaking()){ - if (isWrench){ - isWrench = false; + if (this.isWrench){ + this.isWrench = false; return false; } - isWrench = true; + this.isWrench = true; return false; } else if (!aPlayer.isSneaking()){ - if (isWrench){ - wrench.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aSide, aSide, aSide, aSide, hitZ, hitZ, hitZ); + if (this.isWrench){ + this.wrench.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aSide, aSide, aSide, aSide, hitZ, hitZ, hitZ); return false; } - prospecting.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); + this.prospecting.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); return false; } return false; } @Override - public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) { + public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList, final ItemStack aStack) { + - - if (isWrench){ - aList.add(this.mTooltip1+"Wrench"); + if (this.isWrench){ + aList.add(this.mTooltip1+"Wrench"); aList.add(this.mTooltipW); } else { - aList.add(this.mTooltip1+"Prospecting"); + aList.add(this.mTooltip1+"Prospecting"); aList.add(this.mTooltipH); } aList.add(this.mTooltip2); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java index 11ff6f0f91..bd4b6d0154 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.items.behaviours; +import java.util.Random; + import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.items.GT_MetaBase_Item; @@ -9,9 +11,6 @@ import gregtech.api.util.*; import gregtech.common.blocks.GT_Block_Ores; import gregtech.common.blocks.GT_TileEntity_Ores; import gregtech.common.items.behaviors.Behaviour_Prospecting; - -import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -22,98 +21,99 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.IFluidBlock; public class Behaviour_Prospecting_Ex - extends Behaviour_Prospecting { - private final int mVanillaCosts; - private final int mEUCosts; +extends Behaviour_Prospecting { + private final int mVanillaCosts; + private final int mEUCosts; - public Behaviour_Prospecting_Ex(int aVanillaCosts, int aEUCosts) { - super(aVanillaCosts, aEUCosts); - this.mVanillaCosts = aVanillaCosts; - this.mEUCosts = aEUCosts; - } + public Behaviour_Prospecting_Ex(final int aVanillaCosts, final int aEUCosts) { + super(aVanillaCosts, aEUCosts); + this.mVanillaCosts = aVanillaCosts; + this.mEUCosts = aEUCosts; + } - public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { - if (aWorld.isRemote) { - return false; - } - Block aBlock = aWorld.getBlock(aX, aY, aZ); - if (aBlock == null) { - return false; - } - byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); + @Override + public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) { + if (aWorld.isRemote) { + return false; + } + final Block aBlock = aWorld.getBlock(aX, aY, aZ); + if (aBlock == null) { + return false; + } + final byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); - ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta)); - if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { - GT_Utility.sendChatToPlayer(aPlayer, "This is " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); - return true; - } - if ((aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.dirt)) ||(aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.grass)) ) { - if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) { - GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); - int tX = aX; - int tY = aY; - int tZ = aZ; - int tMetaID = 0; - int tQuality = ((aItem instanceof GT_MetaGenerated_Tool) ? ((GT_MetaGenerated_Tool) aItem).getHarvestLevel(aStack, "") : 0)*3; + ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta)); + if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { + GT_Utility.sendChatToPlayer(aPlayer, "This is " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); + return true; + } + if ((aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.dirt)) ||(aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.grass)) ) { + if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) { + GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ); + int tX = aX; + int tY = aY; + int tZ = aZ; + int tMetaID = 0; + final int tQuality = ((aItem instanceof GT_MetaGenerated_Tool) ? ((GT_MetaGenerated_Tool) aItem).getHarvestLevel(aStack, "") : 0)*3; - int i = 0; - for (int j = 6 + tQuality; i < j; i++) { - tX -= ForgeDirection.getOrientation(aSide).offsetX; - tY -= ForgeDirection.getOrientation(aSide).offsetY; - tZ -= ForgeDirection.getOrientation(aSide).offsetZ; + int i = 0; + for (final int j = 6 + tQuality; i < j; i++) { + tX -= ForgeDirection.getOrientation(aSide).offsetX; + tY -= ForgeDirection.getOrientation(aSide).offsetY; + tZ -= ForgeDirection.getOrientation(aSide).offsetZ; - Block tBlock = aWorld.getBlock(tX, tY, tZ); - if ((tBlock == Blocks.lava) || (tBlock == Blocks.flowing_lava)) { - GT_Utility.sendChatToPlayer(aPlayer, "There is Lava behind this Block."); - break; - } - if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water) || ((tBlock instanceof IFluidBlock))) { - GT_Utility.sendChatToPlayer(aPlayer, "There is a Liquid behind this Block."); - break; - } - if ((tBlock == Blocks.monster_egg) || (!GT_Utility.hasBlockHitBox(aWorld, tX, tY, tZ))) { - GT_Utility.sendChatToPlayer(aPlayer, "There is an Air Pocket behind this Block."); - break; - } - if (tBlock != aBlock) { - if (i >= 4) { - break; - } - GT_Utility.sendChatToPlayer(aPlayer, "Material is changing behind this Block."); - break; - } - } - Random tRandom = new Random(aX ^ aY ^ aZ ^ aSide); - i = 0; - for (int j = 9 + 2 * tQuality; i < j; i++) { - tX = aX - 4 - tQuality + tRandom.nextInt(j); - tY = aY - 4 - tQuality + tRandom.nextInt(j); - tZ = aZ - 4 - tQuality + tRandom.nextInt(j); - Block tBlock = aWorld.getBlock(tX, tY, tZ); - if ((tBlock instanceof GT_Block_Ores)) { - TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ); - if ((tTileEntity instanceof GT_TileEntity_Ores)) { - Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)]; - if ((tMaterial != null) && (tMaterial != Materials._NULL)) { - GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tMaterial.mDefaultLocalName + " Ore."); - return true; - } - } - } else { - tMetaID = aWorld.getBlockMetadata(tX, tY, tZ); - tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID)); - if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { - GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); - return true; - } - } - } - GT_Utility.sendChatToPlayer(aPlayer, "No Ores found."); - } - return true; - } - return false; - } + final Block tBlock = aWorld.getBlock(tX, tY, tZ); + if ((tBlock == Blocks.lava) || (tBlock == Blocks.flowing_lava)) { + GT_Utility.sendChatToPlayer(aPlayer, "There is Lava behind this Block."); + break; + } + if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water) || ((tBlock instanceof IFluidBlock))) { + GT_Utility.sendChatToPlayer(aPlayer, "There is a Liquid behind this Block."); + break; + } + if ((tBlock == Blocks.monster_egg) || (!GT_Utility.hasBlockHitBox(aWorld, tX, tY, tZ))) { + GT_Utility.sendChatToPlayer(aPlayer, "There is an Air Pocket behind this Block."); + break; + } + if (tBlock != aBlock) { + if (i >= 4) { + break; + } + GT_Utility.sendChatToPlayer(aPlayer, "Material is changing behind this Block."); + break; + } + } + final Random tRandom = new Random(aX ^ aY ^ aZ ^ aSide); + i = 0; + for (final int j = 9 + (2 * tQuality); i < j; i++) { + tX = (aX - 4 - tQuality) + tRandom.nextInt(j); + tY = (aY - 4 - tQuality) + tRandom.nextInt(j); + tZ = (aZ - 4 - tQuality) + tRandom.nextInt(j); + final Block tBlock = aWorld.getBlock(tX, tY, tZ); + if ((tBlock instanceof GT_Block_Ores)) { + final TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ); + if ((tTileEntity instanceof GT_TileEntity_Ores)) { + final Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)]; + if ((tMaterial != null) && (tMaterial != Materials._NULL)) { + GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tMaterial.mDefaultLocalName + " Ore."); + return true; + } + } + } else { + tMetaID = aWorld.getBlockMetadata(tX, tY, tZ); + tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID)); + if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { + GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); + return true; + } + } + } + GT_Utility.sendChatToPlayer(aPlayer, "No Ores found."); + } + return true; + } + return false; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java index 9fa42b0286..73eae3608c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.automation; import static gtPlusPlus.core.lib.CORE.sTesseractGenerators; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.*; @@ -32,17 +33,17 @@ extends GT_MetaTileEntity_BasicTank public int mNeededEnergy = 0; public int mFrequency = 0; - public GT_MetaTileEntity_TesseractGenerator(int aID, String aName, String aNameRegional, int aTier) { + public GT_MetaTileEntity_TesseractGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { super(aID, aName, aNameRegional, aTier, 3, ""); } - public GT_MetaTileEntity_TesseractGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_TesseractGenerator(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); - } + } @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_TesseractGenerator(mName, mTier, mDescription, mTextures); + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TesseractGenerator(this.mName, this.mTier, this.mDescription, this.mTextures); } @Override @@ -64,7 +65,7 @@ extends GT_MetaTileEntity_BasicTank } @Override - public boolean isFacingValid(byte aFacing) + public boolean isFacingValid(final byte aFacing) { return true; } @@ -82,18 +83,18 @@ extends GT_MetaTileEntity_BasicTank } @Override - public boolean isInputFacing(byte aSide) + public boolean isInputFacing(final byte aSide) { return true; } @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getBackFacing(); + public boolean isOutputFacing(final byte aSide) { + return aSide == this.getBaseMetaTileEntity().getBackFacing(); } @Override - public boolean isValidSlot(int aIndex) + public boolean isValidSlot(final int aIndex) { return false; } @@ -101,7 +102,7 @@ extends GT_MetaTileEntity_BasicTank @Override public long getMinimumStoredEU() { - return getBaseMetaTileEntity().getEUCapacity() / 2; + return this.getBaseMetaTileEntity().getEUCapacity() / 2; } @Override @@ -125,11 +126,11 @@ extends GT_MetaTileEntity_BasicTank @Override public long maxSteamStore() { - return maxEUStore(); + return this.maxEUStore(); } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) + public boolean isAccessAllowed(final EntityPlayer aPlayer) { return true; } @@ -153,19 +154,19 @@ extends GT_MetaTileEntity_BasicTank } @Override - public void saveNBTData(NBTTagCompound aNBT) + public void saveNBTData(final NBTTagCompound aNBT) { aNBT.setInteger("mFrequency", this.mFrequency); } @Override - public void loadNBTData(NBTTagCompound aNBT) + public void loadNBTData(final NBTTagCompound aNBT) { this.mFrequency = aNBT.getInteger("mFrequency"); } @Override - public void onConfigLoad(GT_Config aConfig) + public void onConfigLoad(final GT_Config aConfig) { TESSERACT_ENERGY_COST = 1024; TESSERACT_ENERGY_COST_DIMENSIONAL = 2048; @@ -181,17 +182,17 @@ extends GT_MetaTileEntity_BasicTank { sTesseractGenerators.clear(); } - + @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ){ - if (aSide == getBaseMetaTileEntity().getFrontFacing()){ - float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); - switch ((byte)((byte)(int)(tCoords[0] * 2.0F) + 2 * (byte)(int)(tCoords[1] * 2.0F))){ - case 0: + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer, final byte aSide, final float aX, final float aY, final float aZ){ + if (aSide == this.getBaseMetaTileEntity().getFrontFacing()){ + final float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); + switch ((byte)((byte)(int)(tCoords[0] * 2.0F) + (2 * (byte)(int)(tCoords[1] * 2.0F)))){ + case 0: Utils.LOG_INFO("Freq. -1 | " + this.mFrequency); this.mFrequency -= 1; break; - case 1: + case 1: Utils.LOG_INFO("Freq. +1 | " + this.mFrequency); this.mFrequency += 1; default: @@ -200,44 +201,44 @@ extends GT_MetaTileEntity_BasicTank } PlayerUtils.messagePlayer(aPlayer, "Frequency: " + this.mFrequency); PlayerUtils.messagePlayer(aPlayer, ((sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != null) && (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != this) ? EnumChatFormatting.RED + " (Occupied)" : "")); - } + } return true; } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) + public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) { - if (aSide == getBaseMetaTileEntity().getFrontFacing()) + if (aSide == this.getBaseMetaTileEntity().getFrontFacing()) { - float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); - switch ((byte)((byte)(int)(tCoords[0] * 2.0F) + 2 * (byte)(int)(tCoords[1] * 2.0F))) + final float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); + switch ((byte)((byte)(int)(tCoords[0] * 2.0F) + (2 * (byte)(int)(tCoords[1] * 2.0F)))) { - case 0: + case 0: this.mFrequency -= 64; break; - case 1: + case 1: this.mFrequency += 64; break; - case 2: + case 2: this.mFrequency -= 512; break; - case 3: + case 3: this.mFrequency += 512; } GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency + ((sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != null) && (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) != this) ? EnumChatFormatting.RED + " (Occupied)" : "")); } } - public boolean allowCoverOnSide(byte aSide, int aCoverID) + public boolean allowCoverOnSide(final byte aSide, final int aCoverID) { - return aSide != getBaseMetaTileEntity().getFrontFacing(); + return aSide != this.getBaseMetaTileEntity().getFrontFacing(); } @Override public String[] getInfoData() { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IGregTechDeviceInformation)) && (((IGregTechDeviceInformation)tTileEntity).isGivingInformation())) { + final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IGregTechDeviceInformation)) && (((IGregTechDeviceInformation)tTileEntity).isGivingInformation())) { return ((IGregTechDeviceInformation)tTileEntity).getInfoData(); } return new String[] { "Tesseract Generator", "Freqency:", "" + this.mFrequency, (sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == this) && (this.isWorking >= 20) ? "Active" : "Inactive" }; @@ -251,8 +252,8 @@ extends GT_MetaTileEntity_BasicTank public boolean isSendingInformation() { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IGregTechDeviceInformation))) { + final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IGregTechDeviceInformation))) { return ((IGregTechDeviceInformation)tTileEntity).isGivingInformation(); } return false; @@ -261,8 +262,8 @@ extends GT_MetaTileEntity_BasicTank @Override public boolean isDigitalChest() { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { + final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { return ((IDigitalChest)tTileEntity).isDigitalChest(); } return false; @@ -271,18 +272,18 @@ extends GT_MetaTileEntity_BasicTank @Override public ItemStack[] getStoredItemData() { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { + final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { return ((IDigitalChest)tTileEntity).getStoredItemData(); } return null; } @Override - public void setItemCount(int aCount) + public void setItemCount(final int aCount) { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { + final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { ((IDigitalChest)tTileEntity).setItemCount(aCount); } } @@ -290,45 +291,45 @@ extends GT_MetaTileEntity_BasicTank @Override public int getMaxItemCount() { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { + final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork()) && ((tTileEntity instanceof IDigitalChest))) { return ((IDigitalChest)tTileEntity).getMaxItemCount(); } return 0; } @Override - public boolean isItemValidForSlot(int aIndex, ItemStack aStack) + public boolean isItemValidForSlot(final int aIndex, final ItemStack aStack) { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } return tTileEntity.isItemValidForSlot(aIndex, aStack); } @Override - public int[] getAccessibleSlotsFromSide(int aSide) + public int[] getAccessibleSlotsFromSide(final int aSide) { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return new int[0]; } if ((tTileEntity instanceof ISidedInventory)) { return ((ISidedInventory)tTileEntity).getAccessibleSlotsFromSide(aSide); } - int[] rArray = new int[getSizeInventory()]; - for (int i = 0; i < getSizeInventory(); i++) { + final int[] rArray = new int[this.getSizeInventory()]; + for (int i = 0; i < this.getSizeInventory(); i++) { rArray[i] = i; } return rArray; } @Override - public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) + public boolean canInsertItem(final int aIndex, final ItemStack aStack, final int aSide) { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } if ((tTileEntity instanceof ISidedInventory)) { @@ -338,10 +339,10 @@ extends GT_MetaTileEntity_BasicTank } @Override - public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) + public boolean canExtractItem(final int aIndex, final ItemStack aStack, final int aSide) { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } if ((tTileEntity instanceof ISidedInventory)) { @@ -353,38 +354,38 @@ extends GT_MetaTileEntity_BasicTank @Override public int getSizeInventory() { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return 0; } return tTileEntity.getSizeInventory(); } @Override - public ItemStack getStackInSlot(int aIndex) + public ItemStack getStackInSlot(final int aIndex) { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.getStackInSlot(aIndex); } @Override - public void setInventorySlotContents(int aIndex, ItemStack aStack) + public void setInventorySlotContents(final int aIndex, final ItemStack aStack) { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return; } tTileEntity.setInventorySlotContents(aIndex, aStack); } @Override - public ItemStack decrStackSize(int aIndex, int aAmount) + public ItemStack decrStackSize(final int aIndex, final int aAmount) { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.decrStackSize(aIndex, aAmount); @@ -393,8 +394,8 @@ extends GT_MetaTileEntity_BasicTank @Override public String getInventoryName() { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return ""; } return tTileEntity.getInventoryName(); @@ -403,107 +404,107 @@ extends GT_MetaTileEntity_BasicTank @Override public int getInventoryStackLimit() { - IInventory tTileEntity = getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IInventory tTileEntity = this.getBaseMetaTileEntity().getIInventoryAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return 0; } return tTileEntity.getInventoryStackLimit(); } @Override - public boolean canFill(ForgeDirection aSide, Fluid aFluid) + public boolean canFill(final ForgeDirection aSide, final Fluid aFluid) { - IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IFluidHandler tTileEntity = this.getBaseMetaTileEntity().getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } return tTileEntity.canFill(aSide, aFluid); } @Override - public boolean canDrain(ForgeDirection aSide, Fluid aFluid) + public boolean canDrain(final ForgeDirection aSide, final Fluid aFluid) { - IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IFluidHandler tTileEntity = this.getBaseMetaTileEntity().getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } return tTileEntity.canDrain(aSide, aFluid); } @Override - public FluidTankInfo[] getTankInfo(ForgeDirection aSide) + public FluidTankInfo[] getTankInfo(final ForgeDirection aSide) { - IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IFluidHandler tTileEntity = this.getBaseMetaTileEntity().getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return new FluidTankInfo[0]; } return tTileEntity.getTankInfo(aSide); } @Override - public int fill_default(ForgeDirection aDirection, FluidStack aFluid, boolean doFill) + public int fill_default(final ForgeDirection aDirection, final FluidStack aFluid, final boolean doFill) { - IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IFluidHandler tTileEntity = this.getBaseMetaTileEntity().getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return 0; } return tTileEntity.fill(aDirection, aFluid, doFill); } @Override - public FluidStack drain(ForgeDirection aDirection, int maxDrain, boolean doDrain) + public FluidStack drain(final ForgeDirection aDirection, final int maxDrain, final boolean doDrain) { - IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IFluidHandler tTileEntity = this.getBaseMetaTileEntity().getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.drain(aDirection, maxDrain, doDrain); } @Override - public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) + public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) { - IFluidHandler tTileEntity = getBaseMetaTileEntity().getITankContainerAtSide(getBaseMetaTileEntity().getBackFacing()); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final IFluidHandler tTileEntity = this.getBaseMetaTileEntity().getITankContainerAtSide(this.getBaseMetaTileEntity().getBackFacing()); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.drain(aSide, aFluid, doDrain); } - public boolean addEnergyConsumption(GT_MetaTileEntity_TesseractTerminal aTerminal) + public boolean addEnergyConsumption(final GT_MetaTileEntity_TesseractTerminal aTerminal) { - if (!getBaseMetaTileEntity().isAllowedToWork()) { + if (!this.getBaseMetaTileEntity().isAllowedToWork()) { return false; } - this.mNeededEnergy += (aTerminal.getBaseMetaTileEntity().getWorld() == getBaseMetaTileEntity().getWorld() ? TESSERACT_ENERGY_COST : TESSERACT_ENERGY_COST_DIMENSIONAL); + this.mNeededEnergy += (aTerminal.getBaseMetaTileEntity().getWorld() == this.getBaseMetaTileEntity().getWorld() ? TESSERACT_ENERGY_COST : TESSERACT_ENERGY_COST_DIMENSIONAL); return true; } - public boolean isValidTesseractGenerator(String aOwnerName, boolean aWorkIrrelevant) + public boolean isValidTesseractGenerator(final String aOwnerName, final boolean aWorkIrrelevant) { - return (getBaseMetaTileEntity() != null) && (!getBaseMetaTileEntity().isInvalidTileEntity()) && (getBaseMetaTileEntity().isAllowedToWork()) && ((aOwnerName == null) || (getBaseMetaTileEntity().getOwnerName().equals(aOwnerName))) && ((aWorkIrrelevant) || (this.isWorking >= 20)); + return (this.getBaseMetaTileEntity() != null) && (!this.getBaseMetaTileEntity().isInvalidTileEntity()) && (this.getBaseMetaTileEntity().isAllowedToWork()) && ((aOwnerName == null) || (this.getBaseMetaTileEntity().getOwnerName().equals(aOwnerName))) && ((aWorkIrrelevant) || (this.isWorking >= 20)); } public void onPostTick() { - if (getBaseMetaTileEntity().isServerSide()){ + if (this.getBaseMetaTileEntity().isServerSide()){ if (this.mFrequency != this.oFrequency){ - + Utils.LOG_INFO("mFreq != oFreq"); - + if (sTesseractGenerators.get(Integer.valueOf(this.oFrequency)) == this) { sTesseractGenerators.remove(Integer.valueOf(this.oFrequency)); - getBaseMetaTileEntity().issueBlockUpdate(); + this.getBaseMetaTileEntity().issueBlockUpdate(); Utils.LOG_INFO("this Gen == oFreq on map - do block update"); } Utils.LOG_INFO("mFreq will be set to oFreq"); this.oFrequency = this.mFrequency; } - if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().decreaseStoredEnergyUnits(this.mNeededEnergy, false))) + if ((this.getBaseMetaTileEntity().isAllowedToWork()) && (this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(this.mNeededEnergy, false))) { Utils.LOG_INFO("Can Work & Has Energy"); - if ((sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == null) || (!((GT_MetaTileEntity_TesseractGenerator)sTesseractGenerators.get(Integer.valueOf(this.mFrequency))).isValidTesseractGenerator(null, true))) { + if ((sTesseractGenerators.get(Integer.valueOf(this.mFrequency)) == null) || (!sTesseractGenerators.get(Integer.valueOf(this.mFrequency)).isValidTesseractGenerator(null, true))) { Utils.LOG_INFO("storing TE I think to mFreq map?"); sTesseractGenerators.put(Integer.valueOf(this.mFrequency), this); } @@ -514,7 +515,7 @@ extends GT_MetaTileEntity_BasicTank { Utils.LOG_INFO("this gen == mFreq on map - do block update"); sTesseractGenerators.remove(Integer.valueOf(this.mFrequency)); - getBaseMetaTileEntity().issueBlockUpdate(); + this.getBaseMetaTileEntity().issueBlockUpdate(); } this.isWorking = 0; } @@ -526,7 +527,7 @@ extends GT_MetaTileEntity_BasicTank } if (this.isWorking == 20) { - getBaseMetaTileEntity().issueBlockUpdate(); + this.getBaseMetaTileEntity().issueBlockUpdate(); this.isWorking = ((byte)(this.isWorking + 1)); } } @@ -545,26 +546,26 @@ extends GT_MetaTileEntity_BasicTank } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { return new ITexture[0][0][0]; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { return aSide == aFacing ? new ITexture[]{ new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_Frequency)} : new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), new GT_RenderedTexture(Textures.BlockIcons.VOID)}; } - + //To-Do? @Override public boolean doesFillContainers() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java index 3544d2a124..4056af5df8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java @@ -26,17 +26,17 @@ extends GT_MetaTileEntity_BasicTank public boolean mDidWork = false; public static boolean sInterDimensionalTesseractAllowed = true; - public GT_MetaTileEntity_TesseractTerminal(int aID, String aName, String aNameRegional, int aTier) { + public GT_MetaTileEntity_TesseractTerminal(final int aID, final String aName, final String aNameRegional, final int aTier) { super(aID, aName, aNameRegional, aTier, 3, ""); } - public GT_MetaTileEntity_TesseractTerminal(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GT_MetaTileEntity_TesseractTerminal(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); - } + } @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_TesseractTerminal(mName, mTier, mDescription, mTextures); + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TesseractTerminal(this.mName, this.mTier, this.mDescription, this.mTextures); } @Override @@ -58,26 +58,26 @@ extends GT_MetaTileEntity_BasicTank } @Override - public boolean isFacingValid(byte aFacing) + public boolean isFacingValid(final byte aFacing) { return true; } - + @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getBackFacing(); + public boolean isOutputFacing(final byte aSide) { + return aSide == this.getBaseMetaTileEntity().getBackFacing(); } @Override - public boolean isValidSlot(int aIndex) + public boolean isValidSlot(final int aIndex) { return false; } - + @Override public long getMinimumStoredEU() { - return getBaseMetaTileEntity().getEUCapacity() / 2; + return this.getBaseMetaTileEntity().getEUCapacity() / 2; } @Override @@ -87,11 +87,11 @@ extends GT_MetaTileEntity_BasicTank } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) + public boolean isAccessAllowed(final EntityPlayer aPlayer) { return true; } - + @Override public long maxEUStore() { @@ -101,7 +101,7 @@ extends GT_MetaTileEntity_BasicTank @Override public long maxSteamStore() { - return maxEUStore(); + return this.maxEUStore(); } @Override @@ -113,7 +113,7 @@ extends GT_MetaTileEntity_BasicTank @Override public int getProgresstime() { - return getTesseract(this.mFrequency, false) != null ? 999 : 0; + return this.getTesseract(this.mFrequency, false) != null ? 999 : 0; } @Override @@ -123,19 +123,19 @@ extends GT_MetaTileEntity_BasicTank } @Override - public void saveNBTData(NBTTagCompound aNBT) + public void saveNBTData(final NBTTagCompound aNBT) { aNBT.setInteger("mFrequency", this.mFrequency); } @Override - public void loadNBTData(NBTTagCompound aNBT) + public void loadNBTData(final NBTTagCompound aNBT) { this.mFrequency = aNBT.getInteger("mFrequency"); } @Override - public void onConfigLoad(GT_Config aConfig) + public void onConfigLoad(final GT_Config aConfig) { sInterDimensionalTesseractAllowed = true; } @@ -147,10 +147,10 @@ extends GT_MetaTileEntity_BasicTank float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); switch ((byte)((byte)(int)(tCoords[0] * 2.0F) + 2 * (byte)(int)(tCoords[1] * 2.0F))) { - case 0: + case 0: this.mFrequency -= 1; break; - case 1: + case 1: this.mFrequency += 1; } GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency + (getTesseract(this.mFrequency, false) == null ? "" : new StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)").toString())); @@ -159,15 +159,15 @@ extends GT_MetaTileEntity_BasicTank }*/ @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ){ - if (aSide == getBaseMetaTileEntity().getFrontFacing()){ - float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); - switch ((byte)((byte)(int)(tCoords[0] * 2.0F) + 2 * (byte)(int)(tCoords[1] * 2.0F))){ - case 0: + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer, final byte aSide, final float aX, final float aY, final float aZ){ + if (aSide == this.getBaseMetaTileEntity().getFrontFacing()){ + final float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); + switch ((byte)((byte)(int)(tCoords[0] * 2.0F) + (2 * (byte)(int)(tCoords[1] * 2.0F)))){ + case 0: Utils.LOG_INFO("Freq. -1 | " + this.mFrequency); this.mFrequency -= 1; break; - case 1: + case 1: Utils.LOG_INFO("Freq. +1 | " + this.mFrequency); this.mFrequency += 1; default: @@ -175,43 +175,43 @@ extends GT_MetaTileEntity_BasicTank break; } PlayerUtils.messagePlayer(aPlayer, "Frequency: " + this.mFrequency); - PlayerUtils.messagePlayer(aPlayer, (getTesseract(this.mFrequency, false) == null ? "" : new StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)").toString())); + PlayerUtils.messagePlayer(aPlayer, (this.getTesseract(this.mFrequency, false) == null ? "" : new StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)").toString())); } return true; } - + @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) + public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) { - if (aSide == getBaseMetaTileEntity().getFrontFacing()) + if (aSide == this.getBaseMetaTileEntity().getFrontFacing()) { - float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); - switch ((byte)((byte)(int)(tCoords[0] * 2.0F) + 2 * (byte)(int)(tCoords[1] * 2.0F))) + final float[] tCoords = GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ); + switch ((byte)((byte)(int)(tCoords[0] * 2.0F) + (2 * (byte)(int)(tCoords[1] * 2.0F)))) { - case 0: + case 0: this.mFrequency -= 64; break; - case 1: + case 1: this.mFrequency += 64; break; - case 2: + case 2: this.mFrequency -= 512; break; - case 3: + case 3: this.mFrequency += 512; } - GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency + (getTesseract(this.mFrequency, false) == null ? "" : new StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)").toString())); + GT_Utility.sendChatToPlayer(aPlayer, "Frequency: " + this.mFrequency + (this.getTesseract(this.mFrequency, false) == null ? "" : new StringBuilder().append(EnumChatFormatting.GREEN).append(" (Connected)").toString())); } } - public boolean allowCoverOnSide(byte aSide, int aCoverID) + public boolean allowCoverOnSide(final byte aSide, final int aCoverID) { - return aSide != getBaseMetaTileEntity().getFrontFacing(); + return aSide != this.getBaseMetaTileEntity().getFrontFacing(); } - public GT_MetaTileEntity_TesseractGenerator getTesseract(int aFrequency, boolean aWorkIrrelevant) + public GT_MetaTileEntity_TesseractGenerator getTesseract(final int aFrequency, final boolean aWorkIrrelevant) { - GT_MetaTileEntity_TesseractGenerator rTesseract = (GT_MetaTileEntity_TesseractGenerator)CORE.sTesseractGenerators.get(Integer.valueOf(aFrequency)); + final GT_MetaTileEntity_TesseractGenerator rTesseract = CORE.sTesseractGenerators.get(Integer.valueOf(aFrequency)); if (rTesseract == null) { return null; } @@ -219,10 +219,10 @@ extends GT_MetaTileEntity_BasicTank { CORE.sTesseractGenerators.put(Integer.valueOf(aFrequency), null);return null; } - if (!rTesseract.isValidTesseractGenerator(getBaseMetaTileEntity().getOwnerName(), aWorkIrrelevant)) { + if (!rTesseract.isValidTesseractGenerator(this.getBaseMetaTileEntity().getOwnerName(), aWorkIrrelevant)) { return null; } - if ((!sInterDimensionalTesseractAllowed) && (rTesseract.getBaseMetaTileEntity().getWorld() != getBaseMetaTileEntity().getWorld())) { + if ((!sInterDimensionalTesseractAllowed) && (rTesseract.getBaseMetaTileEntity().getWorld() != this.getBaseMetaTileEntity().getWorld())) { return null; } return rTesseract; @@ -231,11 +231,11 @@ extends GT_MetaTileEntity_BasicTank @Override public String[] getInfoData() { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity != null) && (getBaseMetaTileEntity().isAllowedToWork()) && (tTileEntity.isSendingInformation())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity != null) && (this.getBaseMetaTileEntity().isAllowedToWork()) && (tTileEntity.isSendingInformation())) { return tTileEntity.getInfoData(); } - return new String[] { "Tesseract Generator", "Freqency:", "" + this.mFrequency, getTesseract(this.mFrequency, false) != null ? "Active" : "Inactive" }; + return new String[] { "Tesseract Generator", "Freqency:", "" + this.mFrequency, this.getTesseract(this.mFrequency, false) != null ? "Active" : "Inactive" }; } @Override @@ -247,8 +247,8 @@ extends GT_MetaTileEntity_BasicTank @Override public boolean isDigitalChest() { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } return tTileEntity.isDigitalChest(); @@ -257,18 +257,18 @@ extends GT_MetaTileEntity_BasicTank @Override public ItemStack[] getStoredItemData() { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.getStoredItemData(); } @Override - public void setItemCount(int aCount) + public void setItemCount(final int aCount) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return; } tTileEntity.setItemCount(aCount); @@ -277,48 +277,48 @@ extends GT_MetaTileEntity_BasicTank @Override public int getMaxItemCount() { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return 0; } return tTileEntity.getMaxItemCount(); } @Override - public boolean isItemValidForSlot(int aIndex, ItemStack aStack) + public boolean isItemValidForSlot(final int aIndex, final ItemStack aStack) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } return tTileEntity.isItemValidForSlot(aIndex, aStack); } @Override - public int[] getAccessibleSlotsFromSide(int aSide) + public int[] getAccessibleSlotsFromSide(final int aSide) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return new int[0]; } return tTileEntity.getAccessibleSlotsFromSide(aSide); } @Override - public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) + public boolean canInsertItem(final int aIndex, final ItemStack aStack, final int aSide) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } return tTileEntity.canInsertItem(aIndex, aStack, aSide); } @Override - public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) + public boolean canExtractItem(final int aIndex, final ItemStack aStack, final int aSide) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } return tTileEntity.canExtractItem(aIndex, aStack, aSide); @@ -327,38 +327,38 @@ extends GT_MetaTileEntity_BasicTank @Override public int getSizeInventory() { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return 0; } return tTileEntity.getSizeInventory(); } @Override - public ItemStack getStackInSlot(int aIndex) + public ItemStack getStackInSlot(final int aIndex) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.getStackInSlot(aIndex); } @Override - public void setInventorySlotContents(int aIndex, ItemStack aStack) + public void setInventorySlotContents(final int aIndex, final ItemStack aStack) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return; } tTileEntity.setInventorySlotContents(aIndex, aStack); } @Override - public ItemStack decrStackSize(int aIndex, int aAmount) + public ItemStack decrStackSize(final int aIndex, final int aAmount) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.decrStackSize(aIndex, aAmount); @@ -367,8 +367,8 @@ extends GT_MetaTileEntity_BasicTank @Override public String getInventoryName() { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return ""; } return tTileEntity.getInventoryName(); @@ -377,68 +377,68 @@ extends GT_MetaTileEntity_BasicTank @Override public int getInventoryStackLimit() { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return 0; } return tTileEntity.getInventoryStackLimit(); } @Override - public boolean canFill(ForgeDirection aSide, Fluid aFluid) + public boolean canFill(final ForgeDirection aSide, final Fluid aFluid) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } return tTileEntity.canFill(aSide, aFluid); } @Override - public boolean canDrain(ForgeDirection aSide, Fluid aFluid) + public boolean canDrain(final ForgeDirection aSide, final Fluid aFluid) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return false; } return tTileEntity.canDrain(aSide, aFluid); } @Override - public FluidTankInfo[] getTankInfo(ForgeDirection aSide) + public FluidTankInfo[] getTankInfo(final ForgeDirection aSide) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return new FluidTankInfo[0]; } return tTileEntity.getTankInfo(aSide); } @Override - public int fill_default(ForgeDirection aDirection, FluidStack aFluid, boolean doFill) + public int fill_default(final ForgeDirection aDirection, final FluidStack aFluid, final boolean doFill) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return 0; } return tTileEntity.fill(aDirection, aFluid, doFill); } @Override - public FluidStack drain(ForgeDirection aDirection, int maxDrain, boolean doDrain) + public FluidStack drain(final ForgeDirection aDirection, final int maxDrain, final boolean doDrain) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.drain(aDirection, maxDrain, doDrain); } @Override - public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) + public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, false); - if ((tTileEntity == null) || (!getBaseMetaTileEntity().isAllowedToWork())) { + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, false); + if ((tTileEntity == null) || (!this.getBaseMetaTileEntity().isAllowedToWork())) { return null; } return tTileEntity.drain(aSide, aFluid, doDrain); @@ -446,22 +446,22 @@ extends GT_MetaTileEntity_BasicTank public void onPostTick() { - if ((getBaseMetaTileEntity().isServerSide()) && (getBaseMetaTileEntity().isAllowedToWork())) + if ((this.getBaseMetaTileEntity().isServerSide()) && (this.getBaseMetaTileEntity().isAllowedToWork())) { - GT_MetaTileEntity_TesseractGenerator tTileEntity = getTesseract(this.mFrequency, true); + final GT_MetaTileEntity_TesseractGenerator tTileEntity = this.getTesseract(this.mFrequency, true); if (tTileEntity != null) { tTileEntity.addEnergyConsumption(this); - if ((!this.mDidWork) && (getTesseract(this.mFrequency, false) != null)) + if ((!this.mDidWork) && (this.getTesseract(this.mFrequency, false) != null)) { this.mDidWork = true; - getBaseMetaTileEntity().issueBlockUpdate(); + this.getBaseMetaTileEntity().issueBlockUpdate(); } } else if (this.mDidWork == true) { this.mDidWork = false; - getBaseMetaTileEntity().issueBlockUpdate(); + this.getBaseMetaTileEntity().issueBlockUpdate(); } } } @@ -473,22 +473,22 @@ extends GT_MetaTileEntity_BasicTank } @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { return new ITexture[0][0][0]; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { return aSide == aFacing ? new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_Frequency)} : new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Dimensional), new GT_RenderedTexture(Textures.BlockIcons.VOID)}; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java index c2cadab478..3c90bf6836 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java @@ -17,128 +17,135 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; public class GT_MetaTileEntity_Boiler_Solar - extends GT_MetaTileEntity_Boiler { - public GT_MetaTileEntity_Boiler_Solar(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, "Steam Power by the Sun", new ITexture[0]); - } +extends GT_MetaTileEntity_Boiler { + public GT_MetaTileEntity_Boiler_Solar(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional, "Steam Power by the Sun", new ITexture[0]); + } - public GT_MetaTileEntity_Boiler_Solar(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } + public GT_MetaTileEntity_Boiler_Solar(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[4][17][]; - for (byte i = -1; i < 16; i = (byte) (i + 1)) { - ITexture[] tmp0 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; - rTextures[0][(i + 1)] = tmp0; - ITexture[] tmp1 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_SOLAR)}; - rTextures[1][(i + 1)] = tmp1; - ITexture[] tmp2 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; - rTextures[2][(i + 1)] = tmp2; - ITexture[] tmp3 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)}; - rTextures[3][(i + 1)] = tmp3; - } - return rTextures; - } + @Override + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + final ITexture[][][] rTextures = new ITexture[4][17][]; + for (byte i = -1; i < 16; i = (byte) (i + 1)) { + final ITexture[] tmp0 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + rTextures[0][(i + 1)] = tmp0; + final ITexture[] tmp1 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_SOLAR)}; + rTextures[1][(i + 1)] = tmp1; + final ITexture[] tmp2 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + rTextures[2][(i + 1)] = tmp2; + final ITexture[] tmp3 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)}; + rTextures[3][(i + 1)] = tmp3; + } + return rTextures; + } - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return mTextures[aSide >= 2 ? ((byte) (aSide != aFacing ? 2 : 3)) : aSide][aColorIndex + 1]; - } + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[aSide >= 2 ? ((byte) (aSide != aFacing ? 2 : 3)) : aSide][aColorIndex + 1]; + } - public int maxProgresstime() { - return 500; - } + @Override + public int maxProgresstime() { + return 500; + } - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity, 16000); - } + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_Boiler(aPlayerInventory, aBaseMetaTileEntity, 16000); + } - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SolarBoiler.png", 16000); - } + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_Boiler(aPlayerInventory, aBaseMetaTileEntity, "SolarBoiler.png", 16000); + } - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Boiler_Solar(this.mName, this.mTier, this.mDescription, this.mTextures); - } - - private int mRunTime = 0; - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("mRunTime", this.mRunTime); - } + @Override + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Boiler_Solar(this.mName, this.mTier, this.mDescription, this.mTextures); + } - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - this.mRunTime = aNBT.getInteger("mRunTime"); - } + private int mRunTime = 0; - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) { - if (this.mTemperature <= 20) { - this.mTemperature = 20; - this.mLossTimer = 0; - } - if (++this.mLossTimer > 45) { - this.mTemperature -= 1; - this.mLossTimer = 0; - } - if (this.mSteam != null) { - byte i = aBaseMetaTileEntity.getFrontFacing(); - IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i); - if (tTileEntity != null) { - FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false); - if (tDrained != null) { - int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false); - if (tFilledAmount > 0) { - tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true); - } - } - } - } - if (aTick % 25L == 0L) { - if (this.mTemperature > 100) { - if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) { - this.mHadNoWater = true; - } else { - if (this.mHadNoWater) { - aBaseMetaTileEntity.doExplosion(2048L); - return; - } - this.mFluid.amount -= 1; - mRunTime += 1; - int tOutput = 150; - if(mRunTime > 10000){ - tOutput = Math.max(50, 150 - ((mRunTime-10000)/100)); - } - if (this.mSteam == null) { - this.mSteam = GT_ModHandler.getSteam(tOutput); - } else if (GT_ModHandler.isSteam(this.mSteam)) { - this.mSteam.amount += tOutput; - } else { - this.mSteam = GT_ModHandler.getSteam(tOutput); - } - } - } else { - this.mHadNoWater = false; - } - } - if ((this.mSteam != null) && - (this.mSteam.amount > 16000)) { - sendSound((byte) 1); - this.mSteam.amount = 12000; - } - if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && (aTick % 256L == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering())) { - boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() && aBaseMetaTileEntity.getBiome().rainfall > 0.0F; - mProcessingEnergy += bRain && aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4 || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8 : 1; - } - if ((this.mTemperature < 500) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L)) { - this.mProcessingEnergy -= 1; - this.mTemperature += 1; - } - aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); - } - } + @Override + public void saveNBTData(final NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("mRunTime", this.mRunTime); + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + this.mRunTime = aNBT.getInteger("mRunTime"); + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) { + if (this.mTemperature <= 20) { + this.mTemperature = 20; + this.mLossTimer = 0; + } + if (++this.mLossTimer > 45) { + this.mTemperature -= 1; + this.mLossTimer = 0; + } + if (this.mSteam != null) { + final byte i = aBaseMetaTileEntity.getFrontFacing(); + final IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i); + if (tTileEntity != null) { + final FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false); + if (tDrained != null) { + final int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false); + if (tFilledAmount > 0) { + tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true); + } + } + } + } + if ((aTick % 25L) == 0L) { + if (this.mTemperature > 100) { + if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) { + this.mHadNoWater = true; + } else { + if (this.mHadNoWater) { + aBaseMetaTileEntity.doExplosion(2048L); + return; + } + this.mFluid.amount -= 1; + this.mRunTime += 1; + int tOutput = 150; + if(this.mRunTime > 10000){ + tOutput = Math.max(50, 150 - ((this.mRunTime-10000)/100)); + } + if (this.mSteam == null) { + this.mSteam = GT_ModHandler.getSteam(tOutput); + } else if (GT_ModHandler.isSteam(this.mSteam)) { + this.mSteam.amount += tOutput; + } else { + this.mSteam = GT_ModHandler.getSteam(tOutput); + } + } + } else { + this.mHadNoWater = false; + } + } + if ((this.mSteam != null) && + (this.mSteam.amount > 16000)) { + this.sendSound((byte) 1); + this.mSteam.amount = 12000; + } + if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && ((aTick % 256L) == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering())) { + final boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() && (aBaseMetaTileEntity.getBiome().rainfall > 0.0F); + this.mProcessingEnergy += (bRain && (aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4)) || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8 : 1; + } + if ((this.mTemperature < 500) && (this.mProcessingEnergy > 0) && ((aTick % 12L) == 0L)) { + this.mProcessingEnergy -= 1; + this.mTemperature += 1; + } + aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); + } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java index b3a1fb456c..6ba0cb0d76 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityDoubleFuelGeneratorBase.java @@ -1,5 +1,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.generators; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; @@ -11,124 +12,123 @@ import gregtech.api.util.GT_Recipe; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechRocketFuelGeneratorBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; public class GregtechMetaTileEntityDoubleFuelGeneratorBase - extends GregtechRocketFuelGeneratorBase { +extends GregtechRocketFuelGeneratorBase { - public int mEfficiency; + public int mEfficiency; - public GregtechMetaTileEntityDoubleFuelGeneratorBase(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires two liquid Fuels. Fuel A is Fastburn, Fuel B is slowburn.", new ITexture[0]); - onConfigLoad(); - } + public GregtechMetaTileEntityDoubleFuelGeneratorBase(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier, "Requires two liquid Fuels. Fuel A is Fastburn, Fuel B is slowburn.", new ITexture[0]); + this.onConfigLoad(); + } - public GregtechMetaTileEntityDoubleFuelGeneratorBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - onConfigLoad(); - } + public GregtechMetaTileEntityDoubleFuelGeneratorBase(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + this.onConfigLoad(); + } - @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); - } + @Override + public boolean isOutputFacing(final byte aSide) { + return aSide == this.getBaseMetaTileEntity().getFrontFacing(); + } - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityDoubleFuelGeneratorBase(this.mName, this.mTier, this.mDescription, this.mTextures); - } + @Override + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityDoubleFuelGeneratorBase(this.mName, this.mTier, this.mDescription, this.mTextures); + } - @Override + @Override public GT_Recipe.GT_Recipe_Map getRecipes() { - return GT_Recipe.GT_Recipe_Map.sDieselFuels; - } + return GT_Recipe.GT_Recipe_Map.sDieselFuels; + } - @Override + @Override public int getCapacity() { - return 32000; - } + return 32000; + } - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, (100 - this.mTier * 8)); - } + public void onConfigLoad() { + this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, (100 - (this.mTier * 8))); + } - @Override + @Override public int getEfficiency() { - return this.mEfficiency; - } - - @Override - public int getFuelValue(ItemStack aStack) { - int rValue = Math.max(GT_ModHandler.getFuelCanValue(aStack) * 6 / 5, super.getFuelValue(aStack)); - if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { - rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); - } - return rValue; - } - - private GT_RenderedTexture getCasingTexture(){ - if (this.mTier <= 4){ - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); - } - else if (this.mTier == 5){ - - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced); - } - else { - - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Ultra); - } + return this.mEfficiency; + } + + @Override + public int getFuelValue(final ItemStack aStack) { + int rValue = Math.max((GT_ModHandler.getFuelCanValue(aStack) * 6) / 5, super.getFuelValue(aStack)); + if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { + rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); + } + return rValue; + } + + private GT_RenderedTexture getCasingTexture(){ + if (this.mTier <= 4){ + return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); + } + else if (this.mTier == 5){ + + return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced); + } + else { + + return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Ultra); + } //return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); - } - - - @Override - public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; - } - - @Override - public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent)}; - } - - @Override - public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; - } - - @Override - public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)}; - } - - @Override - public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal)}; - } - - @Override - public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; - } - - @Override - public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast)}; - } - - @Override - public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; - } - - @Override - public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)}; - } - - @Override - public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal_Active)}; - } + } + + + @Override + public ITexture[] getFront(final byte aColor) { + return new ITexture[]{super.getFront(aColor)[0], this.getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; + } + + @Override + public ITexture[] getBack(final byte aColor) { + return new ITexture[]{super.getBack(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent)}; + } + + @Override + public ITexture[] getBottom(final byte aColor) { + return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; + } + + @Override + public ITexture[] getTop(final byte aColor) { + return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)}; + } + + @Override + public ITexture[] getSides(final byte aColor) { + return new ITexture[]{super.getSides(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal)}; + } + + @Override + public ITexture[] getFrontActive(final byte aColor) { + return new ITexture[]{super.getFrontActive(aColor)[0], this.getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; + } + + @Override + public ITexture[] getBackActive(final byte aColor) { + return new ITexture[]{super.getBackActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast)}; + } + + @Override + public ITexture[] getBottomActive(final byte aColor) { + return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; + } + + @Override + public ITexture[] getTopActive(final byte aColor) { + return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)}; + } + + @Override + public ITexture[] getSidesActive(final byte aColor) { + return new ITexture[]{super.getSidesActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal_Active)}; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java index f4ee1c97b1..b6053d8d5e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java @@ -1,5 +1,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.generators; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; @@ -12,7 +13,6 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; public class GregtechMetaTileEntityGeothermalGenerator extends GT_MetaTileEntity_BasicGenerator @@ -20,24 +20,24 @@ extends GT_MetaTileEntity_BasicGenerator public int mEfficiency; - public GregtechMetaTileEntityGeothermalGenerator(int aID, String aName, String aNameRegional, int aTier) { + public GregtechMetaTileEntityGeothermalGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { super(aID, aName, aNameRegional, aTier, "Requires Pahoehoe Lava or Normal Lava as Fuel", new ITexture[0]); - onConfigLoad(); + this.onConfigLoad(); } - public GregtechMetaTileEntityGeothermalGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GregtechMetaTileEntityGeothermalGenerator(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - onConfigLoad(); - } + this.onConfigLoad(); + } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()){ return true; } aBaseMetaTileEntity.openGUI(aPlayer); return true; - } + } @Override public int getCapacity() { @@ -46,7 +46,7 @@ extends GT_MetaTileEntity_BasicGenerator } public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "ThermalGenerator.efficiency.tier." + this.mTier, (100 - this.mTier * 7)); + this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "ThermalGenerator.efficiency.tier." + this.mTier, (100 - (this.mTier * 7))); } @Override @@ -55,8 +55,8 @@ extends GT_MetaTileEntity_BasicGenerator } @Override - public int getFuelValue(ItemStack aStack) { - int rValue = Math.max(GT_ModHandler.getFuelCanValue(aStack) * 6 / 5, super.getFuelValue(aStack)); + public int getFuelValue(final ItemStack aStack) { + int rValue = Math.max((GT_ModHandler.getFuelCanValue(aStack) * 6) / 5, super.getFuelValue(aStack)); if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); } @@ -64,62 +64,62 @@ extends GT_MetaTileEntity_BasicGenerator } @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); + public boolean isOutputFacing(final byte aSide) { + return aSide == this.getBaseMetaTileEntity().getFrontFacing(); } @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntityGeothermalGenerator(this.mName, this.mTier, this.mDescription, this.mTextures); } @Override - public ITexture[] getFront(byte aColor) { + public ITexture[] getFront(final byte aColor) { return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; } @Override - public ITexture[] getBack(byte aColor) { + public ITexture[] getBack(final byte aColor) { return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Vertical)}; } @Override - public ITexture[] getBottom(byte aColor) { + public ITexture[] getBottom(final byte aColor) { return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM)}; } @Override - public ITexture[] getTop(byte aColor) { + public ITexture[] getTop(final byte aColor) { return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER)}; } @Override - public ITexture[] getSides(byte aColor) { + public ITexture[] getSides(final byte aColor) { return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.BOILER_LAVA_FRONT)}; } @Override - public ITexture[] getFrontActive(byte aColor) { + public ITexture[] getFrontActive(final byte aColor) { return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; } @Override - public ITexture[] getBackActive(byte aColor) { + public ITexture[] getBackActive(final byte aColor) { return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK_ACTIVE), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Vertical_Active)}; } @Override - public ITexture[] getBottomActive(byte aColor) { + public ITexture[] getBottomActive(final byte aColor) { return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM_ACTIVE)}; } @Override - public ITexture[] getTopActive(byte aColor) { + public ITexture[] getTopActive(final byte aColor) { return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE)}; } @Override - public ITexture[] getSidesActive(byte aColor) { + public ITexture[] getSidesActive(final byte aColor) { return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.BOILER_LAVA_FRONT_ACTIVE)}; } @@ -127,7 +127,7 @@ extends GT_MetaTileEntity_BasicGenerator @Override public String[] getDescription() { - return new String[] {"Generates power from Lava/Pahoehoe at " + getEfficiency() + "% Efficiency per tick"}; + return new String[] {"Generates power from Lava/Pahoehoe at " + this.getEfficiency() + "% Efficiency per tick"}; } @Override @@ -136,7 +136,7 @@ extends GT_MetaTileEntity_BasicGenerator return GT_Recipe_Map.sHotFuels; } - + public int getPollution() { return 100; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java index ee36a920b0..b63c367fd5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java @@ -1,5 +1,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.generators; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; @@ -11,124 +12,123 @@ import gregtech.api.util.GT_Recipe; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechRocketFuelGeneratorBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; public class GregtechMetaTileEntityRocketFuelGenerator - extends GregtechRocketFuelGeneratorBase { +extends GregtechRocketFuelGeneratorBase { - public int mEfficiency; + public int mEfficiency; - public GregtechMetaTileEntityRocketFuelGenerator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires liquid Fuels.", new ITexture[0]); - onConfigLoad(); - } + public GregtechMetaTileEntityRocketFuelGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier, "Requires liquid Fuels.", new ITexture[0]); + this.onConfigLoad(); + } - public GregtechMetaTileEntityRocketFuelGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - onConfigLoad(); - } + public GregtechMetaTileEntityRocketFuelGenerator(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + this.onConfigLoad(); + } - @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); - } + @Override + public boolean isOutputFacing(final byte aSide) { + return aSide == this.getBaseMetaTileEntity().getFrontFacing(); + } - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityRocketFuelGenerator(this.mName, this.mTier, this.mDescription, this.mTextures); - } + @Override + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityRocketFuelGenerator(this.mName, this.mTier, this.mDescription, this.mTextures); + } - @Override + @Override public GT_Recipe.GT_Recipe_Map getRecipes() { - return GT_Recipe.GT_Recipe_Map.sDieselFuels; - } + return GT_Recipe.GT_Recipe_Map.sDieselFuels; + } - @Override + @Override public int getCapacity() { - return 32000; - } + return 32000; + } - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, (100 - this.mTier * 8)); - } + public void onConfigLoad() { + this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, (100 - (this.mTier * 8))); + } - @Override + @Override public int getEfficiency() { - return this.mEfficiency; - } - - @Override - public int getFuelValue(ItemStack aStack) { - int rValue = Math.max(GT_ModHandler.getFuelCanValue(aStack) * 6 / 5, super.getFuelValue(aStack)); - if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { - rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); - } - return rValue; - } - - private GT_RenderedTexture getCasingTexture(){ - if (this.mTier <= 4){ - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); - } - else if (this.mTier == 5){ - - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced); - } - else{ - - return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Ultra); - } + return this.mEfficiency; + } + + @Override + public int getFuelValue(final ItemStack aStack) { + int rValue = Math.max((GT_ModHandler.getFuelCanValue(aStack) * 6) / 5, super.getFuelValue(aStack)); + if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { + rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); + } + return rValue; + } + + private GT_RenderedTexture getCasingTexture(){ + if (this.mTier <= 4){ + return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); + } + else if (this.mTier == 5){ + + return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Advanced); + } + else{ + + return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Ultra); + } //return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top); - } - - - @Override - public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; - } - - @Override - public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent)}; - } - - @Override - public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; - } - - @Override - public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)}; - } - - @Override - public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal)}; - } - - @Override - public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; - } - - @Override - public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast)}; - } - - @Override - public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; - } - - @Override - public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)}; - } - - @Override - public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal_Active)}; - } + } + + + @Override + public ITexture[] getFront(final byte aColor) { + return new ITexture[]{super.getFront(aColor)[0], this.getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; + } + + @Override + public ITexture[] getBack(final byte aColor) { + return new ITexture[]{super.getBack(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent)}; + } + + @Override + public ITexture[] getBottom(final byte aColor) { + return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; + } + + @Override + public ITexture[] getTop(final byte aColor) { + return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)}; + } + + @Override + public ITexture[] getSides(final byte aColor) { + return new ITexture[]{super.getSides(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal)}; + } + + @Override + public ITexture[] getFrontActive(final byte aColor) { + return new ITexture[]{super.getFrontActive(aColor)[0], this.getCasingTexture(), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; + } + + @Override + public ITexture[] getBackActive(final byte aColor) { + return new ITexture[]{super.getBackActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast)}; + } + + @Override + public ITexture[] getBottomActive(final byte aColor) { + return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Bottom)}; + } + + @Override + public ITexture[] getTopActive(final byte aColor) { + return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)}; + } + + @Override + public ITexture[] getSidesActive(final byte aColor) { + return new ITexture[]{super.getSidesActive(aColor)[0], this.getCasingTexture(), new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Diesel_Horizontal_Active)}; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java index c41c1851fa..a268ade81e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.generators; import static gregtech.api.enums.GT_Values.V; + import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Textures; @@ -16,45 +17,45 @@ import net.minecraft.entity.player.InventoryPlayer; public class GregtechMetaTileEntitySolarGenerator extends GregtechMetaSolarGenerator { - public GregtechMetaTileEntitySolarGenerator(int aID, String aName, String aNameRegional, int aTier) { + public GregtechMetaTileEntitySolarGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { super(aID, aName, aNameRegional, aTier, "Feasts on the power of the Sun!", new ITexture[0]); - onConfigLoad(); + this.onConfigLoad(); } - public GregtechMetaTileEntitySolarGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + public GregtechMetaTileEntitySolarGenerator(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); - onConfigLoad(); + this.onConfigLoad(); } @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); + public boolean isOutputFacing(final byte aSide) { + return aSide == this.getBaseMetaTileEntity().getFrontFacing(); } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new CONTAINER_SolarGenerator(aPlayerInventory, aBaseMetaTileEntity, 16000); } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new GUI_SolarGenerator(aPlayerInventory, aBaseMetaTileEntity, "SolarBoiler.png", 16000); } @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntitySolarGenerator(this.mName, this.mTier, this.mDescription, this.mTextures); } public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "SunAbsorber.efficiency.tier." + this.mTier, 100 - this.mTier * 10); + this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "SunAbsorber.efficiency.tier." + this.mTier, 100 - (this.mTier * 10)); } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() - && aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() + aBaseMetaTileEntity.getEUCapacity()) { + && (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUOutput() + aBaseMetaTileEntity.getEUCapacity()))) { if (this.mSolarCharge <= 20) { //Utils.LOG_WARNING("1."); @@ -67,32 +68,32 @@ public class GregtechMetaTileEntitySolarGenerator extends GregtechMetaSolarGener this.mLossTimer = 0; } - if (aTick % 10L == 0L) { + if ((aTick % 10L) == 0L) { - Utils.LOG_WARNING("getUniversalEnergyStored: "+aBaseMetaTileEntity.getUniversalEnergyStored() + " maxEUOutput * 20 + getMinimumStoredEU: " + (maxEUOutput() * 20 + getMinimumStoredEU())); + Utils.LOG_WARNING("getUniversalEnergyStored: "+aBaseMetaTileEntity.getUniversalEnergyStored() + " maxEUOutput * 20 + getMinimumStoredEU: " + ((this.maxEUOutput() * 20) + this.getMinimumStoredEU())); - if ((this.mSolarCharge > 100) && (aBaseMetaTileEntity.isAllowedToWork()) && - (!aBaseMetaTileEntity.getWorld().isThundering()) && - aBaseMetaTileEntity.getUniversalEnergyStored() < (maxEUStore() - getMinimumStoredEU())) { - getBaseMetaTileEntity().increaseStoredEnergyUnits(sEnergyPerTick * getEfficiency(), true); + if ((this.mSolarCharge > 100) && (aBaseMetaTileEntity.isAllowedToWork()) && + (!aBaseMetaTileEntity.getWorld().isThundering()) && + (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUStore() - this.getMinimumStoredEU()))) { + this.getBaseMetaTileEntity().increaseStoredEnergyUnits(sEnergyPerTick * this.getEfficiency(), true); } - } + } - if ((this.mSolarCharge < 500) && (this.mProcessingEnergy != 0) && (aTick % 32L == 0L)) { - Utils.LOG_WARNING("Adding Solar Charge. Currently "+mSolarCharge); + if ((this.mSolarCharge < 500) && (this.mProcessingEnergy != 0) && ((aTick % 32L) == 0L)) { + Utils.LOG_WARNING("Adding Solar Charge. Currently "+this.mSolarCharge); this.mProcessingEnergy -= 1; this.mSolarCharge += 1; } - if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && (aTick % 64L == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering())) { - Utils.LOG_WARNING("Adding Processing Energy. Currently "+mProcessingEnergy); - boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() && aBaseMetaTileEntity.getBiome().rainfall > 0.0F; - mProcessingEnergy += bRain && aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4 || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8 : 1; + if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) && ((aTick % 64L) == 0L) && (!aBaseMetaTileEntity.getWorld().isThundering())) { + Utils.LOG_WARNING("Adding Processing Energy. Currently "+this.mProcessingEnergy); + final boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() && (aBaseMetaTileEntity.getBiome().rainfall > 0.0F); + this.mProcessingEnergy += (bRain && (aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4)) || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8 : 1; } if (aBaseMetaTileEntity.isServerSide()){ //Utils.LOG_WARNING("6."); - aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); + aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && (aBaseMetaTileEntity.getUniversalEnergyStored() >= (this.maxEUOutput() + this.getMinimumStoredEU()))); } } } @@ -109,65 +110,65 @@ public class GregtechMetaTileEntitySolarGenerator extends GregtechMetaSolarGener @Override public long maxEUStore() { - return Math.max(getEUVar(), V[mTier] * 16000 + getMinimumStoredEU()); + return Math.max(this.getEUVar(), (V[this.mTier] * 16000) + this.getMinimumStoredEU()); } - ITexture SolarArray[] = {new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_8V), + ITexture SolarArray[] = {new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_8V), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_LV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_MV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_HV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_EV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_IV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_LuV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_ZPM), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_UV), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL)}; @Override - public ITexture[] getFront(byte aColor) { + public ITexture[] getFront(final byte aColor) { return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; } @Override - public ITexture[] getBack(byte aColor) { + public ITexture[] getBack(final byte aColor) { return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC)}; } @Override - public ITexture[] getBottom(byte aColor) { + public ITexture[] getBottom(final byte aColor) { return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC)}; } @Override - public ITexture[] getTop(byte aColor) { + public ITexture[] getTop(final byte aColor) { return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL)}; } @Override - public ITexture[] getSides(byte aColor) { + public ITexture[] getSides(final byte aColor) { return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC)}; } @Override - public ITexture[] getFrontActive(byte aColor) { + public ITexture[] getFrontActive(final byte aColor) { return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; } @Override - public ITexture[] getBackActive(byte aColor) { + public ITexture[] getBackActive(final byte aColor) { return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)}; } @Override - public ITexture[] getBottomActive(byte aColor) { + public ITexture[] getBottomActive(final byte aColor) { return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)}; } @Override - public ITexture[] getTopActive(byte aColor) { + public ITexture[] getTopActive(final byte aColor) { return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL)}; } @Override - public ITexture[] getSidesActive(byte aColor) { + public ITexture[] getSidesActive(final byte aColor) { return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)}; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySuperCondensor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySuperCondensor.java index 5d1befbbad..89ed69e247 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySuperCondensor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySuperCondensor.java @@ -9,96 +9,96 @@ import gregtech.api.util.GT_Recipe; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GregtechMetaSuperConductorNodeBase; public class GregtechMetaTileEntitySuperCondensor - extends GregtechMetaSuperConductorNodeBase { +extends GregtechMetaSuperConductorNodeBase { - public int mEfficiency; + public int mEfficiency; - public GregtechMetaTileEntitySuperCondensor(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires liquid Nitrogen/Helium", new ITexture[0]); - onConfigLoad(); - } + public GregtechMetaTileEntitySuperCondensor(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier, "Requires liquid Nitrogen/Helium", new ITexture[0]); + this.onConfigLoad(); + } - public GregtechMetaTileEntitySuperCondensor(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - onConfigLoad(); - } + public GregtechMetaTileEntitySuperCondensor(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + this.onConfigLoad(); + } - @Override - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); - } + @Override + public boolean isOutputFacing(final byte aSide) { + return aSide == this.getBaseMetaTileEntity().getFrontFacing(); + } - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntitySuperCondensor(this.mName, this.mTier, this.mDescription, this.mTextures); - } + @Override + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntitySuperCondensor(this.mName, this.mTier, this.mDescription, this.mTextures); + } - @Override + @Override public GT_Recipe.GT_Recipe_Map getRecipes() { - return GT_Recipe.GT_Recipe_Map.sDieselFuels; - } + return GT_Recipe.GT_Recipe_Map.sDieselFuels; + } - @Override + @Override public int getCapacity() { - return 64000; - } + return 64000; + } - public void onConfigLoad() { - this.mEfficiency = 100; - } + public void onConfigLoad() { + this.mEfficiency = 100; + } - @Override + @Override public int getEfficiency() { - return this.mEfficiency; - } - - @Override - public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; - } - - @Override - public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; - } - - @Override - public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; - } - - @Override - public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP)}; - } - - @Override - public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; - } - - @Override - public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; - } - - @Override - public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; - } - - @Override - public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; - } - - @Override - public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE)}; - } - - @Override - public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; - } + return this.mEfficiency; + } + + @Override + public ITexture[] getFront(final byte aColor) { + return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; + } + + @Override + public ITexture[] getBack(final byte aColor) { + return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; + } + + @Override + public ITexture[] getBottom(final byte aColor) { + return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; + } + + @Override + public ITexture[] getTop(final byte aColor) { + return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP)}; + } + + @Override + public ITexture[] getSides(final byte aColor) { + return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; + } + + @Override + public ITexture[] getFrontActive(final byte aColor) { + return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]}; + } + + @Override + public ITexture[] getBackActive(final byte aColor) { + return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; + } + + @Override + public ITexture[] getBottomActive(final byte aColor) { + return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; + } + + @Override + public ITexture[] getTopActive(final byte aColor) { + return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE)}; + } + + @Override + public ITexture[] getSidesActive(final byte aColor) { + return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR), Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java index 0d9fadc6df..b68c49c48c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; import static gregtech.api.enums.GT_Values.V; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -13,117 +14,118 @@ import net.minecraft.nbt.NBTTagCompound; public class GregtechMetaTileEntityChunkLoader extends GT_MetaTileEntity_TieredMachineBlock { - public int mRange = 16; - - public GregtechMetaTileEntityChunkLoader(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Reprells nasty Creatures. Range: " + (4 + (12 * aTier)) + " unpowered / " + (16 + (48 * aTier)) + " powered"); - } - - public GregtechMetaTileEntityChunkLoader(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityChunkLoader(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide != 1) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER)}; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide()) { - int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; - if ((aTimer % 600 == 0) && !GT_SpawnEventHandler.mobReps.contains(tCoords)) { - GT_SpawnEventHandler.mobReps.add(tCoords); - } - if (aBaseMetaTileEntity.isUniversalEnergyStored(getMinimumStoredEU()) && aBaseMetaTileEntity.decreaseStoredEnergyUnits(1 << (this.mTier * 2), false)) { - mRange = 16 + (48 * mTier); - } else { - mRange = 4 + (12 * mTier); - } - } - } - - @Override - public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { - int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; - GT_SpawnEventHandler.mobReps.add(tCoords); - } - - @Override - public void onRemoval() { - int[] tCoords = new int[]{this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId}; - GT_SpawnEventHandler.mobReps.remove(tCoords); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isInputFacing(byte aSide) { - return true; - } - - @Override - public boolean isTeleporterCompatible() { - return false; - } - - @Override - public long getMinimumStoredEU() { - return 512; - } - - @Override - public long maxEUStore() { - return 512 + V[mTier] * 50; - } - - @Override - public long maxEUInput() { - return V[mTier]; - } - - @Override - public long maxAmperesIn() { - return 2; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - return null; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - } + public int mRange = 16; + + public GregtechMetaTileEntityChunkLoader(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier, 0, "Reprells nasty Creatures. Range: " + (4 + (12 * aTier)) + " unpowered / " + (16 + (48 * aTier)) + " powered"); + } + + public GregtechMetaTileEntityChunkLoader(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityChunkLoader(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures); + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], (aSide != 1) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER)}; + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTimer) { + if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide()) { + final int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; + if (((aTimer % 600) == 0) && !GT_SpawnEventHandler.mobReps.contains(tCoords)) { + GT_SpawnEventHandler.mobReps.add(tCoords); + } + if (aBaseMetaTileEntity.isUniversalEnergyStored(this.getMinimumStoredEU()) && aBaseMetaTileEntity.decreaseStoredEnergyUnits(1 << (this.mTier * 2), false)) { + this.mRange = 16 + (48 * this.mTier); + } else { + this.mRange = 4 + (12 * this.mTier); + } + } + } + + @Override + public void onFirstTick(final IGregTechTileEntity aBaseMetaTileEntity) { + final int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; + GT_SpawnEventHandler.mobReps.add(tCoords); + } + + @Override + public void onRemoval() { + final int[] tCoords = new int[]{this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId}; + GT_SpawnEventHandler.mobReps.remove(tCoords); + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return true; + } + + @Override + public boolean isEnetInput() { + return true; + } + + @Override + public boolean isInputFacing(final byte aSide) { + return true; + } + + @Override + public boolean isTeleporterCompatible() { + return false; + } + + @Override + public long getMinimumStoredEU() { + return 512; + } + + @Override + public long maxEUStore() { + return 512 + (V[this.mTier] * 50); + } + + @Override + public long maxEUInput() { + return V[this.mTier]; + } + + @Override + public long maxAmperesIn() { + return 2; + } + + @Override + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return false; + } + + @Override + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + return null; + } + + @Override + public void saveNBTData(final NBTTagCompound aNBT) { + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java index 9b11e82dbd..33bfbc2f1f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; +import java.util.Collection; + import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -19,10 +22,6 @@ import gtPlusPlus.core.material.nuclear.NUCLIDE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; - -import java.util.ArrayList; -import java.util.Collection; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; @@ -42,17 +41,17 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase //public FluidStack mFluidOut = Materials.UUMatter.getFluid(1L); - public GregtechMTE_NuclearReactor(int aID, String aName, String aNameRegional) { + public GregtechMTE_NuclearReactor(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMTE_NuclearReactor(String aName) { + public GregtechMTE_NuclearReactor(final String aName) { super(aName); } @Override public long maxEUStore() { - return 640000000L * (Math.min(16, this.mEnergyHatches.size())) / 16L; + return (640000000L * (Math.min(16, this.mEnergyHatches.size()))) / 16L; } @Override @@ -74,20 +73,20 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase @Override public String[] getInfoData() { - String tRunning = (mMaxProgresstime>0 ? "Reactor running":"Reactor stopped"); - String tMaintainance = (getIdealStatus() == getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"); + final String tRunning = (this.mMaxProgresstime>0 ? "Reactor running":"Reactor stopped"); + final String tMaintainance = (this.getIdealStatus() == this.getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"); return new String[]{ "Liquid Fluoride Thorium Reactor", tRunning, tMaintainance, - "Current Output: "+(mEUt*mEfficiency/10000)+" EU/t", - "Fuel Consumption: "+fuelConsumption+"L/t", - "Fuel Value: "+fuelValue+" EU/L", - "Fuel Remaining: "+fuelRemaining+" Litres", - "Current Efficiency: "+(mEfficiency/100)+"%", - "Optimal Fuel Flow: "+(int)realOptFlow+" L/t", - "Current Speed: "+(mEfficiency/100)+"%",}; + "Current Output: "+((this.mEUt*this.mEfficiency)/10000)+" EU/t", + "Fuel Consumption: "+this.fuelConsumption+"L/t", + "Fuel Value: "+this.fuelValue+" EU/L", + "Fuel Remaining: "+this.fuelRemaining+" Litres", + "Current Efficiency: "+(this.mEfficiency/100)+"%", + "Optimal Fuel Flow: "+(int)this.realOptFlow+" L/t", + "Current Speed: "+(this.mEfficiency/100)+"%",}; } @Override @@ -96,12 +95,12 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { - return aSide != getBaseMetaTileEntity().getFrontFacing(); + public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aStack) { + return aSide != this.getBaseMetaTileEntity().getFrontFacing(); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[70], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR)}; @@ -110,12 +109,12 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MatterFabricator.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png"); } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { // Life Lessons from Greg. /** @@ -135,22 +134,22 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase [23:46:06] <Alkalus> Noted, thanks :D */ - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 3; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 3; + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 3; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 3; for (int i = -3; i <= 3; i++) { for (int j = -3; j <= 3; j++) { for (int h = 0; h < 4; h++) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); // Reactor Floor/Roof inner 5x5 - if ((i != -3 && i != 3) && (j != -3 && j != 3)) { + if (((i != -3) && (i != 3)) && ((j != -3) && (j != 3))) { // Reactor Floor & Roof (Inner 5x5) + Mufflers, Dynamos and Fluid outputs. - if (h == 0 || h == 3) { + if ((h == 0) || (h == 3)) { //If not a hatch, continue, else add hatch and continue. - if ((!addMufflerToMachineList(tTileEntity, 70)) && (!addOutputToMachineList(tTileEntity, 70)) && (!addDynamoToMachineList(tTileEntity, 70))) { + if ((!this.addMufflerToMachineList(tTileEntity, 70)) && (!this.addOutputToMachineList(tTileEntity, 70)) && (!this.addDynamoToMachineList(tTileEntity, 70))) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); @@ -160,16 +159,16 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3. Wrong Meta for Casing."); return false; } - } - } + } + } // Inside 2 layers, mostly air - else { + else { // Reactor Inner 5x5 //if ((i != -1 && i != 1) && (j != -1 && j != 1)) { if (!aBaseMetaTileEntity.getAirOffset(xDir + i, h, zDir + j)) { - Utils.LOG_INFO("Make sure the inner 3x3 of the Multiblock is Air."); + Utils.LOG_INFO("Make sure the inner 3x3 of the Multiblock is Air."); return false; } @@ -187,7 +186,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3."); return false; } - }*/ + }*/ } @@ -195,7 +194,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase else { //Deal with all 4 sides (Reactor walls) - if (h == 1 || h == 2) { + if ((h == 1) || (h == 2)) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); @@ -205,13 +204,13 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; - } + } } //Deal with top and Bottom edges (Inner 5x5) - else if (h == 0 || h == 3) { - if ((!addToMachineList(tTileEntity, 70)) && (!addInputToMachineList(tTileEntity, 70)) && (!addOutputToMachineList(tTileEntity, 70)) && (!addDynamoToMachineList(tTileEntity, 70))) { - if ((xDir + i != 0) || (zDir + j != 0)) {//no controller + else if ((h == 0) || (h == 3)) { + if ((!this.addToMachineList(tTileEntity, 70)) && (!this.addInputToMachineList(tTileEntity, 70)) && (!this.addOutputToMachineList(tTileEntity, 70)) && (!this.addDynamoToMachineList(tTileEntity, 70))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("LFTR Casing(s) Missing from one of the edges on the top layer."); @@ -254,7 +253,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if (this.mOutputHatches != null) { for (int i = 0; i < this.mOutputHatches.size(); i++) { - if (this.mOutputHatches.get(i).mTier < 5 && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ + if ((this.mOutputHatches.get(i).mTier < 5) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ Utils.LOG_INFO("You require at LEAST V tier Output Hatches."); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); @@ -272,79 +271,79 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } } } - mWrench = true; - mScrewdriver = true; - mSoftHammer = true; - mHardHammer = true; - mSolderingTool = true; - mCrowbar = true; - turnCasingActive(true); + this.mWrench = true; + this.mScrewdriver = true; + this.mSoftHammer = true; + this.mHardHammer = true; + this.mSolderingTool = true; + this.mCrowbar = true; + this.turnCasingActive(true); Utils.LOG_INFO("Multiblock Formed."); return true; } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { + public boolean isCorrectMachinePart(final ItemStack aStack) { return true; } @Override - public int getMaxEfficiency(ItemStack aStack) { - return boostEu ? 30000 : 10000; + public int getMaxEfficiency(final ItemStack aStack) { + return this.boostEu ? 30000 : 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 5; } @Override - public int getDamageToComponent(ItemStack aStack) { + public int getDamageToComponent(final ItemStack aStack) { return 0; } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return true; } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMTE_NuclearReactor(this.mName); } - public static int overclock(int mStartEnergy) { + public static int overclock(final int mStartEnergy) { return mStartEnergy < 160000000 ? 4 : mStartEnergy < 320000000 ? 2 : 1; } - public boolean turnCasingActive(boolean status) { + public boolean turnCasingActive(final boolean status) { if (this.mDynamoHatches != null) { - for (GT_MetaTileEntity_Hatch_Dynamo hatch : this.mDynamoHatches) { + for (final GT_MetaTileEntity_Hatch_Dynamo hatch : this.mDynamoHatches) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mMufflerHatches != null) { - for (GT_MetaTileEntity_Hatch_Muffler hatch : this.mMufflerHatches) { + for (final GT_MetaTileEntity_Hatch_Muffler hatch : this.mMufflerHatches) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mOutputHatches != null) { - for (GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { + for (final GT_MetaTileEntity_Hatch_Output hatch : this.mOutputHatches) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mInputHatches != null) { - for (GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { + for (final GT_MetaTileEntity_Hatch_Input hatch : this.mInputHatches) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mOutputBusses != null) { - for (GT_MetaTileEntity_Hatch_OutputBus hatch : this.mOutputBusses) { + for (final GT_MetaTileEntity_Hatch_OutputBus hatch : this.mOutputBusses) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } if (this.mInputBusses != null) { - for (GT_MetaTileEntity_Hatch_InputBus hatch : this.mInputBusses) { + for (final GT_MetaTileEntity_Hatch_InputBus hatch : this.mInputBusses) { hatch.mMachineBlock = status ? (byte) 70 : (byte) 71; } } @@ -354,107 +353,107 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList<FluidStack> tFluids = getStoredFluids(); - Collection<GT_Recipe> tRecipeList = Recipe_GT.Gregtech_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mRecipeList; - if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a LFTR fuel? + public boolean checkRecipe(final ItemStack aStack) { + final ArrayList<FluidStack> tFluids = this.getStoredFluids(); + final Collection<GT_Recipe> tRecipeList = Recipe_GT.Gregtech_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mRecipeList; + if((tFluids.size() > 0) && (tRecipeList != null)) { //Does input hatch have a LFTR fuel? Utils.LOG_INFO("Found more than one input fluid and a list of valid recipes."); - boolean containsFLIBE = false; - boolean containsPrimarySalt = false; - for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches + final boolean containsFLIBE = false; + final boolean containsPrimarySalt = false; + for (final FluidStack hatchFluid1 : tFluids) { //Loops through hatches Utils.LOG_INFO("Looping through Input hatches - Found "+hatchFluid1.getLocalizedName()); - for(GT_Recipe aFuel : tRecipeList) { //Loops through LFTR fuel recipes + for(final GT_Recipe aFuel : tRecipeList) { //Loops through LFTR fuel recipes Utils.LOG_INFO("Looping through Recipes. "+aFuel.mSpecialValue); - FluidStack tLiquid; - FluidStack testStack = aFuel.mFluidInputs[1]; + FluidStack tLiquid; + final FluidStack testStack = aFuel.mFluidInputs[1]; if ((tLiquid = testStack) != null) { //Create fluidstack from current recipe Utils.LOG_INFO("Creating a fluidstack from the current recipe"); if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a LFTR fluid - fuelConsumption = tLiquid.amount = boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048); //Calc fuel consumption - Utils.LOG_INFO("Input hatch contains some FLiBe Fuel, using "+fuelConsumption); - if(depleteInput(tLiquid)) { //Deplete that amount + this.fuelConsumption = tLiquid.amount = this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048); //Calc fuel consumption + Utils.LOG_INFO("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption); + if(this.depleteInput(tLiquid)) { //Deplete that amount Utils.LOG_INFO("Depleted some FLiBe fluid"); this.mMaxProgresstime = 500; - + if(tFluids.contains(NUCLIDE.LiFBeF2ThF4UF4.getFluid(1)) || tFluids.contains(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(2)) || tFluids.contains(NUCLIDE.LiFBeF2ZrF4U235.getFluid(10))) { //Has a Primary fuel salt? //Deplete Primary Salt. 1000L should = 1 hour of runtime (if baseEU = 2048) && using 1l each time - if(mRuntime % 72 == 0 || mRuntime == 0){ + if(((this.mRuntime % 72) == 0) || (this.mRuntime == 0)){ //U235 fuel is 10x less efficient than UF4 with Thorium, UF4 with Zirconium is only 2x less efficient than UF4 with Thorium. //Most Efficient if(tFluids.contains(NUCLIDE.LiFBeF2ThF4UF4.getFluid(2))){ - depleteInput(NUCLIDE.LiFBeF2ThF4UF4.getFluid(boostEu ? 2 : 1)); - Utils.LOG_INFO("Depleted "+(boostEu ? 2 : 1)+"L of LiFBeF2ThF4UF4 fluid"); + this.depleteInput(NUCLIDE.LiFBeF2ThF4UF4.getFluid(this.boostEu ? 2 : 1)); + Utils.LOG_INFO("Depleted "+(this.boostEu ? 2 : 1)+"L of LiFBeF2ThF4UF4 fluid"); } //1/2 as Efficient if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(4))){ - depleteInput(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(boostEu ? 4 : 2)); - Utils.LOG_INFO("Depleted "+(boostEu ? 4 : 2)+"L of LiFBeF2ZrF4UF4 fluid"); + this.depleteInput(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(this.boostEu ? 4 : 2)); + Utils.LOG_INFO("Depleted "+(this.boostEu ? 4 : 2)+"L of LiFBeF2ZrF4UF4 fluid"); } //10x less Efficient. - if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4U235.getFluid(20))) { - depleteInput(NUCLIDE.LiFBeF2ZrF4U235.getFluid(boostEu ? 20 : 10)); - Utils.LOG_INFO("Depleted "+(boostEu ? 20 : 10)+"L of LiFBeF2ZrF4U235 fluid"); + if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4U235.getFluid(20))) { + this.depleteInput(NUCLIDE.LiFBeF2ZrF4U235.getFluid(this.boostEu ? 20 : 10)); + Utils.LOG_INFO("Depleted "+(this.boostEu ? 20 : 10)+"L of LiFBeF2ZrF4U235 fluid"); } } } else { return false; } - + //Try Sparge Noble Gases - if (depleteInput(Materials.Helium.getGas(1000L)) && heliumSparging){ + if (this.depleteInput(Materials.Helium.getGas(1000L)) && this.heliumSparging){ //Make an empty fluid stack for possible sparging output FluidStack[] spargeOutput = new FluidStack[]{}; Utils.LOG_INFO("Doing a Sparge with Helium"); - spargeOutput = getByproductsOfSparge(Materials.Helium.getGas(1000L)); - heliumSparging = false; + spargeOutput = this.getByproductsOfSparge(Materials.Helium.getGas(1000L)); + this.heliumSparging = false; //If Sparging occurred, try add the outputs to the output hatches. try { - if (spargeOutput.length >= 1){ - for (FluidStack F : spargeOutput){ - Utils.LOG_INFO("Adding Sparge Output - "+F.getLocalizedName()); - addOutput(F); + if (spargeOutput.length >= 1){ + for (final FluidStack F : spargeOutput){ + Utils.LOG_INFO("Adding Sparge Output - "+F.getLocalizedName()); + this.addOutput(F); + } } - } - } catch (Throwable T){} + } catch (final Throwable T){} } - + //Try Sparge Fluorides - if (depleteInput(Materials.Fluorine.getGas(100L)) && !heliumSparging){ + if (this.depleteInput(Materials.Fluorine.getGas(100L)) && !this.heliumSparging){ //Make an empty fluid stack for possible sparging output FluidStack[] spargeOutput = new FluidStack[]{}; Utils.LOG_INFO("Doing a Sparge with Fluorine"); - spargeOutput = getByproductsOfSparge(Materials.Fluorine.getGas(100L)); - heliumSparging = true; + spargeOutput = this.getByproductsOfSparge(Materials.Fluorine.getGas(100L)); + this.heliumSparging = true; //If Sparging occurred, try add the outputs to the output hatches. if (spargeOutput.length > 0){ - for (FluidStack F : spargeOutput){ + for (final FluidStack F : spargeOutput){ Utils.LOG_INFO("Adding Sparge Output - "+F.getLocalizedName()); - addOutput(F); + this.addOutput(F); } } } - + if (aFuel != null){ Utils.LOG_INFO("Saving previous Recipe."); - this.mLastRecipe = aFuel; + this.mLastRecipe = aFuel; } - - fuelValue = aFuel.mSpecialValue; - fuelRemaining = hatchFluid1.amount; //Record available fuel - + + this.fuelValue = aFuel.mSpecialValue; + this.fuelRemaining = hatchFluid1.amount; //Record available fuel + if (this.mEfficiency < 500){ this.mEfficiency++; } - - this.mEUt = (mEfficiency < 500 ? 2048 : (8196*4)); //Output 0 if startup is less than 20% + + this.mEUt = (this.mEfficiency < 500 ? 2048 : (8196*4)); //Output 0 if startup is less than 20% Utils.LOG_INFO("Generating "+this.mEUt+"EU/t @ an efficiency level of "+this.mEfficiency); - + this.mProgresstime = 1; this.mMaxProgresstime = 1; this.mEfficiencyIncrease = 15; @@ -522,18 +521,18 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } - protected FluidStack[] getByproductsOfSparge(FluidStack spargeGas){ + protected FluidStack[] getByproductsOfSparge(final FluidStack spargeGas){ FluidStack[] outputArrayOfGases = new FluidStack[]{}; if (spargeGas != null){ if (spargeGas.isFluidEqual(Materials.Helium.getGas(1000))){ - int outputChances[] = { + final int outputChances[] = { MathUtils.roundToClosestInt(MathUtils.randInt(10, 1000)/10), MathUtils.roundToClosestInt(MathUtils.randInt(10, 600)/10), MathUtils.roundToClosestInt(MathUtils.randInt(10, 400)/10), MathUtils.roundToClosestInt(MathUtils.randInt(10, 1000)/10), - MathUtils.roundToClosestInt(MathUtils.randInt(10, 100)/10) + MathUtils.roundToClosestInt(MathUtils.randInt(10, 100)/10) }; - int heliumContent = (1000-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]-outputChances[4]); + final int heliumContent = (1000-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]-outputChances[4]); Utils.LOG_INFO("Helium remaining: "+heliumContent); outputArrayOfGases = new FluidStack[]{ ELEMENT.getInstance().XENON.getFluid(outputChances[0]), @@ -541,24 +540,24 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase ELEMENT.getInstance().ARGON.getFluid(outputChances[2]), ELEMENT.getInstance().KRYPTON.getFluid(outputChances[3]), ELEMENT.getInstance().RADON.getFluid(outputChances[4]), - Materials.Helium.getGas(heliumContent) + Materials.Helium.getGas(heliumContent) }; } else if (spargeGas.isFluidEqual(Materials.Fluorine.getGas(100))){ - int outputChances[] = { + final int outputChances[] = { MathUtils.roundToClosestInt(MathUtils.randDouble(10, 100)), MathUtils.roundToClosestInt(MathUtils.randDouble(1, 50)/10), MathUtils.roundToClosestInt(MathUtils.randDouble(1, 50)/10), - MathUtils.roundToClosestInt(MathUtils.randDouble(1, 50)/10) + MathUtils.roundToClosestInt(MathUtils.randDouble(1, 50)/10) }; - int fluorineContent = (100-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]); + final int fluorineContent = (100-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]); Utils.LOG_INFO("Fluorine remaining: "+fluorineContent); outputArrayOfGases = new FluidStack[]{ FLUORIDES.URANIUM_HEXAFLUORIDE.getFluid(outputChances[0]), FLUORIDES.NEPTUNIUM_HEXAFLUORIDE.getFluid(outputChances[1]), FLUORIDES.TECHNETIUM_HEXAFLUORIDE.getFluid(outputChances[2]), FLUORIDES.SELENIUM_HEXAFLUORIDE.getFluid(outputChances[3]), - Materials.Fluorine.getGas(fluorineContent) + Materials.Fluorine.getGas(fluorineContent) }; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java index 5a165c4072..2114bd1af2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.lang.reflect.Field; + import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -15,9 +17,6 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.forestry.trees.TreefarmManager; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -import java.lang.reflect.Field; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -33,20 +32,20 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo //public ArrayList<GT_MetaTileEntity_TieredMachineBlock> mCasings = new ArrayList(); - private boolean running = false; + private final boolean running = false; private boolean p1, p2, p3, p4, p5, p6; public ItemStack mOutputItem1; public ItemStack mOutputItem2; private Block Humus; - private boolean isForestryLoaded = TreefarmManager.isForestryValid(); + private final boolean isForestryLoaded = TreefarmManager.isForestryValid(); - public GregtechMetaTileEntityAnimalFarm(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntityAnimalFarm(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntityAnimalFarm(String aName) { + public GregtechMetaTileEntityAnimalFarm(final String aName) { super(aName); - } + } @Override public String[] getDescription() { @@ -55,11 +54,11 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo "How to get your first logs without an axe.", "Max Size(WxHxD): 9x1x9 (Controller, with upto 4 dirt out each direction on a flat plane.)", "Dirt for the rest! [D = Dirt, X = Controller]" - }; + }; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == 1) { return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Vent_Fast : TexturesGtBlock.Overlay_Machine_Vent)}; } @@ -77,39 +76,41 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { + public boolean isAccessAllowed(final EntityPlayer aPlayer) { return true; } @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { + public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aCoverID) { return (GregTech_API.getCoverBehavior(aCoverID.toStack()).isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID)); } @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntityAnimalFarm(this.mName); } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } return true; } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { + public boolean isCorrectMachinePart(final ItemStack aStack) { return true; } @Override - public boolean checkRecipe(ItemStack aStack) { + public boolean checkRecipe(final ItemStack aStack) { Utils.LOG_INFO("Working"); /*if (!checkRecursiveBlocks()) { this.mEfficiency = 0; @@ -137,16 +138,16 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo if (!LoadedMods.Forestry){ return null; } - return TreefarmManager.getHumus(); + return TreefarmManager.getHumus(); } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { //this.mCasings.clear(); Utils.LOG_INFO("Step 1"); - int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; - int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; for (int i = -7; i <= 7; i++) { Utils.LOG_INFO("Step 2"); @@ -155,10 +156,10 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo for (int h = 0; h <= 1; h++) { Utils.LOG_INFO("Step 4"); - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); //Farm Floor inner 14x14 - if ((i != -7 && i != 7) && (j != -7 && j != 7)) { + if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) { Utils.LOG_INFO("Step 5 - H:"+h); // Farm Dirt Floor and Inner Air/Log space. if (h == 0) { @@ -172,40 +173,40 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo (aBaseMetaTileEntity.getZCoord()+(zDir+j)), Blocks.melon_block); return false; - } - } + } + } // Inside fenced area, mostly air or trees or saplings - else if (h == 1){ + else if (h == 1){ //Farm Inner 14x14 /*if (!TreefarmManager.isWoodLog(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)) || !TreefarmManager.isAirBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)) || !aBaseMetaTileEntity.getAirOffset(xDir+i, h, zDir+j)) { Utils.LOG_INFO("Wood like block missing from inner 14x14, layer 2."); //TODO - Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); Utils.LOG_INFO("Found at x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)); //return false; - }*/ - } + }*/ + } } //Dealt with inner 5x5, now deal with the exterior. else { Utils.LOG_INFO("Step 6 - H:"+h); //Deal with all 4 sides (Fenced area) - if (h == 1) { + if (h == 1) { if (!TreefarmManager.isFenceBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) { Utils.LOG_INFO("Fence/Gate missing from outside the second layer."); Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; - } + } } //Deal with Bottom edges (Add Hatches/Busses first, othercheck make sure it's dirt) //TODO change the casings to not dirt~ else if (h == 0) { try { - addCasingToCasingList(tTileEntity); - } catch (Throwable t){} + this.addCasingToCasingList(tTileEntity); + } catch (final Throwable t){} - if ((!addMaintenanceToMachineList(tTileEntity, 77)) && (!addInputToMachineList(tTileEntity, 77)) && (!addOutputToMachineList(tTileEntity, 77)) && (!addEnergyInputToMachineList(tTileEntity, 77))) { - if ((xDir + i != 0) || (zDir + j != 0)) {//no controller + if ((!this.addMaintenanceToMachineList(tTileEntity, 77)) && (!this.addInputToMachineList(tTileEntity, 77)) && (!this.addOutputToMachineList(tTileEntity, 77)) && (!this.addEnergyInputToMachineList(tTileEntity, 77))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (!(aBaseMetaTileEntity.getMetaTileID() != 752)) { Utils.LOG_INFO("Fark Keeper Casings Missing from one of the edges on the bottom edge. x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)+" | "+aBaseMetaTileEntity.getClass()); @@ -241,7 +242,7 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo if (this.mOutputHatches != null) { for (int i = 0; i < this.mOutputHatches.size(); i++) { - if (this.mOutputHatches.get(i).mTier < 2 && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ + if ((this.mOutputHatches.get(i).mTier < 2) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ Utils.LOG_INFO("You require at LEAST MV tier Output Hatches."); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); @@ -260,24 +261,24 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo } } } - mSolderingTool = true; + this.mSolderingTool = true; //turnCasingActive(true); Utils.LOG_INFO("Multiblock Formed."); return true; } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @Override - public int getDamageToComponent(ItemStack aStack) { + public int getDamageToComponent(final ItemStack aStack) { return 0; } @@ -287,29 +288,31 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } - public boolean addCasingToCasingList(IGregTechTileEntity aTileEntity) { - if (aTileEntity == null) + public boolean addCasingToCasingList(final IGregTechTileEntity aTileEntity) { + if (aTileEntity == null) { return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { return false; + } if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) { //return this.mCasings.add((GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity); } return false; } - private GT_MetaTileEntity_TieredMachineBlock changeTextureswithReflection(GT_MetaTileEntity_TieredMachineBlock casing, ITexture[][][] textureSet){ - GT_MetaTileEntity_TieredMachineBlock cv = casing; + private GT_MetaTileEntity_TieredMachineBlock changeTextureswithReflection(final GT_MetaTileEntity_TieredMachineBlock casing, final ITexture[][][] textureSet){ + final GT_MetaTileEntity_TieredMachineBlock cv = casing; //System.out.println("Before: "+cv.mTextures.hashCode()); //Get declared field from class Field f; try { - Field[] x = cv.getClass().getFields(); + final Field[] x = cv.getClass().getFields(); for (int i =0; i<x.length;i++){ //Utils.LOG_INFO(x[i].getName()); } @@ -317,13 +320,13 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo //Try get the field variable f = cv.getClass().getField("mTextures"); // set the accessiblity of the field to true, this will enable you to change the value - f.setAccessible(true); + f.setAccessible(true); //change the field value f.set(cv, textureSet); //Verify change in texture set //System.out.println("After: "+cv.mTextures.hashCode()); return cv; - } catch (NoSuchFieldException e) { + } catch (final NoSuchFieldException e) { Utils.LOG_INFO("Could not find mTextures."); return casing; } @@ -336,60 +339,60 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo public ITexture[][][] getTextureSet() { - ITexture[][][] rTextures = new ITexture[10][17][]; + final ITexture[][][] rTextures = new ITexture[10][17][]; for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = getFront(i); - rTextures[1][i + 1] = getBack(i); - rTextures[2][i + 1] = getBottom(i); - rTextures[3][i + 1] = getTop(i); - rTextures[4][i + 1] = getSides(i); - rTextures[5][i + 1] = getFrontActive(i); - rTextures[6][i + 1] = getBackActive(i); - rTextures[7][i + 1] = getBottomActive(i); - rTextures[8][i + 1] = getTopActive(i); - rTextures[9][i + 1] = getSidesActive(i); + rTextures[0][i + 1] = this.getFront(i); + rTextures[1][i + 1] = this.getBack(i); + rTextures[2][i + 1] = this.getBottom(i); + rTextures[3][i + 1] = this.getTop(i); + rTextures[4][i + 1] = this.getSides(i); + rTextures[5][i + 1] = this.getFrontActive(i); + rTextures[6][i + 1] = this.getBackActive(i); + rTextures[7][i + 1] = this.getBottomActive(i); + rTextures[8][i + 1] = this.getTopActive(i); + rTextures[9][i + 1] = this.getSidesActive(i); } return rTextures; } - public ITexture[] getFront(byte aColor) { + public ITexture[] getFront(final byte aColor) { return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; } - public ITexture[] getBack(byte aColor) { + public ITexture[] getBack(final byte aColor) { return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; } - public ITexture[] getBottom(byte aColor) { + public ITexture[] getBottom(final byte aColor) { return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; } - public ITexture[] getTop(byte aColor) { + public ITexture[] getTop(final byte aColor) { return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; } - public ITexture[] getSides(byte aColor) { + public ITexture[] getSides(final byte aColor) { return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][aColor + 1]}; } - public ITexture[] getFrontActive(byte aColor) { - return getFront(aColor); + public ITexture[] getFrontActive(final byte aColor) { + return this.getFront(aColor); } - public ITexture[] getBackActive(byte aColor) { - return getBack(aColor); + public ITexture[] getBackActive(final byte aColor) { + return this.getBack(aColor); } - public ITexture[] getBottomActive(byte aColor) { - return getBottom(aColor); + public ITexture[] getBottomActive(final byte aColor) { + return this.getBottom(aColor); } - public ITexture[] getTopActive(byte aColor) { - return getTop(aColor); + public ITexture[] getTopActive(final byte aColor) { + return this.getTop(aColor); } - public ITexture[] getSidesActive(byte aColor) { - return getSides(aColor); + public ITexture[] getSidesActive(final byte aColor) { + return this.getSides(aColor); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java index aa5580858b..ac3f5622b1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; + +import cpw.mods.fml.common.Optional; import forestry.api.arboriculture.ITree; import forestry.api.arboriculture.TreeManager; import forestry.api.genetics.IIndividual; @@ -28,9 +31,6 @@ import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_TreeFarmer; import gtPlusPlus.xmod.gregtech.api.gui.GUI_TreeFarmer; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.helpers.TreeFarmHelper; - -import java.util.ArrayList; - import net.minecraft.block.Block; import net.minecraft.entity.player.*; import net.minecraft.item.ItemStack; @@ -38,30 +38,29 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; -import cpw.mods.fml.common.Optional; public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlockBase { /* private */ private int treeCheckTicks = 0; /* private */ private int plantSaplingTicks = 0; /* private */ private int cleanupTicks = 0; - /* private */ public long mInternalPower = 0; + /* private */ public long mInternalPower = 0; /* private */ private static int powerDrain = 32; private short energyHatchRetryCount = 0; //Too Many logs, lag breaker - private boolean takingBreak = false; - private int logsToBreakAfter = 500; + private final boolean takingBreak = false; + private final int logsToBreakAfter = 500; private EntityPlayerMP farmerAI; private SAWTOOL mCurrentMachineTool = SAWTOOL.NONE; private boolean canChop = false; - private int cuttingNumber = 0; - private int cuttingNumber2 = 0; - private int cuttingNumber3 = 0; + private final int cuttingNumber = 0; + private final int cuttingNumber2 = 0; + private final int cuttingNumber3 = 0; public GregtechMetaTileEntityTreeFarm(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -69,7 +68,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock public GregtechMetaTileEntityTreeFarm(final String aName) { super(aName); - } + } @Override public String[] getDescription() { @@ -91,34 +90,34 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override - public void saveNBTData(NBTTagCompound aNBT) { + public void saveNBTData(final NBTTagCompound aNBT) { aNBT.setLong("mInternalPower", this.mInternalPower); super.saveNBTData(aNBT); } @Override - public void loadNBTData(NBTTagCompound aNBT) { + public void loadNBTData(final NBTTagCompound aNBT) { this.mInternalPower = aNBT.getLong("mInternalPower"); super.loadNBTData(aNBT); } @Override - public boolean drainEnergyInput(long aEU) { + public boolean drainEnergyInput(final long aEU) { this.mInternalPower = (this.mInternalPower-32); - Utils.LOG_MACHINE_INFO("Draining internal power storage by 32EU. Stored:"+this.mInternalPower); + Utils.LOG_MACHINE_INFO("Draining internal power storage by 32EU. Stored:"+this.mInternalPower); return true; } - public boolean addPowerToInternalStorage(IGregTechTileEntity aBaseMetaTileEntity){ + public boolean addPowerToInternalStorage(final IGregTechTileEntity aBaseMetaTileEntity){ if (this.mEnergyHatches.size() > 0) { - for (final GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches){ + for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches){ if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getEUVar() >= 128) { + if (tHatch.getEUVar() >= 128) { for (int o=0;o<(tHatch.getEUVar()/128);o++){ - if (this.mInternalPower<(maxEUStore()-128)){ - tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(128, false); - this.mInternalPower = (this.mInternalPower+128); - //Utils.LOG_MACHINE_INFO("Increasing internal power storage by 128EU. Stored:"+this.mInternalPower); + if (this.mInternalPower<(this.maxEUStore()-128)){ + tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(128, false); + this.mInternalPower = (this.mInternalPower+128); + //Utils.LOG_MACHINE_INFO("Increasing internal power storage by 128EU. Stored:"+this.mInternalPower); } } } @@ -127,18 +126,18 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock Utils.LOG_INFO("Bad Power hatch to obtain energy from."); } } - } - else { - if (energyHatchRetryCount <= 10){ - energyHatchRetryCount++; + } + else { + if (this.energyHatchRetryCount <= 10){ + this.energyHatchRetryCount++; Utils.LOG_INFO("No energy hatches found."); } else { Utils.LOG_MACHINE_INFO("Rechecking for Energy hatches."); - energyHatchRetryCount = 0; - this.mEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch_Energy>(); - checkMachine(aBaseMetaTileEntity, mInventory[1]); - } + this.energyHatchRetryCount = 0; + this.mEnergyHatches = new ArrayList<>(); + this.checkMachine(aBaseMetaTileEntity, this.mInventory[1]); + } } return true; } @@ -151,7 +150,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == 1) { - return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log), new GT_RenderedTexture(canChop ? TexturesGtBlock.Overlay_Machine_Vent_Fast : TexturesGtBlock.Overlay_Machine_Vent)}; + return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log), new GT_RenderedTexture(this.canChop ? TexturesGtBlock.Overlay_Machine_Vent_Fast : TexturesGtBlock.Overlay_Machine_Vent)}; } return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)}; } @@ -187,17 +186,17 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "TreeFarmer.png"); - } + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "TreeFarmer.png"); + } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { return new CONTAINER_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity); } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) { return true; } @@ -208,13 +207,13 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public boolean isCorrectMachinePart(final ItemStack aStack) { boolean isValid = false; - SAWTOOL currentInputItem = TreeFarmHelper.isCorrectMachinePart(aStack); + final SAWTOOL currentInputItem = TreeFarmHelper.isCorrectMachinePart(aStack); if (currentInputItem != SAWTOOL.NONE){ if (currentInputItem == SAWTOOL.SAW){ - mCurrentMachineTool = SAWTOOL.SAW; + this.mCurrentMachineTool = SAWTOOL.SAW; } else { - mCurrentMachineTool = SAWTOOL.BUZZSAW; + this.mCurrentMachineTool = SAWTOOL.BUZZSAW; } isValid = true; } @@ -226,7 +225,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public boolean checkRecipe(final ItemStack aStack) { - Utils.LOG_MACHINE_INFO("Working"); + Utils.LOG_MACHINE_INFO("Working"); this.mEfficiency = 0; this.mEfficiencyIncrease = 0; this.mMaxProgresstime = 0; @@ -236,7 +235,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { Utils.LOG_WARNING("Step 1"); - final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; for (int i = -7; i <= 7; i++) { @@ -247,7 +246,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock Utils.LOG_WARNING("Step 4"); final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); //Farm Floor inner 14x14 - if ((i != -7 && i != 7) && (j != -7 && j != 7)) { + if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) { Utils.LOG_WARNING("Step 5 - H:"+h); // Farm Dirt Floor and Inner Air/Log space. if (h == 0) { @@ -256,24 +255,24 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock Utils.LOG_MACHINE_INFO("Dirt like block missing from inner 14x14."); Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; - } + } } } //Dealt with inner 5x5, now deal with the exterior. else { Utils.LOG_WARNING("Step 6 - H:"+h); //Deal with all 4 sides (Fenced area) - if (h == 1) { + if (h == 1) { if (!TreefarmManager.isFenceBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) { Utils.LOG_MACHINE_INFO("Fence/Gate missing from outside the second layer."); Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; - } + } } //Deal with Bottom edges (Add Hatches/Busses first, othercheck make sure it's dirt) //TODO change the casings to not dirt~ else if (h == 0) { - if ((!addMaintenanceToMachineList(tTileEntity, 77)) && (!addInputToMachineList(tTileEntity, 77)) && (!addOutputToMachineList(tTileEntity, 77)) && (!addEnergyInputToMachineList(tTileEntity, 77))) { - if ((xDir + i != 0) || (zDir + j != 0)) {//no controller + if ((!this.addMaintenanceToMachineList(tTileEntity, 77)) && (!this.addInputToMachineList(tTileEntity, 77)) && (!this.addOutputToMachineList(tTileEntity, 77)) && (!this.addEnergyInputToMachineList(tTileEntity, 77))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (tTileEntity.getMetaTileID() != 752) { Utils.LOG_MACHINE_INFO("Farm Keeper Casings Missing from one of the edges on the bottom edge. x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)+" | "+aBaseMetaTileEntity.getClass()); @@ -303,7 +302,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock if (this.mOutputHatches != null) { for (int i = 0; i < this.mOutputHatches.size(); i++) { - if (this.mOutputHatches.get(i).mTier < 2 && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ + if ((this.mOutputHatches.get(i).mTier < 2) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ Utils.LOG_INFO("You require at LEAST MV tier Output Hatches."); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); @@ -357,7 +356,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock private boolean isMachineRepaired(){ if (this.mSolderingTool || this.mCrowbar || this.mHardHammer || this.mScrewdriver || this.mSoftHammer || this.mWrench){ return true; - } + } return false; } @@ -368,12 +367,12 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock Utils.LOG_MACHINE_INFO("called findLogs()"); int logsCut = 0; boolean stopCheck = false; - final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; final World world = aBaseMetaTileEntity.getWorld(); int posX, posY, posZ; - if (mInternalPower >= 128) { + if (this.mInternalPower >= 128) { OUTER : for (int h=0;h<150;h++){ for (int i = -7; i <= 7; i++) { @@ -382,88 +381,88 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock //Cut too many logs, do this to prevent lag. - if (logsCut >= logsToBreakAfter){ + if (logsCut >= this.logsToBreakAfter){ stopCheck = true; - } + } //Already Breaking but first two layers are empty, let's do a full check. - else if (logsCut == 0 && h == 2 && takingBreak){ + else if ((logsCut == 0) && (h == 2) && this.takingBreak){ stopCheck = false; } //No Trees Grown and not breaking, take a break, reduce lag. - else if (logsCut == 0 && h == 3 && !takingBreak){ + else if ((logsCut == 0) && (h == 3) && !this.takingBreak){ stopCheck = true; - } + } else { stopCheck = false; } if (stopCheck){ Utils.LOG_MACHINE_INFO("Either found too many logs, so taking a break mid cut for lag conservation, or found no trees to cut, so stopping"); - Utils.LOG_MACHINE_INFO("found: "+logsCut +" and check up to h:"+h+" - Taking Break:"+takingBreak); + Utils.LOG_MACHINE_INFO("found: "+logsCut +" and check up to h:"+h+" - Taking Break:"+this.takingBreak); stopCheck = false; break OUTER; } - if ((i != -7 && i != 7) && (j != -7 && j != 7)) { - Block loopBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - if (TreefarmManager.isWoodLog(loopBlock) || TreefarmManager.isLeaves(loopBlock)){ - long tempStoredEU = mInternalPower; - if (tempStoredEU >= powerDrain){ - Utils.LOG_MACHINE_INFO("Cutting a "+loopBlock.getLocalizedName()+", currently stored:"+tempStoredEU+" | max:"+maxEUStore()); - drainEnergyInput(powerDrain); + if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) { + final Block loopBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + if (TreefarmManager.isWoodLog(loopBlock) || TreefarmManager.isLeaves(loopBlock)){ + final long tempStoredEU = this.mInternalPower; + if (tempStoredEU >= powerDrain){ + Utils.LOG_MACHINE_INFO("Cutting a "+loopBlock.getLocalizedName()+", currently stored:"+tempStoredEU+" | max:"+this.maxEUStore()); + this.drainEnergyInput(powerDrain); - long tempStoredEU2 = mInternalPower; + final long tempStoredEU2 = this.mInternalPower; if (tempStoredEU != tempStoredEU2){ if (tempStoredEU == (tempStoredEU2+powerDrain)){ - Utils.LOG_MACHINE_INFO(powerDrain+"EU was drained."); + Utils.LOG_MACHINE_INFO(powerDrain+"EU was drained."); } else { Utils.LOG_MACHINE_INFO(""+(tempStoredEU-tempStoredEU2)+"EU was drained."); } } else { - Utils.LOG_MACHINE_INFO("Stored EU did not change."); + Utils.LOG_MACHINE_INFO("Stored EU did not change."); } posX = aBaseMetaTileEntity.getXCoord()+xDir+i; posY = aBaseMetaTileEntity.getYCoord()+h; posZ = aBaseMetaTileEntity.getZCoord()+zDir+j; - cutLog(world, posX, posY, posZ); + this.cutLog(world, posX, posY, posZ); if (TreefarmManager.isWoodLog(loopBlock)){ - logsCut++; - } + logsCut++; + } } else { Utils.LOG_MACHINE_INFO("Not enough power to cut."); - } + } } } } } - } + } } else { - Utils.LOG_MACHINE_INFO("Not enough Power | can hold:"+maxEUStore()+" | holding:"+aBaseMetaTileEntity.getStoredEU()); + Utils.LOG_MACHINE_INFO("Not enough Power | can hold:"+this.maxEUStore()+" | holding:"+aBaseMetaTileEntity.getStoredEU()); } - canChop = false; - if (logsCut >= logsToBreakAfter){ + this.canChop = false; + if (logsCut >= this.logsToBreakAfter){ TreeFarmHelper.cleanUp(aBaseMetaTileEntity); } - return false; + return false; } private boolean growSaplingsWithBonemeal(final IGregTechTileEntity aBaseMetaTileEntity){ Utils.LOG_MACHINE_INFO("called growSaplingsWithBonemeal()"); int saplings = 0; - final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; for (int i = -7; i <= 7; i++) { for (int j = -7; j <= 7; j++) { - int h = 1; + final int h = 1; //Utils.LOG_MACHINE_INFO("Looking for saplings."); if (TreefarmManager.isSapling(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))){ int posiX, posiY, posiZ; @@ -473,10 +472,10 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock //Utils.LOG_MACHINE_INFO("Found a sapling to grow."); saplings++; - if (depleteFertiliser()){ - if (drainEnergyInput(powerDrain)){ - short fertTier = getFertiliserTier(getCurrentFertiliserStack()); - TreeFarmHelper.applyBonemeal(getFakePlayer(), aBaseMetaTileEntity.getWorld(), posiX, posiY, posiZ, fertTier); + if (this.depleteFertiliser()){ + if (this.drainEnergyInput(powerDrain)){ + final short fertTier = this.getFertiliserTier(this.getCurrentFertiliserStack()); + TreeFarmHelper.applyBonemeal(this.getFakePlayer(), aBaseMetaTileEntity.getWorld(), posiX, posiY, posiZ, fertTier); } else { Utils.LOG_MACHINE_INFO("x3"); @@ -486,40 +485,40 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock else { Utils.LOG_MACHINE_INFO("x2"); break; - } - } + } + } } } Utils.LOG_MACHINE_INFO("Tried to grow saplings: | "+saplings ); - return true; + return true; } private boolean plantSaplings(final IGregTechTileEntity aBaseMetaTileEntity){ Utils.LOG_MACHINE_INFO("called plantSaplings()"); - World world = aBaseMetaTileEntity.getWorld(); - ArrayList<ItemStack> r = getStoredInputs(); - int saplings = 0; - final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + final World world = aBaseMetaTileEntity.getWorld(); + ArrayList<ItemStack> r = this.getStoredInputs(); + final int saplings = 0; + final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; int counter = 0; if (r.size() > 0){ Utils.LOG_MACHINE_INFO("| r was not null. "+r.size()+" |"); - OUTER : for (ItemStack n : r){ + OUTER : for (final ItemStack n : r){ Utils.LOG_MACHINE_INFO("found "+n.getDisplayName()); if (OrePrefixes.sapling.contains(n) || n.getDisplayName().toLowerCase().contains("sapling")){ Utils.LOG_MACHINE_INFO(""+n.getDisplayName()); counter = n.stackSize; - Block saplingToPlace = Block.getBlockFromItem(n.getItem()); + final Block saplingToPlace = Block.getBlockFromItem(n.getItem()); //Find Gaps for Saplings after scanning Item Busses for (int i = -7; i <= 7; i++) { INNER : for (int j = -7; j <= 7; j++) { - int h = 1; - if (counter > 0){ - if ((i != -7 && i != 7) && (j != -7 && j != 7)) { - if (TreefarmManager.isAirBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))){ + final int h = 1; + if (counter > 0){ + if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) { + if (TreefarmManager.isAirBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))){ //Get block location to place sapling block int posX, posY, posZ; @@ -528,7 +527,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock posZ = aBaseMetaTileEntity.getZCoord()+zDir+j; //If sapling block is not null || Ignore if forestry is loaded. - if ((saplingToPlace != null && !LoadedMods.Forestry) || LoadedMods.Forestry){ + if (((saplingToPlace != null) && !LoadedMods.Forestry) || LoadedMods.Forestry){ //Plant Sapling if (!LoadedMods.Forestry){ @@ -536,33 +535,33 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock world.setBlockMetadataWithNotify(posX, posY, posZ, n.getItemDamage(), 4); } else { - plantSaplingAt(n, this.getBaseMetaTileEntity().getWorld(), posX, posY, posZ); - } + this.plantSaplingAt(n, this.getBaseMetaTileEntity().getWorld(), posX, posY, posZ); + } //Deplete Input stack - depleteInputEx(n); - drainEnergyInput(powerDrain); + this.depleteInputEx(n); + this.drainEnergyInput(powerDrain); counter--; //Update slot contents? - updateSlots(); + this.updateSlots(); //Test If Inputs Changed - ArrayList<ItemStack> temp = getStoredInputs(); + final ArrayList<ItemStack> temp = this.getStoredInputs(); if (r != temp){ Utils.LOG_MACHINE_INFO("Inputs changed, updating."); - for (ItemStack xr : r){ + for (final ItemStack xr : r){ Utils.LOG_MACHINE_INFO("xr:"+xr.getDisplayName()+"x"+xr.stackSize); } - for (ItemStack xc : temp){ + for (final ItemStack xc : temp){ Utils.LOG_MACHINE_INFO("xc:"+xc.getDisplayName()+"x"+xc.stackSize); } - r = temp; + r = temp; } } else { - Utils.LOG_MACHINE_INFO(n.getDisplayName()+" did not have a valid block."); + Utils.LOG_MACHINE_INFO(n.getDisplayName()+" did not have a valid block."); } - } + } else { //Utils.LOG_MACHINE_INFO("No space for sapling, no air."); continue INNER; @@ -590,63 +589,64 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock }*/ } Utils.LOG_MACHINE_INFO("Tried to plant saplings: | "+saplings ); - return true; + return true; } @Optional.Method(modid = "Forestry") - public boolean plantSaplingAt(ItemStack germling, World world, int x, int y, int z) { + public boolean plantSaplingAt(final ItemStack germling, final World world, final int x, final int y, final int z) { Utils.LOG_MACHINE_INFO("Planting Sapling with Forestry method, since it's installed."); if (PluginManager.Module.ARBORICULTURE.isEnabled()) { - IIndividual tree = GeneticsUtil.getGeneticEquivalent(germling); + final IIndividual tree = GeneticsUtil.getGeneticEquivalent(germling); if (!(tree instanceof ITree)) { return false; } - return TreeManager.treeRoot.plantSapling(world, (ITree) tree, getFakePlayer().getGameProfile(), x, y, z); + return TreeManager.treeRoot.plantSapling(world, (ITree) tree, this.getFakePlayer().getGameProfile(), x, y, z); } - return germling.copy().tryPlaceItemIntoWorld(getFakePlayer(), world, x, y - 1, z, 1, 0.0F, 0.0F, 0.0F); + return germling.copy().tryPlaceItemIntoWorld(this.getFakePlayer(), world, x, y - 1, z, 1, 0.0F, 0.0F, 0.0F); } private boolean cutLog(final World world, final int x, final int y, final int z){ //Utils.LOG_MACHINE_INFO("Cutting Log"); try { - final Block block = world.getBlock(x, y, z); + final Block block = world.getBlock(x, y, z); int chanceForLeaves = 1000; //is it leaves or a log? if leaves, heavily reduce chance to obtain rubber if (block.getUnlocalizedName().toLowerCase().contains("leaves")){ chanceForLeaves = MathUtils.randInt(1, 1000); - if (chanceForLeaves > 990) + if (chanceForLeaves > 990) { Utils.LOG_MACHINE_INFO("Found some leaves that will drop, chance to drop item "+chanceForLeaves+", needed 990-1000."); + } } //IC2 Sticky Rubber handling if (block.getUnlocalizedName().toLowerCase().contains("blockrubwood") || block.getUnlocalizedName().toLowerCase().contains("blockrubleaves")){ - ItemStack rubberResin = ItemUtils.getCorrectStacktype("IC2:itemHarz", 1); - int chanceForRubber = MathUtils.randInt(1, 10); - int multiplier = MathUtils.randInt(1, 3); - if (chanceForRubber > 7 && chanceForLeaves > 990){ + final ItemStack rubberResin = ItemUtils.getCorrectStacktype("IC2:itemHarz", 1); + final int chanceForRubber = MathUtils.randInt(1, 10); + final int multiplier = MathUtils.randInt(1, 3); + if ((chanceForRubber > 7) && (chanceForLeaves > 990)){ rubberResin.stackSize = multiplier; Utils.LOG_MACHINE_INFO("Adding "+rubberResin.getDisplayName()+" x"+rubberResin.stackSize); - addOutput(rubberResin); - updateSlots(); - } + this.addOutput(rubberResin); + this.updateSlots(); + } } - int dropMeta = world.getBlockMetadata(x, y, z); - ArrayList<ItemStack> blockDrops = block.getDrops(world, x, y, z, dropMeta, 0); - ItemStack[] drops = ItemUtils.getBlockDrops(blockDrops); + final int dropMeta = world.getBlockMetadata(x, y, z); + final ArrayList<ItemStack> blockDrops = block.getDrops(world, x, y, z, dropMeta, 0); + final ItemStack[] drops = ItemUtils.getBlockDrops(blockDrops); //Add Drops - if (drops != null){ - for (ItemStack outputs : drops){ + if (drops != null){ + for (final ItemStack outputs : drops){ if (chanceForLeaves > 990){ Utils.LOG_MACHINE_INFO("Adding 1x "+outputs.getDisplayName()); - addOutput(outputs); + this.addOutput(outputs); //Update bus contents. - updateSlots(); + this.updateSlots(); } - } + } - } + } //Remove drop that was added to the bus. world.setBlockToAir(x, y, z); @@ -654,31 +654,31 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock return true; - } catch (NullPointerException e){} + } catch (final NullPointerException e){} return false; } public FluidStack[] getStoredInputFluids(){ - ArrayList<FluidStack> fluidArray = this.getStoredFluids(); + final ArrayList<FluidStack> fluidArray = this.getStoredFluids(); if (fluidArray.size() < 1){ return new FluidStack[] {}; } - FluidStack storedInputFluids[] = new FluidStack[fluidArray.size()]; + final FluidStack storedInputFluids[] = new FluidStack[fluidArray.size()]; if (storedInputFluids.length >= 1){ int counter = 0; - for (FluidStack inputPuddle : fluidArray){ + for (final FluidStack inputPuddle : fluidArray){ storedInputFluids[counter] = inputPuddle; counter++; } - return storedInputFluids; + return storedInputFluids; } return new FluidStack[] {}; } public boolean doesInputHatchContainAnyFertiliser(){ - FluidStack[] tempFluids = getStoredInputFluids(); + final FluidStack[] tempFluids = this.getStoredInputFluids(); if (tempFluids.length >= 1){ - for (FluidStack f : tempFluids){ + for (final FluidStack f : tempFluids){ if (f.isFluidEqual(TreeFarmHelper.fertT1) || f.isFluidEqual(TreeFarmHelper.fertT2) || f.isFluidEqual(TreeFarmHelper.fertT3)){ return true; } @@ -691,7 +691,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock return false; } - public short getFertiliserTier(FluidStack f){ + public short getFertiliserTier(final FluidStack f){ if (f.isFluidEqual(TreeFarmHelper.fertT1)){ return 1; } @@ -707,12 +707,12 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } public FluidStack getCurrentFertiliserStack(){ - if (!doesInputHatchContainAnyFertiliser()){ + if (!this.doesInputHatchContainAnyFertiliser()){ return null; - } - FluidStack[] tempFluids = getStoredInputFluids(); + } + final FluidStack[] tempFluids = this.getStoredInputFluids(); if (tempFluids.length >= 1){ - for (FluidStack f : tempFluids){ + for (final FluidStack f : tempFluids){ if (f.isFluidEqual(TreeFarmHelper.fertT1)){ return TreeFarmHelper.fertT1; } @@ -729,10 +729,10 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock public boolean doesInputHatchContainEnoughFertiliser(){ - FluidStack[] tempFluids = getStoredInputFluids(); + final FluidStack[] tempFluids = this.getStoredInputFluids(); if (tempFluids.length >= 1){ - for (FluidStack f : tempFluids){ - if (f.amount >= TreeFarmHelper.fertT1.amount || f.amount >= TreeFarmHelper.fertT2.amount || f.amount >= TreeFarmHelper.fertT3.amount){ + for (final FluidStack f : tempFluids){ + if ((f.amount >= TreeFarmHelper.fertT1.amount) || (f.amount >= TreeFarmHelper.fertT2.amount) || (f.amount >= TreeFarmHelper.fertT3.amount)){ return true; } } @@ -742,22 +742,22 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } public boolean depleteFertiliser(){ - if (!doesInputHatchContainEnoughFertiliser()){ + if (!this.doesInputHatchContainEnoughFertiliser()){ return false; - } - FluidStack[] tempFluids = getStoredInputFluids(); + } + final FluidStack[] tempFluids = this.getStoredInputFluids(); if (tempFluids.length >= 1){ - for (FluidStack f : tempFluids){ - if (f.isFluidEqual(TreeFarmHelper.fertT1) || f.isFluidEqual(TreeFarmHelper.fertT2) || f.isFluidEqual(TreeFarmHelper.fertT3)){ - if (f.isFluidEqual(TreeFarmHelper.fertT1) && f.amount >= TreeFarmHelper.fertT1.amount){ + for (final FluidStack f : tempFluids){ + if (f.isFluidEqual(TreeFarmHelper.fertT1) || f.isFluidEqual(TreeFarmHelper.fertT2) || f.isFluidEqual(TreeFarmHelper.fertT3)){ + if (f.isFluidEqual(TreeFarmHelper.fertT1) && (f.amount >= TreeFarmHelper.fertT1.amount)){ this.depleteInput(TreeFarmHelper.fertT1); return true; } - else if(f.isFluidEqual(TreeFarmHelper.fertT2) && f.amount >= TreeFarmHelper.fertT2.amount){ + else if(f.isFluidEqual(TreeFarmHelper.fertT2) && (f.amount >= TreeFarmHelper.fertT2.amount)){ this.depleteInput(TreeFarmHelper.fertT2); return true; } - else if(f.isFluidEqual(TreeFarmHelper.fertT3) && f.amount >= TreeFarmHelper.fertT3.amount){ + else if(f.isFluidEqual(TreeFarmHelper.fertT3) && (f.amount >= TreeFarmHelper.fertT3.amount)){ this.depleteInput(TreeFarmHelper.fertT3); return true; } @@ -769,13 +769,15 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock - public boolean depleteInputEx(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return false; + public boolean depleteInputEx(final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) { + return false; + } Utils.LOG_MACHINE_INFO("Taking one sapling away from in input bus."); - for (GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { - tHatch.mRecipeMap = getRecipeMap(); + for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { + tHatch.mRecipeMap = this.getRecipeMap(); if (isValidMetaTileEntity(tHatch)) { for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; --i) { if ((!(GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i)))) || (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize < aStack.stackSize)){ @@ -793,39 +795,39 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock //Tree Manager private void tickTrees(){ - if (treeCheckTicks > 200){ - treeCheckTicks = 0; + if (this.treeCheckTicks > 200){ + this.treeCheckTicks = 0; } else { - treeCheckTicks++; + this.treeCheckTicks++; } } private void tickSaplings(){ - if (plantSaplingTicks > 200){ - plantSaplingTicks = 0; + if (this.plantSaplingTicks > 200){ + this.plantSaplingTicks = 0; } else { - plantSaplingTicks++; + this.plantSaplingTicks++; } } private void tickCleanup(){ - if (cleanupTicks > 600){ - cleanupTicks = 0; + if (this.cleanupTicks > 600){ + this.cleanupTicks = 0; } else { - cleanupTicks++; + this.cleanupTicks++; } } private void tickHandler(){ //Count Sapling Timer - tickSaplings(); + this.tickSaplings(); //Count Tree Cutting Timer - tickTrees(); + this.tickTrees(); //Tick Cleanup script Timer. - tickCleanup(); + this.tickCleanup(); } public EntityPlayerMP getFakePlayer() { @@ -833,7 +835,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } @Override - public boolean onRunningTick(ItemStack aStack) { + public boolean onRunningTick(final ItemStack aStack) { return super.onRunningTick(aStack); } @@ -844,82 +846,82 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock //Does it have a tool this cycle to cut? boolean validCuttingTool = false; - boolean isRepaired = isMachineRepaired(); + final boolean isRepaired = this.isMachineRepaired(); //Add some Power - addPowerToInternalStorage(aBaseMetaTileEntity); + this.addPowerToInternalStorage(aBaseMetaTileEntity); //Set Forestry Fake player Sapling Planter if (this.farmerAI == null) { this.farmerAI = new FakeFarmer(MinecraftServer.getServer().worldServerForDimension(this.getBaseMetaTileEntity().getWorld().provider.dimensionId)); - } + } //Check Inventory slots [1] - Find a valid Buzzsaw Blade or a Saw try { - validCuttingTool = isCorrectMachinePart(mInventory[1]); + validCuttingTool = this.isCorrectMachinePart(this.mInventory[1]); if (validCuttingTool){ this.mMaxProgresstime = 600; - String materialName = GT_MetaGenerated_Tool.getPrimaryMaterial(mInventory[1]).mDefaultLocalName; + final String materialName = GT_MetaGenerated_Tool.getPrimaryMaterial(this.mInventory[1]).mDefaultLocalName; if (materialName.toLowerCase().contains("null")){ } else { } - } + } else { this.mMaxProgresstime = 0; } - } catch (NullPointerException t){} + } catch (final NullPointerException t){} if (isRepaired){ //Utils.LOG_INFO("Ticking3"); //If Machine can work and it's only once every 5 seconds this will tick. - if (canChop){ + if (this.canChop){ //Set Machine State - if (treeCheckTicks == 200){ - Utils.LOG_MACHINE_INFO("Looking For Trees - Serverside | "+treeCheckTicks); + if (this.treeCheckTicks == 200){ + Utils.LOG_MACHINE_INFO("Looking For Trees - Serverside | "+this.treeCheckTicks); //Find wood to Cut if (validCuttingTool){ - findLogs(aBaseMetaTileEntity); + this.findLogs(aBaseMetaTileEntity); } else { Utils.LOG_MACHINE_INFO("Did not find a valid saw or Buzzsaw blade."); } } - } + } else { - if (plantSaplingTicks == 100){ - Utils.LOG_MACHINE_INFO("Looking For space to plant saplings - Serverside | "+plantSaplingTicks); + if (this.plantSaplingTicks == 100){ + Utils.LOG_MACHINE_INFO("Looking For space to plant saplings - Serverside | "+this.plantSaplingTicks); //Plant Some Saplings - plantSaplings(aBaseMetaTileEntity); - } - else if (plantSaplingTicks == 200){ - Utils.LOG_MACHINE_INFO("Looking For Saplings to grow - Serverside | "+plantSaplingTicks); + this.plantSaplings(aBaseMetaTileEntity); + } + else if (this.plantSaplingTicks == 200){ + Utils.LOG_MACHINE_INFO("Looking For Saplings to grow - Serverside | "+this.plantSaplingTicks); //Try Grow some Saplings - if (doesInputHatchContainAnyFertiliser()){ - growSaplingsWithBonemeal(aBaseMetaTileEntity); - } + if (this.doesInputHatchContainAnyFertiliser()){ + this.growSaplingsWithBonemeal(aBaseMetaTileEntity); + } //Set can work state - this.mInputBusses = new ArrayList<GT_MetaTileEntity_Hatch_InputBus>(); - this.mEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch_Energy>(); - canChop = checkMachine(aBaseMetaTileEntity, mInventory[1]); + this.mInputBusses = new ArrayList<>(); + this.mEnergyHatches = new ArrayList<>(); + this.canChop = this.checkMachine(aBaseMetaTileEntity, this.mInventory[1]); } - } + } //Tick TE - tickHandler(); + this.tickHandler(); } else { - if (treeCheckTicks == 200 || plantSaplingTicks == 100 || plantSaplingTicks == 200){ - Utils.LOG_MACHINE_INFO("Machine is not fully repaired, not ticking."); + if ((this.treeCheckTicks == 200) || (this.plantSaplingTicks == 100) || (this.plantSaplingTicks == 200)){ + Utils.LOG_MACHINE_INFO("Machine is not fully repaired, not ticking."); } } - + //Call Cleanup Task last, before ticking. - if (cleanupTicks == 600){ - Utils.LOG_MACHINE_INFO("Looking For rubbish to cleanup - Serverside | "+cleanupTicks); + if (this.cleanupTicks == 600){ + Utils.LOG_MACHINE_INFO("Looking For rubbish to cleanup - Serverside | "+this.cleanupTicks); TreeFarmHelper.cleanUp(aBaseMetaTileEntity); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java index 4de7048ffd..b4f3254e2c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; +import java.util.Arrays; + import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; @@ -10,221 +13,217 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.*; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.util.Utils; - -import java.util.ArrayList; -import java.util.Arrays; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_AlloyBlastSmelter - extends GT_MetaTileEntity_MultiBlockBase { - private int mHeatingCapacity = 0; +extends GT_MetaTileEntity_MultiBlockBase { + private int mHeatingCapacity = 0; - public GregtechMetaTileEntity_AlloyBlastSmelter(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } + public GregtechMetaTileEntity_AlloyBlastSmelter(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional); + } - public GregtechMetaTileEntity_AlloyBlastSmelter(String aName) { - super(aName); - } + public GregtechMetaTileEntity_AlloyBlastSmelter(final String aName) { + super(aName); + } - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_AlloyBlastSmelter(this.mName); - } + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_AlloyBlastSmelter(this.mName); + } - @Override + @Override public String[] getDescription() { - return new String[]{ - "Controller Block for the Alloy Blast Smelter", //Outputs 144mb fluid for every inputStack.stackSize; Time to use those hot metals. - "Size: 3x3x4 (Hollow)", - "Controller (front middle at bottom)", - "16x Blast Smelter Heat Containment Coils (two middle Layers, hollow)", - "1x Input bus (one of bottom)", - "1x Output Hatch (one of bottom)", - "1x Energy Hatch (one of bottom)", - "1x Maintenance Hatch (one of bottom)", - "1x Muffler Hatch (top middle)", - "Blast Smelter Casings for the rest"}; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[72], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[72]}; - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ElectricBlastFurnace.png"); - } - - @Override + return new String[]{ + "Controller Block for the Alloy Blast Smelter", //Outputs 144mb fluid for every inputStack.stackSize; Time to use those hot metals. + "Size: 3x3x4 (Hollow)", + "Controller (front middle at bottom)", + "16x Blast Smelter Heat Containment Coils (two middle Layers, hollow)", + "1x Input bus (one of bottom)", + "1x Output Hatch (one of bottom)", + "1x Energy Hatch (one of bottom)", + "1x Maintenance Hatch (one of bottom)", + "1x Muffler Hatch (top middle)", + "Blast Smelter Casings for the rest"}; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[72], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[72]}; + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "ElectricBlastFurnace.png"); + } + + @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return Recipe_GT.Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } - - @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); - } else { - tInputList.remove(i--); - break; - } - } - } - } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, tInputList.size()); - - ArrayList<FluidStack> tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); - } else { - tFluidList.remove(i--); - break; - } - } - } - } - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); - if (tInputList.size() > 1) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - if ((tRecipe != null) && (this.mHeatingCapacity >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { - Utils.LOG_WARNING("Found some Valid Inputs."); - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; - updateSlots(); - return true; - } - } - Utils.LOG_WARNING("Failed to find some Valid Inputs."); - return false; - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - - //this.mHeatingCapacity = 0; - if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { - return false; - } - if (!aBaseMetaTileEntity.getAirOffset(xDir, 2, zDir)) { - return false; - } - addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), 72); - - byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir); - - this.mHeatingCapacity = 20000; - - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if ((i != 0) || (j != 0)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 14) { - return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != 14) { - return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) != 15) { - return false; - } - } - } - } - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if ((xDir + i != 0) || (zDir + j != 0)) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 72)) && (!addInputToMachineList(tTileEntity, 72)) && (!addOutputToMachineList(tTileEntity, 72)) && (!addEnergyInputToMachineList(tTileEntity, 72))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 15) { - return false; - } - } - } - } - } - this.mHeatingCapacity += 100 * (GT_Utility.getTier(getMaxInputVoltage()) - 2); - return true; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack aStack) { - return 10; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override + return Recipe_GT.Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes; + } + + @Override + public boolean isCorrectMachinePart(final ItemStack aStack) { + return true; + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return aFacing > 1; + } + + @Override + public boolean checkRecipe(final ItemStack aStack) { + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (int i = 0; i < (tInputList.size() - 1); i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, tInputList.size()); + + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + for (int i = 0; i < (tFluidList.size() - 1); i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; + } + } + } + } + final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); + if (tInputList.size() > 1) { + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + final GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if ((tRecipe != null) && (this.mHeatingCapacity >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { + Utils.LOG_WARNING("Found some Valid Inputs."); + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; + this.updateSlots(); + return true; + } + } + Utils.LOG_WARNING("Failed to find some Valid Inputs."); + return false; + } + + @Override + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + + //this.mHeatingCapacity = 0; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { + return false; + } + if (!aBaseMetaTileEntity.getAirOffset(xDir, 2, zDir)) { + return false; + } + this.addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), 72); + + final byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir); + + this.mHeatingCapacity = 20000; + + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + if ((i != 0) || (j != 0)) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 14) { + return false; + } + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != 14) { + return false; + } + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) != 15) { + return false; + } + } + } + } + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); + if ((!this.addMaintenanceToMachineList(tTileEntity, 72)) && (!this.addInputToMachineList(tTileEntity, 72)) && (!this.addOutputToMachineList(tTileEntity, 72)) && (!this.addEnergyInputToMachineList(tTileEntity, 72))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 15) { + return false; + } + } + } + } + } + this.mHeatingCapacity += 100 * (GT_Utility.getTier(this.getMaxInputVoltage()) - 2); + return true; + } + + @Override + public int getMaxEfficiency(final ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(final ItemStack aStack) { + return 10; + } + + @Override + public int getDamageToComponent(final ItemStack aStack) { + return 0; + } + + @Override public int getAmountOfOutputs() { - return 2; - } + return 2; + } - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } + @Override + public boolean explodesOnComponentBreak(final ItemStack aStack) { + return false; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java index 0838bdefbd..87aa5582f9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java @@ -1,5 +1,10 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.ArrayUtils; + import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -16,18 +21,12 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; - -import java.util.ArrayList; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import org.apache.commons.lang3.ArrayUtils; - public class GregtechMetaTileEntity_IndustrialCentrifuge extends GregtechMeta_MultiBlockBase { private static boolean controller; @@ -38,18 +37,18 @@ extends GregtechMeta_MultiBlockBase { private static CustomIcon GT9_5 = new CustomIcon("iconsets/LARGECENTRIFUGE5"); //public static double recipesComplete = 0; - public GregtechMetaTileEntity_IndustrialCentrifuge(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_IndustrialCentrifuge(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); - frontFaceActive = new GT_RenderedTexture(GT9_5_Active); - frontFace = new GT_RenderedTexture(GT9_5); + frontFaceActive = new GT_RenderedTexture(GT9_5_Active); + frontFace = new GT_RenderedTexture(GT9_5); } - public GregtechMetaTileEntity_IndustrialCentrifuge(String aName) { + public GregtechMetaTileEntity_IndustrialCentrifuge(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_IndustrialCentrifuge(this.mName); } @@ -57,7 +56,7 @@ extends GregtechMeta_MultiBlockBase { public String[] getDescription() { return new String[]{ "Controller Block for the Industrial Centrifuge", - "Size: 3x3x3 (Hollow)", + "Size: 3x3x3 (Hollow)", "Controller (Front Center) [Orange]", "1x Maintenance Hatch (Rear Center) [Green]", "The rest can be placed anywhere except the Front [Red]", @@ -73,14 +72,14 @@ extends GregtechMeta_MultiBlockBase { @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.CASING_BLOCKS[57]}; } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "IndustrialCentrifuge.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "IndustrialCentrifuge.png"); } @Override @@ -89,38 +88,38 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } - ArrayList<ItemStack> tInputList = getStoredInputs(); + ArrayList<ItemStack> tInputList = this.getStoredInputs(); GT_Recipe mLastRecipe; @Override - public boolean checkRecipe(ItemStack aStack) { + public boolean checkRecipe(final ItemStack aStack) { /*if (!isCorrectMachinePart(mInventory[1])) { return false; }*/ Utils.LOG_WARNING("Centrifuge Debug - 1"); - GT_Recipe.GT_Recipe_Map map = getRecipeMap(); + final GT_Recipe.GT_Recipe_Map map = this.getRecipeMap(); if (map == null) { Utils.LOG_WARNING("Centrifuge Debug - False - No recipe map"); return false; } Utils.LOG_WARNING("Centrifuge Debug - 2"); - ArrayList<ItemStack> tInputList = getStoredInputs(); - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); Utils.LOG_WARNING("Centrifuge Debug - Tier variable: "+tTier); - ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]); - ArrayList<FluidStack> tFluidList = getStoredFluids(); - FluidStack[] tFluids = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]); - if (tInputList.size() > 0 || tFluids.length > 0) { - GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + final ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]); + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + final FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]); + if ((tInputList.size() > 0) || (tFluids.length > 0)) { + final GT_Recipe tRecipe = map.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); if (tRecipe != null) { Utils.LOG_WARNING("Recipe was not invalid"); - mLastRecipe = tRecipe; + this.mLastRecipe = tRecipe; this.mEUt = 0; this.mOutputItems = null; this.mOutputFluids = null; @@ -131,13 +130,13 @@ extends GregtechMeta_MultiBlockBase { } this.mMaxProgresstime = tRecipe.mDuration; - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; Utils.LOG_WARNING("Centrifuge Debug - 2 - Max Progress Time: "+this.mMaxProgresstime); if (tRecipe.mEUt <= 16) { Utils.LOG_WARNING("Centrifuge Debug - Using < 16eu/t"); - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); Utils.LOG_WARNING("Centrifuge Debug - 3.1 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt + " Obscure GT Value "+gregtech.api.enums.GT_Values.V[(tTier - 1)]); } else { Utils.LOG_WARNING("Centrifuge Debug - using > 16eu/t"); @@ -161,17 +160,20 @@ extends GregtechMeta_MultiBlockBase { tOut[h].stackSize = 0; } FluidStack tFOut = null; - if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy(); + if (tRecipe.getFluidOutput(0) != null) { + tFOut = tRecipe.getFluidOutput(0).copy(); + } for (int f = 0; f < tOut.length; f++) { - if (tRecipe.mOutputs[f] != null && tOut[f] != null) { + if ((tRecipe.mOutputs[f] != null) && (tOut[f] != null)) { for (int g = 0; g < 1; g++) { - if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) + if (this.getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) { tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; + } } } } if (tFOut != null) { - int tSize = tFOut.amount; + final int tSize = tFOut.amount; tFOut.amount = tSize * 6; } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); @@ -180,11 +182,11 @@ extends GregtechMeta_MultiBlockBase { this.mMaxProgresstime++; } Utils.LOG_WARNING("Centrifuge Debug - 6 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt); - List<ItemStack> overStacks = new ArrayList<ItemStack>(); + final List<ItemStack> overStacks = new ArrayList<>(); for (int f = 0; f < tOut.length; f++) { if (tOut[f].getMaxStackSize() < tOut[f].stackSize) { while (tOut[f].getMaxStackSize() < tOut[f].stackSize) { - ItemStack tmp = tOut[f].copy(); + final ItemStack tmp = tOut[f].copy(); tmp.stackSize = tmp.getMaxStackSize(); tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize(); overStacks.add(tmp); @@ -196,14 +198,16 @@ extends GregtechMeta_MultiBlockBase { tmp = overStacks.toArray(tmp); tOut = ArrayUtils.addAll(tOut, tmp); } - List<ItemStack> tSList = new ArrayList<ItemStack>(); - for (ItemStack tS : tOut) { - if (tS.stackSize > 0) tSList.add(tS); + final List<ItemStack> tSList = new ArrayList<>(); + for (final ItemStack tS : tOut) { + if (tS.stackSize > 0) { + tSList.add(tS); + } } tOut = tSList.toArray(new ItemStack[tSList.size()]); this.mOutputItems = tOut; this.mOutputFluids = new FluidStack[]{tFOut}; - updateSlots(); + this.updateSlots(); Utils.LOG_WARNING("Centrifuge: True"); return true; } @@ -228,7 +232,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { /*if (configSwitches.disableCentrifugeFormation){ EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(this.getBaseMetaTileEntity().getOwnerName()); if (!player.getEntityWorld().isRemote && isDisabled == false) @@ -236,9 +240,9 @@ extends GregtechMeta_MultiBlockBase { isDisabled = true; return false; }*/ - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; //Utils.LOG_WARNING("X:"+xDir+" Y:"+yDir+" Z:"+zDir); if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { return false; @@ -247,23 +251,23 @@ extends GregtechMeta_MultiBlockBase { for (int i = -1; i < 2; i++) { //X-Dir for (int j = -1; j < 2; j++) { //Z-Dir for (int h = -1; h < 2; h++) { //Y-Dir - if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { + if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); //Utils.LOG_WARNING("X:"+tTileEntity.getXCoord()+" Y:"+tTileEntity.getYCoord()+" Z:"+tTileEntity.getZCoord()); - if ((!addMaintenanceToMachineList(tTileEntity, 57)) && (!addInputToMachineList(tTileEntity, 57)) && (!addOutputToMachineList(tTileEntity, 57)) && (!addEnergyInputToMachineList(tTileEntity, 57))) { + if ((!this.addMaintenanceToMachineList(tTileEntity, 57)) && (!this.addInputToMachineList(tTileEntity, 57)) && (!this.addOutputToMachineList(tTileEntity, 57)) && (!this.addEnergyInputToMachineList(tTileEntity, 57))) { //Maintenance Hatch if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { - if (tTileEntity.getXCoord() == aBaseMetaTileEntity.getXCoord() && tTileEntity.getYCoord() == aBaseMetaTileEntity.getYCoord() && tTileEntity.getZCoord() == (aBaseMetaTileEntity.getZCoord()+2)) { + if ((tTileEntity.getXCoord() == aBaseMetaTileEntity.getXCoord()) && (tTileEntity.getYCoord() == aBaseMetaTileEntity.getYCoord()) && (tTileEntity.getZCoord() == (aBaseMetaTileEntity.getZCoord()+2))) { if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { Utils.LOG_WARNING("MAINT HATCH IN CORRECT PLACE"); this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity()); - ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); + ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = this.getCasingTextureIndex(); } else { return false; } - } + } else { Utils.LOG_WARNING("MAINT HATCH IN WRONG PLACE"); } @@ -281,25 +285,25 @@ extends GregtechMeta_MultiBlockBase { } } } - } + } return tAmount >= 16; } @SuppressWarnings("static-method") - public boolean ignoreController(Block tTileEntity) { - if (!controller && tTileEntity == GregTech_API.sBlockMachines) { + public boolean ignoreController(final Block tTileEntity) { + if (!controller && (tTileEntity == GregTech_API.sBlockMachines)) { return true; } return false; } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @@ -309,7 +313,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java index 5aa49c8395..08f186b992 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java @@ -1,6 +1,10 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; import static gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks.GTID; + +import java.util.ArrayList; +import java.util.Arrays; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -12,145 +16,143 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -import java.util.ArrayList; -import java.util.Arrays; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_IndustrialCokeOven - extends GregtechMeta_MultiBlockBase { - private int mLevel = 0; +extends GregtechMeta_MultiBlockBase { + private int mLevel = 0; - public GregtechMetaTileEntity_IndustrialCokeOven(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } + public GregtechMetaTileEntity_IndustrialCokeOven(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional); + } - public GregtechMetaTileEntity_IndustrialCokeOven(String aName) { - super(aName); - } + public GregtechMetaTileEntity_IndustrialCokeOven(final String aName) { + super(aName); + } - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialCokeOven(this.mName); - } + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_IndustrialCokeOven(this.mName); + } - @Override + @Override public String[] getDescription() { - return new String[]{"Processes Logs and Coal into Charcoal and Coal Coke.", - "Controller Block for the Industrial Coke Oven", - "Size: 3x3x3 (Hollow)", - "Controller (front middle at bottom)", - "8x Heat Resistant/Proof Coils (middle Layer, hollow)", - "1x Input (one of bottom)", - "1x Output (one of bottom)", - "1x Energy Hatch (one of bottom)", - "1x Maintenance Hatch (one of bottom)", - "1x Muffler Hatch (top middle)", - "Structural Coke Oven Casings for the rest", - CORE.GT_Tooltip}; - } + return new String[]{"Processes Logs and Coal into Charcoal and Coal Coke.", + "Controller Block for the Industrial Coke Oven", + "Size: 3x3x3 (Hollow)", + "Controller (front middle at bottom)", + "8x Heat Resistant/Proof Coils (middle Layer, hollow)", + "1x Input Hatch (one of bottom)", + "1x Output Hatch (one of bottom)", + "1x Input Bus (one of bottom)", + "1x Output Bus (one of bottom)", + "1x Energy Hatch (one of bottom)", + "1x Maintenance Hatch (one of bottom)", + "1x Muffler Hatch (top middle)", + "Structural Coke Oven Casings for the rest", + CORE.GT_Tooltip}; + } - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+1], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+1]}; - } + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+1], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+1]}; + } - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "CokeOven.png"); - } + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "CokeOven.png"); + } - @Override + @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return Recipe_GT.Gregtech_Recipe_Map.sCokeOvenRecipes; - - } + return Recipe_GT.Gregtech_Recipe_Map.sCokeOvenRecipes; + + } - /* @Override + /* @Override public boolean isCorrectMachinePart(ItemStack aStack) { return true; }*/ - @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } + @Override + public boolean isFacingValid(final byte aFacing) { + return aFacing > 1; + } - @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); - } else { - tInputList.remove(i--); - break; - } - } - } - } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + @Override + public boolean checkRecipe(final ItemStack aStack) { + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (int i = 0; i < (tInputList.size() - 1); i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - ArrayList<FluidStack> tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); - } else { - tFluidList.remove(i--); - break; - } - } - } - } - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); - - int tValidOutputSlots = this.getValidOutputSlots(getRecipeMap(), tInputs); + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + for (int i = 0; i < (tFluidList.size() - 1); i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; + } + } + } + } + final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); + + final int tValidOutputSlots = this.getValidOutputSlots(this.getRecipeMap(), tInputs); Utils.LOG_WARNING("Valid Output Slots: "+tValidOutputSlots); - + //More than or one input - if (tInputList.size() > 0 && tValidOutputSlots >= 1) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sCokeOvenRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - if ((tRecipe != null) && (this.mLevel >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; - this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; - updateSlots(); - //Utils.LOG_INFO("Coke oven: True"); - return true; - } - } - //Utils.LOG_INFO("Coke oven: False"); - return false; - } + if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + final GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sCokeOvenRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if ((tRecipe != null) && (this.mLevel >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; + this.updateSlots(); + //Utils.LOG_INFO("Coke oven: True"); + return true; + } + } + //Utils.LOG_INFO("Coke oven: False"); + return false; + } /*public boolean checkRecipe(ItemStack aStack) { ArrayList<ItemStack> tInputList = getStoredInputs(); if (!tInputList.isEmpty()) { @@ -176,101 +178,101 @@ public class GregtechMetaTileEntity_IndustrialCokeOven return false; }*/ - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - int xr = aBaseMetaTileEntity.getXCoord(); - int yr = aBaseMetaTileEntity.getYCoord(); - int zr = aBaseMetaTileEntity.getZCoord(); - this.mLevel = 0; - if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { - return false; - } - addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), GTID+1); + @Override + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int xr = aBaseMetaTileEntity.getXCoord(); + int yr = aBaseMetaTileEntity.getYCoord(); + int zr = aBaseMetaTileEntity.getZCoord(); + this.mLevel = 0; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { + return false; + } + this.addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), GTID+1); - byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir); - switch (tUsedMeta) { - case 2: - this.mLevel = 1; - break; - case 3: - this.mLevel = 2; - break; - default: - return false; - } - this.mOutputItems = new ItemStack[12 * this.mLevel]; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if ((i != 0) || (j != 0)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != tUsedMeta) { - return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 1) { - return false; - } - } - } - } - for (int i = -1; i < 2; i++) { - xr = aBaseMetaTileEntity.getXCoord(); - yr = aBaseMetaTileEntity.getYCoord(); - zr = aBaseMetaTileEntity.getZCoord(); - //Utils.LOG_WARNING("STEP 1 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); - for (int j = -1; j < 2; j++) { - xr = aBaseMetaTileEntity.getXCoord(); - yr = aBaseMetaTileEntity.getYCoord(); - zr = aBaseMetaTileEntity.getZCoord(); - //Utils.LOG_WARNING("STEP 2 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); - if ((xDir + i != 0) || (zDir + j != 0)) { - xr = aBaseMetaTileEntity.getXCoord(); - yr = aBaseMetaTileEntity.getYCoord(); - zr = aBaseMetaTileEntity.getZCoord(); - //Utils.LOG_WARNING("STEP 3 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, GTID+1)) && (!addInputToMachineList(tTileEntity, GTID+1)) && (!addOutputToMachineList(tTileEntity, GTID+1)) && (!addEnergyInputToMachineList(tTileEntity, GTID+1))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 1) { - return false; - } - } - } - } - } - return true; - } + final byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir); + switch (tUsedMeta) { + case 2: + this.mLevel = 1; + break; + case 3: + this.mLevel = 2; + break; + default: + return false; + } + this.mOutputItems = new ItemStack[12 * this.mLevel]; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + if ((i != 0) || (j != 0)) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != tUsedMeta) { + return false; + } + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 1) { + return false; + } + } + } + } + for (int i = -1; i < 2; i++) { + xr = aBaseMetaTileEntity.getXCoord(); + yr = aBaseMetaTileEntity.getYCoord(); + zr = aBaseMetaTileEntity.getZCoord(); + //Utils.LOG_WARNING("STEP 1 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); + for (int j = -1; j < 2; j++) { + xr = aBaseMetaTileEntity.getXCoord(); + yr = aBaseMetaTileEntity.getYCoord(); + zr = aBaseMetaTileEntity.getZCoord(); + //Utils.LOG_WARNING("STEP 2 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); + if (((xDir + i) != 0) || ((zDir + j) != 0)) { + xr = aBaseMetaTileEntity.getXCoord(); + yr = aBaseMetaTileEntity.getYCoord(); + zr = aBaseMetaTileEntity.getZCoord(); + //Utils.LOG_WARNING("STEP 3 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); + if ((!this.addMaintenanceToMachineList(tTileEntity, GTID+1)) && (!this.addInputToMachineList(tTileEntity, GTID+1)) && (!this.addOutputToMachineList(tTileEntity, GTID+1)) && (!this.addEnergyInputToMachineList(tTileEntity, GTID+1))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 1) { + return false; + } + } + } + } + } + return true; + } - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } + @Override + public int getMaxEfficiency(final ItemStack aStack) { + return 10000; + } - @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } + @Override + public int getPollutionPerTick(final ItemStack aStack) { + return 0; + } - /* @Override + /* @Override public int getDamageToComponent(ItemStack aStack) { return 0; }*/ - @Override + @Override public int getAmountOfOutputs() { - return 24; - } + return 24; + } - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } + @Override + public boolean explodesOnComponentBreak(final ItemStack aStack) { + return false; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java index 81e2feea5c..70e0e9546e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialElectrolyzer.java @@ -1,6 +1,11 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; import static gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks.GTID; + +import java.util.*; + +import org.apache.commons.lang3.ArrayUtils; + import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -14,29 +19,24 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -import java.util.*; - import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import org.apache.commons.lang3.ArrayUtils; - public class GregtechMetaTileEntity_IndustrialElectrolyzer extends GregtechMeta_MultiBlockBase { - public GregtechMetaTileEntity_IndustrialElectrolyzer(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_IndustrialElectrolyzer(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_IndustrialElectrolyzer(String aName) { + public GregtechMetaTileEntity_IndustrialElectrolyzer(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_IndustrialElectrolyzer(this.mName); } @@ -57,7 +57,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+5], new GT_RenderedTexture(aActive ? Textures.BlockIcons.STEAM_TURBINE_SIDE_ACTIVE : Textures.BlockIcons.STEAM_TURBINE_SIDE)}; } @@ -65,8 +65,8 @@ extends GregtechMeta_MultiBlockBase { } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "IndustrialElectrolyzer.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "IndustrialElectrolyzer.png"); } @Override @@ -75,97 +75,100 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } - - ArrayList<ItemStack> tInputList = getStoredInputs(); + + ArrayList<ItemStack> tInputList = this.getStoredInputs(); GT_Recipe mLastRecipe; @Override - public boolean checkRecipe(ItemStack aStack) { //TODO - Add Check to make sure Fluid output isn't full - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); - } else { - tInputList.remove(i--); - break; - } - } - } - } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - - ArrayList<FluidStack> tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); - } else { - tFluidList.remove(i--); - break; - } - } - } - } - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); - - int tValidOutputSlots = this.getValidOutputSlots(getRecipeMap(), tInputs); + public boolean checkRecipe(final ItemStack aStack) { //TODO - Add Check to make sure Fluid output isn't full + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (int i = 0; i < (tInputList.size() - 1); i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + for (int i = 0; i < (tFluidList.size() - 1); i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; + } + } + } + } + final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); + + final int tValidOutputSlots = this.getValidOutputSlots(this.getRecipeMap(), tInputs); Utils.LOG_WARNING("Valid Output Slots: "+tValidOutputSlots); - + //More than or one input - if (tInputList.size() > 0 && tValidOutputSlots >= 1) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - if ((tRecipe != null) && (7500 >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - - ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; + if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if ((tRecipe != null) && (7500 >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + + ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; for (int h = 0; h < tRecipe.mOutputs.length; h++) { tOut[h] = tRecipe.getOutput(h).copy(); tOut[h].stackSize = 0; } - FluidStack tFOut = null; - if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy(); + FluidStack tFOut = null; + if (tRecipe.getFluidOutput(0) != null) { + tFOut = tRecipe.getFluidOutput(0).copy(); + } for (int f = 0; f < tOut.length; f++) { - if (tRecipe.mOutputs[f] != null && tOut[f] != null) { + if ((tRecipe.mOutputs[f] != null) && (tOut[f] != null)) { for (int g = 0; g < 1; g++) { - if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) + if (this.getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) { tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; + } } } } if (tFOut != null) { - int tSize = tFOut.amount; + final int tSize = tFOut.amount; tFOut.amount = tSize * 1; } - - List<ItemStack> overStacks = new ArrayList<ItemStack>(); + + final List<ItemStack> overStacks = new ArrayList<>(); for (int f = 0; f < tOut.length; f++) { if (tOut[f].getMaxStackSize() < tOut[f].stackSize) { while (tOut[f].getMaxStackSize() < tOut[f].stackSize) { - ItemStack tmp = tOut[f].copy(); + final ItemStack tmp = tOut[f].copy(); tmp.stackSize = tmp.getMaxStackSize(); tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize(); overStacks.add(tmp); @@ -177,66 +180,68 @@ extends GregtechMeta_MultiBlockBase { tmp = overStacks.toArray(tmp); tOut = ArrayUtils.addAll(tOut, tmp); } - List<ItemStack> tSList = new ArrayList<ItemStack>(); - for (ItemStack tS : tOut) { - if (tS.stackSize > 0) tSList.add(tS); + final List<ItemStack> tSList = new ArrayList<>(); + for (final ItemStack tS : tOut) { + if (tS.stackSize > 0) { + tSList.add(tS); + } } tOut = tSList.toArray(new ItemStack[tSList.size()]); this.mOutputItems = tOut; this.mOutputFluids = new FluidStack[]{tFOut}; - updateSlots(); - - /* this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; + this.updateSlots(); + + /* this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; updateSlots();*/ - return true; - } - } - return false; - } + return true; + } + } + return false; + } @Override - public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { - super.startSoundLoop(aIndex, aX, aY, aZ); - if (aIndex == 20) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(5)), 10, 1.0F, aX, aY, aZ); - } - } + public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) { + super.startSoundLoop(aIndex, aX, aY, aZ); + if (aIndex == 20) { + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(Integer.valueOf(5)), 10, 1.0F, aX, aY, aZ); + } + } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { - return false; - } - int tAmount = 0; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - for (int h = -1; h < 2; h++) { - if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 62)) && (!addMufflerToMachineList(tTileEntity, 62)) && (!addInputToMachineList(tTileEntity, 62)) && (!addOutputToMachineList(tTileEntity, 62)) && (!addEnergyInputToMachineList(tTileEntity, 62))) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if (((tBlock != ModBlocks.blockCasingsMisc) || (tMeta != 5))) { - return false; - } - tAmount++; - } - } - } - } - } - return tAmount >= 16; - } + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + return false; + } + int tAmount = 0; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = -1; h < 2; h++) { + if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!this.addMaintenanceToMachineList(tTileEntity, 62)) && (!this.addMufflerToMachineList(tTileEntity, 62)) && (!this.addInputToMachineList(tTileEntity, 62)) && (!this.addOutputToMachineList(tTileEntity, 62)) && (!this.addEnergyInputToMachineList(tTileEntity, 62))) { + final Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + final byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + if (((tBlock != ModBlocks.blockCasingsMisc) || (tMeta != 5))) { + return false; + } + tAmount++; + } + } + } + } + } + return tAmount >= 16; + } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @@ -246,7 +251,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java index 34832d0bc5..497e2979f8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMacerator.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.*; + import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -15,9 +17,6 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -import java.util.*; - import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -27,16 +26,16 @@ public class GregtechMetaTileEntity_IndustrialMacerator extends GregtechMeta_MultiBlockBase { private static boolean controller; - public GregtechMetaTileEntity_IndustrialMacerator(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_IndustrialMacerator(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_IndustrialMacerator(String aName) { + public GregtechMetaTileEntity_IndustrialMacerator(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_IndustrialMacerator(this.mName); } @@ -44,7 +43,7 @@ extends GregtechMeta_MultiBlockBase { public String[] getDescription() { return new String[]{ "Controller Block for the Industrial Maceration Stack", - "Size[WxHxL]: 3x6x3 (Hollow)", + "Size[WxHxL]: 3x6x3 (Hollow)", "Controller (Center Bottom)", "1x Input Bus (Any bottom layer casing)", "5x Output Bus (Any casing besides bottom layer)", @@ -55,7 +54,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[64], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_MatterFab_Active : TexturesGtBlock.Overlay_MatterFab)}; } @@ -63,8 +62,8 @@ extends GregtechMeta_MultiBlockBase { } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MacerationStack.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MacerationStack.png"); } @Override @@ -78,41 +77,41 @@ extends GregtechMeta_MultiBlockBase { }*/ @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0) && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) { - Random tRandom = aBaseMetaTileEntity.getWorld().rand; - aBaseMetaTileEntity.getWorld().spawnParticle("smoke", aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, aBaseMetaTileEntity.getYCoord() + 0.3f + tRandom.nextFloat() * 0.2F, aBaseMetaTileEntity.getZCoord() + 1.2F - tRandom.nextFloat() * 1.6F, 0.0D, 0.0D, 0.0D); + final Random tRandom = aBaseMetaTileEntity.getWorld().rand; + aBaseMetaTileEntity.getWorld().spawnParticle("smoke", (aBaseMetaTileEntity.getXCoord() + 0.8F) - (tRandom.nextFloat() * 0.6F), aBaseMetaTileEntity.getYCoord() + 0.3f + (tRandom.nextFloat() * 0.2F), (aBaseMetaTileEntity.getZCoord() + 1.2F) - (tRandom.nextFloat() * 1.6F), 0.0D, 0.0D, 0.0D); } } @Override - public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { + public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(201)), 10, 1.0F, aX, aY, aZ); + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(Integer.valueOf(201)), 10, 1.0F, aX, aY, aZ); } } @Override public void startProcess() { - sendLoopStart((byte) 1); + this.sendLoopStart((byte) 1); } @Override - public boolean checkRecipe(ItemStack aStack) { - + public boolean checkRecipe(final ItemStack aStack) { + //Get inputs. - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (int i = 0; i < (tInputList.size() - 1); i++) { for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { tInputList.remove(j--); } else { tInputList.remove(i--); @@ -121,41 +120,41 @@ extends GregtechMeta_MultiBlockBase { } } } - + //Temp var - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); //Don't check the recipe if someone got around the output bus size check. if (this.mOutputBusses.size() != 5){ return false; } - + //Make a recipe instance for the rest of the method. - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); - - - int tValidOutputSlots = this.getValidOutputSlots(getRecipeMap(), tInputs); + final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(this.getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); + + + final int tValidOutputSlots = this.getValidOutputSlots(this.getRecipeMap(), tInputs); Utils.LOG_WARNING("Valid Output Slots: "+tValidOutputSlots); - + //More than or one input - if (tInputList.size() > 0 && tValidOutputSlots >= 1) { + if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, null, tInputs))) { Utils.LOG_WARNING("Valid Recipe found - size "+tRecipe.mOutputs.length); - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; this.mEUt = (-tRecipe.mEUt); this.mMaxProgresstime = Math.max(1, (tRecipe.mDuration/5)); - ItemStack[] outputs = new ItemStack[tRecipe.mOutputs.length]; + final ItemStack[] outputs = new ItemStack[tRecipe.mOutputs.length]; for (int i = 0; i < tRecipe.mOutputs.length; i++){ if (i==0) { Utils.LOG_WARNING("Adding the default output"); outputs[0] = tRecipe.getOutput(i); } - else if (getBaseMetaTileEntity().getRandomNumber(7500) < tRecipe.getOutputChance(i)){ + else if (this.getBaseMetaTileEntity().getRandomNumber(7500) < tRecipe.getOutputChance(i)){ Utils.LOG_WARNING("Adding a bonus output"); - outputs[i] = tRecipe.getOutput(i); + outputs[i] = tRecipe.getOutput(i); } else { Utils.LOG_WARNING("Adding null output"); @@ -164,8 +163,8 @@ extends GregtechMeta_MultiBlockBase { } this.mOutputItems = outputs; - sendLoopStart((byte) 20); - updateSlots(); + this.sendLoopStart((byte) 20); + this.updateSlots(); return true; } } @@ -173,9 +172,9 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { return false; } @@ -184,10 +183,10 @@ extends GregtechMeta_MultiBlockBase { for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { for (int h = 0; h < 6; h++) { - if (!(i == 0 && j == 0 && (h > 0 && h < 5)))//((h > 0)&&(h<5)) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0))) + if (!((i == 0) && (j == 0) && ((h > 0) && (h < 5))))//((h > 0)&&(h<5)) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0))) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 64)) && (!addInputToMachineList(tTileEntity, 64)) && (!addOutputToMachineList(tTileEntity, 64)) && (!addEnergyInputToMachineList(tTileEntity, 64)) && (!ignoreController(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)))) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!this.addMaintenanceToMachineList(tTileEntity, 64)) && (!this.addInputToMachineList(tTileEntity, 64)) && (!this.addOutputToMachineList(tTileEntity, 64)) && (!this.addEnergyInputToMachineList(tTileEntity, 64)) && (!this.ignoreController(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)))) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Returned False 1"); return false; @@ -202,18 +201,18 @@ extends GregtechMeta_MultiBlockBase { } } } - if (this.mOutputHatches.size() != 0 || this.mInputBusses.size() != 1 || this.mOutputBusses.size() != 5) { + if ((this.mOutputHatches.size() != 0) || (this.mInputBusses.size() != 1) || (this.mOutputBusses.size() != 5)) { Utils.LOG_INFO("Returned False 3"); return false; } - int height = this.getBaseMetaTileEntity().getYCoord(); + final int height = this.getBaseMetaTileEntity().getYCoord(); if (this.mInputBusses.get(0).getBaseMetaTileEntity().getYCoord() != height) { Utils.LOG_INFO("height: "+height+" | Returned False 4"); return false; } - GT_MetaTileEntity_Hatch_OutputBus[] tmpHatches = new GT_MetaTileEntity_Hatch_OutputBus[5]; + final GT_MetaTileEntity_Hatch_OutputBus[] tmpHatches = new GT_MetaTileEntity_Hatch_OutputBus[5]; for (int i = 0; i < this.mOutputBusses.size(); i++) { - int hatchNumber = this.mOutputBusses.get(i).getBaseMetaTileEntity().getYCoord() - 1 - height; + final int hatchNumber = this.mOutputBusses.get(i).getBaseMetaTileEntity().getYCoord() - 1 - height; if (tmpHatches[hatchNumber] == null) { tmpHatches[hatchNumber] = this.mOutputBusses.get(i); } else { @@ -228,20 +227,20 @@ extends GregtechMeta_MultiBlockBase { return tAmount >= 26; } - public boolean ignoreController(Block tTileEntity) { - if (!controller && tTileEntity == GregTech_API.sBlockMachines) { + public boolean ignoreController(final Block tTileEntity) { + if (!controller && (tTileEntity == GregTech_API.sBlockMachines)) { return true; } return false; } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @@ -251,7 +250,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java index 96095698fa..5b56a4357c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialPlatePress.java @@ -1,6 +1,10 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; import static gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks.GTID; + +import java.util.ArrayList; +import java.util.Arrays; + import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -14,10 +18,6 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -import java.util.ArrayList; -import java.util.Arrays; - import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -26,16 +26,16 @@ import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_MultiBlockBase { - public GregtechMetaTileEntity_IndustrialPlatePress(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_IndustrialPlatePress(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_IndustrialPlatePress(String aName) { + public GregtechMetaTileEntity_IndustrialPlatePress(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_IndustrialPlatePress(this.mName); } @@ -54,7 +54,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+4], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; } @@ -62,8 +62,8 @@ extends GregtechMeta_MultiBlockBase { } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MaterialPress.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MaterialPress.png"); } @Override @@ -72,118 +72,118 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } - @Override - public boolean checkRecipe(ItemStack aStack) { //TODO - Add Check to make sure Fluid output isn't full - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); - } else { - tInputList.remove(i--); - break; - } - } - } - } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - - ArrayList<FluidStack> tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); - } else { - tFluidList.remove(i--); - break; - } - } - } - } - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); - - int tValidOutputSlots = this.getValidOutputSlots(getRecipeMap(), tInputs); - Utils.LOG_WARNING("Valid Output Slots: "+tValidOutputSlots); + @Override + public boolean checkRecipe(final ItemStack aStack) { //TODO - Add Check to make sure Fluid output isn't full + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (int i = 0; i < (tInputList.size() - 1); i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + for (int i = 0; i < (tFluidList.size() - 1); i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; + } + } + } + } + final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); + + final int tValidOutputSlots = this.getValidOutputSlots(this.getRecipeMap(), tInputs); + Utils.LOG_WARNING("Valid Output Slots: "+tValidOutputSlots); //More than or one input - if (tInputList.size() > 0 && tValidOutputSlots >= 1) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBenderRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - if ((tRecipe != null) && (2500 >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; - updateSlots(); - return true; - } - } - return false; - } + if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBenderRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if ((tRecipe != null) && (2500 >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; + this.updateSlots(); + return true; + } + } + return false; + } @Override - public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { - super.startSoundLoop(aIndex, aX, aY, aZ); - if (aIndex == 20) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(5)), 10, 1.0F, aX, aY, aZ); - } - } + public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) { + super.startSoundLoop(aIndex, aX, aY, aZ); + if (aIndex == 20) { + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(Integer.valueOf(5)), 10, 1.0F, aX, aY, aZ); + } + } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { - return false; - } - int tAmount = 0; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - for (int h = -1; h < 2; h++) { - if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 61)) && (!addMufflerToMachineList(tTileEntity, 61)) && (!addInputToMachineList(tTileEntity, 61)) && (!addOutputToMachineList(tTileEntity, 61)) && (!addEnergyInputToMachineList(tTileEntity, 61))) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if (((tBlock != ModBlocks.blockCasingsMisc) || (tMeta != 4))) { - return false; - } - tAmount++; - } - } - } - } - } - return tAmount >= 16; - } + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + return false; + } + int tAmount = 0; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = -1; h < 2; h++) { + if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!this.addMaintenanceToMachineList(tTileEntity, 61)) && (!this.addMufflerToMachineList(tTileEntity, 61)) && (!this.addInputToMachineList(tTileEntity, 61)) && (!this.addOutputToMachineList(tTileEntity, 61)) && (!this.addEnergyInputToMachineList(tTileEntity, 61))) { + final Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + final byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + if (((tBlock != ModBlocks.blockCasingsMisc) || (tMeta != 4))) { + return false; + } + tAmount++; + } + } + } + } + } + return tAmount >= 16; + } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @@ -193,7 +193,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSinter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSinter.java index 8f928a9590..4e80445dcc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSinter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSinter.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -12,9 +14,6 @@ import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; - -import java.util.ArrayList; - import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.entity.player.InventoryPlayer; @@ -22,26 +21,26 @@ import net.minecraft.item.ItemStack; public class GregtechMetaTileEntity_IndustrialSinter extends GT_MetaTileEntity_MultiBlockBase { - + RenderBlocks asdasd = RenderBlocks.getInstance(); - - public GregtechMetaTileEntity_IndustrialSinter(int aID, String aName, String aNameRegional) { + + public GregtechMetaTileEntity_IndustrialSinter(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_IndustrialSinter(String aName) { + public GregtechMetaTileEntity_IndustrialSinter(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_IndustrialSinter(this.mName); } @Override public String[] getDescription() { - return new String[]{ + return new String[]{ "Controller Block for the Industrial Sinter Furnace", "Size: 3x5x3 [WxLxH] (Hollow)", "Controller (front centered)", "2x Input Bus (side centered)", @@ -54,7 +53,7 @@ extends GT_MetaTileEntity_MultiBlockBase { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[63], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; } @@ -62,8 +61,8 @@ extends GT_MetaTileEntity_MultiBlockBase { } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "WireFactory.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "WireFactory.png"); } @Override @@ -72,30 +71,30 @@ extends GT_MetaTileEntity_MultiBlockBase { } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { + public boolean isCorrectMachinePart(final ItemStack aStack) { return true; } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (ItemStack tInput : tInputList) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + public boolean checkRecipe(final ItemStack aStack) { + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (final ItemStack tInput : tInputList) { + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sWiremillRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); + final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sWiremillRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); if (tRecipe != null) { if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); } else { this.mEUt = tRecipe.mEUt; this.mMaxProgresstime = tRecipe.mDuration; @@ -109,7 +108,7 @@ extends GT_MetaTileEntity_MultiBlockBase { } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; - updateSlots(); + this.updateSlots(); return true; } } @@ -118,22 +117,22 @@ extends GT_MetaTileEntity_MultiBlockBase { } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int controllerX = aBaseMetaTileEntity.getXCoord(); - int controllerY = aBaseMetaTileEntity.getYCoord(); - int controllerZ = aBaseMetaTileEntity.getZCoord(); + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int controllerX = aBaseMetaTileEntity.getXCoord(); + final int controllerY = aBaseMetaTileEntity.getYCoord(); + final int controllerZ = aBaseMetaTileEntity.getZCoord(); - byte tSide = getBaseMetaTileEntity().getBackFacing(); - if ((getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 1)) && (getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2) && (getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 3)))) { + final byte tSide = this.getBaseMetaTileEntity().getBackFacing(); + if ((this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 1)) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 2) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 3)))) { int tAirCount = 0; for (byte i = -1; i < 2; i = (byte) (i + 1)) { for (byte j = -1; j < 2; j = (byte) (j + 1)) { for (byte k = -1; k < 2; k = (byte) (k + 1)) { - if (getBaseMetaTileEntity().getAirOffset(i, j, k)) { + if (this.getBaseMetaTileEntity().getAirOffset(i, j, k)) { Utils.LOG_INFO("Found Air at: "+(controllerX+i)+" "+(controllerY+k)+" "+(controllerZ+k)); //if (aBaseMetaTileEntity.getWorld().isRemote){ - //asdasd.renderStandardBlock(ModBlocks.MatterFabricatorEffectBlock, (controllerX+i), (controllerY+k), (controllerZ+k)); - //UtilsRendering.drawBlockInWorld((controllerX+i), (controllerY+k), (controllerZ+k), Color.YELLOW_GREEN); + //asdasd.renderStandardBlock(ModBlocks.MatterFabricatorEffectBlock, (controllerX+i), (controllerY+k), (controllerZ+k)); + //UtilsRendering.drawBlockInWorld((controllerX+i), (controllerY+k), (controllerZ+k), Color.YELLOW_GREEN); //} tAirCount++; } @@ -147,16 +146,16 @@ extends GT_MetaTileEntity_MultiBlockBase { for (byte i = 2; i < 6; i = (byte) (i + 1)) { //UtilsRendering.drawBlockInWorld((controllerX+i), (controllerY), (controllerZ), Color.LIME_GREEN); IGregTechTileEntity tTileEntity; - if ((null != (tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(i, 2))) && - (tTileEntity.getFrontFacing() == getBaseMetaTileEntity().getFrontFacing()) && (tTileEntity.getMetaTileEntity() != null) && + if ((null != (tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(i, 2))) && + (tTileEntity.getFrontFacing() == this.getBaseMetaTileEntity().getFrontFacing()) && (tTileEntity.getMetaTileEntity() != null) && ((tTileEntity.getMetaTileEntity() instanceof GregtechMetaTileEntity_IndustrialSinter))) { //Utils.LOG_INFO("False 1"); return false; } } - int tX = getBaseMetaTileEntity().getXCoord(); - int tY = getBaseMetaTileEntity().getYCoord(); - int tZ = getBaseMetaTileEntity().getZCoord(); + final int tX = this.getBaseMetaTileEntity().getXCoord(); + final int tY = this.getBaseMetaTileEntity().getYCoord(); + final int tZ = this.getBaseMetaTileEntity().getZCoord(); for (byte i = -1; i < 2; i = (byte) (i + 1)) { for (byte j = -1; j < 2; j = (byte) (j + 1)) { if ((i != 0) || (j != 0)) { @@ -164,15 +163,15 @@ extends GT_MetaTileEntity_MultiBlockBase { //UtilsRendering.drawBlockInWorld((controllerX+i), (controllerY+k), (controllerZ+k), Color.ORANGE); if (((i == 0) || (j == 0)) && ((k == 1) || (k == 2) || (k == 3))) { //UtilsRendering.drawBlockInWorld((controllerX+i), (controllerY+k), (controllerZ+k), Color.TOMATO); - if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) { - } - else if (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))) && (!addEnergyInputToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))))) { + if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) { + } + else if (!this.addToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))) && (!this.addEnergyInputToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))))) { Utils.LOG_INFO("False 2"); return false; } - } - else if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) { - } + } + else if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) { + } else { Utils.LOG_INFO("False 3"); return false; @@ -181,26 +180,26 @@ extends GT_MetaTileEntity_MultiBlockBase { } } } - if (this.mOutputHatches.size() != 0 || this.mInputHatches.size() != 0) { + if ((this.mOutputHatches.size() != 0) || (this.mInputHatches.size() != 0)) { Utils.LOG_INFO("Use Busses, Not Hatches for Input/Output."); return false; } - if (this.mInputBusses.size() != 2 || this.mOutputBusses.size() != 2) { + if ((this.mInputBusses.size() != 2) || (this.mOutputBusses.size() != 2)) { Utils.LOG_INFO("Incorrect amount of Input & Output busses."); return false; - } + } this.mMaintenanceHatches.clear(); - IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 4); + final IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 4); if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity()); - ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); + ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = this.getCasingTextureIndex(); } else { Utils.LOG_INFO("Maintenance hatch must be in the middle block on the back."); return false; } } - if (this.mMaintenanceHatches.size() != 1 || this.mEnergyHatches.size() != 1) { + if ((this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() != 1)) { Utils.LOG_INFO("Incorrect amount of Maintenance or Energy hatches."); return false; } @@ -213,17 +212,17 @@ extends GT_MetaTileEntity_MultiBlockBase { } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @Override - public int getDamageToComponent(ItemStack aStack) { + public int getDamageToComponent(final ItemStack aStack) { return 0; } @@ -233,7 +232,7 @@ extends GT_MetaTileEntity_MultiBlockBase { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } @@ -251,11 +250,11 @@ extends GT_MetaTileEntity_MultiBlockBase { return 63; } - private boolean addToMachineList(IGregTechTileEntity tTileEntity) { - return ((addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex()))); + private boolean addToMachineList(final IGregTechTileEntity tTileEntity) { + return ((this.addMaintenanceToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addInputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addOutputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addMufflerToMachineList(tTileEntity, this.getCasingTextureIndex()))); } - private boolean addEnergyInputToMachineList(IGregTechTileEntity tTileEntity) { - return ((addEnergyInputToMachineList(tTileEntity, getCasingTextureIndex()))); + private boolean addEnergyInputToMachineList(final IGregTechTileEntity tTileEntity) { + return ((this.addEnergyInputToMachineList(tTileEntity, this.getCasingTextureIndex()))); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java index ca300ba277..15dbb35dd3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialWireMill.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; + import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -14,31 +16,28 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; - -import java.util.ArrayList; - import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; public class GregtechMetaTileEntity_IndustrialWireMill extends GregtechMeta_MultiBlockBase { - public GregtechMetaTileEntity_IndustrialWireMill(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_IndustrialWireMill(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_IndustrialWireMill(String aName) { + public GregtechMetaTileEntity_IndustrialWireMill(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_IndustrialWireMill(this.mName); } @Override public String[] getDescription() { - return new String[]{ + return new String[]{ "Controller Block for the Industrial Wire Factory", "Size: 3x5x3 [WxLxH] (Hollow)", "Controller (front centered)", "2x Input Bus (side centered)", @@ -51,7 +50,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[63], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; } @@ -59,8 +58,8 @@ extends GregtechMeta_MultiBlockBase { } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "WireFactory.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "WireFactory.png"); } @Override @@ -69,47 +68,47 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (ItemStack tInput : tInputList) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + public boolean checkRecipe(final ItemStack aStack) { + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (final ItemStack tInput : tInputList) { + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sWiremillRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); + final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sWiremillRecipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); if (tRecipe != null) { - - int tValidOutputSlots = this.getValidOutputSlots(getRecipeMap(), new ItemStack[]{tInput}); + + final int tValidOutputSlots = this.getValidOutputSlots(this.getRecipeMap(), new ItemStack[]{tInput}); Utils.LOG_WARNING("Valid Output Slots: "+tValidOutputSlots); //More than or one input - if (tInputList.size() > 0 && tValidOutputSlots >= 1) { - - if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; + if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) { + + if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) { + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << (tTier - 1))); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + this.updateSlots(); + return true; } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; - updateSlots(); - return true; - } } } } @@ -117,14 +116,14 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - byte tSide = getBaseMetaTileEntity().getBackFacing(); - if ((getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 1)) && (getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2) && (getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 3)))) { + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final byte tSide = this.getBaseMetaTileEntity().getBackFacing(); + if ((this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 1)) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 2) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 3)))) { int tAirCount = 0; for (byte i = -1; i < 2; i = (byte) (i + 1)) { for (byte j = -1; j < 2; j = (byte) (j + 1)) { for (byte k = -1; k < 2; k = (byte) (k + 1)) { - if (getBaseMetaTileEntity().getAirOffset(i, j, k)) { + if (this.getBaseMetaTileEntity().getAirOffset(i, j, k)) { tAirCount++; } } @@ -136,30 +135,30 @@ extends GregtechMeta_MultiBlockBase { } for (byte i = 2; i < 6; i = (byte) (i + 1)) { IGregTechTileEntity tTileEntity; - if ((null != (tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(i, 2))) && - (tTileEntity.getFrontFacing() == getBaseMetaTileEntity().getFrontFacing()) && (tTileEntity.getMetaTileEntity() != null) && + if ((null != (tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(i, 2))) && + (tTileEntity.getFrontFacing() == this.getBaseMetaTileEntity().getFrontFacing()) && (tTileEntity.getMetaTileEntity() != null) && ((tTileEntity.getMetaTileEntity() instanceof GregtechMetaTileEntity_IndustrialWireMill))) { //Utils.LOG_INFO("False 1"); return false; } } - int tX = getBaseMetaTileEntity().getXCoord(); - int tY = getBaseMetaTileEntity().getYCoord(); - int tZ = getBaseMetaTileEntity().getZCoord(); + final int tX = this.getBaseMetaTileEntity().getXCoord(); + final int tY = this.getBaseMetaTileEntity().getYCoord(); + final int tZ = this.getBaseMetaTileEntity().getZCoord(); for (byte i = -1; i < 2; i = (byte) (i + 1)) { for (byte j = -1; j < 2; j = (byte) (j + 1)) { if ((i != 0) || (j != 0)) { for (byte k = 0; k < 5; k = (byte) (k + 1)) { if (((i == 0) || (j == 0)) && ((k == 1) || (k == 2) || (k == 3))) { - if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) { - } - else if (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))) && (!addEnergyInputToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))))) { + if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) { + } + else if (!this.addToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))) && (!this.addEnergyInputToMachineList(this.getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i))))) { Utils.LOG_INFO("False 2"); return false; } - } - else if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) { - } + } + else if ((this.getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingBlock()) && (this.getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == this.getCasingMeta())) { + } else { Utils.LOG_INFO("False 3"); return false; @@ -168,26 +167,26 @@ extends GregtechMeta_MultiBlockBase { } } } - if (this.mOutputHatches.size() != 0 || this.mInputHatches.size() != 0) { + if ((this.mOutputHatches.size() != 0) || (this.mInputHatches.size() != 0)) { Utils.LOG_INFO("Use Busses, Not Hatches for Input/Output."); return false; } - if (this.mInputBusses.size() != 2 || this.mOutputBusses.size() != 2) { + if ((this.mInputBusses.size() != 2) || (this.mOutputBusses.size() != 2)) { Utils.LOG_INFO("Incorrect amount of Input & Output busses."); return false; - } + } this.mMaintenanceHatches.clear(); - IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 4); + final IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 4); if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity()); - ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); + ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = this.getCasingTextureIndex(); } else { Utils.LOG_INFO("Maintenance hatch must be in the middle block on the back."); return false; } } - if (this.mMaintenanceHatches.size() != 1 || this.mEnergyHatches.size() != 1) { + if ((this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() != 1)) { Utils.LOG_INFO("Incorrect amount of Maintenance or Energy hatches."); return false; } @@ -200,12 +199,12 @@ extends GregtechMeta_MultiBlockBase { } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @@ -215,7 +214,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } @@ -233,11 +232,11 @@ extends GregtechMeta_MultiBlockBase { return 63; } - private boolean addToMachineList(IGregTechTileEntity tTileEntity) { - return ((addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex()))); + private boolean addToMachineList(final IGregTechTileEntity tTileEntity) { + return ((this.addMaintenanceToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addInputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addOutputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addMufflerToMachineList(tTileEntity, this.getCasingTextureIndex()))); } - - private boolean addEnergyInputToMachineList(IGregTechTileEntity tTileEntity) { - return ((addEnergyInputToMachineList(tTileEntity, getCasingTextureIndex()))); + + private boolean addEnergyInputToMachineList(final IGregTechTileEntity tTileEntity) { + return ((this.addEnergyInputToMachineList(tTileEntity, this.getCasingTextureIndex()))); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IronBlastFurnace.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IronBlastFurnace.java index aa7aecc8c5..be28d3ef72 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IronBlastFurnace.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IronBlastFurnace.java @@ -24,357 +24,357 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; public class GregtechMetaTileEntity_IronBlastFurnace - extends MetaTileEntity { - private static final ITexture[] FACING_SIDE = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top)}; - private static final ITexture[] FACING_FRONT = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)}; - private static final ITexture[] FACING_ACTIVE = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)}; - public int mMaxProgresstime = 0; - public int mUpdate = 30; - public int mProgresstime = 0; - public boolean mMachine = false; - public ItemStack mOutputItem1; - public ItemStack mOutputItem2; - - public GregtechMetaTileEntity_IronBlastFurnace(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, 4); - } - - public GregtechMetaTileEntity_IronBlastFurnace(String aName) { - super(aName, 4); - } - - @Override +extends MetaTileEntity { + private static final ITexture[] FACING_SIDE = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top)}; + private static final ITexture[] FACING_FRONT = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off)}; + private static final ITexture[] FACING_ACTIVE = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_On)}; + public int mMaxProgresstime = 0; + public int mUpdate = 30; + public int mProgresstime = 0; + public boolean mMachine = false; + public ItemStack mOutputItem1; + public ItemStack mOutputItem2; + + public GregtechMetaTileEntity_IronBlastFurnace(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional, 4); + } + + public GregtechMetaTileEntity_IronBlastFurnace(final String aName) { + super(aName, 4); + } + + @Override public String[] getDescription() { - return new String[]{"Sloooowly, Skip the Bronze age, Get some Steel!", - "Multiblock: 3x3x5 hollow with opening on top", - "40 Iron Plated Bricks required", - "----", - "Even though Iron melts hotter than bronze,", - "this machine is to help players skip looking", - "for tin and copper, which are not as common", - "as Iron is. This machine takes 5x longer than the bronze", - "blast furnace as a result.", - "----", - CORE.GT_Tooltip}; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return aActive ? FACING_ACTIVE : FACING_FRONT; - } - return FACING_SIDE; - } - - @Override + return new String[]{"Sloooowly, Skip the Bronze age, Get some Steel!", + "Multiblock: 3x3x5 hollow with opening on top", + "40 Iron Plated Bricks required", + "----", + "Even though Iron melts hotter than bronze,", + "this machine is to help players skip looking", + "for tin and copper, which are not as common", + "as Iron is. This machine takes 5x longer than the bronze", + "blast furnace as a result.", + "----", + CORE.GT_Tooltip}; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + if (aSide == aFacing) { + return aActive ? FACING_ACTIVE : FACING_FRONT; + } + return FACING_SIDE; + } + + @Override public boolean isSteampowered() { - return false; - } + return false; + } - @Override + @Override public boolean isElectric() { - return false; - } + return false; + } - @Override + @Override public boolean isPneumatic() { - return false; - } + return false; + } - @Override + @Override public boolean isEnetInput() { - return false; - } + return false; + } - @Override + @Override public boolean isEnetOutput() { - return false; - } + return false; + } - @Override - public boolean isInputFacing(byte aSide) { - return false; - } + @Override + public boolean isInputFacing(final byte aSide) { + return false; + } - @Override - public boolean isOutputFacing(byte aSide) { - return false; - } + @Override + public boolean isOutputFacing(final byte aSide) { + return false; + } - @Override + @Override public boolean isTeleporterCompatible() { - return false; - } + return false; + } - @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } + @Override + public boolean isFacingValid(final byte aFacing) { + return aFacing > 1; + } - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } + @Override + public boolean isAccessAllowed(final EntityPlayer aPlayer) { + return true; + } - @Override + @Override public int getProgresstime() { - return this.mProgresstime; - } + return this.mProgresstime; + } - @Override + @Override public int maxProgresstime() { - return this.mMaxProgresstime; - } - - @Override - public int increaseProgress(int aProgress) { - this.mProgresstime += aProgress; - return this.mMaxProgresstime - this.mProgresstime; - } - - @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { - return (GregTech_API.getCoverBehavior(aCoverID.toStack()).isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID)); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IronBlastFurnace(this.mName); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mProgresstime", this.mProgresstime); - aNBT.setInteger("mMaxProgresstime", this.mMaxProgresstime); - if (this.mOutputItem1 != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - this.mOutputItem1.writeToNBT(tNBT); - aNBT.setTag("mOutputItem1", tNBT); - } - if (this.mOutputItem2 != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - this.mOutputItem2.writeToNBT(tNBT); - aNBT.setTag("mOutputItem2", tNBT); - } - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - this.mUpdate = 30; - this.mProgresstime = aNBT.getInteger("mProgresstime"); - this.mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); - this.mOutputItem1 = GT_Utility.loadItem(aNBT, "mOutputItem1"); - this.mOutputItem2 = GT_Utility.loadItem(aNBT, "mOutputItem2"); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); - } - - private boolean checkMachine() { - int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 4; j++) { //This is height - for (int k = -1; k < 2; k++) { - if ((xDir + i != 0) || (j != 0) || (zDir + k != 0)) { - if ((i != 0) || (j == -1) || (k != 0)) { - if ((getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k) != ModBlocks.blockCasingsMisc) || (getBaseMetaTileEntity().getMetaIDOffset(xDir + i, j, zDir + k) != 10)) { - return false; - } - } else if ((!GT_Utility.arrayContains(getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k), new Object[]{Blocks.lava, Blocks.flowing_lava, null})) && (!getBaseMetaTileEntity().getAirOffset(xDir + i, j, zDir + k))) { - return false; - } - } - } - } - } - return true; - } - - @Override + return this.mMaxProgresstime; + } + + @Override + public int increaseProgress(final int aProgress) { + this.mProgresstime += aProgress; + return this.mMaxProgresstime - this.mProgresstime; + } + + @Override + public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aCoverID) { + return (GregTech_API.getCoverBehavior(aCoverID.toStack()).isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID)); + } + + @Override + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_IronBlastFurnace(this.mName); + } + + @Override + public void saveNBTData(final NBTTagCompound aNBT) { + aNBT.setInteger("mProgresstime", this.mProgresstime); + aNBT.setInteger("mMaxProgresstime", this.mMaxProgresstime); + if (this.mOutputItem1 != null) { + final NBTTagCompound tNBT = new NBTTagCompound(); + this.mOutputItem1.writeToNBT(tNBT); + aNBT.setTag("mOutputItem1", tNBT); + } + if (this.mOutputItem2 != null) { + final NBTTagCompound tNBT = new NBTTagCompound(); + this.mOutputItem2.writeToNBT(tNBT); + aNBT.setTag("mOutputItem2", tNBT); + } + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + this.mUpdate = 30; + this.mProgresstime = aNBT.getInteger("mProgresstime"); + this.mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); + this.mOutputItem1 = GT_Utility.loadItem(aNBT, "mOutputItem1"); + this.mOutputItem2 = GT_Utility.loadItem(aNBT, "mOutputItem2"); + } + + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new CONTAINER_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); + } + + private boolean checkMachine() { + final int xDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetZ; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 4; j++) { //This is height + for (int k = -1; k < 2; k++) { + if (((xDir + i) != 0) || (j != 0) || ((zDir + k) != 0)) { + if ((i != 0) || (j == -1) || (k != 0)) { + if ((this.getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k) != ModBlocks.blockCasingsMisc) || (this.getBaseMetaTileEntity().getMetaIDOffset(xDir + i, j, zDir + k) != 10)) { + return false; + } + } else if ((!GT_Utility.arrayContains(this.getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k), new Object[]{Blocks.lava, Blocks.flowing_lava, null})) && (!this.getBaseMetaTileEntity().getAirOffset(xDir + i, j, zDir + k))) { + return false; + } + } + } + } + } + return true; + } + + @Override public void onMachineBlockUpdate() { - this.mUpdate = 30; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if ((aBaseMetaTileEntity.isClientSide()) && - (aBaseMetaTileEntity.isActive())) { - aBaseMetaTileEntity.getWorld().spawnParticle("cloud", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), 0.0D, 0.3D, 0.0D); - } - if (aBaseMetaTileEntity.isServerSide()) { - if (this.mUpdate-- == 0) { - this.mMachine = checkMachine(); - } - if (this.mMachine) { - if (this.mMaxProgresstime > 0) { - if (++this.mProgresstime >= this.mMaxProgresstime) { - addOutputProducts(); - this.mOutputItem1 = null; - this.mOutputItem2 = null; - this.mProgresstime = 0; - this.mMaxProgresstime = 0; - try { - // GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "steel"); - } catch (Exception e) { - } - } - } else if (aBaseMetaTileEntity.isAllowedToWork()) { - checkRecipe(); - } - } - aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine)); - if (aBaseMetaTileEntity.isActive()) { - if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) { - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2); - this.mUpdate = 1; - } - if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) { - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2); - this.mUpdate = 1; - } - } else { - if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) { - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2); - this.mUpdate = 1; - } - if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) { - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2); - this.mUpdate = 1; - } - } - } - } - - private void addOutputProducts() { - if (this.mOutputItem1 != null) { - if (this.mInventory[2] == null) { - this.mInventory[2] = GT_Utility.copy(new Object[]{this.mOutputItem1}); - } else if (GT_Utility.areStacksEqual(this.mInventory[2], this.mOutputItem1)) { - this.mInventory[2].stackSize = Math.min(this.mOutputItem1.getMaxStackSize(), this.mOutputItem1.stackSize + this.mInventory[2].stackSize); - } - } - if (this.mOutputItem2 != null) { - if (this.mInventory[3] == null) { - this.mInventory[3] = GT_Utility.copy(new Object[]{this.mOutputItem2}); - } else if (GT_Utility.areStacksEqual(this.mInventory[3], this.mOutputItem2)) { - this.mInventory[3].stackSize = Math.min(this.mOutputItem2.getMaxStackSize(), this.mOutputItem2.stackSize + this.mInventory[3].stackSize); - } - } - } - - private boolean spaceForOutput(ItemStack aStack1, ItemStack aStack2) { - if (((this.mInventory[2] == null) || (aStack1 == null) || ((this.mInventory[2].stackSize + aStack1.stackSize <= this.mInventory[2].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[2], aStack1)))) && ( - (this.mInventory[3] == null) || (aStack2 == null) || ((this.mInventory[3].stackSize + aStack2.stackSize <= this.mInventory[3].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[3], aStack2))))) { - return true; - } - return false; - } - - private boolean checkRecipe() { - if (!this.mMachine) { - return false; - } - if ((this.mInventory[0] != null) && (this.mInventory[1] != null) && (this.mInventory[0].stackSize >= 1)) { - if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustIron")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "ingotIron"))) { - if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 4*3); - this.mMaxProgresstime = 36000; - return true; - } - if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 2*3); - this.mMaxProgresstime = 4800*5; - return true; - } - if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 9); - getBaseMetaTileEntity().decrStackSize(1, 4*3); - this.mMaxProgresstime = 64800*5; - return true; - } - } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustSteel")) { - if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 2*3); - this.mMaxProgresstime = 3600*5; - return true; - } - if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 1) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 2L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 1*3); - this.mMaxProgresstime = 2400*5; - return true; - } - if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 2L)))) { - getBaseMetaTileEntity().decrStackSize(0, 9); - getBaseMetaTileEntity().decrStackSize(1, 2*3); - this.mMaxProgresstime = 32400*5; - return true; - } - } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "blockIron")) { - if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 36) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 64); - this.mMaxProgresstime = 64800*9; - return true; - } - if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 18) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Ash, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 18*3); - this.mMaxProgresstime = 43200*5; - return true; - } - if (((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 4*3); - this.mMaxProgresstime = 64800*5; - return true; - } - } - } - this.mOutputItem1 = null; - this.mOutputItem2 = null; - return false; - } - - @Override + this.mUpdate = 30; + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTimer) { + if ((aBaseMetaTileEntity.isClientSide()) && + (aBaseMetaTileEntity.isActive())) { + aBaseMetaTileEntity.getWorld().spawnParticle("cloud", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), 0.0D, 0.3D, 0.0D); + } + if (aBaseMetaTileEntity.isServerSide()) { + if (this.mUpdate-- == 0) { + this.mMachine = this.checkMachine(); + } + if (this.mMachine) { + if (this.mMaxProgresstime > 0) { + if (++this.mProgresstime >= this.mMaxProgresstime) { + this.addOutputProducts(); + this.mOutputItem1 = null; + this.mOutputItem2 = null; + this.mProgresstime = 0; + this.mMaxProgresstime = 0; + try { + // GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "steel"); + } catch (final Exception e) { + } + } + } else if (aBaseMetaTileEntity.isAllowedToWork()) { + this.checkRecipe(); + } + } + aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine)); + if (aBaseMetaTileEntity.isActive()) { + if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2); + this.mUpdate = 1; + } + if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2); + this.mUpdate = 1; + } + } else { + if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2); + this.mUpdate = 1; + } + if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2); + this.mUpdate = 1; + } + } + } + } + + private void addOutputProducts() { + if (this.mOutputItem1 != null) { + if (this.mInventory[2] == null) { + this.mInventory[2] = GT_Utility.copy(new Object[]{this.mOutputItem1}); + } else if (GT_Utility.areStacksEqual(this.mInventory[2], this.mOutputItem1)) { + this.mInventory[2].stackSize = Math.min(this.mOutputItem1.getMaxStackSize(), this.mOutputItem1.stackSize + this.mInventory[2].stackSize); + } + } + if (this.mOutputItem2 != null) { + if (this.mInventory[3] == null) { + this.mInventory[3] = GT_Utility.copy(new Object[]{this.mOutputItem2}); + } else if (GT_Utility.areStacksEqual(this.mInventory[3], this.mOutputItem2)) { + this.mInventory[3].stackSize = Math.min(this.mOutputItem2.getMaxStackSize(), this.mOutputItem2.stackSize + this.mInventory[3].stackSize); + } + } + } + + private boolean spaceForOutput(final ItemStack aStack1, final ItemStack aStack2) { + if (((this.mInventory[2] == null) || (aStack1 == null) || (((this.mInventory[2].stackSize + aStack1.stackSize) <= this.mInventory[2].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[2], aStack1)))) && ( + (this.mInventory[3] == null) || (aStack2 == null) || (((this.mInventory[3].stackSize + aStack2.stackSize) <= this.mInventory[3].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[3], aStack2))))) { + return true; + } + return false; + } + + private boolean checkRecipe() { + if (!this.mMachine) { + return false; + } + if ((this.mInventory[0] != null) && (this.mInventory[1] != null) && (this.mInventory[0].stackSize >= 1)) { + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustIron")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "ingotIron"))) { + if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 4) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 4L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 4*3); + this.mMaxProgresstime = 36000; + return true; + } + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 2) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 4L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 2*3); + this.mMaxProgresstime = 4800*5; + return true; + } + if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 9); + this.getBaseMetaTileEntity().decrStackSize(1, 4*3); + this.mMaxProgresstime = 64800*5; + return true; + } + } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustSteel")) { + if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 2) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 2*3); + this.mMaxProgresstime = 3600*5; + return true; + } + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 1) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 2L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 1*3); + this.mMaxProgresstime = 2400*5; + return true; + } + if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 2) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 2L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 9); + this.getBaseMetaTileEntity().decrStackSize(1, 2*3); + this.mMaxProgresstime = 32400*5; + return true; + } + } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "blockIron")) { + if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 36) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 64); + this.mMaxProgresstime = 64800*9; + return true; + } + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 18) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Ash, 4L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 18*3); + this.mMaxProgresstime = 43200*5; + return true; + } + if (((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (this.spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { + this.getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 4*3); + this.mMaxProgresstime = 64800*5; + return true; + } + } + } + this.mOutputItem1 = null; + this.mOutputItem2 = null; + return false; + } + + @Override public boolean isGivingInformation() { - return false; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aIndex > 1; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - if (aIndex < 2) { - } - return !GT_Utility.areStacksEqual(aStack, this.mInventory[0]); - } - - @Override + return false; + } + + @Override + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return aIndex > 1; + } + + @Override + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + if (aIndex < 2) { + } + return !GT_Utility.areStacksEqual(aStack, this.mInventory[0]); + } + + @Override public byte getTileEntityBaseType() { - return 0; - } + return 0; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java index f6e43f783a..67b592950b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java @@ -1,5 +1,10 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; +import java.util.Arrays; + +import org.apache.commons.lang3.ArrayUtils; + import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -15,18 +20,12 @@ import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MatterFab; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -import java.util.ArrayList; -import java.util.Arrays; - import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import org.apache.commons.lang3.ArrayUtils; - public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlockBase { public static int sUUAperUUM = 1; @@ -43,18 +42,18 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo GT_Recipe fakeRecipe; public int getAmplifierUsed(){ - return mAmplifierUsed; + return this.mAmplifierUsed; } public int getMatterProduced(){ - return mMatterProduced; + return this.mMatterProduced; } - public GregtechMetaTileEntity_MassFabricator(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_MassFabricator(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_MassFabricator(String aName) { + public GregtechMetaTileEntity_MassFabricator(final String aName) { super(aName); } @@ -70,14 +69,14 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo "1x Output Hatch (Any bottom layer casing)", "1x Maintenance Hatch (Any bottom layer casing)", "1x Muffler Hatch (Centered 3x1x3 area in Top layer)", - "1x Energy Hatch (Any bottom layer casing)", + "1x Energy Hatch (Any bottom layer casing)", "24x IC2 Reinforced Glass for the walls", "Matter Fabricator Casings for the edges & top (40 at least!)", CORE.GT_Tooltip}; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[66], new GT_RenderedTexture(aActive ? TexturesGtBlock.Casing_Machine_Screen_3 : TexturesGtBlock.Casing_Machine_Screen_1)}; @@ -86,12 +85,12 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MatterFab(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MatterFabricator.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MatterFab(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png"); } @Override - public void onConfigLoad(GT_Config aConfig) { + public void onConfigLoad(final GT_Config aConfig) { super.onConfigLoad(aConfig); sDurationMultiplier = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUM_Duration_Multiplier", sDurationMultiplier); sUUAperUUM = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_per_UUM", sUUAperUUM); @@ -101,18 +100,18 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } @Override - public boolean checkRecipe(ItemStack aStack) { + public boolean checkRecipe(final ItemStack aStack) { Utils.LOG_INFO("Fabricating Matter."); - if (mInputHatches.size() != 1){ - Utils.LOG_INFO("Too many input hatches. Found: "+mInputHatches.size()+" | Expected: 1"); + if (this.mInputHatches.size() != 1){ + Utils.LOG_INFO("Too many input hatches. Found: "+this.mInputHatches.size()+" | Expected: 1"); return false; } - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (int i = 0; i < (tInputList.size() - 1); i++) { for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { tInputList.remove(j--); } else { tInputList.remove(i--); @@ -120,17 +119,17 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } } } - } + } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - ArrayList<FluidStack> tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + for (int i = 0; i < (tFluidList.size() - 1); i++) { for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { tFluidList.remove(j--); } else { tFluidList.remove(i--); @@ -140,16 +139,16 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } } - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tFluidList.size()]), 0, tFluidList.size()); + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tFluidList.size()]), 0, tFluidList.size()); for (int scrapSlots=0;scrapSlots<tInputs.length;scrapSlots++){ - if (tInputs[scrapSlots].getItem() == scrapPile.getItem()){ + if (tInputs[scrapSlots].getItem() == this.scrapPile.getItem()){ if (tInputs[scrapSlots].stackSize >= 9 ){ Utils.LOG_INFO("Found enough scrap for a special recipe. x"+tInputs[scrapSlots].stackSize); - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { if (isValidMetaTileEntity(tHatch)) { Utils.LOG_INFO("Input fluid empty - Time to generate 1UU-A."); if (tHatch.mFluid == null){ @@ -163,7 +162,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo Utils.LOG_INFO("Remaining after recipe. x"+tInputs[scrapSlots].stackSize); } } - } + } } } @@ -171,14 +170,14 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo if (tFluids.length > 0) { Utils.LOG_INFO("Input fluid found"); for(int i = 0;i<tFluids.length;i++){ - GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tFluids[i]}, new ItemStack[]{}); + final GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tFluids[i]}, new ItemStack[]{}); if (tRecipe != null) { if (tRecipe.isRecipeInputEqual(true, tFluids, new ItemStack[]{})) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = ((tRecipe.mDuration/**sDurationMultiplier*/) / (1 << tTier - 1)); + this.mEUt = (tRecipe.mEUt * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = ((tRecipe.mDuration/**sDurationMultiplier*/) / (1 << (tTier - 1))); } else { this.mEUt = tRecipe.mEUt; this.mMaxProgresstime = (tRecipe.mDuration/**sDurationMultiplier*/); @@ -193,10 +192,10 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; this.mOutputFluids = tRecipe.mFluidOutputs.clone(); - ArrayUtils.reverse(mOutputFluids); - mMatterProduced++; - mAmplifierUsed++; - updateSlots(); + ArrayUtils.reverse(this.mOutputFluids); + this.mMatterProduced++; + this.mAmplifierUsed++; + this.updateSlots(); //Utils.LOG_INFO("Recipes Finished: "+mMatterProduced); return true; } @@ -209,9 +208,9 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } else if (tFluids.length == 0) { Utils.LOG_INFO("Input fluid not found"); - fakeRecipe = Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tempFake}, new ItemStack[]{}); + this.fakeRecipe = Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.findRecipe(this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{this.tempFake}, new ItemStack[]{}); - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; this.mEUt = 32; @@ -225,13 +224,13 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo this.mEUt = (-this.mEUt); } - if (fakeRecipe != null) { + if (this.fakeRecipe != null) { this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{fakeRecipe.getOutput(0)}; - this.mOutputFluids = fakeRecipe.mFluidOutputs.clone(); - ArrayUtils.reverse(mOutputFluids); - mMatterProduced++; - updateSlots(); + this.mOutputItems = new ItemStack[]{this.fakeRecipe.getOutput(0)}; + this.mOutputFluids = this.fakeRecipe.mFluidOutputs.clone(); + ArrayUtils.reverse(this.mOutputFluids); + this.mMatterProduced++; + this.updateSlots(); //Utils.LOG_INFO("Recipes Finished: "+mMatterProduced); return true; } @@ -244,16 +243,16 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2; + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2; for (int i = -2; i < 3; i++) { for (int j = -2; j < 3; j++) { for (int h = 0; h < 4; h++) { //Utils.LOG_INFO("Logging Variables - xDir:"+xDir+" zDir:"+zDir+" h:"+h+" i:"+i+" j:"+j); - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); /*if (tTileEntity != Block.getBlockFromItem(UtilsItems.getItem("IC2:blockAlloyGlass"))) { Utils.LOG_INFO("h:"+h+" i:"+i+" j:"+j); double tX = tTileEntity.getXCoord(); @@ -262,7 +261,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo Utils.LOG_INFO("Found Glass at X:"+tX+" Y:"+tY+" Z:"+tZ); //return false; }*/ - if ((i != -2 && i != 2) && (j != -2 && j != 2)) {// innerer 3x3 ohne h�he + if (((i != -2) && (i != 2)) && ((j != -2) && (j != 2))) {// innerer 3x3 ohne h�he if (h == 0) {// innen boden (kantal coils) if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Matter Generation Coils missings from the bottom layer, inner 3x3."); @@ -273,7 +272,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo return false; } } else if (h == 3) {// innen decke (ulv casings + input + muffler) - if ((!addMufflerToMachineList(tTileEntity, 66))) { + if ((!this.addMufflerToMachineList(tTileEntity, 66))) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); return false; @@ -291,8 +290,8 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } } else {// Outer 5x5 if (h == 0) {// au�en boden (controller, output, energy, maintainance, rest ulv casings) - if ((!addMaintenanceToMachineList(tTileEntity, 66)) && (!addInputToMachineList(tTileEntity, 66)) && (!addOutputToMachineList(tTileEntity, 66)) && (!addEnergyInputToMachineList(tTileEntity, 66))) { - if ((xDir + i != 0) || (zDir + j != 0)) {//no controller + if ((!this.addMaintenanceToMachineList(tTileEntity, 66)) && (!this.addInputToMachineList(tTileEntity, 66)) && (!this.addOutputToMachineList(tTileEntity, 66)) && (!this.addEnergyInputToMachineList(tTileEntity, 66))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the edges of the bottom layer."); return false; @@ -306,7 +305,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } else {// au�en �ber boden (ulv casings) if (h == 1) { - if ((i == -2 || i == 2) && (j == -2 || j == 2)){ + if (((i == -2) || (i == 2)) && ((j == -2) || (j == 2))){ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the corners in the second layer."); return false; @@ -317,7 +316,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } } - else if ((i != -2 || i != 2) && (j != -2 || j != 2)){ + else if (((i != -2) || (i != 2)) && ((j != -2) || (j != 2))){ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != IC2Glass) { Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); return false; @@ -325,7 +324,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } } if (h == 2) { - if ((i == -2 || i == 2) && (j == -2 || j == 2)){ + if (((i == -2) || (i == 2)) && ((j == -2) || (j == 2))){ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the corners in the third layer."); return false; @@ -336,7 +335,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } } - else if ((i != -2 || i != 2) && (j != -2 || j != 2)){ + else if (((i != -2) || (i != 2)) && ((j != -2) || (j != 2))){ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != IC2Glass) { Utils.LOG_INFO("Glass Casings Missing from somewhere in the third layer."); return false; @@ -363,12 +362,12 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @@ -378,12 +377,12 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_MassFabricator(this.mName); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java index fec81aaa15..d8867f904d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; +import java.util.Arrays; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -17,10 +20,6 @@ import gtPlusPlus.core.util.array.Pair; import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -import java.util.ArrayList; -import java.util.Arrays; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; @@ -32,83 +31,83 @@ import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_MultiTank extends GregtechMeta_MultiBlockBase { - public GregtechMetaTileEntity_MultiTank(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_MultiTank(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } private short multiblockCasingCount = 0; private int mInternalSaveClock = 0; - private short storageMultiplier = 1; + private final short storageMultiplier = 1; private int maximumFluidStorage = 96000; private FluidStack internalStorageTank = null; - private NBTTagCompound internalCraftingComponentsTag = new NBTTagCompound(); + private final NBTTagCompound internalCraftingComponentsTag = new NBTTagCompound(); @Override public String[] getInfoData() { - ArrayList<GT_MetaTileEntity_Hatch_Energy> mTier = this.mEnergyHatches; + final ArrayList<GT_MetaTileEntity_Hatch_Energy> mTier = this.mEnergyHatches; if (!mTier.isEmpty()){ - int temp = mTier.get(0).mTier; - if (internalStorageTank == null) { + final int temp = mTier.get(0).mTier; + if (this.internalStorageTank == null) { return new String[]{ GT_Values.VOLTAGE_NAMES[temp]+" Large Fluid Tank", "Stored Fluid: No Fluid", "Internal | Current: "+Integer.toString(0) + "L", - "Internal | Maximum: "+Integer.toString((int) maximumFluidStorage) + "L"}; + "Internal | Maximum: "+Integer.toString(this.maximumFluidStorage) + "L"}; } return new String[]{ GT_Values.VOLTAGE_NAMES[temp]+" Large Fluid Tank", - "Stored Fluid: "+internalStorageTank.getLocalizedName(), - "Internal | Current: "+Integer.toString(internalStorageTank.amount) + "L", - "Internal | Maximum: "+Integer.toString((int) maximumFluidStorage) + "L"}; + "Stored Fluid: "+this.internalStorageTank.getLocalizedName(), + "Internal | Current: "+Integer.toString(this.internalStorageTank.amount) + "L", + "Internal | Maximum: "+Integer.toString(this.maximumFluidStorage) + "L"}; } return new String[]{ "Voltage Tier not set -" +" Large Fluid Tank", "Stored Fluid: No Fluid", "Internal | Current: "+Integer.toString(0) + "L", - "Internal | Maximum: "+Integer.toString((int) maximumFluidStorage) + "L"}; + "Internal | Maximum: "+Integer.toString(this.maximumFluidStorage) + "L"}; } @Override - public void saveNBTData(NBTTagCompound aNBT) { + public void saveNBTData(final NBTTagCompound aNBT) { super.saveNBTData(aNBT); - NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); + final NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); if (gtCraftingComponentsTag != null){ - + Utils.LOG_WARNING("Got Crafting Tag"); - - if (internalStorageTank != null){ - Utils.LOG_WARNING("mFluid was not null, Saving TileEntity NBT data."); - gtCraftingComponentsTag.setString("xFluid", internalStorageTank.getFluid().getName()); - gtCraftingComponentsTag.setInteger("xAmount", internalStorageTank.amount); - gtCraftingComponentsTag.setLong("xAmountMax", maximumFluidStorage); + if (this.internalStorageTank != null){ + Utils.LOG_WARNING("mFluid was not null, Saving TileEntity NBT data."); - aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); - } - else { - Utils.LOG_WARNING("mFluid was null, Saving TileEntity NBT data."); - gtCraftingComponentsTag.removeTag("xFluid"); - gtCraftingComponentsTag.removeTag("xAmount"); - gtCraftingComponentsTag.removeTag("xAmountMax"); - gtCraftingComponentsTag.setLong("xAmountMax", maximumFluidStorage); + gtCraftingComponentsTag.setString("xFluid", this.internalStorageTank.getFluid().getName()); + gtCraftingComponentsTag.setInteger("xAmount", this.internalStorageTank.amount); + gtCraftingComponentsTag.setLong("xAmountMax", this.maximumFluidStorage); + aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); + } + else { + Utils.LOG_WARNING("mFluid was null, Saving TileEntity NBT data."); + gtCraftingComponentsTag.removeTag("xFluid"); + gtCraftingComponentsTag.removeTag("xAmount"); + gtCraftingComponentsTag.removeTag("xAmountMax"); + gtCraftingComponentsTag.setLong("xAmountMax", this.maximumFluidStorage); - aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); - } + + aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); + } } } - + @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + final NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); String xFluid = null; int xAmount = 0; if (gtCraftingComponentsTag.hasNoTags()){ - if (internalStorageTank != null){ + if (this.internalStorageTank != null){ Utils.LOG_WARNING("mFluid was not null, Creating TileEntity NBT data."); - gtCraftingComponentsTag.setInteger("xAmount", internalStorageTank.amount); - gtCraftingComponentsTag.setString("xFluid", internalStorageTank.getFluid().getName()); + gtCraftingComponentsTag.setInteger("xAmount", this.internalStorageTank.amount); + gtCraftingComponentsTag.setString("xFluid", this.internalStorageTank.getFluid().getName()); aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); } } @@ -124,76 +123,76 @@ extends GregtechMeta_MultiBlockBase { Utils.LOG_WARNING("xAmount was not null, Loading TileEntity NBT data."); xAmount = gtCraftingComponentsTag.getInteger("xAmount"); } - if (xFluid != null && xAmount != 0){ + if ((xFluid != null) && (xAmount != 0)){ Utils.LOG_WARNING("Setting Internal Tank, loading "+xAmount+"L of "+xFluid); - setInternalTank(xFluid, xAmount); + this.setInternalTank(xFluid, xAmount); } } } - - private boolean setInternalTank(String fluidName, int amount){ - FluidStack temp = FluidUtils.getFluidStack(fluidName, amount); + + private boolean setInternalTank(final String fluidName, final int amount){ + final FluidStack temp = FluidUtils.getFluidStack(fluidName, amount); if (temp != null){ - if (internalStorageTank == null){ - internalStorageTank = temp; + if (this.internalStorageTank == null){ + this.internalStorageTank = temp; Utils.LOG_WARNING(temp.getFluid().getName()+" Amount: "+temp.amount+"L"); } else{ Utils.LOG_WARNING("Retained Fluid."); - Utils.LOG_WARNING(internalStorageTank.getFluid().getName()+" Amxount: "+internalStorageTank.amount+"L"); + Utils.LOG_WARNING(this.internalStorageTank.getFluid().getName()+" Amxount: "+this.internalStorageTank.amount+"L"); } - markDirty(); + this.markDirty(); return true; } return false; } - + @Override - public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - tryForceNBTUpdate(); + public void onLeftclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + this.tryForceNBTUpdate(); super.onLeftclick(aBaseMetaTileEntity, aPlayer); } - + @Override - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - tryForceNBTUpdate(); + public boolean onWrenchRightClick(final byte aSide, final byte aWrenchingSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) { + this.tryForceNBTUpdate(); return super.onWrenchRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); } - + @Override public void onRemoval() { - tryForceNBTUpdate(); + this.tryForceNBTUpdate(); super.onRemoval(); } - + @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (internalStorageTank.amount >= maximumFluidStorage){ - if (internalStorageTank.amount > maximumFluidStorage){ - internalStorageTank.amount = (int) maximumFluidStorage; + if (this.internalStorageTank.amount >= this.maximumFluidStorage){ + if (this.internalStorageTank.amount > this.maximumFluidStorage){ + this.internalStorageTank.amount = this.maximumFluidStorage; } this.stopMachine(); } - - if (mInternalSaveClock != 20){ - mInternalSaveClock++; + + if (this.mInternalSaveClock != 20){ + this.mInternalSaveClock++; } else { - mInternalSaveClock = 0; - tryForceNBTUpdate(); + this.mInternalSaveClock = 0; + this.tryForceNBTUpdate(); } - } + } - public GregtechMetaTileEntity_MultiTank(String aName) { + public GregtechMetaTileEntity_MultiTank(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_MultiTank(this.mName); } @@ -201,11 +200,11 @@ extends GregtechMeta_MultiBlockBase { public String[] getDescription() { return new String[]{ "Controller Block for the Multitank", - "Size: 3xHx3 (Block behind controller must be air)", + "Size: 3xHx3 (Block behind controller must be air)", "Structure must be at least 4 blocks tall, maximum 20.", "Each casing within the structure adds 96000L storage.", "Controller (front centered)", - "1x Input hatch (anywhere)", + "1x Input hatch (anywhere)", "1x Output hatch (anywhere)", "1x Energy Hatch (anywhere)", "1x Maintenance Hatch (anywhere)", @@ -214,7 +213,7 @@ extends GregtechMeta_MultiBlockBase { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[68], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Screen_Logo : TexturesGtBlock.Overlay_Machine_Screen_Logo)}; } @@ -222,8 +221,8 @@ extends GregtechMeta_MultiBlockBase { } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "VacuumFreezer.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "VacuumFreezer.png"); } @Override @@ -232,18 +231,18 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return aFacing > 1; } @Override - public boolean checkRecipe(ItemStack aStack) { + public boolean checkRecipe(final ItemStack aStack) { - ArrayList<ItemStack> tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { + final ArrayList<ItemStack> tInputList = this.getStoredInputs(); + for (int i = 0; i < (tInputList.size() - 1); i++) { for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { tInputList.remove(j--); } else { tInputList.remove(i--); @@ -252,13 +251,13 @@ extends GregtechMeta_MultiBlockBase { } } } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - ArrayList<FluidStack> tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { + final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + for (int i = 0; i < (tFluidList.size() - 1); i++) { for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { tFluidList.remove(j--); } else { tFluidList.remove(i--); @@ -267,92 +266,93 @@ extends GregtechMeta_MultiBlockBase { } } } - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[1]), 0, 1); + final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[1]), 0, 1); if (tFluids.length >= 2){ Utils.LOG_WARNING("Bad"); return false; } - ArrayList<Pair<GT_MetaTileEntity_Hatch_Input, Boolean>> rList = new ArrayList<Pair<GT_MetaTileEntity_Hatch_Input, Boolean>>(); + final ArrayList<Pair<GT_MetaTileEntity_Hatch_Input, Boolean>> rList = new ArrayList<>(); int slotInputCount = 0; - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { boolean containsFluid = false; if (isValidMetaTileEntity(tHatch)) { slotInputCount++; for (int i=0; i<tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) { - if (tHatch.canTankBeEmptied()){containsFluid=true;} + if (tHatch.canTankBeEmptied()){containsFluid=true;} } - rList.add(new Pair<GT_MetaTileEntity_Hatch_Input, Boolean>(tHatch, containsFluid)); + rList.add(new Pair<>(tHatch, containsFluid)); } } - if (tFluids.length <= 0 || slotInputCount > 1){ + if ((tFluids.length <= 0) || (slotInputCount > 1)){ Utils.LOG_WARNING("Bad"); return false; } - Utils.LOG_WARNING("Okay - 2"); - if (internalStorageTank == null){ - Utils.LOG_WARNING("Okay - 3"); - if (rList.get(0).getKey().mFluid != null && rList.get(0).getKey().mFluid.amount > 0){ - Utils.LOG_WARNING("Okay - 4"); - Utils.LOG_WARNING("Okay - 1"+" rList.get(0).getKey().mFluid.amount: "+rList.get(0).getKey().mFluid.amount /*+" internalStorageTank:"+internalStorageTank.amount*/); - FluidStack tempFluidStack = rList.get(0).getKey().mFluid; - Fluid tempFluid = tempFluidStack.getFluid(); - internalStorageTank = FluidUtils.getFluidStack(tempFluid.getName(), tempFluidStack.amount); + Utils.LOG_WARNING("Okay - 2"); + if (this.internalStorageTank == null){ + Utils.LOG_WARNING("Okay - 3"); + if ((rList.get(0).getKey().mFluid != null) && (rList.get(0).getKey().mFluid.amount > 0)){ + Utils.LOG_WARNING("Okay - 4"); + Utils.LOG_WARNING("Okay - 1"+" rList.get(0).getKey().mFluid.amount: "+rList.get(0).getKey().mFluid.amount /*+" internalStorageTank:"+internalStorageTank.amount*/); + final FluidStack tempFluidStack = rList.get(0).getKey().mFluid; + final Fluid tempFluid = tempFluidStack.getFluid(); + this.internalStorageTank = FluidUtils.getFluidStack(tempFluid.getName(), tempFluidStack.amount); rList.get(0).getKey().mFluid.amount = 0; - Utils.LOG_WARNING("Okay - 1.1"+" rList.get(0).getKey().mFluid.amount: "+rList.get(0).getKey().mFluid.amount +" internalStorageTank:"+internalStorageTank.amount); + Utils.LOG_WARNING("Okay - 1.1"+" rList.get(0).getKey().mFluid.amount: "+rList.get(0).getKey().mFluid.amount +" internalStorageTank:"+this.internalStorageTank.amount); return true; } Utils.LOG_WARNING("No Fluid in hatch."); - return false; + return false; } - else if (internalStorageTank.isFluidEqual(rList.get(0).getKey().mFluid)){ + else if (this.internalStorageTank.isFluidEqual(rList.get(0).getKey().mFluid)){ Utils.LOG_WARNING("Storing "+rList.get(0).getKey().mFluid.amount+"L"); - Utils.LOG_WARNING("Contains "+internalStorageTank.amount+"L"); + Utils.LOG_WARNING("Contains "+this.internalStorageTank.amount+"L"); int tempAdd = 0; tempAdd = rList.get(0).getKey().getFluidAmount(); - rList.get(0).getKey().mFluid = null; + rList.get(0).getKey().mFluid = null; Utils.LOG_WARNING("adding "+tempAdd); - internalStorageTank.amount = internalStorageTank.amount + tempAdd; - Utils.LOG_WARNING("Tank now Contains "+internalStorageTank.amount+"L of "+internalStorageTank.getFluid().getName()+"."); + this.internalStorageTank.amount = this.internalStorageTank.amount + tempAdd; + Utils.LOG_WARNING("Tank now Contains "+this.internalStorageTank.amount+"L of "+this.internalStorageTank.getFluid().getName()+"."); //Utils.LOG_WARNING("Tank"); return true; } else { - FluidStack superTempFluidStack = rList.get(0).getKey().mFluid; - Utils.LOG_WARNING("is input fluid equal to stored fluid? "+(internalStorageTank.isFluidEqual(superTempFluidStack))); - if (superTempFluidStack != null) + final FluidStack superTempFluidStack = rList.get(0).getKey().mFluid; + Utils.LOG_WARNING("is input fluid equal to stored fluid? "+(this.internalStorageTank.isFluidEqual(superTempFluidStack))); + if (superTempFluidStack != null) { Utils.LOG_WARNING("Input hatch[0] Contains "+superTempFluidStack.amount+"L of "+superTempFluidStack.getFluid().getName()+"."); - Utils.LOG_WARNING("Large Multi-Tank Contains "+internalStorageTank.amount+"L of "+internalStorageTank.getFluid().getName()+"."); + } + Utils.LOG_WARNING("Large Multi-Tank Contains "+this.internalStorageTank.amount+"L of "+this.internalStorageTank.getFluid().getName()+"."); - if (internalStorageTank.amount <= 0){ + if (this.internalStorageTank.amount <= 0){ Utils.LOG_WARNING("Internal Tank is empty, sitting idle."); return false; } - if (mOutputHatches.get(0).mFluid == null || mOutputHatches.isEmpty() || (mOutputHatches.get(0).mFluid.isFluidEqual(internalStorageTank) && mOutputHatches.get(0).mFluid.amount < mOutputHatches.get(0).getCapacity())){ - Utils.LOG_WARNING("Okay - 3"); - int tempCurrentStored = internalStorageTank.amount; + if ((this.mOutputHatches.get(0).mFluid == null) || this.mOutputHatches.isEmpty() || (this.mOutputHatches.get(0).mFluid.isFluidEqual(this.internalStorageTank) && (this.mOutputHatches.get(0).mFluid.amount < this.mOutputHatches.get(0).getCapacity()))){ + Utils.LOG_WARNING("Okay - 3"); + final int tempCurrentStored = this.internalStorageTank.amount; int tempResult = 0; - int tempHatchSize = mOutputHatches.get(0).getCapacity(); - int tempHatchCurrentHolding = mOutputHatches.get(0).getFluidAmount(); - int tempHatchRemainingSpace = tempHatchSize - tempHatchCurrentHolding; - FluidStack tempOutputFluid = internalStorageTank; + final int tempHatchSize = this.mOutputHatches.get(0).getCapacity(); + final int tempHatchCurrentHolding = this.mOutputHatches.get(0).getFluidAmount(); + final int tempHatchRemainingSpace = tempHatchSize - tempHatchCurrentHolding; + final FluidStack tempOutputFluid = this.internalStorageTank; if (tempHatchRemainingSpace <= 0){ return false; } - Utils.LOG_WARNING("Okay - 3.1.x"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored: "+tempCurrentStored+" output hatch holds: "+tempHatchCurrentHolding+" tank has "+tempHatchRemainingSpace+"L of space left."); + Utils.LOG_WARNING("Okay - 3.1.x"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored: "+tempCurrentStored+" output hatch holds: "+tempHatchCurrentHolding+" tank has "+tempHatchRemainingSpace+"L of space left."); if (tempHatchSize >= tempHatchRemainingSpace){ - Utils.LOG_WARNING("Okay - 3.1.1"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored: "+tempCurrentStored+" output hatch holds: "+tempHatchCurrentHolding+" tank has "+tempHatchRemainingSpace+"L of space left."); + Utils.LOG_WARNING("Okay - 3.1.1"+" hatchCapacity: "+tempHatchSize +" tempCurrentStored: "+tempCurrentStored+" output hatch holds: "+tempHatchCurrentHolding+" tank has "+tempHatchRemainingSpace+"L of space left."); int adder; - if (tempCurrentStored > 0 && tempCurrentStored <= tempHatchSize){ + if ((tempCurrentStored > 0) && (tempCurrentStored <= tempHatchSize)){ adder = tempCurrentStored; if (adder >= tempHatchRemainingSpace){ adder = tempHatchRemainingSpace; @@ -367,11 +367,11 @@ extends GregtechMeta_MultiBlockBase { tempResult = adder; tempOutputFluid.amount = tempResult; - Utils.LOG_WARNING("Okay - 3.1.2"+" result: "+tempResult +" tempCurrentStored: "+tempCurrentStored + " filling output hatch with: "+tempOutputFluid.amount+"L of "+tempOutputFluid.getFluid().getName()); - mOutputHatches.get(0).fill(tempOutputFluid, true); + Utils.LOG_WARNING("Okay - 3.1.2"+" result: "+tempResult +" tempCurrentStored: "+tempCurrentStored + " filling output hatch with: "+tempOutputFluid.amount+"L of "+tempOutputFluid.getFluid().getName()); + this.mOutputHatches.get(0).fill(tempOutputFluid, true); //mOutputHatches.get(0).mFluid.amount = tempResult; - internalStorageTank.amount = (tempCurrentStored-adder); - Utils.LOG_WARNING("Okay - 3.1.3"+" internalTankStorage: "+internalStorageTank.amount +"L | output hatch contains: "+mOutputHatches.get(0).mFluid.amount+"L of "+mOutputHatches.get(0).mFluid.getFluid().getName()); + this.internalStorageTank.amount = (tempCurrentStored-adder); + Utils.LOG_WARNING("Okay - 3.1.3"+" internalTankStorage: "+this.internalStorageTank.amount +"L | output hatch contains: "+this.mOutputHatches.get(0).mFluid.amount+"L of "+this.mOutputHatches.get(0).mFluid.getFluid().getName()); /*if (internalStorageTank.amount <= 0) internalStorageTank = null;*/ } @@ -379,15 +379,15 @@ extends GregtechMeta_MultiBlockBase { return true; } } - //this.getBaseMetaTileEntity().(tFluids[0].amount, true); + //this.getBaseMetaTileEntity().(tFluids[0].amount, true); Utils.LOG_WARNING("Tank"); return false; } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { Utils.LOG_WARNING("Must be hollow."); return false; @@ -396,9 +396,9 @@ extends GregtechMeta_MultiBlockBase { for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { for (int h = -1; h < 19; h++) { - if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 68)) && (!addInputToMachineList(tTileEntity, 68)) && (!addOutputToMachineList(tTileEntity, 68)) && (!addEnergyInputToMachineList(tTileEntity, 68))) { + if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!this.addMaintenanceToMachineList(tTileEntity, 68)) && (!this.addInputToMachineList(tTileEntity, 68)) && (!this.addOutputToMachineList(tTileEntity, 68)) && (!this.addEnergyInputToMachineList(tTileEntity, 68))) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { if (h < 3){ Utils.LOG_WARNING("Casing Expected."); @@ -421,7 +421,7 @@ extends GregtechMeta_MultiBlockBase { tAmount++; } else if (h >= 3){ - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == Blocks.air || aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName().contains("residual")){ + if ((aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == Blocks.air) || aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName().contains("residual")){ Utils.LOG_WARNING("Found air"); } else { @@ -434,21 +434,21 @@ extends GregtechMeta_MultiBlockBase { } } } - multiblockCasingCount = (short) tAmount; - maximumFluidStorage = getMaximumTankStorage(tAmount); + this.multiblockCasingCount = (short) tAmount; + this.maximumFluidStorage = getMaximumTankStorage(tAmount); Utils.LOG_INFO("Your Multitank can be 20 blocks tall."); - Utils.LOG_INFO("Casings Count: "+multiblockCasingCount+" Valid Multiblock: "+(tAmount >= 16)+" Tank Storage Capacity:"+maximumFluidStorage+"L"); - tryForceNBTUpdate(); + Utils.LOG_INFO("Casings Count: "+this.multiblockCasingCount+" Valid Multiblock: "+(tAmount >= 16)+" Tank Storage Capacity:"+this.maximumFluidStorage+"L"); + this.tryForceNBTUpdate(); return tAmount >= 16; } - + /*public int countCasings() { Utils.LOG_INFO("Counting Machine Casings"); try{ if (this.getBaseMetaTileEntity().getWorld() == null){ Utils.LOG_INFO("Tile Entity's world was null for casing count."); return 0; - } + } if (this.getBaseMetaTileEntity() == null){ Utils.LOG_INFO("Tile Entity was null for casing count."); return 0; @@ -515,12 +515,12 @@ extends GregtechMeta_MultiBlockBase { }*/ @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @@ -530,29 +530,29 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } - - private static short getStorageMultiplier(int casingCount){ - int tsm = 1*casingCount; - if (tsm <= 0){ - return 1; + + private static short getStorageMultiplier(final int casingCount){ + final int tsm = 1*casingCount; + if (tsm <= 0){ + return 1; } return (short) tsm; } - - private static int getMaximumTankStorage(int casingCount){ - int multiplier = getStorageMultiplier(casingCount); - int tempTankStorageMax = 96000*multiplier; + + private static int getMaximumTankStorage(final int casingCount){ + final int multiplier = getStorageMultiplier(casingCount); + final int tempTankStorageMax = 96000*multiplier; if (tempTankStorageMax <= 0){return 96000;} return tempTankStorageMax; } - + private boolean tryForceNBTUpdate(){ //Block is invalid. - if (this == null || this.getBaseMetaTileEntity() == null){ + if ((this == null) || (this.getBaseMetaTileEntity() == null)){ Utils.LOG_WARNING("Block was not valid for saving data."); return false; } @@ -564,17 +564,17 @@ extends GregtechMeta_MultiBlockBase { //Internal Tag was not valid. try{ - if (internalCraftingComponentsTag == null){ - Utils.LOG_WARNING("Internal NBT data tag was null."); - return false; - } - } catch (NullPointerException x){ + if (this.internalCraftingComponentsTag == null){ + Utils.LOG_WARNING("Internal NBT data tag was null."); + return false; + } + } catch (final NullPointerException x){ Utils.LOG_WARNING("Caught null NBT."); } //Internal tag was valid. - saveNBTData(internalCraftingComponentsTag); - + this.saveNBTData(this.internalCraftingComponentsTag); + //Mark block for update int x,y,z = 0; @@ -585,6 +585,6 @@ extends GregtechMeta_MultiBlockBase { //Mark block dirty, let chunk know it's data has changed and it must be saved to disk. (Albeit slowly) this.getBaseMetaTileEntity().markDirty(); - return true; + return true; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java index 45635ea74d..a924e1418d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_PowerSubStationController.java @@ -17,13 +17,13 @@ import net.minecraftforge.common.util.ForgeDirection; public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTileEntity_MultiBlockBase { - private int recipeCounter = 0; + private final int recipeCounter = 0; - public GregtechMetaTileEntity_PowerSubStationController(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_PowerSubStationController(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_PowerSubStationController(String aName) { + public GregtechMetaTileEntity_PowerSubStationController(final String aName) { super(aName); } @@ -37,7 +37,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[67], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER)}; @@ -46,31 +46,31 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MatterFabricator.png"); + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png"); } @Override - public void onConfigLoad(GT_Config aConfig) { + public void onConfigLoad(final GT_Config aConfig) { super.onConfigLoad(aConfig); } @Override - public boolean checkRecipe(ItemStack aStack) { + public boolean checkRecipe(final ItemStack aStack) { return false; } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; for (int i = -2; i < 3; i++) { for (int j = -2; j < 3; j++) { for (int h = 0; h < 4; h++) { //Utils.LOG_INFO("Logging Variables - xDir:"+xDir+" zDir:"+zDir+" h:"+h+" i:"+i+" j:"+j); - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); /*if (tTileEntity != Block.getBlockFromItem(UtilsItems.getItem("IC2:blockAlloyGlass"))) { Utils.LOG_INFO("h:"+h+" i:"+i+" j:"+j); double tX = tTileEntity.getXCoord(); @@ -79,8 +79,8 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil Utils.LOG_INFO("Found Glass at X:"+tX+" Y:"+tY+" Z:"+tZ); //return false; }*/ - if ((i != -2 && i != 2) && (j != -2 && j != 2)) {// innerer 3x3 ohne h�he - if (h == 0 && i != 0 && j != 0) {// innen boden (kantal coils) + if (((i != -2) && (i != 2)) && ((j != -2) && (j != 2))) {// innerer 3x3 ohne h�he + if ((h == 0) && (i != 0) && (j != 0)) {// innen boden (kantal coils) if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Matter Generation Coils missings from the bottom layer, inner 3x3. - Wrong Block"); Utils.LOG_INFO("Found: "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName()+" at x:"+(xDir + i)+" y:" +h+" z:"+(zDir + j)); @@ -92,24 +92,24 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil Utils.LOG_INFO("Matter Generation Coils missings from the bottom layer, inner 3x3. - Wrong Meta"); return false; } - } - else if (h == 3 && i != 0 && j != 0) {// innen decke (ulv casings + input + muffler) - //if(j == 0 && i == 0) { - - if ((!addMufflerToMachineList(tTileEntity, 66))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_INFO("Found: "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName()+" at x:"+(xDir + i)+" y:" +h+" z:"+(zDir + j)); - Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 4) { - Utils.LOG_INFO("Found: "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName()+" at x:"+(xDir + i)+" y:" +h+" z:"+(zDir + j)); - Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); - return false; - } - } + } + else if ((h == 3) && (i != 0) && (j != 0)) {// innen decke (ulv casings + input + muffler) + //if(j == 0 && i == 0) { + + if ((!this.addMufflerToMachineList(tTileEntity, 66))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + Utils.LOG_INFO("Found: "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName()+" at x:"+(xDir + i)+" y:" +h+" z:"+(zDir + j)); + Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 4) { + Utils.LOG_INFO("Found: "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName()+" at x:"+(xDir + i)+" y:" +h+" z:"+(zDir + j)); + Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); + return false; + } + } //} - + } /*else {// top air if ((i != -2 && i != 2) && (j != -2 && j != 2) && h == 3) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { @@ -123,12 +123,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil Utils.LOG_INFO("Matter Generation Coils missings from the top layer, inner 3x3. - Wrong Meta"); return false; } - } + } }*/ } else {// Outer 5x5 if (h == 0) {// au�en boden (controller, output, energy, maintainance, rest ulv casings) - if ((!addEnergyInputToMachineList(tTileEntity, 66) && (!addDynamoToMachineList(tTileEntity, 66)))) { - if ((xDir + i != 0) || (zDir + j != 0)) {//no controller + if ((!this.addEnergyInputToMachineList(tTileEntity, 66) && (!this.addDynamoToMachineList(tTileEntity, 66)))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Found: "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getUnlocalizedName()+" at x:"+(xDir + i)+" y:" +h+" z:"+(zDir + j)); Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the edges of the bottom layer. "+(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName())); @@ -141,7 +141,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil } } } else { - + } } } @@ -152,22 +152,22 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { + public boolean isCorrectMachinePart(final ItemStack aStack) { return true; } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @Override - public int getDamageToComponent(ItemStack aStack) { + public int getDamageToComponent(final ItemStack aStack) { return 0; } @@ -177,12 +177,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GT_MetaTil } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_PowerSubStationController(this.mName); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java index 5ff1239ce3..2b58c09daa 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_Refinery.java @@ -1,6 +1,9 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; import static gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks2.GTID; + +import java.util.ArrayList; + import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; @@ -12,9 +15,6 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.util.Utils; - -import java.util.ArrayList; - import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -25,14 +25,15 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc private boolean completedCycle = false; - public GregtechMetaTileEntity_Refinery(int aID, String aName, String aNameRegional) { + public GregtechMetaTileEntity_Refinery(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMetaTileEntity_Refinery(String aName) { + public GregtechMetaTileEntity_Refinery(final String aName) { super(aName); } + @Override public String[] getDescription() { return new String[]{ "Controller Block for the Fission Fuel Processing Unit", @@ -49,21 +50,23 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc "1x Energy Hatch (One of base platform)"}; } - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+2], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; } return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+2]}; } - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LFTR.png"); + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "LFTR.png"); } @Override - public boolean checkRecipe(ItemStack aStack) { - if (mInventory[1] == null || (mInventory[1].isItemEqual(GT_ModHandler.getIC2Item("miningPipe", 1L)) && mInventory[1].stackSize < mInventory[1].getMaxStackSize())) { - ArrayList<ItemStack> tItems = getStoredInputs(); + public boolean checkRecipe(final ItemStack aStack) { + if ((this.mInventory[1] == null) || (this.mInventory[1].isItemEqual(GT_ModHandler.getIC2Item("miningPipe", 1L)) && (this.mInventory[1].stackSize < this.mInventory[1].getMaxStackSize()))) { + final ArrayList<ItemStack> tItems = this.getStoredInputs(); for (ItemStack tStack : tItems) { if (tStack.isItemEqual(GT_ModHandler.getIC2Item("miningPipe", 1L))) { if (tStack.stackSize < 2) { @@ -73,10 +76,10 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc } } - if (mInventory[1] == null) { - mInventory[1] = GT_ModHandler.getIC2Item("miningPipe", 1L); + if (this.mInventory[1] == null) { + this.mInventory[1] = GT_ModHandler.getIC2Item("miningPipe", 1L); } else { - mInventory[1].stackSize++; + this.mInventory[1].stackSize++; } } } @@ -84,28 +87,29 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc if (tFluid == null) { return false; } - if (getYOfPumpHead() > 0 && getBaseMetaTileEntity().getBlockOffset(ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX, getYOfPumpHead() - 1 - getBaseMetaTileEntity().getYCoord(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ) != Blocks.bedrock) { - if (completedCycle) { - moveOneDown(); + if ((this.getYOfPumpHead() > 0) && (this.getBaseMetaTileEntity().getBlockOffset(ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetX, this.getYOfPumpHead() - 1 - this.getBaseMetaTileEntity().getYCoord(), ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetZ) != Blocks.bedrock)) { + if (this.completedCycle) { + this.moveOneDown(); } tFluid = null; - if (mEnergyHatches.size() > 0 && mEnergyHatches.get(0).getEUVar() > (512 + getMaxInputVoltage() * 4)) - completedCycle = true; + if ((this.mEnergyHatches.size() > 0) && (this.mEnergyHatches.get(0).getEUVar() > (512 + (this.getMaxInputVoltage() * 4)))) { + this.completedCycle = true; + } } else if (tFluid.amount < 5000) { - stopMachine(); + this.stopMachine(); return false; } else { tFluid.amount = tFluid.amount / 5000; } - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + final long tVoltage = this.getMaxInputVoltage(); + final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000)); this.mEfficiencyIncrease = 10000; - int tEU = 24; - int tDuration = 160; + final int tEU = 24; + final int tDuration = 160; if (tEU <= 16) { - this.mEUt = (tEU * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tDuration / (1 << tTier - 1)); + this.mEUt = (tEU * (1 << (tTier - 1)) * (1 << (tTier - 1))); + this.mMaxProgresstime = (tDuration / (1 << (tTier - 1))); } else { this.mEUt = tEU; this.mMaxProgresstime = tDuration; @@ -127,89 +131,89 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc || (!GT_Utility.areStacksEqual(this.mInventory[1], GT_ModHandler.getIC2Item("miningPipe", 1L)))) { return false; } - int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ; - int yHead = getYOfPumpHead(); + final int xDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetZ; + final int yHead = this.getYOfPumpHead(); if (yHead < 1) { return false; } - if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead - 1, getBaseMetaTileEntity().getZCoord() + zDir) == Blocks.bedrock) { + if (this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord() + xDir, yHead - 1, this.getBaseMetaTileEntity().getZCoord() + zDir) == Blocks.bedrock) { return false; } - if (!(getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead - 1, getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))))) { + if (!(this.getBaseMetaTileEntity().getWorld().setBlock(this.getBaseMetaTileEntity().getXCoord() + xDir, yHead - 1, this.getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))))) { return false; } - if (yHead != getBaseMetaTileEntity().getYCoord()) { - getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead, getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))); + if (yHead != this.getBaseMetaTileEntity().getYCoord()) { + this.getBaseMetaTileEntity().getWorld().setBlock(this.getBaseMetaTileEntity().getXCoord() + xDir, yHead, this.getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))); } - getBaseMetaTileEntity().decrStackSize(1, 1); + this.getBaseMetaTileEntity().decrStackSize(1, 1); return true; } private int getYOfPumpHead() { - int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ; - int y = getBaseMetaTileEntity().getYCoord() - 1; - while (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) == GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))) { + final int xDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetZ; + int y = this.getBaseMetaTileEntity().getYCoord() - 1; + while (this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord() + xDir, y, this.getBaseMetaTileEntity().getZCoord() + zDir) == GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))) { y--; } - if (y == getBaseMetaTileEntity().getYCoord() - 1) { - if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) != GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))) { + if (y == (this.getBaseMetaTileEntity().getYCoord() - 1)) { + if (this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord() + xDir, y, this.getBaseMetaTileEntity().getZCoord() + zDir) != GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))) { return y + 1; } - } else if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) != GT_Utility - .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L)) && this.mInventory[1] != null && this.mInventory[1].stackSize > 0 && GT_Utility.areStacksEqual(this.mInventory[1], GT_ModHandler.getIC2Item("miningPipe", 1L))) { - getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir, + } else if ((this.getBaseMetaTileEntity().getBlock(this.getBaseMetaTileEntity().getXCoord() + xDir, y, this.getBaseMetaTileEntity().getZCoord() + zDir) != GT_Utility + .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))) && (this.mInventory[1] != null) && (this.mInventory[1].stackSize > 0) && GT_Utility.areStacksEqual(this.mInventory[1], GT_ModHandler.getIC2Item("miningPipe", 1L))) { + this.getBaseMetaTileEntity().getWorld().setBlock(this.getBaseMetaTileEntity().getXCoord() + xDir, y, this.getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))); - getBaseMetaTileEntity().decrStackSize(0, 1); + this.getBaseMetaTileEntity().decrStackSize(0, 1); } return y; } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - int Y = 0; - if ((xDir + i != 0) || (zDir + j != 0)) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, Y, zDir + j); - if ((!addToMachineList(tTileEntity, GTID+2)) && (!addEnergyInputToMachineList(tTileEntity, GTID+1))) { + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + int Y = 0; + if (((xDir + i) != 0) || ((zDir + j) != 0)) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, Y, zDir + j); + if ((!this.addToMachineList(tTileEntity, GTID+2)) && (!this.addEnergyInputToMachineList(tTileEntity, GTID+1))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, Y, zDir + j) != ModBlocks.blockCasings2Misc) { - Utils.LOG_INFO("Wrong Block."); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, Y, zDir + j) != 2) { - Utils.LOG_INFO("Wrong Meta 1."); - return false; - } + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, Y, zDir + j) != ModBlocks.blockCasings2Misc) { + Utils.LOG_INFO("Wrong Block."); + return false; } - else { - Utils.LOG_INFO("Added Hatch. "+tTileEntity.getInventoryName()); + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, Y, zDir + j) != 2) { + Utils.LOG_INFO("Wrong Meta 1."); + return false; } } - Y = 1; - Utils.LOG_INFO("Checking at Y+1 as well."); - IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, Y, zDir + j); - if ((!addToMachineList(tTileEntity2, GTID+2)) && (!addEnergyInputToMachineList(tTileEntity2, GTID+1))) { + else { + Utils.LOG_INFO("Added Hatch. "+tTileEntity.getInventoryName()); + } + } + Y = 1; + Utils.LOG_INFO("Checking at Y+1 as well."); + final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, Y, zDir + j); + if ((!this.addToMachineList(tTileEntity2, GTID+2)) && (!this.addEnergyInputToMachineList(tTileEntity2, GTID+1))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, Y, zDir + j) != ModBlocks.blockCasings2Misc) { - Utils.LOG_INFO("Wrong Block."); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, Y, zDir + j) != 2) { - Utils.LOG_INFO("Wrong Meta 1."); - return false; - } - } - else { - Utils.LOG_INFO("Added Hatch. "+tTileEntity2.getInventoryName()); - } + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, Y, zDir + j) != ModBlocks.blockCasings2Misc) { + Utils.LOG_INFO("Wrong Block."); + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, Y, zDir + j) != 2) { + Utils.LOG_INFO("Wrong Meta 1."); + return false; + } + } + else { + Utils.LOG_INFO("Added Hatch. "+tTileEntity2.getInventoryName()); } } - + } + for (int y = 2; y < 6; y++) { if (aBaseMetaTileEntity.getBlockOffset(xDir, y, zDir) != ModBlocks.blockCasings2Misc) { //Must Define meta for center blocks Utils.LOG_INFO("Wrong Block."); @@ -290,39 +294,39 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc return false; } } - - if (mInputHatches.size() != 4 || mOutputHatches.size() != 2 || - mOutputBusses.size() != 1 || mMufflerHatches.size() != 1 || - mMaintenanceHatches.size() != 2 || mEnergyHatches.size() < 1){ + + if ((this.mInputHatches.size() != 4) || (this.mOutputHatches.size() != 2) || + (this.mOutputBusses.size() != 1) || (this.mMufflerHatches.size() != 1) || + (this.mMaintenanceHatches.size() != 2) || (this.mEnergyHatches.size() < 1)){ Utils.LOG_INFO("Wrong Hatch count."); return false; } - if (mMufflerHatches.size() == 1){ - if (mMufflerHatches.get(0).mTier < 7){ + if (this.mMufflerHatches.size() == 1){ + if (this.mMufflerHatches.get(0).mTier < 7){ Utils.LOG_INFO("Your Muffler must be AT LEAST ZPM tier or higher."); } } - Utils.LOG_INFO("Multiblock Formed."); + Utils.LOG_INFO("Multiblock Formed."); return true; } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { + public boolean isCorrectMachinePart(final ItemStack aStack) { return true; } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { return 0; } @Override - public int getDamageToComponent(ItemStack aStack) { + public int getDamageToComponent(final ItemStack aStack) { return 0; } @@ -332,11 +336,12 @@ public class GregtechMetaTileEntity_Refinery extends GT_MetaTileEntity_MultiBloc } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { return false; } - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_Refinery(this.mName); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java index 6cd65437cb..1e502be52c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java @@ -20,81 +20,81 @@ extends GT_MetaTileEntity_BasicTank { private String mFluidName; private int mFluidAmount; - private NBTTagCompound internalCraftingComponentsTag = new NBTTagCompound(); + private final NBTTagCompound internalCraftingComponentsTag = new NBTTagCompound(); - public GT_MetaTileEntity_TieredTank(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, "Stores " + ((int) (Math.pow(2, aTier) * 32000)) + "L of fluid"); + public GT_MetaTileEntity_TieredTank(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier, 3, "Stores " + ((aTier+1) * 32000) + "L of fluid"); } - public GT_MetaTileEntity_TieredTank(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); + public GT_MetaTileEntity_TieredTank(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, 3, "Stores " + ((aTier+1) * 32000) + "L of fluid", aTextures); } @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { return new ITexture[0][0][0]; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return aSide == 1 ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER)}; + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return aSide == 1 ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER)}; } - @Override + /*@Override public String[] getDescription() { //setVars(); - if ((mFluidName.equals("Empty")||mFluidName.equals("")) || mFluidAmount <= 0){ - return new String[] {mDescription, CORE.GT_Tooltip}; + if ((this.mFluidName.equals("Empty")||this.mFluidName.equals("")) || (this.mFluidAmount <= 0)){ + return new String[] {"Stores " + (this.mTier * 32000) + "L of fluid", CORE.GT_Tooltip}; } - return new String[] {mDescription, "Stored Fluid: "+mFluidName, "Stored Amount: "+mFluidAmount+"l", CORE.GT_Tooltip}; - } + return new String[] {"Stores " + (this.mTier * 32000) + "L of fluid", "Stored Fluid: "+this.mFluidName, "Stored Amount: "+this.mFluidAmount+"l", CORE.GT_Tooltip}; + }*/ @Override - public void saveNBTData(NBTTagCompound aNBT) { + public void saveNBTData(final NBTTagCompound aNBT) { super.saveNBTData(aNBT); - NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); + final NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); if (gtCraftingComponentsTag != null){ - + Utils.LOG_WARNING("Got Crafting Tag"); - - if (mFluid != null){ - Utils.LOG_WARNING("mFluid was not null, Saving TileEntity NBT data."); - gtCraftingComponentsTag.setInteger("xAmount", mFluid.amount); - gtCraftingComponentsTag.setString("xFluid", mFluid.getFluid().getName()); - mFluidName = mFluid.getFluid().getName(); - - //Backup the current tag - //gtCraftingComponentsTag.setTag("backupTag", internalCraftingComponentsTag); - //internalCraftingComponentsTag = gtCraftingComponentsTag; - - aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); - } - else { - Utils.LOG_WARNING("mFluid was null, Saving TileEntity NBT data."); - gtCraftingComponentsTag.removeTag("xFluid"); - gtCraftingComponentsTag.removeTag("xAmount"); - - //Backup the current tag - //gtCraftingComponentsTag.setTag("backupTag", internalCraftingComponentsTag); - //internalCraftingComponentsTag = gtCraftingComponentsTag; - - aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); - } + + if (this.mFluid != null){ + Utils.LOG_WARNING("mFluid was not null, Saving TileEntity NBT data."); + gtCraftingComponentsTag.setInteger("xAmount", this.mFluid.amount); + gtCraftingComponentsTag.setString("xFluid", this.mFluid.getFluid().getName()); + this.mFluidName = this.mFluid.getFluid().getName(); + + //Backup the current tag + //gtCraftingComponentsTag.setTag("backupTag", internalCraftingComponentsTag); + //internalCraftingComponentsTag = gtCraftingComponentsTag; + + aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); + } + else { + Utils.LOG_WARNING("mFluid was null, Saving TileEntity NBT data."); + gtCraftingComponentsTag.removeTag("xFluid"); + gtCraftingComponentsTag.removeTag("xAmount"); + + //Backup the current tag + //gtCraftingComponentsTag.setTag("backupTag", internalCraftingComponentsTag); + //internalCraftingComponentsTag = gtCraftingComponentsTag; + + aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); + } } } @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + final NBTTagCompound gtCraftingComponentsTag = aNBT.getCompoundTag("GT.CraftingComponents"); String xFluid = null; int xAmount = 0; if (gtCraftingComponentsTag.hasNoTags()){ - if (mFluid != null){ + if (this.mFluid != null){ Utils.LOG_WARNING("mFluid was not null, Creating TileEntity NBT data."); - gtCraftingComponentsTag.setInteger("xAmount", mFluid.amount); - gtCraftingComponentsTag.setString("xFluid", mFluid.getFluid().getName()); + gtCraftingComponentsTag.setInteger("xAmount", this.mFluid.amount); + gtCraftingComponentsTag.setString("xFluid", this.mFluid.getFluid().getName()); aNBT.setTag("GT.CraftingComponents", gtCraftingComponentsTag); } } @@ -110,26 +110,26 @@ extends GT_MetaTileEntity_BasicTank { Utils.LOG_WARNING("xAmount was not null, Loading TileEntity NBT data."); xAmount = gtCraftingComponentsTag.getInteger("xAmount"); } - if (xFluid != null && xAmount != 0){ + if ((xFluid != null) && (xAmount != 0)){ Utils.LOG_WARNING("Setting Internal Tank, loading "+xAmount+"L of "+xFluid); - setInternalTank(xFluid, xAmount); + this.setInternalTank(xFluid, xAmount); } } } - private boolean setInternalTank(String fluidName, int amount){ - FluidStack temp = FluidUtils.getFluidStack(fluidName, amount); + private boolean setInternalTank(final String fluidName, final int amount){ + final FluidStack temp = FluidUtils.getFluidStack(fluidName, amount); if (temp != null){ - if (mFluid == null){ - mFluid = temp; + if (this.mFluid == null){ + this.mFluid = temp; Utils.LOG_WARNING(temp.getFluid().getName()+" Amount: "+temp.amount+"L"); } else{ Utils.LOG_WARNING("Retained Fluid."); - Utils.LOG_WARNING(mFluid.getFluid().getName()+" Amxount: "+mFluid.amount+"L"); + Utils.LOG_WARNING(this.mFluid.getFluid().getName()+" Amxount: "+this.mFluid.amount+"L"); } - markDirty(); + this.markDirty(); return true; } return false; @@ -138,19 +138,19 @@ extends GT_MetaTileEntity_BasicTank { } @Override - public FluidStack drain(int maxDrain, boolean doDrain) { - tryForceNBTUpdate(); + public FluidStack drain(final int maxDrain, final boolean doDrain) { + this.tryForceNBTUpdate(); return super.drain(maxDrain, doDrain); } @Override - public int fill(FluidStack aFluid, boolean doFill) { - tryForceNBTUpdate(); + public int fill(final FluidStack aFluid, final boolean doFill) { + this.tryForceNBTUpdate(); return super.fill(aFluid, doFill); } @Override - public void setItemNBT(NBTTagCompound aNBT) { + public void setItemNBT(final NBTTagCompound aNBT) { super.setItemNBT(aNBT); Utils.LOG_WARNING("setItemNBT"); //aNBT.setTag("GT.CraftingComponents", lRecipeStuff); @@ -159,32 +159,32 @@ extends GT_MetaTileEntity_BasicTank { @Override public void closeInventory() { - tryForceNBTUpdate(); + this.tryForceNBTUpdate(); super.closeInventory(); } @Override - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, - EntityPlayer aPlayer, float aX, float aY, float aZ) { - tryForceNBTUpdate(); + public boolean onWrenchRightClick(final byte aSide, final byte aWrenchingSide, + final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) { + this.tryForceNBTUpdate(); return super.onWrenchRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()){ //setVars(); return true; } aBaseMetaTileEntity.openGUI(aPlayer); - tryForceNBTUpdate(); + this.tryForceNBTUpdate(); return true; } @Override - public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + public void onLeftclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { super.onLeftclick(aBaseMetaTileEntity, aPlayer); - tryForceNBTUpdate(); + this.tryForceNBTUpdate(); } @Override @@ -193,12 +193,12 @@ extends GT_MetaTileEntity_BasicTank { } @Override - public boolean isFacingValid(byte aFacing) { + public boolean isFacingValid(final byte aFacing) { return true; } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { + public boolean isAccessAllowed(final EntityPlayer aPlayer) { return true; } @@ -240,20 +240,20 @@ extends GT_MetaTileEntity_BasicTank { @Override public String[] getInfoData() { - if (mFluid == null) { + if (this.mFluid == null) { return new String[]{ - GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank", + GT_Values.VOLTAGE_NAMES[this.mTier]+" Fluid Tank", "Stored Fluid:", "No Fluid", Integer.toString(0) + "L", - Integer.toString(getCapacity()) + "L"}; + Integer.toString(this.getCapacity()) + "L"}; } return new String[]{ - GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank", + GT_Values.VOLTAGE_NAMES[this.mTier]+" Fluid Tank", "Stored Fluid:", - mFluid.getLocalizedName(), - Integer.toString(mFluid.amount) + "L", - Integer.toString(getCapacity()) + "L"}; + this.mFluid.getLocalizedName(), + Integer.toString(this.mFluid.amount) + "L", + Integer.toString(this.getCapacity()) + "L"}; } @Override @@ -262,13 +262,13 @@ extends GT_MetaTileEntity_BasicTank { } @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_TieredTank(mName, mTier, mDescription, mTextures); + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TieredTank(this.mName, this.mTier, this.mDescription, this.mTextures); } @Override public int getCapacity() { - return (int) (Math.pow(2, mTier) * 32000); + return (int) (Math.pow(2, this.mTier) * 32000); } @Override @@ -284,52 +284,52 @@ extends GT_MetaTileEntity_BasicTank { @Override public void onRemoval() { - tryForceNBTUpdate(); + this.tryForceNBTUpdate(); super.onRemoval(); } @Override public void onCloseGUI() { super.onCloseGUI(); - tryForceNBTUpdate(); + this.tryForceNBTUpdate(); } @Override - public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) { - tryForceNBTUpdate(); + public FluidStack drain(final ForgeDirection aSide, final FluidStack aFluid, final boolean doDrain) { + this.tryForceNBTUpdate(); return super.drain(aSide, aFluid, doDrain); } @Override - public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) { - tryForceNBTUpdate(); + public FluidStack drain(final ForgeDirection aSide, final int maxDrain, final boolean doDrain) { + this.tryForceNBTUpdate(); return super.drain(aSide, maxDrain, doDrain); } @Override - public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) { - tryForceNBTUpdate(); + public int fill(final ForgeDirection arg0, final FluidStack arg1, final boolean arg2) { + this.tryForceNBTUpdate(); return super.fill(arg0, arg1, arg2); } @Override - public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - tryForceNBTUpdate(); + public int fill_default(final ForgeDirection aSide, final FluidStack aFluid, final boolean doFill) { + this.tryForceNBTUpdate(); return super.fill_default(aSide, aFluid, doFill); } private int mInternalSaveClock = 0; @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (mInternalSaveClock != 20){ - mInternalSaveClock++; + if (this.mInternalSaveClock != 20){ + this.mInternalSaveClock++; } else { - mInternalSaveClock = 0; - tryForceNBTUpdate(); + this.mInternalSaveClock = 0; + this.tryForceNBTUpdate(); } } @@ -337,7 +337,7 @@ extends GT_MetaTileEntity_BasicTank { private void tryForceNBTUpdate(){ //Block is invalid. - if (this == null || this.getBaseMetaTileEntity() == null){ + if ((this == null) || (this.getBaseMetaTileEntity() == null)){ Utils.LOG_WARNING("Block was not valid for saving data."); return; } @@ -348,7 +348,7 @@ extends GT_MetaTileEntity_BasicTank { } //Internal Tag was not valid. - if (internalCraftingComponentsTag == null){ + if (this.internalCraftingComponentsTag == null){ Utils.LOG_WARNING("Internal NBT data tag was null."); return; } @@ -360,12 +360,12 @@ extends GT_MetaTileEntity_BasicTank { //Internal tag was valid and contains tags. if (!this.internalCraftingComponentsTag.hasNoTags()){ Utils.LOG_WARNING("Found tags to save."); - saveNBTData(internalCraftingComponentsTag); + this.saveNBTData(this.internalCraftingComponentsTag); } //Internal tag has no tags. else { - Utils.LOG_WARNING("Found no tags to save."); - saveNBTData(internalCraftingComponentsTag); + Utils.LOG_WARNING("Found no tags to save."); + this.saveNBTData(this.internalCraftingComponentsTag); } //Mark block for update @@ -376,7 +376,7 @@ extends GT_MetaTileEntity_BasicTank { this.getBaseMetaTileEntity().getWorld().markBlockForUpdate(x, y, z); //Mark block dirty, let chunk know it's data has changed and it must be saved to disk. (Albeit slowly) - this.getBaseMetaTileEntity().markDirty(); + this.getBaseMetaTileEntity().markDirty(); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Base.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Base.java index cfa7060832..6a53d68221 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Base.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Base.java @@ -1,12 +1,11 @@ package gtPlusPlus.xmod.gregtech.common.tools; +import java.util.List; + import gregtech.api.GregTech_API; import gregtech.api.damagesources.GT_DamageSources; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ToolStats; import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool; - -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.Entity; @@ -55,7 +54,7 @@ implements Interface_ToolStats { } @Override - public int getHurtResistanceTime(int aOriginalHurtResistance, Entity aEntity) { + public int getHurtResistanceTime(final int aOriginalHurtResistance, final Entity aEntity) { return aOriginalHurtResistance; } @@ -76,7 +75,7 @@ implements Interface_ToolStats { @Override public String getBreakingSound() { - return (String) GregTech_API.sSoundList.get(Integer.valueOf(0)); + return GregTech_API.sSoundList.get(Integer.valueOf(0)); } @Override @@ -113,62 +112,65 @@ implements Interface_ToolStats { public boolean isMiningTool() { return true; } - + public boolean isChainsaw(){ return false; } - - + + + @Override public boolean isGrafter(){ return false; } - - public DamageSource getDamageSource(EntityLivingBase aPlayer, Entity aEntity) { - return GT_DamageSources.getCombatDamage((aPlayer instanceof EntityPlayer) ? "player" : "mob", aPlayer, (aEntity instanceof EntityLivingBase) ? getDeathMessage(aPlayer, (EntityLivingBase) aEntity) : null); + + @Override + public DamageSource getDamageSource(final EntityLivingBase aPlayer, final Entity aEntity) { + return GT_DamageSources.getCombatDamage((aPlayer instanceof EntityPlayer) ? "player" : "mob", aPlayer, (aEntity instanceof EntityLivingBase) ? this.getDeathMessage(aPlayer, (EntityLivingBase) aEntity) : null); } - public IChatComponent getDeathMessage(EntityLivingBase aPlayer, EntityLivingBase aEntity) { + public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) { return new EntityDamageSource((aPlayer instanceof EntityPlayer) ? "player" : "mob", aPlayer).func_151519_b(aEntity); } @Override - public int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent) { + public int convertBlockDrops(final List<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { return 0; } @Override - public ItemStack getBrokenItem(ItemStack aStack) { + public ItemStack getBrokenItem(final ItemStack aStack) { return null; } @Override - public Enchantment[] getEnchantments(ItemStack aStack) { + public Enchantment[] getEnchantments(final ItemStack aStack) { return ZERO_ENCHANTMENTS; } @Override - public int[] getEnchantmentLevels(ItemStack aStack) { + public int[] getEnchantmentLevels(final ItemStack aStack) { return ZERO_ENCHANTMENT_LEVELS; } @Override - public void onToolCrafted(ItemStack aStack, EntityPlayer aPlayer) { + public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) { aPlayer.triggerAchievement(AchievementList.openInventory); aPlayer.triggerAchievement(AchievementList.mineWood); aPlayer.triggerAchievement(AchievementList.buildWorkBench); } - - public void onStatsAddedToTool(Gregtech_MetaTool aItem, int aID) { + + @Override + public void onStatsAddedToTool(final Gregtech_MetaTool aItem, final int aID) { } @Override - public float getNormalDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer) { + public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) { return aOriginalDamage; } @Override - public float getMagicDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer) { + public float getMagicDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) { return aOriginalDamage; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Choocher.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Choocher.java index 331bd32f85..0a0e730248 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Choocher.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_Choocher.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.common.tools; +import java.util.Arrays; +import java.util.List; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.IIconContainer; @@ -8,10 +11,6 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; import gtPlusPlus.xmod.gregtech.common.items.behaviours.Behaviour_Choocher; - -import java.util.Arrays; -import java.util.List; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; @@ -25,169 +24,169 @@ import net.minecraft.util.*; import net.minecraftforge.event.world.BlockEvent; public class TOOL_Gregtech_Choocher - extends TOOL_Gregtech_Base { - +extends TOOL_Gregtech_Base { + public static final List<String> mEffectiveList = Arrays.asList(new String[]{EntityIronGolem.class.getName(), "EntityTowerGuardian"}); - - + + @Override - public float getNormalDamageAgainstEntity(float aOriginalDamage, Entity aEntity, ItemStack aStack, EntityPlayer aPlayer) { + public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) { String tName = aEntity.getClass().getName(); tName = tName.substring(tName.lastIndexOf(".") + 1); return (mEffectiveList.contains(tName)) || (tName.contains("Golem")) ? aOriginalDamage * 2.0F : aOriginalDamage; - } - - @Override + } + + @Override public int getToolDamagePerBlockBreak() { - return 50; - } + return 50; + } - @Override + @Override public int getToolDamagePerDropConversion() { - return 100; - } + return 100; + } - @Override + @Override public int getToolDamagePerContainerCraft() { - return 400; - } + return 400; + } - @Override + @Override public int getToolDamagePerEntityAttack() { - return 100; - } + return 100; + } - @Override + @Override public int getBaseQuality() { - return 0; - } + return 0; + } - @Override + @Override public float getBaseDamage() { - return 4.0F; - } + return 4.0F; + } - @Override + @Override public float getSpeedMultiplier() { - return 0.85F; - } + return 0.85F; + } - @Override + @Override public float getMaxDurabilityMultiplier() { - return 1.2F; - } + return 1.2F; + } - @Override + @Override public String getCraftingSound() { - return (String) GregTech_API.sSoundList.get(Integer.valueOf(1)); - } + return GregTech_API.sSoundList.get(Integer.valueOf(1)); + } - @Override + @Override public String getEntityHitSound() { - return (String) GregTech_API.sSoundList.get(Integer.valueOf(2)); - } + return GregTech_API.sSoundList.get(Integer.valueOf(2)); + } - @Override + @Override public String getBreakingSound() { - return (String) GregTech_API.sSoundList.get(Integer.valueOf(0)); - } + return GregTech_API.sSoundList.get(Integer.valueOf(0)); + } - @Override + @Override public String getMiningSound() { - return null; - } + return null; + } - @Override + @Override public boolean canBlock() { - return true; - } - - @Override + return true; + } + + @Override public boolean isWrench(){ - return true; - } + return true; + } - @Override + @Override public boolean isCrowbar() { - return false; - } + return false; + } - @Override + @Override public boolean isWeapon() { - return true; - } - - @Override - public boolean isMinableBlock(Block aBlock, byte aMetaData) { - String tTool = aBlock.getHarvestTool(aMetaData); - return ((tTool != null) && ((tTool.equals("sword")) || (tTool.equals("wrench")) || (tTool.equals("hammer")) || (tTool.equals("pickaxe")))) || (aBlock.getMaterial() == Material.rock) || (aBlock.getMaterial() == Material.glass) || (aBlock.getMaterial() == Material.piston) || (aBlock == Blocks.hopper) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper) || (aBlock.getMaterial() == Material.ice) || (aBlock.getMaterial() == Material.packedIce) || (GT_Recipe.GT_Recipe_Map.sHammerRecipes.containsInput(new ItemStack(aBlock, 1, aMetaData))) || (aBlock.getMaterial() == Material.sand) || (aBlock.getMaterial() == Material.grass) || (aBlock.getMaterial() == Material.ground) || (aBlock.getMaterial() == Material.snow) || (aBlock.getMaterial() == Material.clay) || (aBlock.getMaterial() == Material.leaves) || (aBlock.getMaterial() == Material.vine) || (aBlock.getMaterial() == Material.wood) || (aBlock.getMaterial() == Material.cactus) || (aBlock.getMaterial() == Material.circuits) || (aBlock.getMaterial() == Material.gourd) || (aBlock.getMaterial() == Material.web) || (aBlock.getMaterial() == Material.cloth) || (aBlock.getMaterial() == Material.carpet) || (aBlock.getMaterial() == Material.plants) || (aBlock.getMaterial() == Material.cake) || (aBlock.getMaterial() == Material.tnt) || (aBlock.getMaterial() == Material.sponge); - } - - @Override - public int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent) { - int rConversions = 0; - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{new ItemStack(aBlock, 1, aMetaData)}); - if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) { - for (ItemStack tDrop : aDrops) { - tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{tDrop})}); - if (tRecipe != null) { - ItemStack tHammeringOutput = tRecipe.getOutput(0); - if (tHammeringOutput != null) { - rConversions += tDrop.stackSize; - tDrop.stackSize *= tHammeringOutput.stackSize; - tHammeringOutput.stackSize = tDrop.stackSize; - GT_Utility.setStack(tDrop, tHammeringOutput); - } - } - } - } else { - aDrops.clear(); - aDrops.add(tRecipe.getOutput(0)); - rConversions++; - } - return rConversions; - } - - @Override - public ItemStack getBrokenItem(ItemStack aStack) { - return null; - } - - @Override - public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { - //Utils.LOG_INFO("Texture: "+TexturesGtTools.SKOOKUM_CHOOCHER.getTextureFile()); - return TexturesGtTools.SKOOKUM_CHOOCHER; - } - - @Override - public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { + return true; + } + + @Override + public boolean isMinableBlock(final Block aBlock, final byte aMetaData) { + final String tTool = aBlock.getHarvestTool(aMetaData); + return ((tTool != null) && ((tTool.equals("sword")) || (tTool.equals("wrench")) || (tTool.equals("hammer")) || (tTool.equals("pickaxe")))) || (aBlock.getMaterial() == Material.rock) || (aBlock.getMaterial() == Material.glass) || (aBlock.getMaterial() == Material.piston) || (aBlock == Blocks.hopper) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper) || (aBlock.getMaterial() == Material.ice) || (aBlock.getMaterial() == Material.packedIce) || (GT_Recipe.GT_Recipe_Map.sHammerRecipes.containsInput(new ItemStack(aBlock, 1, aMetaData))) || (aBlock.getMaterial() == Material.sand) || (aBlock.getMaterial() == Material.grass) || (aBlock.getMaterial() == Material.ground) || (aBlock.getMaterial() == Material.snow) || (aBlock.getMaterial() == Material.clay) || (aBlock.getMaterial() == Material.leaves) || (aBlock.getMaterial() == Material.vine) || (aBlock.getMaterial() == Material.wood) || (aBlock.getMaterial() == Material.cactus) || (aBlock.getMaterial() == Material.circuits) || (aBlock.getMaterial() == Material.gourd) || (aBlock.getMaterial() == Material.web) || (aBlock.getMaterial() == Material.cloth) || (aBlock.getMaterial() == Material.carpet) || (aBlock.getMaterial() == Material.plants) || (aBlock.getMaterial() == Material.cake) || (aBlock.getMaterial() == Material.tnt) || (aBlock.getMaterial() == Material.sponge); + } + + @Override + public int convertBlockDrops(final List<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { + int rConversions = 0; + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{new ItemStack(aBlock, 1, aMetaData)}); + if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) { + for (final ItemStack tDrop : aDrops) { + tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{tDrop})}); + if (tRecipe != null) { + final ItemStack tHammeringOutput = tRecipe.getOutput(0); + if (tHammeringOutput != null) { + rConversions += tDrop.stackSize; + tDrop.stackSize *= tHammeringOutput.stackSize; + tHammeringOutput.stackSize = tDrop.stackSize; + GT_Utility.setStack(tDrop, tHammeringOutput); + } + } + } + } else { + aDrops.clear(); + aDrops.add(tRecipe.getOutput(0)); + rConversions++; + } + return rConversions; + } + + @Override + public ItemStack getBrokenItem(final ItemStack aStack) { + return null; + } + + @Override + public IIconContainer getIcon(final boolean aIsToolHead, final ItemStack aStack) { + //Utils.LOG_INFO("Texture: "+TexturesGtTools.SKOOKUM_CHOOCHER.getTextureFile()); + return TexturesGtTools.SKOOKUM_CHOOCHER; + } + + @Override + public short[] getRGBa(final boolean aIsToolHead, final ItemStack aStack) { return GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa; } - /*@Override + /*@Override public void onStatsAddedToTool(Gregtech_MetaTool aItem, int aID) { aItem.addItemBehavior(aID, new Behaviour_Choocher()); }*/ - @Override - public void onToolCrafted(ItemStack aStack, EntityPlayer aPlayer) { - super.onToolCrafted(aStack, aPlayer); - aPlayer.triggerAchievement(AchievementList.buildSword); - try { - GT_Mod.instance.achievements.issueAchievement(aPlayer, "tools"); - GT_Mod.instance.achievements.issueAchievement(aPlayer, "unitool"); - } catch (Exception e) { - } - } - - @Override - public IChatComponent getDeathMessage(EntityLivingBase aPlayer, EntityLivingBase aEntity) { - return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Choochered by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); - } - - @Override - public void onStatsAddedToTool(GT_MetaGenerated_Tool aItem, int aID) { - aItem.addItemBehavior(aID, new Behaviour_Choocher()); + @Override + public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) { + super.onToolCrafted(aStack, aPlayer); + aPlayer.triggerAchievement(AchievementList.buildSword); + try { + GT_Mod.achievements.issueAchievement(aPlayer, "tools"); + GT_Mod.achievements.issueAchievement(aPlayer, "unitool"); + } catch (final Exception e) { + } + } + + @Override + public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) { + return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Choochered by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); + } + + @Override + public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) { + aItem.addItemBehavior(aID, new Behaviour_Choocher()); } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java index 3ab2c613a2..3dd3c88dc4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java @@ -11,6 +11,6 @@ public class Gregtech_Blocks { //Casing Blocks ModBlocks.blockCasingsMisc = new GregtechMetaCasingBlocks(); ModBlocks.blockCasings2Misc = new GregtechMetaCasingBlocks2(); - + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingToolHeadChoocher.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingToolHeadChoocher.java index 7928907db1..190cf416f3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingToolHeadChoocher.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingToolHeadChoocher.java @@ -12,78 +12,79 @@ import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import net.minecraft.item.ItemStack; public class ProcessingToolHeadChoocher implements Interface_OreRecipeRegistrator, Runnable { - public ProcessingToolHeadChoocher() { - GregtechOrePrefixes.toolSkookumChoocher.add(this); - } + public ProcessingToolHeadChoocher() { + GregtechOrePrefixes.toolSkookumChoocher.add(this); + } - @Override - public void registerOre(GregtechOrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { - if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint)) { - if (aMaterial != Materials.Rubber) - if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) && (!aMaterial.contains(SubTag.NO_SMASHING))) { - GT_ModHandler.addCraftingRecipe(MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(16, 1, aMaterial, aMaterial, null), GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"IhI", "III", " I ", Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial)}); - } - } - } + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, final String aModName, final ItemStack aStack) { + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint)) { + if (aMaterial != Materials.Rubber) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) && (!aMaterial.contains(SubTag.NO_SMASHING))) { + GT_ModHandler.addCraftingRecipe(MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(16, 1, aMaterial, aMaterial, null), GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"IhI", "III", " I ", Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial)}); + } + } + } + } @Override - public void registerOre(GregtechOrePrefixes aPrefix, - GT_Materials aMaterial, String aOreDictName, String aModName, - ItemStack aStack) { + public void registerOre(final GregtechOrePrefixes aPrefix, + final GT_Materials aMaterial, final String aOreDictName, final String aModName, + final ItemStack aStack) { // TODO Auto-generated method stub - + } - + public void materialsLoops(){ - Materials[] i = Materials.values(); - int size = i.length; + final Materials[] i = Materials.values(); + final int size = i.length; Utils.LOG_WARNING("Materials to attempt tool gen. with: "+size); int used = 0; Materials aMaterial = null; for (int r=0;r<size;r++){ - aMaterial = i[r]; - if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint) && (aMaterial != Materials.Rubber) && (aMaterial != Materials._NULL)) { - if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) && (!aMaterial.contains(SubTag.NO_SMASHING))&& (!aMaterial.contains(SubTag.TRANSPARENT))&& (!aMaterial.contains(SubTag.FLAMMABLE))&& (!aMaterial.contains(SubTag.MAGICAL))&& (!aMaterial.contains(SubTag.NO_SMELTING))) { - Utils.LOG_WARNING("Found "+aMaterial.name()+" as a valid Skookum Choocher Material."); - //Input 1 - ItemStack plate = GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L); - ItemStack ingot = GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L); - ItemStack screw = GT_OreDictUnificator.get(OrePrefixes.screw, aMaterial, 1L); - ItemStack longrod = GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 1L); - ItemStack hammerhead = GT_OreDictUnificator.get(OrePrefixes.toolHeadHammer, aMaterial, 1L); - - if (null != plate && null != ingot && null != hammerhead && null != longrod && null != screw){ - RecipeUtils.recipeBuilder( - hammerhead, ToolDictNames.craftingToolScrewdriver.name(), plate, - ingot, plate, plate, - longrod, screw, null, - MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(MetaGeneratedGregtechTools.SKOOKUM_CHOOCHER, 1, aMaterial, null, null)); - used++; - } - else { - Utils.LOG_WARNING(""+aMaterial.name()+" could not be used for all input compoenents. [3x"+aMaterial.name()+" plates, 2x"+aMaterial.name()+" ingots, 1x"+aMaterial.name()+" Hard Hammer Head."); - } - //GT_ModHandler.addCraftingRecipe(, GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"P H", "PIP", " I ", Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial), Character.valueOf('P'), OrePrefixes.plate.get(aMaterial), Character.valueOf('H'), OrePrefixes.toolHeadHammer.get(aMaterial)}); - } - else { - Utils.LOG_WARNING(""+aMaterial.name()+" was not a valid Skookum Choocher Material."); + aMaterial = i[r]; + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint) && (aMaterial != Materials.Rubber) && (aMaterial != Materials._NULL)) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) && (!aMaterial.contains(SubTag.NO_SMASHING))&& (!aMaterial.contains(SubTag.TRANSPARENT))&& (!aMaterial.contains(SubTag.FLAMMABLE))&& (!aMaterial.contains(SubTag.MAGICAL))&& (!aMaterial.contains(SubTag.NO_SMELTING))) { + Utils.LOG_WARNING("Found "+aMaterial.name()+" as a valid Skookum Choocher Material."); + //Input 1 + final ItemStack plate = GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L); + final ItemStack ingot = GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L); + final ItemStack screw = GT_OreDictUnificator.get(OrePrefixes.screw, aMaterial, 1L); + final ItemStack longrod = GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 1L); + final ItemStack hammerhead = GT_OreDictUnificator.get(OrePrefixes.toolHeadHammer, aMaterial, 1L); + + if ((null != plate) && (null != ingot) && (null != hammerhead) && (null != longrod) && (null != screw)){ + RecipeUtils.recipeBuilder( + hammerhead, ToolDictNames.craftingToolScrewdriver.name(), plate, + ingot, plate, plate, + longrod, screw, null, + MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(MetaGeneratedGregtechTools.SKOOKUM_CHOOCHER, 1, aMaterial, null, null)); + used++; + } + else { + Utils.LOG_WARNING(""+aMaterial.name()+" could not be used for all input compoenents. [3x"+aMaterial.name()+" plates, 2x"+aMaterial.name()+" ingots, 1x"+aMaterial.name()+" Hard Hammer Head."); + } + //GT_ModHandler.addCraftingRecipe(, GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"P H", "PIP", " I ", Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial), Character.valueOf('P'), OrePrefixes.plate.get(aMaterial), Character.valueOf('H'), OrePrefixes.toolHeadHammer.get(aMaterial)}); + } + else { + Utils.LOG_WARNING(""+aMaterial.name()+" was not a valid Skookum Choocher Material."); } - } + } else { - Utils.LOG_WARNING(""+aMaterial.name()+" was not a valid Skookum Choocher Material."); + Utils.LOG_WARNING(""+aMaterial.name()+" was not a valid Skookum Choocher Material."); } - - + + } - + Utils.LOG_INFO("Materials used for tool gen: "+used); } @Override public void run() { Utils.LOG_INFO("Generating Skookum Choochers of all GT Materials."); - materialsLoops(); + this.materialsLoops(); } - - + + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Processing_Textures_Items.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Processing_Textures_Items.java index 41e0511ace..845fb6db68 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Processing_Textures_Items.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Processing_Textures_Items.java @@ -3,8 +3,8 @@ package gtPlusPlus.xmod.gregtech.loaders; import gtPlusPlus.xmod.gregtech.api.enums.GregtechTextures.ItemIcons.CustomIcon; public class Processing_Textures_Items { - + public static final CustomIcon itemSkookumChoocher = new CustomIcon("iconsets/SKOOKUMCHOOCHER"); - + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java index d2bee058e1..f43aae74b6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java @@ -7,36 +7,36 @@ import gtPlusPlus.core.material.Material; public class RecipeGen_AlloySmelter implements Runnable{ final Material toGenerate; - + public RecipeGen_AlloySmelter(final Material M){ this.toGenerate = M; } - + @Override public void run() { - generateRecipes(toGenerate); + generateRecipes(this.toGenerate); } - + public static void generateRecipes(final Material material){ final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 60 : 15; - + //Nuggets GT_Values.RA.addAlloySmelterRecipe( material.getIngot(1), ItemList.Shape_Mold_Nugget.get(1), material.getNugget(9), (int) Math.max(material.getMass() * 2L, 1L), - 2 * tVoltageMultiplier); - + 2 * tVoltageMultiplier); + //Gears GT_Values.RA.addAlloySmelterRecipe( material.getIngot(8), ItemList.Shape_Mold_Gear.get(1), material.getGear(1), (int) Math.max(material.getMass() * 2L, 1L), - 2 * tVoltageMultiplier); - - } - + 2 * tVoltageMultiplier); + + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Assembler.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Assembler.java index dc22912f0a..6279a28d5c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Assembler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Assembler.java @@ -9,37 +9,37 @@ import net.minecraft.item.ItemStack; public class RecipeGen_Assembler implements Runnable{ final Material toGenerate; - + public RecipeGen_Assembler(final Material M){ this.toGenerate = M; } - + @Override public void run() { - generateRecipes(toGenerate); + generateRecipes(this.toGenerate); } - + public static void generateRecipes(final Material material){ - + //Frame Box GT_Values.RA.addAssemblerRecipe( material.getRod(4), ItemUtils.getGregtechCircuit(4), - material.getBlock(1), + material.getFrameBox(1), 60, - 8); - + 8); + //Rotor addAssemblerRecipe( material.getPlate(4), material.getRing(1), material.getRotor(1), 240, - 24); - + 24); + } - - private static void addAssemblerRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int seconds, int euCost){ + + private static void addAssemblerRecipe(final ItemStack input1, final ItemStack input2, final ItemStack output1, final int seconds, final int euCost){ GT_Values.RA.addAssemblerRecipe( input1, input2, @@ -61,8 +61,8 @@ public class RecipeGen_Assembler implements Runnable{ output1, seconds, euCost); - } - - + } + + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java index c84989e950..efc5c10551 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.loaders; +import java.util.ArrayList; + import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gtPlusPlus.core.lib.CORE; @@ -8,39 +10,36 @@ import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.material.nuclear.NUCLIDE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; - -import java.util.ArrayList; - import net.minecraft.item.ItemStack; public class RecipeGen_BlastSmelter implements Runnable{ final Material toGenerate; - + public RecipeGen_BlastSmelter(final Material M){ this.toGenerate = M; } - + @Override public void run() { - generateARecipe(toGenerate); + generateARecipe(this.toGenerate); } public static void generateARecipe(final Material M){ - //Add a Blast Smelting Recipe, Let's go! + //Add a Blast Smelting Recipe, Let's go! ItemStack tStack; if (null != (tStack = M.getDust(1))) { - - Material[] badMaterials = { - FLUORIDES.THORIUM_HEXAFLUORIDE, - FLUORIDES.THORIUM_TETRAFLUORIDE, - ALLOY.BLOODSTEEL, - //ALLOY.BEDROCKIUM, - NUCLIDE.LiFBeF2ThF4UF4, - NUCLIDE.LiFBeF2ZrF4U235 + + final Material[] badMaterials = { + FLUORIDES.THORIUM_HEXAFLUORIDE, + FLUORIDES.THORIUM_TETRAFLUORIDE, + ALLOY.BLOODSTEEL, + //ALLOY.BEDROCKIUM, + NUCLIDE.LiFBeF2ThF4UF4, + NUCLIDE.LiFBeF2ZrF4U235 }; - for (Material R : badMaterials){ + for (final Material R : badMaterials){ if (M == R){ return; } @@ -48,12 +47,12 @@ public class RecipeGen_BlastSmelter implements Runnable{ //Prepare some Variables ItemStack[] components; - ArrayList<MaterialStack> tMaterial = new ArrayList<MaterialStack>(); + ArrayList<MaterialStack> tMaterial = new ArrayList<>(); short counter=0; int inputStackCount=0; int fluidAmount=0; - boolean doTest = true; - tMaterial = M.getComposites(); + final boolean doTest = true; + tMaterial = M.getComposites(); //This Bad boy here is what dictates unique recipes. Fuck life, right? ItemStack circuitGT = ItemUtils.getGregtechCircuit(0); @@ -65,36 +64,38 @@ public class RecipeGen_BlastSmelter implements Runnable{ duration = (int) Math.max(M.getMass() / 50L, 1L) * M.getMeltingPointK(); } else { - duration = (int) Math.max(M.getMass() / 50L, 1L) * 150; + duration = (int) Math.max(M.getMass() / 50L, 1L) * 150; } int mMaterialListSize=0; if (M.getComposites() != null){ - for (gtPlusPlus.core.material.MaterialStack ternkfsdf : M.getComposites()){ - if (ternkfsdf != null) - mMaterialListSize++; + for (final gtPlusPlus.core.material.MaterialStack ternkfsdf : M.getComposites()){ + if (ternkfsdf != null) { + mMaterialListSize++; + } } } else { - mMaterialListSize = 1; - } + mMaterialListSize = 1; + } Utils.LOG_WARNING("Size: "+mMaterialListSize); - //Make a simple one Material Materialstack[] and log it for validity. + //Make a simple one Material Materialstack[] and log it for validity. circuitGT = ItemUtils.getGregtechCircuit(1); - ItemStack[] tItemStackTest = new ItemStack[]{circuitGT, tStack}; + final ItemStack[] tItemStackTest = new ItemStack[]{circuitGT, tStack}; inputStackCount = 1; fluidAmount = 144*inputStackCount; Utils.LOG_WARNING("Adding an Alloy Blast Smelter Recipe for "+M.getLocalizedName()+". Gives "+fluidAmount+"L of molten metal."); for (int das=0;das<tItemStackTest.length;das++){ - if (tItemStackTest[das] != null) + if (tItemStackTest[das] != null) { Utils.LOG_WARNING("tMaterial["+das+"]: "+tItemStackTest[das].getDisplayName()+" Meta: "+tItemStackTest[das].getItemDamage()+", Amount: "+tItemStackTest[das].stackSize); + } } - - boolean hasMoreInputThanACircuit = (tItemStackTest.length > 1); + + final boolean hasMoreInputThanACircuit = (tItemStackTest.length > 1); //Generate Recipes for all singular materials that can be made molten. if (hasMoreInputThanACircuit){ @@ -130,12 +131,12 @@ public class RecipeGen_BlastSmelter implements Runnable{ if (GT_Values.RA.addFluidExtractionRecipe(M.getIngot(1), null, M.getFluid(144), 100, duration/2, 60)){ Utils.LOG_WARNING("Success, Also added a Fluid Extractor recipe."); } - ItemStack tempitem = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nugget"+M.getUnlocalizedName(), 1); + final ItemStack tempitem = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nugget"+M.getUnlocalizedName(), 1); if (tempitem != null){ if (GT_Values.RA.addFluidExtractionRecipe(tempitem, null, M.getFluid(16), 100, duration/2/9, 60)){ Utils.LOG_WARNING("Success, Also added a Fluid Extractor recipe."); } - } + } if (GT_Values.RA.addFluidExtractionRecipe(M.getSmallDust(1), null, M.getFluid(36), 100, duration/2/4, 60)){ Utils.LOG_WARNING("Success, Also added a Fluid Extractor recipe."); } @@ -143,11 +144,11 @@ public class RecipeGen_BlastSmelter implements Runnable{ Utils.LOG_WARNING("Success, Also added a Fluid Extractor recipe."); } } - } + } else { Utils.LOG_WARNING("Failed."); - } - } + } + } if (tMaterial != null){ //Reset the Variables for compounds if last recipe was a success. @@ -158,21 +159,21 @@ public class RecipeGen_BlastSmelter implements Runnable{ //If this Material has some kind of compound list, proceed if (mMaterialListSize > 1){ - gtPlusPlus.core.material.MaterialStack[] tempStack = new gtPlusPlus.core.material.MaterialStack[mMaterialListSize]; + final gtPlusPlus.core.material.MaterialStack[] tempStack = new gtPlusPlus.core.material.MaterialStack[mMaterialListSize]; circuitGT = ItemUtils.getGregtechCircuit(mMaterialListSize); //Just double checking if (tempStack.length > 1){ //Builds me a MaterialStack[] from the MaterialList of M. int ooo=0; - for (gtPlusPlus.core.material.MaterialStack xMaterial : M.getComposites()){ + for (final gtPlusPlus.core.material.MaterialStack xMaterial : M.getComposites()){ if (xMaterial != null){ if (xMaterial.getStackMaterial() != null){ Utils.LOG_WARNING("FOUND: "+xMaterial.getStackMaterial().getLocalizedName()); - Utils.LOG_WARNING("ADDING: "+xMaterial.getStackMaterial().getLocalizedName()); - } - tempStack[ooo] = xMaterial; - } + Utils.LOG_WARNING("ADDING: "+xMaterial.getStackMaterial().getLocalizedName()); + } + tempStack[ooo] = xMaterial; + } ooo++; } @@ -181,25 +182,25 @@ public class RecipeGen_BlastSmelter implements Runnable{ inputStackCount=0; for (int irc=0;irc<M.getComposites().size();irc++){ if (M.getComposites().get(irc) != null){ - int r = (int) M.vSmallestRatio[irc]; + final int r = (int) M.vSmallestRatio[irc]; inputStackCount = inputStackCount+r; components[irc] = M.getComposites().get(irc).getDustStack(r); - } + } } //Adds a circuit - if (mMaterialListSize < 9 && mMaterialListSize != 0){ - ItemStack[] components_NoCircuit = components; + if ((mMaterialListSize < 9) && (mMaterialListSize != 0)){ + final ItemStack[] components_NoCircuit = components; //Builds me an ItemStack[] of the materials. - With a circuit components = new ItemStack[components_NoCircuit.length+1]; - for (int fr=0;fr<components.length;fr++){ + for (int fr=0;fr<components.length;fr++){ if (fr==0){ components[0] = circuitGT; } else { components[fr] = components_NoCircuit[fr-1]; - } + } } Utils.LOG_WARNING("Should have added a circuit. mMaterialListSize: "+mMaterialListSize+" | circuit: "+components[0].getDisplayName()); } @@ -213,8 +214,9 @@ public class RecipeGen_BlastSmelter implements Runnable{ Utils.LOG_WARNING("Adding an Alloy Blast Smelter Recipe for "+M.getLocalizedName()+" using it's compound dusts. This material has "+ inputStackCount+" parts. Gives "+fluidAmount+"L of molten metal."); Utils.LOG_WARNING("tMaterial.length: "+components.length+"."); for (int das=0;das<components.length;das++){ - if (components[das] != null) + if (components[das] != null) { Utils.LOG_WARNING("tMaterial["+das+"]: "+components[das].getDisplayName()+" Meta: "+components[das].getItemDamage()+", Amount: "+components[das].stackSize); + } } //Adds Recipe @@ -229,10 +231,10 @@ public class RecipeGen_BlastSmelter implements Runnable{ else { if (CORE.RA.addBlastSmelterRecipe(components, M.getFluid(fluidAmount), 100, duration, 240)){ Utils.LOG_WARNING("Success."); - } + } else { Utils.LOG_WARNING("Failed."); - } + } } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT.java index e5262ac645..38f4f5c808 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT.java @@ -6,8 +6,6 @@ import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; -import gtPlusPlus.core.util.materials.MaterialUtils; -import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.item.ItemStack; public class RecipeGen_BlastSmelterGT implements Runnable{ @@ -18,17 +16,17 @@ public class RecipeGen_BlastSmelterGT implements Runnable{ @Override public void run() { - generateRecipes(); + generateRecipes(); } public static void generateRecipes(){ - Materials[] GregMaterials = Materials.values(); + final Materials[] GregMaterials = Materials.values(); - GT: for (Materials M : GregMaterials){ + GT: for (final Materials M : GregMaterials){ if (!M.equals(Materials._NULL)){ - //Add a Blast Smelting Recipe, Let's go! + //Add a Blast Smelting Recipe, Let's go! ItemStack tStack; if ((null != (tStack = GT_OreDictUnificator.get(OrePrefixes.ingot, M.mSmeltInto, 1L))) && (!M.contains(SubTag.NO_SMELTING) && (M.contains(SubTag.METAL)))) { @@ -50,25 +48,26 @@ public class RecipeGen_BlastSmelterGT implements Runnable{ duration = (int) Math.max(M.getMass() / 50L, 1L) * M.mBlastFurnaceTemp; } else { - duration = (int) Math.max(M.getMass() / 50L, 1L) * 150; + duration = (int) Math.max(M.getMass() / 50L, 1L) * 150; } - + //Sets the materials 'tier'. Will probably replace this logic. - int x = M.mMeltingPoint; - int vVoltageMultiplier = (x <= 800 ? 8 : (x <= 1600 ? 16 : (x <= 2800 ? 32 : (x <= 3600 ? 64 : (x <= 4200 ? 128 : (x <= 5400 ? 256 : (x <= 7200 ? 512 : 1024))))))); + final int x = M.mMeltingPoint; + final int vVoltageMultiplier = (x <= 800 ? 8 : (x <= 1600 ? 16 : (x <= 2800 ? 32 : (x <= 3600 ? 64 : (x <= 4200 ? 128 : (x <= 5400 ? 256 : (x <= 7200 ? 512 : 1024))))))); //Make a simple one Material Materialstack[] and log it for validity. - tMaterial = new MaterialStack[]{new MaterialStack(M, 1)}; + tMaterial = new MaterialStack[]{new MaterialStack(M, 1)}; circuitGT = ItemUtils.getGregtechCircuit(1); - ItemStack[] tItemStackTest = new ItemStack[]{circuitGT, ItemUtils.getGregtechDust(M, 1)}; + final ItemStack[] tItemStackTest = new ItemStack[]{circuitGT, ItemUtils.getGregtechDust(M, 1)}; inputStackCount = 1; fluidAmount = 144*inputStackCount; Utils.LOG_WARNING("Adding an Alloy Blast Smelter Recipe for "+M+". Gives "+fluidAmount+"L of molten metal."); Utils.LOG_WARNING("tMaterial.length: "+tMaterial.length+"."); for (int das=0;das<tItemStackTest.length;das++){ - if (tItemStackTest[das] != null) + if (tItemStackTest[das] != null) { Utils.LOG_WARNING("tMaterial["+das+"]: "+tItemStackTest[das].getDisplayName()+" Meta: "+tItemStackTest[das].getItemDamage()+", Amount: "+tItemStackTest[das].stackSize); + } } //Generate Recipes for all singular materials that can be made molten. @@ -76,15 +75,15 @@ public class RecipeGen_BlastSmelterGT implements Runnable{ doTest = CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getMolten(fluidAmount), 100, duration, 8*vVoltageMultiplier); } else { - doTest = CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getMolten(fluidAmount), 100, duration/2, 4*vVoltageMultiplier); + doTest = CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getMolten(fluidAmount), 100, duration/2, 4*vVoltageMultiplier); } - - for (MaterialStack xMaterial : M.mMaterialList){ - if (xMaterial.mMaterial == Materials.Magic || xMaterial.mMaterial == Materials.Metal){ - continue GT; + + for (final MaterialStack xMaterial : M.mMaterialList){ + if ((xMaterial.mMaterial == Materials.Magic) || (xMaterial.mMaterial == Materials.Metal)){ + continue GT; } if (null == GT_OreDictUnificator.get(OrePrefixes.dust, xMaterial, 1L)){ - continue GT; + continue GT; } } @@ -95,20 +94,20 @@ public class RecipeGen_BlastSmelterGT implements Runnable{ int mMaterialListSize=0; - for (MaterialStack ternkfsdf:M.mMaterialList){ + for (final MaterialStack ternkfsdf:M.mMaterialList){ mMaterialListSize++; } Utils.LOG_WARNING("Size: "+mMaterialListSize); //If this Material has some kind of compound list, proceed if (mMaterialListSize > 1){ - MaterialStack[] tempStack = new MaterialStack[mMaterialListSize]; + final MaterialStack[] tempStack = new MaterialStack[mMaterialListSize]; circuitGT = ItemUtils.getGregtechCircuit(mMaterialListSize); //Just double checking if (tempStack.length > 1){ //Builds me a MaterialStack[] from the MaterialList of M. int ooo=0; - for (MaterialStack xMaterial : M.mMaterialList){ + for (final MaterialStack xMaterial : M.mMaterialList){ Utils.LOG_WARNING("FOUND: "+xMaterial.mMaterial); Utils.LOG_WARNING("ADDING: "+xMaterial.mMaterial); tempStack[ooo] = M.mMaterialList.get(ooo); @@ -117,31 +116,31 @@ public class RecipeGen_BlastSmelterGT implements Runnable{ //Builds me an ItemStack[] of the materials. - Without a circuit - this gets a good count for the 144L fluid multiplier components = new ItemStack[tempStack.length]; - for (MaterialStack aOutputPart : tempStack){ + for (final MaterialStack aOutputPart : tempStack){ if (aOutputPart != null){ Utils.LOG_WARNING("Finding dust: "+aOutputPart.mMaterial); - ItemStack rStack = ItemUtils.getGregtechDust(aOutputPart.mMaterial, (int) aOutputPart.mAmount); + final ItemStack rStack = ItemUtils.getGregtechDust(aOutputPart.mMaterial, (int) aOutputPart.mAmount); if (rStack != null){ Utils.LOG_WARNING("Found dust: "+aOutputPart.mMaterial); components[counter] = rStack; inputStackCount = inputStackCount+rStack.stackSize; } - } - counter++; + } + counter++; } - if (mMaterialListSize > 0 && mMaterialListSize < 9){ - ItemStack[] components_NoCircuit = components; + if ((mMaterialListSize > 0) && (mMaterialListSize < 9)){ + final ItemStack[] components_NoCircuit = components; //Builds me an ItemStack[] of the materials. - With a circuit components = new ItemStack[components_NoCircuit.length+1]; - for (int fr=0;fr<components.length;fr++){ + for (int fr=0;fr<components.length;fr++){ if (fr==0){ components[0] = circuitGT; } else { components[fr] = components_NoCircuit[fr-1]; - } + } } } @@ -159,22 +158,23 @@ public class RecipeGen_BlastSmelterGT implements Runnable{ Utils.LOG_WARNING("Adding an Alloy Blast Smelter Recipe for "+M+" using it's compound dusts. This material has "+ inputStackCount+" parts. Gives "+fluidAmount+"L of molten metal."); Utils.LOG_WARNING("tMaterial.length: "+components.length+"."); for (int das=0;das<components.length;das++){ - if (components[das] != null) + if (components[das] != null) { Utils.LOG_WARNING("tMaterial["+das+"]: "+components[das].getDisplayName()+" Meta: "+components[das].getItemDamage()+", Amount: "+components[das].stackSize); + } } - + CORE.RA.addBlastSmelterRecipe( components, M.getMolten(fluidAmount), 100, (int) Math.max(M.getMass() * 2L * 1, 1), 8 * vVoltageMultiplier); // EU Cost - + /*if (M.mBlastFurnaceRequired) { - CORE.RA.addBlastSmelterRecipe(components, M.getMolten(fluidAmount), 100, duration, 500); + CORE.RA.addBlastSmelterRecipe(components, M.getMolten(fluidAmount), 100, duration, 500); } else { - CORE.RA.addBlastSmelterRecipe(components, M.getMolten(fluidAmount), 100, duration, 240); + CORE.RA.addBlastSmelterRecipe(components, M.getMolten(fluidAmount), 100, duration, 240); }*/ } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java index 4a2f91647e..6c93ef58a7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java @@ -2,10 +2,10 @@ package gtPlusPlus.xmod.gregtech.loaders; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.core.material.*; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import net.minecraft.item.ItemStack; @@ -21,14 +21,14 @@ public class RecipeGen_DustGeneration implements Runnable{ @Override public void run() { - generateRecipes(toGenerate); + generateRecipes(this.toGenerate); } public static void generateRecipes(final Material material){ generateRecipes(material, false); } - public static void generateRecipes(final Material material, boolean disableOptional){ + public static void generateRecipes(final Material material, final boolean disableOptional){ final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 60 : 15; Utils.LOG_WARNING("Generating Shaped Crafting recipes for "+material.getLocalizedName()); //TODO @@ -42,7 +42,7 @@ public class RecipeGen_DustGeneration implements Runnable{ Utils.LOG_WARNING("Ring Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Ring Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Ring Recipe: "+material.getLocalizedName()+" - Failed"); } @@ -54,66 +54,68 @@ public class RecipeGen_DustGeneration implements Runnable{ final ItemStack outputStacks = material.getDust(material.smallestStackSizeWhenProcessing); if (RecipeUtils.recipeBuilder( - tinyDust, tinyDust, tinyDust, - tinyDust, tinyDust, tinyDust, + tinyDust, tinyDust, tinyDust, + tinyDust, tinyDust, tinyDust, tinyDust, tinyDust, tinyDust, normalDust)){ Utils.LOG_WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); } if (RecipeUtils.recipeBuilder( - normalDust, null, null, - null, null, null, + normalDust, null, null, + null, null, null, null, null, null, material.getTinyDust(9))){ Utils.LOG_WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Failed"); } if (RecipeUtils.recipeBuilder( - smallDust, smallDust, null, - smallDust, smallDust, null, + smallDust, smallDust, null, + smallDust, smallDust, null, null, null, null, normalDust)){ Utils.LOG_WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); } if (RecipeUtils.recipeBuilder( - null, normalDust, null, - null, null, null, + null, normalDust, null, + null, null, null, null, null, null, material.getSmallDust(4))){ Utils.LOG_WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); } //Macerate blocks back to dusts. - ItemStack materialBlock = material.getBlock(1); - ItemStack materialFrameBox = material.getFrameBox(1); + final ItemStack materialBlock = material.getBlock(1); + final ItemStack materialFrameBox = material.getFrameBox(1); - if (materialBlock != null) + if (materialBlock != null) { GT_ModHandler.addPulverisationRecipe(materialBlock, material.getDust(9)); + } - if (materialFrameBox != null) + if (materialFrameBox != null) { GT_ModHandler.addPulverisationRecipe(materialFrameBox, material.getDust(2)); + } //Is this a composite? - if (inputStacks != null && !disableOptional){ + if ((inputStacks != null) && !disableOptional){ //Is this a composite? Utils.LOG_INFO("mixer length: "+inputStacks.length); - if (inputStacks.length != 0 && inputStacks.length <= 4){ + if ((inputStacks.length != 0) && (inputStacks.length <= 4)){ //Log Input items Utils.LOG_WARNING(ItemUtils.getArrayStackNames(inputStacks)); final long[] inputStackSize = material.vSmallestRatio; @@ -122,12 +124,12 @@ public class RecipeGen_DustGeneration implements Runnable{ if (inputStackSize != null){ //set stack sizes on an input ItemStack[] for (short x=0;x<inputStacks.length;x++){ - if (inputStacks[x] != null && inputStackSize[x] != 0){ - inputStacks[x].stackSize = (int) inputStackSize[x]; + if ((inputStacks[x] != null) && (inputStackSize[x] != 0)){ + inputStacks[x].stackSize = (int) inputStackSize[x]; } } //Relog input values, with stack sizes - Utils.LOG_WARNING(ItemUtils.getArrayStackNames(inputStacks)); + Utils.LOG_WARNING(ItemUtils.getArrayStackNames(inputStacks)); //Get us four ItemStacks to input into the mixer ItemStack input1, input2, input3, input4; @@ -140,13 +142,13 @@ public class RecipeGen_DustGeneration implements Runnable{ FluidStack oxygen = GT_Values.NF; if (material.getComposites() != null){ - for (MaterialStack x : material.getComposites()){ + for (final MaterialStack x : material.getComposites()){ if (!material.getComposites().isEmpty()){ if (x != null){ if (x.getStackMaterial() != null){ if (x.getStackMaterial().getDust(1) == null){ if (x.getStackMaterial().getState() == MaterialState.GAS){ - oxygen = x.getStackMaterial().getFluid(1000); + oxygen = x.getStackMaterial().getFluid(1000); } } } @@ -168,7 +170,7 @@ public class RecipeGen_DustGeneration implements Runnable{ Utils.LOG_INFO("Dust Mixer Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_INFO("Dust Mixer Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_INFO("Dust Mixer Recipe: "+material.getLocalizedName()+" - Failed"); } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java index caaf0f9b47..d0670e2d7e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java @@ -17,7 +17,7 @@ public class RecipeGen_Extruder implements Runnable{ @Override public void run() { - generateRecipes(toGenerate); + generateRecipes(this.toGenerate); } public static void generateRecipes(final Material material){ @@ -47,7 +47,7 @@ public class RecipeGen_Extruder implements Runnable{ Utils.LOG_WARNING("Extruder Ingot Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Extruder Ingot Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Extruder Ingot Recipe: "+material.getLocalizedName()+" - Failed"); } //Block Recipe @@ -60,7 +60,7 @@ public class RecipeGen_Extruder implements Runnable{ Utils.LOG_WARNING("Extruder Block Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Extruder Block Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Extruder Block Recipe: "+material.getLocalizedName()+" - Failed"); } //Plate Recipe @@ -72,7 +72,7 @@ public class RecipeGen_Extruder implements Runnable{ Utils.LOG_WARNING("Extruder Plate Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Extruder Plate Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Extruder Plate Recipe: "+material.getLocalizedName()+" - Failed"); } //Ring Recipe @@ -86,7 +86,7 @@ public class RecipeGen_Extruder implements Runnable{ Utils.LOG_WARNING("Extruder Ring Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Extruder Ring Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Extruder Ring Recipe: "+material.getLocalizedName()+" - Failed"); } } @@ -102,7 +102,7 @@ public class RecipeGen_Extruder implements Runnable{ Utils.LOG_WARNING("Extruder Gear Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Extruder Gear Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Extruder Gear Recipe: "+material.getLocalizedName()+" - Failed"); } } @@ -117,29 +117,29 @@ public class RecipeGen_Extruder implements Runnable{ Utils.LOG_WARNING("Extruder Rod Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Extruder Rod Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Extruder Rod Recipe: "+material.getLocalizedName()+" - Failed"); } //Bolt Recipe if (!material.isRadioactive){ if (addExtruderRecipe( - itemIngot, - shape_Bolt, + itemIngot, + shape_Bolt, material.getBolt(8), (int) Math.max(material.getMass() * 2L * 1, 1), 6 * material.vVoltageMultiplier)){ Utils.LOG_WARNING("Extruder Bolt Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Extruder Bolt Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Extruder Bolt Recipe: "+material.getLocalizedName()+" - Failed"); } } - } + } - public static boolean addExtruderRecipe(ItemStack aInput, ItemStack aShape, ItemStack aOutput, int aDuration, int aEUt) { + public static boolean addExtruderRecipe(final ItemStack aInput, final ItemStack aShape, final ItemStack aOutput, int aDuration, final int aEUt) { if ((aInput == null) || (aShape == null) || (aOutput == null)) { return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java index eac2cba20f..f4f8752421 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java @@ -15,14 +15,14 @@ public class RecipeGen_Fluids implements Runnable{ @Override public void run() { - generateRecipes(toGenerate); + generateRecipes(this.toGenerate); } public static void generateRecipes(final Material material){ generateRecipes(material, false); } - public static void generateRecipes(final Material material, boolean disableOptional){ + public static void generateRecipes(final Material material, final boolean disableOptional){ //Melting Shapes to fluid if (!material.getFluid(1).getUnlocalizedName().toLowerCase().contains("plasma")){ @@ -37,8 +37,8 @@ public class RecipeGen_Fluids implements Runnable{ Utils.LOG_WARNING("144l fluid extractor from 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("144l fluid extractor from 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); - } + Utils.LOG_WARNING("144l fluid extractor from 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + } //Ingot if (GT_Values.RA.addFluidExtractionRecipe(material.getIngot(1), //Input @@ -51,7 +51,7 @@ public class RecipeGen_Fluids implements Runnable{ Utils.LOG_WARNING("144l fluid extractor from 1 ingot Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("144l fluid extractor from 1 ingot Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("144l fluid extractor from 1 ingot Recipe: "+material.getLocalizedName()+" - Failed"); } //Plate @@ -65,8 +65,8 @@ public class RecipeGen_Fluids implements Runnable{ Utils.LOG_WARNING("144l fluid extractor from 1 plate Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("144l fluid extractor from 1 plate Recipe: "+material.getLocalizedName()+" - Failed"); - } + Utils.LOG_WARNING("144l fluid extractor from 1 plate Recipe: "+material.getLocalizedName()+" - Failed"); + } //Double Plate if (GT_Values.RA.addFluidExtractionRecipe(material.getPlateDouble(1), //Input @@ -79,7 +79,7 @@ public class RecipeGen_Fluids implements Runnable{ Utils.LOG_WARNING("144l fluid extractor from 1 double plate Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("144l fluid extractor from 1 double plate Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("144l fluid extractor from 1 double plate Recipe: "+material.getLocalizedName()+" - Failed"); } //Nugget @@ -93,7 +93,7 @@ public class RecipeGen_Fluids implements Runnable{ Utils.LOG_WARNING("16l fluid extractor from 1 nugget Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("16l fluid extractor from 1 nugget Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("16l fluid extractor from 1 nugget Recipe: "+material.getLocalizedName()+" - Failed"); } //Block @@ -107,7 +107,7 @@ public class RecipeGen_Fluids implements Runnable{ Utils.LOG_WARNING((144*9)+"l fluid extractor from 1 block Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING((144*9)+"l fluid extractor from 1 block Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING((144*9)+"l fluid extractor from 1 block Recipe: "+material.getLocalizedName()+" - Failed"); } @@ -120,72 +120,72 @@ public class RecipeGen_Fluids implements Runnable{ //Ingot if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Ingot.get(0), //Item Shape + ItemList.Shape_Mold_Ingot.get(0), //Item Shape material.getFluid(144), //Fluid Input - material.getIngot(1), //output + material.getIngot(1), //output 32, //Duration 8 //Eu Tick )){ Utils.LOG_WARNING("144l fluid molder for 1 ingot Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("144l fluid molder for 1 ingot Recipe: "+material.getLocalizedName()+" - Failed"); - } + Utils.LOG_WARNING("144l fluid molder for 1 ingot Recipe: "+material.getLocalizedName()+" - Failed"); + } //Plate if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Plate.get(1), //Item Shape + ItemList.Shape_Mold_Plate.get(1), //Item Shape material.getFluid(144), //Fluid Input - material.getPlate(1), //output + material.getPlate(1), //output 32, //Duration 8 //Eu Tick )){ Utils.LOG_WARNING("144l fluid molder for 1 plate Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("144l fluid molder for 1 plate Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("144l fluid molder for 1 plate Recipe: "+material.getLocalizedName()+" - Failed"); } //Nugget if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Nugget.get(0), //Item Shape + ItemList.Shape_Mold_Nugget.get(0), //Item Shape material.getFluid(16), //Fluid Input - material.getNugget(1), //output + material.getNugget(1), //output 16, //Duration 4 //Eu Tick )){ Utils.LOG_WARNING("16l fluid molder for 1 nugget Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("16l fluid molder for 1 nugget Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("16l fluid molder for 1 nugget Recipe: "+material.getLocalizedName()+" - Failed"); } //Gears if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Gear.get(0), //Item Shape + ItemList.Shape_Mold_Gear.get(0), //Item Shape material.getFluid(576), //Fluid Input - material.getGear(1), //output + material.getGear(1), //output 128, //Duration 8 //Eu Tick )){ Utils.LOG_WARNING("576l fluid molder for 1 gear Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("576l fluid molder for 1 gear Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("576l fluid molder for 1 gear Recipe: "+material.getLocalizedName()+" - Failed"); } //Blocks if (GT_Values.RA.addFluidSolidifierRecipe( - ItemList.Shape_Mold_Block.get(0), //Item Shape + ItemList.Shape_Mold_Block.get(0), //Item Shape material.getFluid(144*9), //Fluid Input - material.getBlock(1), //output + material.getBlock(1), //output 288, //Duration 16 //Eu Tick )){ Utils.LOG_WARNING((144*9)+"l fluid molder from 1 block Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING((144*9)+"l fluid molder from 1 block Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING((144*9)+"l fluid molder from 1 block Recipe: "+material.getLocalizedName()+" - Failed"); } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java index c48a41b496..fe9d322fde 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java @@ -11,16 +11,16 @@ import net.minecraft.item.ItemStack; public class RecipeGen_Plates implements Runnable{ final Material toGenerate; - + public RecipeGen_Plates(final Material M){ this.toGenerate = M; } - + @Override public void run() { - generateRecipes(toGenerate); + generateRecipes(this.toGenerate); } - + public static void generateRecipes(final Material material){ final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 60 : 15; @@ -32,7 +32,7 @@ public class RecipeGen_Plates implements Runnable{ final ItemStack plate_Double = material.getPlateDouble(1); Utils.LOG_WARNING("Generating Plate recipes for "+material.getLocalizedName()); - + //Forge Hammer if (addForgeHammerRecipe( ingotStackTwo, @@ -42,7 +42,7 @@ public class RecipeGen_Plates implements Runnable{ Utils.LOG_WARNING("Forge Hammer Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Forge Hammer Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Forge Hammer Recipe: "+material.getLocalizedName()+" - Failed"); } //Bender if (addBenderRecipe( @@ -53,7 +53,7 @@ public class RecipeGen_Plates implements Runnable{ Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Failed"); } //Alloy Smelter if (GT_Values.RA.addAlloySmelterRecipe( @@ -65,7 +65,7 @@ public class RecipeGen_Plates implements Runnable{ Utils.LOG_WARNING("Alloy Smelter Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Alloy Smelter Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Alloy Smelter Recipe: "+material.getLocalizedName()+" - Failed"); } @@ -78,7 +78,7 @@ public class RecipeGen_Plates implements Runnable{ Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Failed"); } if (addBenderRecipe( plate_SingleTwo, @@ -88,11 +88,11 @@ public class RecipeGen_Plates implements Runnable{ Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Failed"); - } + Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Failed"); + } } - public static boolean addBenderRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt) { + public static boolean addBenderRecipe(final ItemStack aInput1, final ItemStack aOutput1, int aDuration, final int aEUt) { if ((aInput1 == null) || (aOutput1 == null)) { return false; } @@ -103,7 +103,7 @@ public class RecipeGen_Plates implements Runnable{ return true; } - public static boolean addExtruderRecipe(ItemStack aInput, ItemStack aShape, ItemStack aOutput, int aDuration, int aEUt) { + public static boolean addExtruderRecipe(final ItemStack aInput, final ItemStack aShape, final ItemStack aOutput, int aDuration, final int aEUt) { if ((aInput == null) || (aShape == null) || (aOutput == null)) { return false; } @@ -114,7 +114,7 @@ public class RecipeGen_Plates implements Runnable{ return true; } - public static boolean addForgeHammerRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt) { + public static boolean addForgeHammerRecipe(final ItemStack aInput1, final ItemStack aOutput1, final int aDuration, final int aEUt) { if ((aInput1 == null) || (aOutput1 == null)) { return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java index e26f630604..6c25b697a2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java @@ -1,11 +1,9 @@ package gtPlusPlus.xmod.gregtech.loaders; import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import net.minecraft.item.ItemStack; @@ -19,7 +17,7 @@ public class RecipeGen_ShapedCrafting implements Runnable{ @Override public void run() { - generateRecipes(toGenerate); + generateRecipes(this.toGenerate); } public static void generateRecipes(final Material material){ @@ -32,32 +30,32 @@ public class RecipeGen_ShapedCrafting implements Runnable{ material.getPlate(1), gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"h", "B", "I", - Character.valueOf('I'), - material.getIngot(1), - Character.valueOf('B'), - material.getIngot(1)}); + Character.valueOf('I'), + material.getIngot(1), + Character.valueOf('B'), + material.getIngot(1)}); GT_ModHandler.addShapelessCraftingRecipe( material.getPlate(1), new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, - material.getIngot(1), - material.getIngot(1)}); + material.getIngot(1), + material.getIngot(1)}); //Double Plate Shaped/Shapeless GT_ModHandler.addCraftingRecipe( material.getPlateDouble(1), gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"I", "B", "h", - Character.valueOf('I'), - material.getPlate(1), - Character.valueOf('B'), - material.getPlate(1)}); + Character.valueOf('I'), + material.getPlate(1), + Character.valueOf('B'), + material.getPlate(1)}); GT_ModHandler.addShapelessCraftingRecipe( material.getPlateDouble(1), new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, - material.getPlate(1), - material.getPlate(1)}); + material.getPlate(1), + material.getPlate(1)}); //Ring Recipe if (!material.isRadioactive){ @@ -70,7 +68,7 @@ public class RecipeGen_ShapedCrafting implements Runnable{ Utils.LOG_WARNING("GT:NH Ring Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("GT:NH Ring Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("GT:NH Ring Recipe: "+material.getLocalizedName()+" - Failed"); } } else { @@ -82,9 +80,9 @@ public class RecipeGen_ShapedCrafting implements Runnable{ Utils.LOG_WARNING("Ring Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Ring Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Ring Recipe: "+material.getLocalizedName()+" - Failed"); } - } + } } @@ -99,13 +97,13 @@ public class RecipeGen_ShapedCrafting implements Runnable{ Utils.LOG_WARNING("Framebox Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Framebox Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Framebox Recipe: "+material.getLocalizedName()+" - Failed"); } } /*final int tVoltageMultiplier = material.getMeltingPointK() >= 1600 ? 60 : 15; - + //Add a shapeless recipe for each dust this way - Compat mode. ItemStack[] inputStacks = material.getMaterialComposites(); @@ -119,18 +117,18 @@ public class RecipeGen_ShapedCrafting implements Runnable{ if (inputStacks[x] != null && inputStackSize[x] != 0) inputStacks[x].stackSize = (int) inputStackSize[x]; } - Utils.LOG_WARNING(ItemUtils.getArrayStackNames(inputStacks)); + Utils.LOG_WARNING(ItemUtils.getArrayStackNames(inputStacks)); if (RecipeUtils.buildShapelessRecipe( - outputStacks, + outputStacks, inputStacks )){ Utils.LOG_WARNING("Shapeless Crafting Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Shapeless Crafting Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Shapeless Crafting Recipe: "+material.getLocalizedName()+" - Failed"); } } - } */ + } */ //Shaped Recipe - Bolts @@ -143,7 +141,7 @@ public class RecipeGen_ShapedCrafting implements Runnable{ Utils.LOG_WARNING("Bolt Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Bolt Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Bolt Recipe: "+material.getLocalizedName()+" - Failed"); } } @@ -157,7 +155,7 @@ public class RecipeGen_ShapedCrafting implements Runnable{ Utils.LOG_WARNING("Rod Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Rod Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Rod Recipe: "+material.getLocalizedName()+" - Failed"); } @@ -170,7 +168,7 @@ public class RecipeGen_ShapedCrafting implements Runnable{ Utils.LOG_WARNING("Rod Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Rod Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Rod Recipe: "+material.getLocalizedName()+" - Failed"); } //Two small to long rod @@ -182,7 +180,7 @@ public class RecipeGen_ShapedCrafting implements Runnable{ Utils.LOG_WARNING("Long Rod Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Long Rod Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Long Rod Recipe: "+material.getLocalizedName()+" - Failed"); } //Rotor Recipe @@ -195,7 +193,7 @@ public class RecipeGen_ShapedCrafting implements Runnable{ Utils.LOG_WARNING("Rotor Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Rotor Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Rotor Recipe: "+material.getLocalizedName()+" - Failed"); } } @@ -209,7 +207,7 @@ public class RecipeGen_ShapedCrafting implements Runnable{ Utils.LOG_WARNING("Gear Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Gear Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Gear Recipe: "+material.getLocalizedName()+" - Failed"); } } @@ -223,7 +221,7 @@ public class RecipeGen_ShapedCrafting implements Runnable{ Utils.LOG_WARNING("Screw Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_WARNING("Screw Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Screw Recipe: "+material.getLocalizedName()+" - Failed"); } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index 177ee518b0..47a2d7eaaa 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -17,7 +17,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { @Override - public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt) { + public boolean addCokeOvenRecipe(final ItemStack aInput1, final ItemStack aInput2, final FluidStack aFluidInput, final FluidStack aFluidOutput, final ItemStack aOutput, int aDuration, final int aEUt) { try { try { RECIPEHANDLER_CokeOven.debug1(); @@ -27,7 +27,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { return false; } - } catch (NullPointerException e){e.getStackTrace();} + } catch (final NullPointerException e){e.getStackTrace();} try { RECIPEHANDLER_CokeOven.debug2(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); if ((aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aOutput, aDuration)) <= 0)) { @@ -36,7 +36,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { return false; } - } catch (NullPointerException e){e.getStackTrace();} + } catch (final NullPointerException e){e.getStackTrace();} try { RECIPEHANDLER_CokeOven.debug3(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); if ((aFluidOutput == null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aFluidOutput.getFluid().getName(), aDuration)) <= 0)) { @@ -45,7 +45,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { return false; } - } catch (NullPointerException e){e.getStackTrace();} + } catch (final NullPointerException e){e.getStackTrace();} try { RECIPEHANDLER_CokeOven.debug4(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); if (aFluidInput == null){ @@ -58,10 +58,10 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { return true; - } catch (NullPointerException e){ + } catch (final NullPointerException e){ return false; } - } catch (Throwable e){ + } catch (final Throwable e){ Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_WARNING("Failed."); e.getStackTrace(); @@ -70,7 +70,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } @Override - public boolean addMatterFabricatorRecipe(FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt) { + public boolean addMatterFabricatorRecipe(final FluidStack aFluidInput, final FluidStack aFluidOutput, final int aDuration, final int aEUt) { try { try { //RECIPEHANDLER_MatterFabricator.debug1(); @@ -80,7 +80,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { return false; } - } catch (NullPointerException e){e.getStackTrace();} + } catch (final NullPointerException e){e.getStackTrace();} try{ //RECIPEHANDLER_MatterFabricator.debug4(aFluidInput, aFluidOutput, aDuration, aEUt); @@ -96,10 +96,10 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { return true; - } catch (NullPointerException e){ + } catch (final NullPointerException e){ return false; } - } catch (Throwable e){ + } catch (final Throwable e){ //Utils.LOG_WARNING("aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_WARNING("Failed."); e.getStackTrace(); @@ -108,9 +108,9 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } @Override - public boolean addMatterFabricatorRecipe(ItemStack aInputStack, FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt) { + public boolean addMatterFabricatorRecipe(final ItemStack aInputStack, final FluidStack aFluidInput, final FluidStack aFluidOutput, final int aDuration, final int aEUt) { try { - try {if (aFluidOutput == null || aInputStack == null) {return false;}} catch (NullPointerException e){} + try {if ((aFluidOutput == null) || (aInputStack == null)) {return false;}} catch (final NullPointerException e){} try{ if (aFluidInput == null){ Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.addRecipe(true, new ItemStack[]{aInputStack}, null, null, null, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0); @@ -120,13 +120,13 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } RECIPEHANDLER_MatterFabricator.debug5(aFluidInput, aFluidOutput, aDuration, aEUt); return true; - } catch (NullPointerException e){return false;} - } catch (Throwable e){return false;} + } catch (final NullPointerException e){return false;} + } catch (final Throwable e){return false;} } - + @Override - public boolean addFuel(ItemStack aInput1, ItemStack aOutput1, int aEU, int aType) { + public boolean addFuel(final ItemStack aInput1, final ItemStack aOutput1, final int aEU, final int aType) { if (aInput1 == null) { Utils.LOG_INFO("Fuel Input is Invalid."); return false; @@ -183,7 +183,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { @Override - public boolean addDehydratorRecipe(ItemStack aInput, FluidStack aFluid, ItemStack[] aOutput, int aDuration, int aEUt) { + public boolean addDehydratorRecipe(final ItemStack aInput, final FluidStack aFluid, final ItemStack[] aOutput, int aDuration, final int aEUt) { Utils.LOG_INFO("Trying to add a Dehydrator recipe."); try{ if ((aInput == null) || (aFluid == null) || (aOutput == null)) { @@ -195,14 +195,14 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes.addRecipe(true, new ItemStack[]{aInput}, aOutput, null, new FluidStack[]{aFluid}, null, aDuration, aEUt, 0); //RECIPEHANDLER_Dehydrator.debug5(aInput, null, aFluid, null, aOutput, aDuration, aEUt); return true; - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");return false;} + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");return false;} } @Override - public boolean addDehydratorRecipe(ItemStack[] aInput, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack[] aOutputItems, int[] aChances, int aDuration, int aEUt) throws IndexOutOfBoundsException{ + public boolean addDehydratorRecipe(final ItemStack[] aInput, final FluidStack aFluidInput, final FluidStack aFluidOutput, final ItemStack[] aOutputItems, final int[] aChances, int aDuration, final int aEUt) throws IndexOutOfBoundsException{ Utils.LOG_INFO("Trying to add a Dehydrator recipe."); try{ if (aInput[0] != null){ @@ -246,7 +246,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } return true; - }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");return false;} + }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");return false;} } @@ -254,13 +254,13 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { @Override - public boolean addBlastSmelterRecipe(ItemStack[] aInput, FluidStack aOutput, int aChance, int aDuration, int aEUt) { + public boolean addBlastSmelterRecipe(final ItemStack[] aInput, FluidStack aOutput, final int aChance, int aDuration, final int aEUt) { if ((aInput == null) || (aOutput == null)) { Utils.LOG_WARNING("Fail - Input or Output was null."); return false; } - - + + if (aOutput.isFluidEqual(Materials.PhasedGold.getMolten(1))) { aOutput = Materials.VibrantAlloy.getMolten(aOutput.amount); } @@ -273,53 +273,54 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } for (int das=0;das<aInput.length;das++){ - if (aInput[das] != null) - Utils.LOG_WARNING("tMaterial["+das+"]: "+aInput[das].getDisplayName()+", Amount: "+aInput[das].stackSize); + if (aInput[das] != null) { + Utils.LOG_WARNING("tMaterial["+das+"]: "+aInput[das].getDisplayName()+", Amount: "+aInput[das].stackSize); + } } - + Recipe_GT.Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes.addRecipe(true, aInput, new ItemStack[]{null}, null, new int[]{aChance}, null, new FluidStack[]{aOutput}, aDuration, aEUt, 0); return true; } - + @Override - public boolean addLFTRRecipe(ItemStack aInput1, FluidStack aInput2, - ItemStack aOutput1, FluidStack aOutput2, int aDuration, int aEUt) { + public boolean addLFTRRecipe(final ItemStack aInput1, final FluidStack aInput2, + final ItemStack aOutput1, final FluidStack aOutput2, final int aDuration, final int aEUt) { // TODO Auto-generated method stub return false; } - + @Override - public boolean addLFTRRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt) { - return false; - } + public boolean addLFTRRecipe(final ItemStack aInput1, final ItemStack aInput2, final ItemStack aOutput1, final int aDuration, final int aEUt) { + return false; + } - @Override - public boolean addLFTRRecipe(FluidStack aInput1, FluidStack aInput2, FluidStack aOutput1, int aDuration, int aEUt) { - if (aInput1 == null || aInput2 == null || aOutput1 == null || aDuration < 1 || aEUt < 1) { - return false; - } - Recipe_GT.Gregtech_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.addRecipe(null, new FluidStack[]{aInput1, aInput2}, new FluidStack[]{aOutput1}, aDuration, aEUt, 16000); - return true; - } + @Override + public boolean addLFTRRecipe(final FluidStack aInput1, final FluidStack aInput2, final FluidStack aOutput1, final int aDuration, final int aEUt) { + if ((aInput1 == null) || (aInput2 == null) || (aOutput1 == null) || (aDuration < 1) || (aEUt < 1)) { + return false; + } + Recipe_GT.Gregtech_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.addRecipe(null, new FluidStack[]{aInput1, aInput2}, new FluidStack[]{aOutput1}, aDuration, aEUt, 16000); + return true; + } @Override public boolean addFissionFuel( - FluidStack aInput1, FluidStack aInput2, FluidStack aInput3, - FluidStack aInput4, FluidStack aInput5, FluidStack aInput6, - FluidStack aInput7, FluidStack aInput8, FluidStack aInput9, - FluidStack aOutput1, FluidStack aOutput2, - int aDuration, int aEUt) { - - if (aInput1 == null || aInput2 == null || aOutput1 == null || aDuration < 1 || aEUt < 1) { - return false; - } - FluidStack inputs[] = {aInput1, aInput2, aInput3, aInput4, aInput5, aInput6, aInput7, aInput8, aInput9}; - FluidStack outputs[] = {aOutput1, aOutput2}; - //Recipe_GT.Gregtech_Recipe_Map.sFissionFuelProcessing.addRecipe(null, inputs, outputs, aDuration, aEUt, 0); + final FluidStack aInput1, final FluidStack aInput2, final FluidStack aInput3, + final FluidStack aInput4, final FluidStack aInput5, final FluidStack aInput6, + final FluidStack aInput7, final FluidStack aInput8, final FluidStack aInput9, + final FluidStack aOutput1, final FluidStack aOutput2, + final int aDuration, final int aEUt) { + + if ((aInput1 == null) || (aInput2 == null) || (aOutput1 == null) || (aDuration < 1) || (aEUt < 1)) { + return false; + } + final FluidStack inputs[] = {aInput1, aInput2, aInput3, aInput4, aInput5, aInput6, aInput7, aInput8, aInput9}; + final FluidStack outputs[] = {aOutput1, aOutput2}; + //Recipe_GT.Gregtech_Recipe_Map.sFissionFuelProcessing.addRecipe(null, inputs, outputs, aDuration, aEUt, 0); CustomRecipeMap.sFissionFuelProcessing.addRecipe(null, inputs, outputs, aDuration, aEUt, 0); - return true; + return true; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/machines/RECIPEHANDLER_CokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/machines/RECIPEHANDLER_CokeOven.java index 01b62e23ca..392f732ab2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/machines/RECIPEHANDLER_CokeOven.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/machines/RECIPEHANDLER_CokeOven.java @@ -13,21 +13,21 @@ public class RECIPEHANDLER_CokeOven { Utils.LOG_WARNING("Walking Through CokeOven Recipe Creation."); Utils.LOG_WARNING("My name is Ralph and I will be your humble host."); } - public static void debug2(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ + public static void debug2(final ItemStack aInput1, final ItemStack aInput2, final FluidStack aFluidInput, final FluidStack aFluidOutput, final ItemStack aOutput, final int aDuration, final int aEUt){ Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("Taking a step forward."); Utils.LOG_WARNING("aInput1 == null && aFluidInput == null || aOutput == null && aFluidOutput == null"); Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_WARNING("Passed."); } - public static void debug3(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ + public static void debug3(final ItemStack aInput1, final ItemStack aInput2, final FluidStack aFluidInput, final FluidStack aFluidOutput, final ItemStack aOutput, final int aDuration, final int aEUt){ Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("Taking a step forward."); Utils.LOG_WARNING("(aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get(cokeoven, aOutput, aDuration)) <= 0)"); Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_WARNING("Passed."); } - public static void debug4(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ + public static void debug4(final ItemStack aInput1, final ItemStack aInput2, final FluidStack aFluidInput, final FluidStack aFluidOutput, final ItemStack aOutput, final int aDuration, final int aEUt){ Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("Taking a step forward."); Utils.LOG_WARNING("(aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get(cokeoven, aFluidOutput.getFluid().getName(), aDuration)) <= 0)"); @@ -36,11 +36,11 @@ public class RECIPEHANDLER_CokeOven { Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); } - public static void debug5(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ + public static void debug5(final ItemStack aInput1, final ItemStack aInput2, final FluidStack aFluidInput, final FluidStack aFluidOutput, final ItemStack aOutput, final int aDuration, final int aEUt){ Utils.LOG_INFO("Successfully added a Coke Oven recipe for: "+aOutput.getDisplayName()+" & "+aFluidOutput.getFluid().getName()+", Using "+aInput1.getDisplayName()+" & "+aInput2.getDisplayName()+" & liquid "+aFluidInput.getFluid().getName()+". This takes "+(aDuration/20)+" seconds for "+aEUt+"eu/t."); Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("=================================================================================="); } - + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/machines/RECIPEHANDLER_Dehydrator.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/machines/RECIPEHANDLER_Dehydrator.java index 0a5094412f..94e74458b3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/machines/RECIPEHANDLER_Dehydrator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/machines/RECIPEHANDLER_Dehydrator.java @@ -14,21 +14,21 @@ public class RECIPEHANDLER_Dehydrator { Utils.LOG_WARNING("Walking Through Chemical Dehydrator Recipe Creation."); Utils.LOG_WARNING("My name is Willus and I will be your humble host."); } - public static void debug2(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ + public static void debug2(final ItemStack aInput1, final ItemStack aInput2, final FluidStack aFluidInput, final FluidStack aFluidOutput, final ItemStack aOutput, final int aDuration, final int aEUt){ Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("Taking a step forward."); Utils.LOG_WARNING("aInput1 == null && aFluidInput == null || aOutput == null && aFluidOutput == null"); Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_WARNING("Passed."); } - public static void debug3(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ + public static void debug3(final ItemStack aInput1, final ItemStack aInput2, final FluidStack aFluidInput, final FluidStack aFluidOutput, final ItemStack aOutput, final int aDuration, final int aEUt){ Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("Taking a step forward."); Utils.LOG_WARNING("(aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get(cokeoven, aOutput, aDuration)) <= 0)"); Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_WARNING("Passed."); } - public static void debug4(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ + public static void debug4(final ItemStack aInput1, final ItemStack aInput2, final FluidStack aFluidInput, final FluidStack aFluidOutput, final ItemStack aOutput, final int aDuration, final int aEUt){ Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("Taking a step forward."); Utils.LOG_WARNING("(aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get(cokeoven, aFluidOutput.getFluid().getName(), aDuration)) <= 0)"); @@ -37,45 +37,45 @@ public class RECIPEHANDLER_Dehydrator { Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); } - public static void debug5(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack[] aOutput, int aDuration, int aEUt){ - + public static void debug5(final ItemStack aInput1, final ItemStack aInput2, final FluidStack aFluidInput, final FluidStack aFluidOutput, final ItemStack[] aOutput, final int aDuration, final int aEUt){ + String inputAname; String inputBname; String inputFluidname; String outputFluidName; - + if (aInput1 != null){ inputAname = aInput1.getDisplayName(); } else { inputAname = "null"; } - + if (aInput2 != null){ inputBname = aInput2.getDisplayName(); } else { inputBname = "null"; } - + if (aFluidInput != null){ inputFluidname = aFluidInput.getFluid().getName(); } else { inputFluidname = "null"; } - + if (aFluidOutput != null){ outputFluidName = aFluidOutput.getFluid().getName(); } else { outputFluidName = "null"; } - + Utils.LOG_INFO("Successfully added a Chemical Dehydrator recipe for: "+ItemUtils.getArrayStackNames(aOutput)+" & "+outputFluidName+", Using "+inputAname+" & "+inputBname+" & liquid "+inputFluidname+". This takes "+(aDuration/20)+" seconds for "+aEUt+"eu/t."); Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("=================================================================================="); } - + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/machines/RECIPEHANDLER_MatterFabricator.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/machines/RECIPEHANDLER_MatterFabricator.java index ff9f87d805..a40848d9df 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/machines/RECIPEHANDLER_MatterFabricator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/machines/RECIPEHANDLER_MatterFabricator.java @@ -12,21 +12,21 @@ public class RECIPEHANDLER_MatterFabricator { Utils.LOG_WARNING("Walking Through Matter Fabrication Recipe Creation."); Utils.LOG_WARNING("My name is Ralph and I will be your humble host."); } - public static void debug2(FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt){ + public static void debug2(final FluidStack aFluidInput, final FluidStack aFluidOutput, final int aDuration, final int aEUt){ Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("Taking a step forward."); Utils.LOG_WARNING("aInput1 == null && aFluidInput == null || aOutput == null && aFluidOutput == null"); Utils.LOG_WARNING("aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_WARNING("Passed."); } - public static void debug3(FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt){ + public static void debug3(final FluidStack aFluidInput, final FluidStack aFluidOutput, final int aDuration, final int aEUt){ Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("Taking a step forward."); Utils.LOG_WARNING("(aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get(cokeoven, aOutput, aDuration)) <= 0)"); Utils.LOG_WARNING("aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); Utils.LOG_WARNING("Passed."); } - public static void debug4(FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt){ + public static void debug4(final FluidStack aFluidInput, final FluidStack aFluidOutput, final int aDuration, final int aEUt){ Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("Taking a step forward."); Utils.LOG_WARNING("(aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get(cokeoven, aFluidOutput.getFluid().getName(), aDuration)) <= 0)"); @@ -35,21 +35,21 @@ public class RECIPEHANDLER_MatterFabricator { Utils.LOG_WARNING("aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); } - public static void debug5(FluidStack aFluidInput, FluidStack aFluidOutput, int aDuration, int aEUt){ + public static void debug5(final FluidStack aFluidInput, final FluidStack aFluidOutput, final int aDuration, final int aEUt){ String a = "nothing"; String b = ""; - + if (aFluidInput != null){ a = aFluidInput.getFluid().getName(); } if (aFluidOutput != null){ b = aFluidOutput.getFluid().getName(); } - + Utils.LOG_INFO("Successfully added a Matter Fabrication recipe for: "+b+", Using "+" liquid "+a+". This takes "+(aDuration/20)+" seconds for "+aEUt+"eu/t."); Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("=================================================================================="); Utils.LOG_WARNING("=================================================================================="); } - + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java index 0b71b612f4..e0d0374493 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java @@ -10,7 +10,7 @@ public class Gregtech4Content { //ID Range 828, 829, 833 - 850 - + public static void run() { if (LoadedMods.Gregtech){ @@ -20,14 +20,14 @@ public class Gregtech4Content } private static void workbenches(){ - //Gregtech 4 Workbenches + //Gregtech 4 Workbenches Utils.LOG_INFO("Gregtech 4 Content | Registering Workbenches."); //Free //GregtechItemList.GT4_Workbench_Bronze.set(new GT_MetaTileEntity_BronzeCraftingTable(828, "workbench.bronze", "Bronze Workbench", 0).getStackForm(1L)); //Free //GregtechItemList.GT4_Workbench_Advanced.set(new GT_MetaTileEntity_AdvancedCraftingTable(829, "workbench.advanced", "Advanced Workbench", 1).getStackForm(1L)); } - + private static void tesseracts(){ - //Gregtech 4 Workbenches + //Gregtech 4 Workbenches Utils.LOG_INFO("Gregtech 4 Content | Registering Tesseracts."); GregtechItemList.GT4_Tesseract_Generator.set(new GT_MetaTileEntity_TesseractGenerator(833, "tesseract.generator", "Tesseract Generator", 4).getStackForm(1L)); GregtechItemList.GT4_Tesseract_Terminal.set(new GT_MetaTileEntity_TesseractTerminal(834, "tesseract.terminal", "Tesseract Terminal", 4).getStackForm(1L)); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java index 118d6083c0..9fd4eedaa7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java @@ -1,6 +1,9 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; import static gtPlusPlus.core.lib.LoadedMods.Gregtech; + +import java.util.ArrayList; + import gregtech.api.enums.*; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; import gregtech.api.util.GT_OreDictUnificator; @@ -14,18 +17,15 @@ import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.*; - -import java.util.ArrayList; - import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; public class GregtechConduits { /** - * + * * The Voltage Tiers. Use this Array instead of the old named Voltage Variables * public static final long[] V = new long[] {0=8, 1=32, 2=128, 3=512, 4=2048, 5=8192, 6=32768, 7=131072, 8=524288, 9=Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE}; - * + * */ @@ -36,8 +36,12 @@ public class GregtechConduits { { if (Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Custom Cables/Wires/Pipes."); - if (CORE.configSwitches.enableCustom_Cables) run1(); - if (CORE.configSwitches.enableCustom_Pipes) run2(); + if (CORE.configSwitches.enableCustom_Cables) { + run1(); + } + if (CORE.configSwitches.enableCustom_Pipes) { + run2(); + } } } @@ -56,11 +60,11 @@ public class GregtechConduits { if (LoadedMods.Thaumcraft){ superConductorFactory(GT_Materials.Void, 512, 30661, 0, 0, 8);} - - - } - + + + } + private static void run2(){ generateNonGTFluidPipes(GT_Materials.Staballoy, ALLOY.STABALLOY, BasePipeID, 6250, 7500, true); generateNonGTFluidPipes(GT_Materials.Tantalloy60, ALLOY.TANTALLOY_60, BasePipeID+5, 5000, 4250, true); @@ -81,8 +85,8 @@ public class GregtechConduits { generateGTFluidPipes(Materials.Lead, BasePipeID+70, 720, 1200, true); } - private static void wireFactory(String Material, int Voltage, int ID, long insulatedLoss, long uninsulatedLoss, long Amps){ - Materials T = Materials.valueOf(Material); + private static void wireFactory(final String Material, final int Voltage, final int ID, final long insulatedLoss, final long uninsulatedLoss, final long Amps){ + final Materials T = Materials.valueOf(Material); int V = 0; if (Voltage == 8){ V = 0; @@ -119,12 +123,12 @@ public class GregtechConduits { Utils.LOG_ERROR(Material+" has defaulted to 8v."); V = 0; } - //makeWires(T, ID, 2L, 4L, 2L, GT_Values.V[V], true, false); - makeWires(T, ID, insulatedLoss, uninsulatedLoss, Amps, GT_Values.V[V], true, false); - //makeWires(T, ID, bEC ? 2L : 2L, bEC ? 4L : 4L, 2L, gregtech.api.enums.GT_Values.V[V], true, false); - } + //makeWires(T, ID, 2L, 4L, 2L, GT_Values.V[V], true, false); + makeWires(T, ID, insulatedLoss, uninsulatedLoss, Amps, GT_Values.V[V], true, false); + //makeWires(T, ID, bEC ? 2L : 2L, bEC ? 4L : 4L, 2L, gregtech.api.enums.GT_Values.V[V], true, false); + } - private static void makeWires(Materials aMaterial, int aStartID, long aLossInsulated, long aLoss, long aAmperage, long aVoltage, boolean aInsulatable, boolean aAutoInsulated) + private static void makeWires(final Materials aMaterial, final int aStartID, final long aLossInsulated, final long aLoss, final long aAmperage, final long aVoltage, final boolean aInsulatable, final boolean aAutoInsulated) { Utils.LOG_WARNING("Gregtech5u Content | Registered "+aMaterial.name() +" as a new material for Wire & Cable."); GT_OreDictUnificator.registerOre(OrePrefixes.wireGt01, aMaterial, new GregtechMetaPipeEntity_Cable(aStartID + 0, "wire." + aMaterial.name().toLowerCase() + ".01", "1x " + aMaterial.mDefaultLocalName + " Wire", 0.125F, aMaterial, aLoss, 1L * aAmperage, aVoltage, false, !aAutoInsulated).getStackForm(1L)); @@ -143,8 +147,8 @@ public class GregtechConduits { } } - private static void superConductorFactory(GT_Materials Material, int Voltage, int ID, long insulatedLoss, long uninsulatedLoss, long Amps){ - GT_Materials T = Material; + private static void superConductorFactory(final GT_Materials Material, final int Voltage, final int ID, final long insulatedLoss, final long uninsulatedLoss, final long Amps){ + final GT_Materials T = Material; int V = 0; if (Voltage == 8){ V = 0; @@ -181,27 +185,27 @@ public class GregtechConduits { Utils.LOG_ERROR(Material.name()+" has defaulted to 8v."); V = 0; } - //makeWires(T, ID, 2L, 4L, 2L, GT_Values.V[V], true, false); - makeSuperConductors(T, ID, insulatedLoss, uninsulatedLoss, Amps, GT_Values.V[V], true, false); - //makeWires(T, ID, bEC ? 2L : 2L, bEC ? 4L : 4L, 2L, gregtech.api.enums.GT_Values.V[V], true, false); - } + //makeWires(T, ID, 2L, 4L, 2L, GT_Values.V[V], true, false); + makeSuperConductors(T, ID, insulatedLoss, uninsulatedLoss, Amps, GT_Values.V[V], true, false); + //makeWires(T, ID, bEC ? 2L : 2L, bEC ? 4L : 4L, 2L, gregtech.api.enums.GT_Values.V[V], true, false); + } - private static void makeSuperConductors(GT_Materials aMaterial, int aStartID, long aLossInsulated, long aLoss, long aAmperage, long aVoltage, boolean aInsulatable, boolean aAutoInsulated) + private static void makeSuperConductors(final GT_Materials aMaterial, final int aStartID, final long aLossInsulated, final long aLoss, final long aAmperage, final long aVoltage, final boolean aInsulatable, final boolean aAutoInsulated) { Utils.LOG_WARNING("Gregtech5u Content | Registered "+aMaterial.name() +" as a new Super Conductor."); registerOre(GregtechOrePrefixes.type2, aMaterial, new GregtechMetaPipeEntity_SuperConductor(aStartID + 5, "wire." + aMaterial.name().toLowerCase() + ".16", "16x " + aMaterial.mDefaultLocalName + " Wire", 1.0F, aMaterial, aLoss, 16L * aAmperage, aVoltage, false, !aAutoInsulated).getStackForm(1L)); } - private static boolean registerOre(GregtechOrePrefixes aPrefix, Object aMaterial, ItemStack aStack) { + private static boolean registerOre(final GregtechOrePrefixes aPrefix, final Object aMaterial, final ItemStack aStack) { return GT_OreDictUnificator.registerOre(aPrefix.get(aMaterial), aStack); } - private static void generateGTFluidPipes(Materials material, int startID, int transferRatePerSec, int heatResistance, boolean isGasProof){ - int transferRatePerTick = transferRatePerSec/20; - long mass = material.getMass(); - long voltage = material.mMeltingPoint >= 2800 ? 64 : 16; + private static void generateGTFluidPipes(final Materials material, final int startID, final int transferRatePerSec, final int heatResistance, final boolean isGasProof){ + final int transferRatePerTick = transferRatePerSec/20; + final long mass = material.getMass(); + final long voltage = material.mMeltingPoint >= 2800 ? 64 : 16; GT_OreDictUnificator.registerOre(OrePrefixes.pipeTiny.get(material), new GT_MetaPipeEntity_Fluid(startID, "GT_Pipe_"+material.mDefaultLocalName+"_Tiny", "Tiny "+material.mDefaultLocalName+" Fluid Pipe", 0.25F, material, transferRatePerTick*2, heatResistance, isGasProof).getStackForm(1L)); GT_OreDictUnificator.registerOre(OrePrefixes.pipeSmall.get(material), new GT_MetaPipeEntity_Fluid(startID+1, "GT_Pipe_"+material.mDefaultLocalName+"_Small", "Small "+material.mDefaultLocalName+" Fluid Pipe", 0.375F, material, transferRatePerTick*4, heatResistance, isGasProof).getStackForm(1L)); GT_OreDictUnificator.registerOre(OrePrefixes.pipeMedium.get(material), new GT_MetaPipeEntity_Fluid(startID+2, "GT_Pipe_"+material.mDefaultLocalName+"", ""+material.mDefaultLocalName+" Fluid Pipe", 0.5F, material, transferRatePerTick*6, heatResistance, isGasProof).getStackForm(1L)); @@ -210,8 +214,8 @@ public class GregtechConduits { generatePipeRecipes(material.mDefaultLocalName, mass, voltage); } - private static void generateNonGTFluidPipes(GT_Materials material, Material myMaterial, int startID, int transferRatePerSec, int heatResistance, boolean isGasProof){ - int transferRatePerTick = transferRatePerSec/20; + private static void generateNonGTFluidPipes(final GT_Materials material, final Material myMaterial, final int startID, final int transferRatePerSec, final int heatResistance, final boolean isGasProof){ + final int transferRatePerTick = transferRatePerSec/20; long mass; long voltage; if (myMaterial != null){ @@ -219,11 +223,11 @@ public class GregtechConduits { voltage = myMaterial.vVoltageMultiplier; if (myMaterial.getLocalizedName().equals(ALLOY.POTIN.getLocalizedName())){ voltage = 4; - } + } } else { mass = ELEMENT.getInstance().IRON.getMass(); - voltage = 8; + voltage = 8; } GT_OreDictUnificator.registerOre(OrePrefixes.pipeTiny.get(material), new GregtechMetaPipeEntityFluid(startID, "GT_Pipe_"+material.mDefaultLocalName+"_Tiny", "Tiny "+material.mDefaultLocalName+" Fluid Pipe", 0.25F, material, transferRatePerTick*2, heatResistance, isGasProof).getStackForm(1L)); @@ -235,7 +239,7 @@ public class GregtechConduits { } - private static void generatePipeRecipes(String materialName, long Mass, long vMulti){ + private static void generatePipeRecipes(final String materialName, final long Mass, final long vMulti){ String output = materialName.substring(0, 1).toUpperCase() + materialName.substring(1); output = output.replace("-", "").replace("_", "").replace(" ", ""); @@ -244,11 +248,17 @@ public class GregtechConduits { output = "Void"; } - Utils.LOG_INFO("Generating "+output+" pipes & respective recipes."); + Utils.LOG_INFO("Generating "+output+" pipes & respective recipes."); - ItemStack pipeIngot = ItemUtils.getItemStackOfAmountFromOreDict("ingot"+output, 1).copy(); - ItemStack pipePlate = ItemUtils.getItemStackOfAmountFromOreDict("plate"+output, 1).copy(); + ItemStack pipeIngot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingot"+output, 1); + ItemStack pipePlate = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plate"+output, 1); + if (pipeIngot == null){ + if (pipePlate != null){ + pipeIngot = pipePlate; + } + } + //Check all pipes are not null Utils.LOG_INFO("Generated pipeTiny from "+ materialName +"? "+ ((ItemUtils.getItemStackOfAmountFromOreDict("pipe"+"Tiny"+output, 1) != null) ? true : false)); Utils.LOG_INFO("Generated pipeSmall from "+ materialName +"? "+ ((ItemUtils.getItemStackOfAmountFromOreDict("pipe"+"Small"+output, 1) != null) ? true : false)); @@ -258,13 +268,13 @@ public class GregtechConduits { int eut = 128; int time = 0; - int bonusMulti = 5*20; + final int bonusMulti = 5*20; time = (int) Math.max(Mass * 8L, 1); eut = (int) (10 * vMulti); - //Add the Three Shaped Recipes First + //Add the Three Shaped Recipes First RecipeUtils.recipeBuilder( pipePlate, "craftingToolWrench", pipePlate, pipePlate, null, pipePlate, @@ -313,25 +323,26 @@ public class GregtechConduits { ItemUtils.getItemStackOfAmountFromOreDict("pipe"+"Huge"+output, 1), time+=bonusMulti, eut); - if (eut < 512 && !output.equals("Void")){ - ItemStack pipePlateDouble = ItemUtils.getItemStackOfAmountFromOreDict("plateDouble"+output, 1).copy(); - if (pipePlateDouble != null) + if ((eut < 512) && !output.equals("Void")){ + final ItemStack pipePlateDouble = ItemUtils.getItemStackOfAmountFromOreDict("plateDouble"+output, 1).copy(); + if (pipePlateDouble != null) { RecipeUtils.recipeBuilder( pipePlateDouble, "craftingToolHardHammer", pipePlateDouble, pipePlateDouble, null, pipePlateDouble, pipePlateDouble, "craftingToolWrench", pipePlateDouble, ItemUtils.getItemStackOfAmountFromOreDict("pipe"+"Huge"+output, 1)); - else + } else { Utils.LOG_INFO("Failed to add a recipe for "+materialName+" Huge pipes. Double plates probably do not exist."); + } } } - private static ItemStack getOredictStack(String oredictName, int amount){ - ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); + private static ItemStack getOredictStack(final String oredictName, final int amount){ + final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); if (!oreDictList.isEmpty()){ - ItemStack returnValue = oreDictList.get(0).copy(); + final ItemStack returnValue = oreDictList.get(0).copy(); returnValue.stackSize = amount; return returnValue; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechDehydrator.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechDehydrator.java index 8c57d47cf5..0c14ca2eaf 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechDehydrator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechDehydrator.java @@ -13,7 +13,9 @@ public class GregtechDehydrator { if (LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Chemical Dehydrators."); - if (CORE.configSwitches.enableMachine_Dehydrators) run1(); + if (CORE.configSwitches.enableMachine_Dehydrators) { + run1(); + } } } @@ -25,7 +27,7 @@ public class GregtechDehydrator public GT_MetaTileEntity_BasicMachine_GT_Recipe( int aID, String aName, String aNameRegional, int aTier, - String aDescription, + String aDescription, GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, @@ -34,7 +36,7 @@ public class GregtechDehydrator boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, - Object[] aRecipe) { + Object[] aRecipe) { */ @@ -44,7 +46,7 @@ public class GregtechDehydrator Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 10000, - 2, 5, + 2, 5, "Dehydrator.png", "", false, false, 0, @@ -56,7 +58,7 @@ public class GregtechDehydrator Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 10000, - 2, 5, + 2, 5, "Dehydrator.png", "", false, false, 0, @@ -68,7 +70,7 @@ public class GregtechDehydrator Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 10000, - 2, 5, + 2, 5, "Dehydrator.png", "", false, false, 0, @@ -80,7 +82,7 @@ public class GregtechDehydrator Recipe_GT.Gregtech_Recipe_Map.sChemicalDehydratorRecipes, 2, 9, 10000, - 2, 5, + 2, 5, "Dehydrator.png", "", false, false, 0, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java index 66b92b90bc..133695204f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechEnergyBuffer.java @@ -11,29 +11,31 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.creative.Greg public class GregtechEnergyBuffer { - + //Misc Items //public static Item itemBufferCore; - + public static void run() { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Energy Buffer Blocks."); - if (CORE.configSwitches.enableMachine_RocketEngines) run1(); + if (CORE.configSwitches.enableMachine_RocketEngines) { + run1(); + } } - + } private static void run1() { - + //itemBufferCore = new Item().setUnlocalizedName("itemBufferCore").setCreativeTab(AddToCreativeTab.tabMisc).setTextureName(CORE.MODID + ":itemBufferCore"); //Registry //GameRegistry.registerItem(itemBufferCore, "itemBufferCore"); //LanguageRegistry.addName(itemBufferCore, "Buffer Core"); //OreDictionary.registerOre("itemBufferCore", itemBufferCore); - + //Energy Buffers GregtechItemList.Energy_Buffer_1by1_ULV.set(new GregtechMetaEnergyBuffer(770, "energybuffer.01.tier.00", "Ultra Low Voltage Energy Buffer", 0, "", 1).getStackForm(1L)); @@ -48,10 +50,10 @@ public class GregtechEnergyBuffer GregtechItemList.Energy_Buffer_1by1_MAX.set(new GregtechMetaEnergyBuffer(779, "energybuffer.01.tier.09", "MAX Voltage Energy Buffer", 9, "", 1).getStackForm(1L)); // Creative Buffer Has Special ID GregtechItemList.Energy_Buffer_CREATIVE - .set(new GregtechMetaCreativeEnergyBuffer(750, - "energybuffer.01.tier.xx", - "512V Creative Energy Buffer", 3, "", 0) - .getStackForm(1L)); + .set(new GregtechMetaCreativeEnergyBuffer(750, + "energybuffer.01.tier.xx", + "512V Creative Energy Buffer", 3, "", 0) + .getStackForm(1L)); GT_ModHandler.addCraftingRecipe(GregtechItemList.Energy_Buffer_1by1_ULV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_ULV, Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Lead), Character.valueOf('T'), GregtechOreDictNames.buffer_core }); GT_ModHandler.addCraftingRecipe(GregtechItemList.Energy_Buffer_1by1_LV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "WTW", "WMW", Character.valueOf('M'), ItemList.Hull_LV, Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Tin), Character.valueOf('T'), GregtechOreDictNames.buffer_core }); @@ -73,9 +75,9 @@ public class GregtechEnergyBuffer ItemList.Hull_MAX, Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Superconductor), Character.valueOf('T'), GregtechOreDictNames.buffer_core });*/ - - - + + + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechGeothermalThermalGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechGeothermalThermalGenerator.java index 174136e8f8..86749e1f40 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechGeothermalThermalGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechGeothermalThermalGenerator.java @@ -7,7 +7,8 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.recipe.RECIPE_CONSTANTS; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.gregtech.api.enums.*; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntityGeothermalGenerator; import net.minecraft.item.ItemStack; @@ -18,7 +19,9 @@ public class GregtechGeothermalThermalGenerator { { if (LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Geothermal Engines."); - if (CORE.configSwitches.enableMachine_GeothermalEngines) run1(); + if (CORE.configSwitches.enableMachine_GeothermalEngines) { + run1(); + } } } @@ -30,36 +33,36 @@ public class GregtechGeothermalThermalGenerator { GT_ModHandler.addCraftingRecipe( GregtechItemList.Geothermal_Engine_EV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, + GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"CEC", "GMG", "PWP", - Character.valueOf('M'), ItemList.Hull_EV, - Character.valueOf('P'), ItemList.Electric_Piston_EV, - Character.valueOf('E'), ItemList.Electric_Motor_EV, - Character.valueOf('C'), GregtechOrePrefixes.circuit.get(Materials.Ultimate), - Character.valueOf('W'), OrePrefixes.cableGt04.get(Materials.Aluminium), - Character.valueOf('G'), ALLOY.TANTALLOY_61.getGear(1)}); - + Character.valueOf('M'), ItemList.Hull_EV, + Character.valueOf('P'), ItemList.Electric_Piston_EV, + Character.valueOf('E'), ItemList.Electric_Motor_EV, + Character.valueOf('C'), GregtechOrePrefixes.circuit.get(Materials.Ultimate), + Character.valueOf('W'), OrePrefixes.cableGt04.get(Materials.Aluminium), + Character.valueOf('G'), ALLOY.TANTALLOY_61.getGear(1)}); + GT_ModHandler.addCraftingRecipe(GregtechItemList.Geothermal_Engine_IV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"CEC", "GMG", "PWP", - Character.valueOf('M'), ItemList.Hull_IV, - Character.valueOf('P'), ItemList.Electric_Piston_IV, - Character.valueOf('E'), ItemList.Electric_Motor_IV, - Character.valueOf('C'), GregtechOrePrefixes.circuit.get(GT_Materials.Symbiotic), - Character.valueOf('W'), OrePrefixes.cableGt04.get(Materials.Platinum), - Character.valueOf('G'), ALLOY.STELLITE.getGear(1)}); - + Character.valueOf('M'), ItemList.Hull_IV, + Character.valueOf('P'), ItemList.Electric_Piston_IV, + Character.valueOf('E'), ItemList.Electric_Motor_IV, + Character.valueOf('C'), GregtechOrePrefixes.circuit.get(GT_Materials.Symbiotic), + Character.valueOf('W'), OrePrefixes.cableGt04.get(Materials.Platinum), + Character.valueOf('G'), ALLOY.STELLITE.getGear(1)}); + final ItemStack INGREDIENT_1 = RECIPE_CONSTANTS.electricPiston_LuV; final ItemStack INGREDIENT_2 = RECIPE_CONSTANTS.electricMotor_LuV; GT_ModHandler.addCraftingRecipe(GregtechItemList.Geothermal_Engine_LuV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, - new Object[]{"CEC", "GMG", "PWP", - Character.valueOf('M'), ItemList.Hull_LuV, - Character.valueOf('P'), INGREDIENT_1, - Character.valueOf('E'), INGREDIENT_2, - Character.valueOf('C'), GregtechOrePrefixes.circuit.get(GT_Materials.Neutronic), - Character.valueOf('W'), OrePrefixes.cableGt04.get(Materials.Tungsten), - Character.valueOf('G'), ALLOY.ZERON_100.getGear(1)}); + new Object[]{"CEC", "GMG", "PWP", + Character.valueOf('M'), ItemList.Hull_LuV, + Character.valueOf('P'), INGREDIENT_1, + Character.valueOf('E'), INGREDIENT_2, + Character.valueOf('C'), GregtechOrePrefixes.circuit.get(GT_Materials.Neutronic), + Character.valueOf('W'), OrePrefixes.cableGt04.get(Materials.Tungsten), + Character.valueOf('G'), ALLOY.ZERON_100.getGear(1)}); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialBlastSmelter.java index 3ff39be788..94b2462cb3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialBlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialBlastSmelter.java @@ -11,7 +11,9 @@ public class GregtechIndustrialBlastSmelter{ { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Alloy Blast Smelter Multiblock."); - if (CORE.configSwitches.enableMultiblock_AlloyBlastSmelter) run1(); + if (CORE.configSwitches.enableMultiblock_AlloyBlastSmelter) { + run1(); + } } } @@ -20,6 +22,6 @@ public class GregtechIndustrialBlastSmelter{ { //Industrial Alloy Blast Smelter Multiblock GregtechItemList.Industrial_AlloyBlastSmelter.set(new GregtechMetaTileEntity_AlloyBlastSmelter(810, "industrialsalloyamelter.controller.tier.single", "Alloy Blast Smelter").getStackForm(1L)); - + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCentrifuge.java index 44a2cb4c0a..b09c36b020 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCentrifuge.java @@ -14,7 +14,9 @@ public class GregtechIndustrialCentrifuge { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Centrifuge Multiblock."); - if (CORE.configSwitches.enableMultiblock_IndustrialCentrifuge) run1(); + if (CORE.configSwitches.enableMultiblock_IndustrialCentrifuge) { + run1(); + } } } @@ -23,6 +25,6 @@ public class GregtechIndustrialCentrifuge { //Industrial Centrifuge Multiblock GregtechItemList.Industrial_Centrifuge.set(new GregtechMetaTileEntity_IndustrialCentrifuge(790, "industrialcentrifuge.controller.tier.single", "Industrial Centrifuge").getStackForm(1L)); - + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCokeOven.java index d9fdb9a0fd..e366658c65 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCokeOven.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialCokeOven.java @@ -14,7 +14,9 @@ public class GregtechIndustrialCokeOven { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Coke Oven Multiblock."); - if (CORE.configSwitches.enableMultiblock_IndustrialCokeOven) run1(); + if (CORE.configSwitches.enableMultiblock_IndustrialCokeOven) { + run1(); + } } } @@ -23,6 +25,6 @@ public class GregtechIndustrialCokeOven { //Industrial Centrifuge Multiblock GregtechItemList.Industrial_CokeOven.set(new GregtechMetaTileEntity_IndustrialCokeOven(791, "industrialcokeoven.controller.tier.single", "Industrial Coke Oven").getStackForm(1L)); - + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElectrolyzer.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElectrolyzer.java index b0d3a02394..932da8fcff 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElectrolyzer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialElectrolyzer.java @@ -14,7 +14,9 @@ public class GregtechIndustrialElectrolyzer { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Electrolyzer Multiblock."); - if (CORE.configSwitches.enableMultiblock_IndustrialElectrolyzer) run1(); + if (CORE.configSwitches.enableMultiblock_IndustrialElectrolyzer) { + run1(); + } } } @@ -23,6 +25,6 @@ public class GregtechIndustrialElectrolyzer { //Industrial Electrolyzer Multiblock GregtechItemList.Industrial_Electrolyzer.set(new GregtechMetaTileEntity_IndustrialElectrolyzer(796, "industrialelectrolyzer.controller.tier.single", "Industrial Electrolyzer").getStackForm(1L)); - + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java index 4fed90007d..a892d31d50 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialFuelRefinery.java @@ -14,7 +14,9 @@ public class GregtechIndustrialFuelRefinery { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Fuel Processing and Refinery Multiblock."); - if (CORE.configSwitches.enableMultiblock_NuclearFuelRefinery) run1(); + if (CORE.configSwitches.enableMultiblock_NuclearFuelRefinery) { + run1(); + } } } @@ -23,6 +25,6 @@ public class GregtechIndustrialFuelRefinery { //Industrial Maceration Stack Multiblock GregtechItemList.Industrial_FuelRefinery.set(new GregtechMetaTileEntity_Refinery(835, "industrialrefinery.controller.tier.single", "Fission Fuel Processing Plant").getStackForm(1L)); - + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMacerator.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMacerator.java index f93cb14012..acdce264a9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMacerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMacerator.java @@ -14,7 +14,9 @@ public class GregtechIndustrialMacerator { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Maceration Stack Multiblock."); - if (CORE.configSwitches.enableMultiblock_IndustrialMacerationStack) run1(); + if (CORE.configSwitches.enableMultiblock_IndustrialMacerationStack) { + run1(); + } } } @@ -23,6 +25,6 @@ public class GregtechIndustrialMacerator { //Industrial Maceration Stack Multiblock GregtechItemList.Industrial_MacerationStack.set(new GregtechMetaTileEntity_IndustrialMacerator(797, "industrialmacerator.controller.tier.single", "Maceration Stack Controller").getStackForm(1L)); - + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMassFabricator.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMassFabricator.java index 4173a08b73..4110d06acc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMassFabricator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMassFabricator.java @@ -14,7 +14,9 @@ public class GregtechIndustrialMassFabricator { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Matter Fabricator Multiblock."); - if (CORE.configSwitches.enableMultiblock_MatterFabricator) run1(); + if (CORE.configSwitches.enableMultiblock_MatterFabricator) { + run1(); + } } } @@ -23,6 +25,6 @@ public class GregtechIndustrialMassFabricator { //Industrial Matter Fabricator Multiblock GregtechItemList.Industrial_MassFab.set(new GregtechMetaTileEntity_MassFabricator(799, "industrialmassfab.controller.tier.single", "Matter Fabrication CPU").getStackForm(1L)); - + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMultiTank.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMultiTank.java index 730bc7ccee..63f461d6f0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMultiTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMultiTank.java @@ -14,7 +14,9 @@ public class GregtechIndustrialMultiTank { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Multitank controller blocks."); - if (CORE.configSwitches.enableMultiblock_MultiTank) run1(); + if (CORE.configSwitches.enableMultiblock_MultiTank) { + run1(); + } } } @@ -23,6 +25,6 @@ public class GregtechIndustrialMultiTank { GregtechItemList.Industrial_MultiTank.set(new GregtechMetaTileEntity_MultiTank(827, "multitank.controller.tier.single", "Gregtech Multitank").getStackForm(1L)); //GregtechItemList.Industrial_MultiTankDense.set(new GregtechMetaTileEntityMultiTankDense(828, "multitankdense.controller.tier.single", "Gregtech Dense Multitank").getStackForm(1L)); - + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialPlatePress.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialPlatePress.java index 2377aa5814..bc345715c1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialPlatePress.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialPlatePress.java @@ -14,7 +14,9 @@ public class GregtechIndustrialPlatePress { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Press Multiblock."); - if (CORE.configSwitches.enableMultiblock_IndustrialPlatePress) run1(); + if (CORE.configSwitches.enableMultiblock_IndustrialPlatePress) { + run1(); + } } } @@ -23,6 +25,6 @@ public class GregtechIndustrialPlatePress { //Industrial Presser Multiblock GregtechItemList.Industrial_PlatePress.set(new GregtechMetaTileEntity_IndustrialPlatePress(792, "industrialbender.controller.tier.single", "Industrial Material Press").getStackForm(1L)); - + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialTreeFarm.java index 250a0df68a..0512d4c1dd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialTreeFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialTreeFarm.java @@ -14,7 +14,9 @@ public class GregtechIndustrialTreeFarm { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Tree Farm Multiblock."); - if (CORE.configSwitches.enableMultiblock_TreeFarmer) run1(); + if (CORE.configSwitches.enableMultiblock_TreeFarmer) { + run1(); + } } } @@ -23,6 +25,6 @@ public class GregtechIndustrialTreeFarm { //Industrial Maceration Stack Multiblock GregtechItemList.Industrial_TreeFarm.set(new GregtechMetaTileEntityTreeFarm(836, "treefarm.controller.tier.single", "Tree Farmer").getStackForm(1L)); - + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialWiremill.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialWiremill.java index f6ddb9ba5a..5cfd25931d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialWiremill.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialWiremill.java @@ -14,7 +14,9 @@ public class GregtechIndustrialWiremill { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Wire Factory Multiblock."); - if (CORE.configSwitches.enableMultiblock_IndustrialWireMill) run1(); + if (CORE.configSwitches.enableMultiblock_IndustrialWireMill) { + run1(); + } } } @@ -23,6 +25,6 @@ public class GregtechIndustrialWiremill { //Industrial Wire Factory Multiblock GregtechItemList.Industrial_WireFactory.set(new GregtechMetaTileEntity_IndustrialWireMill(798, "industrialwiremill.controller.tier.single", "Wire Factory Controller").getStackForm(1L)); - + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIronBlastFurnace.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIronBlastFurnace.java index 86a5feeda9..731caaf706 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIronBlastFurnace.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIronBlastFurnace.java @@ -14,7 +14,9 @@ public class GregtechIronBlastFurnace { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Iron Blast Furnace."); - if (CORE.configSwitches.enableMultiblock_IronBlastFurnace) run1(); + if (CORE.configSwitches.enableMultiblock_IronBlastFurnace) { + run1(); + } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechLFTR.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechLFTR.java index a05354a0e8..fa3d327dba 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechLFTR.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechLFTR.java @@ -14,7 +14,9 @@ public class GregtechLFTR { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Liquid Fluorine Thorium Reactor [LFTR]."); - if (CORE.configSwitches.enableMultiblock_LiquidFluorideThoriumReactor) run1(); + if (CORE.configSwitches.enableMultiblock_LiquidFluorideThoriumReactor) { + run1(); + } } } @@ -23,6 +25,6 @@ public class GregtechLFTR { //LFTR GregtechItemList.ThoriumReactor.set(new GregtechMTE_NuclearReactor(751, "lftr.controller.single", "Thorium Reactor [LFTR]").getStackForm(1L)); - + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java index f6011c8c45..39d10a5413 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPowerSubStation.java @@ -14,7 +14,9 @@ public class GregtechPowerSubStation { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Power Substation Node."); - if (CORE.configSwitches.enableMultiblock_PowerSubstation) run1(); + if (CORE.configSwitches.enableMultiblock_PowerSubstation) { + run1(); + } } } @@ -23,6 +25,6 @@ public class GregtechPowerSubStation { //Steam Condensors GregtechItemList.PowerSubStation.set(new GregtechMetaTileEntity_PowerSubStationController(812, "substation.01.input.single", "Power Substation Node").getStackForm(1L)); - + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java index 3cf11ac0b0..37e8075353 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java @@ -7,7 +7,8 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.recipe.RECIPE_CONSTANTS; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.gregtech.api.enums.*; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntityRocketFuelGenerator; import net.minecraft.item.ItemStack; @@ -18,7 +19,9 @@ public class GregtechRocketFuelGenerator { { if (LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Rocket Engines."); - if (CORE.configSwitches.enableMachine_RocketEngines) run1(); + if (CORE.configSwitches.enableMachine_RocketEngines) { + run1(); + } } } @@ -30,36 +33,36 @@ public class GregtechRocketFuelGenerator { GT_ModHandler.addCraftingRecipe( GregtechItemList.Rocket_Engine_EV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, + GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"PCP", "EME", "GWG", - Character.valueOf('M'), ItemList.Hull_EV, - Character.valueOf('P'), ItemList.Electric_Piston_EV, - Character.valueOf('E'), ItemList.Electric_Motor_EV, - Character.valueOf('C'), GregtechOrePrefixes.circuit.get(Materials.Ultimate), - Character.valueOf('W'), OrePrefixes.cableGt02.get(Materials.Aluminium), - Character.valueOf('G'), ALLOY.TANTALLOY_61.getGear(1)}); - + Character.valueOf('M'), ItemList.Hull_EV, + Character.valueOf('P'), ItemList.Electric_Piston_EV, + Character.valueOf('E'), ItemList.Electric_Motor_EV, + Character.valueOf('C'), GregtechOrePrefixes.circuit.get(Materials.Ultimate), + Character.valueOf('W'), OrePrefixes.cableGt02.get(Materials.Aluminium), + Character.valueOf('G'), ALLOY.TANTALLOY_61.getGear(1)}); + GT_ModHandler.addCraftingRecipe(GregtechItemList.Rocket_Engine_IV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"PCP", "EME", "GWG", - Character.valueOf('M'), ItemList.Hull_IV, - Character.valueOf('P'), ItemList.Electric_Piston_IV, - Character.valueOf('E'), ItemList.Electric_Motor_IV, - Character.valueOf('C'), GregtechOrePrefixes.circuit.get(GT_Materials.Symbiotic), - Character.valueOf('W'), OrePrefixes.cableGt02.get(Materials.Platinum), - Character.valueOf('G'), ALLOY.STELLITE.getGear(1)}); - + Character.valueOf('M'), ItemList.Hull_IV, + Character.valueOf('P'), ItemList.Electric_Piston_IV, + Character.valueOf('E'), ItemList.Electric_Motor_IV, + Character.valueOf('C'), GregtechOrePrefixes.circuit.get(GT_Materials.Symbiotic), + Character.valueOf('W'), OrePrefixes.cableGt02.get(Materials.Platinum), + Character.valueOf('G'), ALLOY.STELLITE.getGear(1)}); + final ItemStack INGREDIENT_1 = RECIPE_CONSTANTS.electricPiston_LuV; final ItemStack INGREDIENT_2 = RECIPE_CONSTANTS.electricMotor_LuV; GT_ModHandler.addCraftingRecipe(GregtechItemList.Rocket_Engine_LuV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, - new Object[]{"PCP", "EME", "GWG", - Character.valueOf('M'), ItemList.Hull_LuV, - Character.valueOf('P'), INGREDIENT_1, - Character.valueOf('E'), INGREDIENT_2, - Character.valueOf('C'), GregtechOrePrefixes.circuit.get(GT_Materials.Neutronic), - Character.valueOf('W'), OrePrefixes.cableGt02.get(Materials.Tungsten), - Character.valueOf('G'), ALLOY.ZERON_100.getGear(1)}); + new Object[]{"PCP", "EME", "GWG", + Character.valueOf('M'), ItemList.Hull_LuV, + Character.valueOf('P'), INGREDIENT_1, + Character.valueOf('E'), INGREDIENT_2, + Character.valueOf('C'), GregtechOrePrefixes.circuit.get(GT_Materials.Neutronic), + Character.valueOf('W'), OrePrefixes.cableGt02.get(Materials.Tungsten), + Character.valueOf('G'), ALLOY.ZERON_100.getGear(1)}); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSafeBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSafeBlock.java index fb33131e56..3e58f2e516 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSafeBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSafeBlock.java @@ -14,7 +14,9 @@ public class GregtechSafeBlock { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Lockable Safe Blocks."); - if (CORE.configSwitches.enableMachine_Safes) run1(); + if (CORE.configSwitches.enableMachine_Safes) { + run1(); + } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSolarGenerators.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSolarGenerators.java index f9964bb606..c6e3755f3a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSolarGenerators.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSolarGenerators.java @@ -1,7 +1,8 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; -import gtPlusPlus.core.lib.*; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.CORE.configSwitches; +import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntitySolarGenerator; @@ -12,25 +13,27 @@ public class GregtechSolarGenerators { if (LoadedMods.Gregtech && configSwitches.enableMachine_SolarGenerators){ Utils.LOG_INFO("Gregtech5u Content | Registering Solar Generator Blocks."); - if (CORE.configSwitches.enableMachine_SolarGenerators) run1(); + if (CORE.configSwitches.enableMachine_SolarGenerators) { + run1(); + } } - + } private static void run1() { - + GregtechItemList.GT_Solar_ULV.set(new GregtechMetaTileEntitySolarGenerator(800, "sunabsorber.tier.00", "Ultra Low Voltage Solar Generator", 0).getStackForm(1L)); GregtechItemList.GT_Solar_LV.set(new GregtechMetaTileEntitySolarGenerator(801, "sunabsorber.tier.01", "Low Voltage Solar Generator", 1).getStackForm(1L)); - GregtechItemList.GT_Solar_MV.set(new GregtechMetaTileEntitySolarGenerator(802, "sunabsorber.tier.02", "Medium Voltage Solar Generator", 2).getStackForm(1L)); - GregtechItemList.GT_Solar_HV.set(new GregtechMetaTileEntitySolarGenerator(803, "sunabsorber.tier.03", "High Voltage Solar Generator", 3).getStackForm(1L)); - GregtechItemList.GT_Solar_EV.set(new GregtechMetaTileEntitySolarGenerator(804, "sunabsorber.tier.04", "Extreme Voltage Solar Generator", 4).getStackForm(1L)); - GregtechItemList.GT_Solar_IV.set(new GregtechMetaTileEntitySolarGenerator(805, "sunabsorber.tier.05", "Insane Voltage Solar Generator", 5).getStackForm(1L)); - GregtechItemList.GT_Solar_LuV.set(new GregtechMetaTileEntitySolarGenerator(806, "sunabsorber.tier.06", "Ludicrous Voltage Solar Generator", 6).getStackForm(1L)); - GregtechItemList.GT_Solar_ZPM.set(new GregtechMetaTileEntitySolarGenerator(807, "sunabsorber.tier.07", "ZPM Voltage Solar Generator", 7).getStackForm(1L)); - GregtechItemList.GT_Solar_UV.set(new GregtechMetaTileEntitySolarGenerator(808, "sunabsorber.tier.08", "Ultimate Voltage Solar Generator", 8).getStackForm(1L)); - GregtechItemList.GT_Solar_MAX.set(new GregtechMetaTileEntitySolarGenerator(809, "sunabsorber.tier.09", "MAX Voltage Solar Generator", 9).getStackForm(1L)); - + GregtechItemList.GT_Solar_MV.set(new GregtechMetaTileEntitySolarGenerator(802, "sunabsorber.tier.02", "Medium Voltage Solar Generator", 2).getStackForm(1L)); + GregtechItemList.GT_Solar_HV.set(new GregtechMetaTileEntitySolarGenerator(803, "sunabsorber.tier.03", "High Voltage Solar Generator", 3).getStackForm(1L)); + GregtechItemList.GT_Solar_EV.set(new GregtechMetaTileEntitySolarGenerator(804, "sunabsorber.tier.04", "Extreme Voltage Solar Generator", 4).getStackForm(1L)); + GregtechItemList.GT_Solar_IV.set(new GregtechMetaTileEntitySolarGenerator(805, "sunabsorber.tier.05", "Insane Voltage Solar Generator", 5).getStackForm(1L)); + GregtechItemList.GT_Solar_LuV.set(new GregtechMetaTileEntitySolarGenerator(806, "sunabsorber.tier.06", "Ludicrous Voltage Solar Generator", 6).getStackForm(1L)); + GregtechItemList.GT_Solar_ZPM.set(new GregtechMetaTileEntitySolarGenerator(807, "sunabsorber.tier.07", "ZPM Voltage Solar Generator", 7).getStackForm(1L)); + GregtechItemList.GT_Solar_UV.set(new GregtechMetaTileEntitySolarGenerator(808, "sunabsorber.tier.08", "Ultimate Voltage Solar Generator", 8).getStackForm(1L)); + GregtechItemList.GT_Solar_MAX.set(new GregtechMetaTileEntitySolarGenerator(809, "sunabsorber.tier.09", "MAX Voltage Solar Generator", 9).getStackForm(1L)); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSteamCondenser.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSteamCondenser.java index 33da5688af..7671ea5a68 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSteamCondenser.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSteamCondenser.java @@ -14,7 +14,9 @@ public class GregtechSteamCondenser { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Steam Condensor."); - if (CORE.configSwitches.enableMachine_SteamConverter) run1(); + if (CORE.configSwitches.enableMachine_SteamConverter) { + run1(); + } } } @@ -23,6 +25,6 @@ public class GregtechSteamCondenser { //Steam Condensors GregtechItemList.Condensor_MAX.set(new GregtechMetaCondensor(769, "steamcondensor.01.tier.single", "Steam Condensor").getStackForm(1L)); - + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSuperConductionPoint.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSuperConductionPoint.java index fc7927d3f2..99a37ffd39 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSuperConductionPoint.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSuperConductionPoint.java @@ -22,6 +22,6 @@ public class GregtechSuperConductionPoint { //Steam Condensors GregtechItemList.SuperConductorInputNode.set(new GregtechMetaTileEntitySuperCondensor(811, "superconductor.01.input.single", "Power Phase Shifting Station", 8).getStackForm(1L)); - + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java index b71cf7e84a..340cb12f5b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java @@ -12,7 +12,9 @@ public class GregtechTieredFluidTanks { if (LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Portable Fluid Tanks."); - if (CORE.configSwitches.enableMachine_FluidTanks) run1(); + if (CORE.configSwitches.enableMachine_FluidTanks) { + run1(); + } } } @@ -33,7 +35,7 @@ public class GregtechTieredFluidTanks GregtechItemList.GT_FluidTank_LuV.set(new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.06", "Ludicrous Voltage Fluid Tank", 6).getStackForm(1L)); GregtechItemList.GT_FluidTank_ZPM.set(new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.07", "ZPM Voltage Fluid Tank", 7).getStackForm(1L)); GregtechItemList.GT_FluidTank_UV.set(new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.08", "Ultimate Voltage Fluid Tank", 8).getStackForm(1L)); - GregtechItemList.GT_FluidTank_MAX.set(new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.09", "MAX Voltage Fluid Tank", 9).getStackForm(1L)); + GregtechItemList.GT_FluidTank_MAX.set(new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.09", "MAX Voltage Fluid Tank", 9).getStackForm(1L)); } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTreeFarmerTE.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTreeFarmerTE.java index 9debd17084..85e80bd2c1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTreeFarmerTE.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTreeFarmerTE.java @@ -9,7 +9,9 @@ public class GregtechTreeFarmerTE { public static void run() { if (gtPlusPlus.core.lib.LoadedMods.Gregtech){ Utils.LOG_INFO("Gregtech5u Content | Registering Tree Farmer Structural Block."); - if (CORE.configSwitches.enableMultiblock_TreeFarmer) run1(); + if (CORE.configSwitches.enableMultiblock_TreeFarmer) { + run1(); + } } } diff --git a/src/Java/gtPlusPlus/xmod/growthcraft/HANDLER_GC.java b/src/Java/gtPlusPlus/xmod/growthcraft/HANDLER_GC.java index 7ad28677a9..1ad7f2a298 100644 --- a/src/Java/gtPlusPlus/xmod/growthcraft/HANDLER_GC.java +++ b/src/Java/gtPlusPlus/xmod/growthcraft/HANDLER_GC.java @@ -9,7 +9,7 @@ public class HANDLER_GC { //Run me during Pre-Init public static void preInit(){ if (LoadedMods.Growthcraft){ - //Register_Booze.preInit(); + //Register_Booze.preInit(); } } diff --git a/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java b/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java index 30c799d49b..bbbf8b96a7 100644 --- a/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java +++ b/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java @@ -9,15 +9,15 @@ import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; public class FishTrapHandler { - + private static final String[] fishTypes = {"fish", "junk", "treasure"}; - protected static void addFish(String lootType, ItemStack lootStack, int lootChance){ - - String GCVersion = LoadedMods.getModVersion("Growthcraft"); - - String[] versionString = GCVersion.split("//."); - + protected static void addFish(final String lootType, final ItemStack lootStack, final int lootChance){ + + final String GCVersion = LoadedMods.getModVersion("Growthcraft"); + + final String[] versionString = GCVersion.split("//."); + if (LoadedMods.getModVersion("Growthcraft").contains("2.3.1") || versionString[1].equals("3")){ if (lootType.equals(fishTypes[0])){ Growthcraft_Old.addTrapFish(lootStack, lootChance); @@ -52,43 +52,43 @@ public class FishTrapHandler { return; } } - + else { Utils.LOG_INFO("Extra Fish loot for Growthcraft Fishtraps disabled. Found V."+LoadedMods.getModVersion("Growthcraft")); } - + } - + final static String prefix = "food"; final static String suffix = "raw"; final static String seaweed = "cropSeaweed"; final static String greenheartFish = "Greenheartfish"; private static final String[] harvestcraftFish = { - "Anchovy", "Bass", "Carp", "Catfish", "Charr", "Clam", "Crab", "Crayfish", "Eel", "Frog", "Grouper", "Herring", - "Jellyfish", "Mudfish", "Octopus", "Perch", "Scallop", "Shrimp", "Snail", "Snapper", "Tilapia", "Trout", "Tuna", "Turtle", "Walleye"}; + "Anchovy", "Bass", "Carp", "Catfish", "Charr", "Clam", "Crab", "Crayfish", "Eel", "Frog", "Grouper", "Herring", + "Jellyfish", "Mudfish", "Octopus", "Perch", "Scallop", "Shrimp", "Snail", "Snapper", "Tilapia", "Trout", "Tuna", "Turtle", "Walleye"}; public static void pamsHarvestCraftCompat(){ for (int i = 0; i < harvestcraftFish.length; i++){ - String itemName = prefix+harvestcraftFish[i]+suffix; - int lootChance = getLootChance(harvestcraftFish[i]); + final String itemName = prefix+harvestcraftFish[i]+suffix; + final int lootChance = getLootChance(harvestcraftFish[i]); if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken(itemName, 1) != null){ - addFish("fish", ItemUtils.getItemStackOfAmountFromOreDict(itemName, 1), lootChance); + addFish("fish", ItemUtils.getItemStackOfAmountFromOreDict(itemName, 1), lootChance); addGregtechMaceratorRecipe(ItemUtils.getItemStackOfAmountFromOreDict(itemName, 1)); addGregtechCentrifugeRecipe(ItemUtils.getItemStackOfAmountFromOreDict(itemName, 1)); addGregtechFluidRecipe(ItemUtils.getItemStackOfAmountFromOreDict(itemName, 1)); } } if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken(greenheartFish, 1) != null){ - addFish("fish", ItemUtils.getItemStackOfAmountFromOreDict(greenheartFish, 1), getLootChance(greenheartFish)); + addFish("fish", ItemUtils.getItemStackOfAmountFromOreDict(greenheartFish, 1), getLootChance(greenheartFish)); addGregtechMaceratorRecipe(ItemUtils.getItemStackOfAmountFromOreDict(greenheartFish, 1)); addGregtechCentrifugeRecipe(ItemUtils.getItemStackOfAmountFromOreDict(greenheartFish, 1)); addGregtechFluidRecipe(ItemUtils.getItemStackOfAmountFromOreDict(greenheartFish, 1)); } if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken(seaweed, 1) != null){ - addFish("junk", ItemUtils.getItemStackOfAmountFromOreDict(seaweed, 1), getLootChance(seaweed)); + addFish("junk", ItemUtils.getItemStackOfAmountFromOreDict(seaweed, 1), getLootChance(seaweed)); } } - - private static int getLootChance(String name){ + + private static int getLootChance(final String name){ if (name.equals(harvestcraftFish[0])){ return 20; } @@ -168,23 +168,23 @@ public class FishTrapHandler { return 25; } } - - private static void addGregtechCentrifugeRecipe(ItemStack input){ + + private static void addGregtechCentrifugeRecipe(final ItemStack input){ if (LoadedMods.Gregtech){ - GT_Values.RA.addCentrifugeRecipe(input, null, null, FluidUtils.getFluidStack("methane", 96), null, null, null, null, null, null, null, 19*20, 5); - } + GT_Values.RA.addCentrifugeRecipe(input, null, null, FluidUtils.getFluidStack("methane", 96), null, null, null, null, null, null, null, 19*20, 5); + } } - - private static void addGregtechMaceratorRecipe(ItemStack input){ + + private static void addGregtechMaceratorRecipe(final ItemStack input){ if (LoadedMods.Gregtech){ GT_ModHandler.addPulverisationRecipe(input, ItemUtils.getItemStackOfAmountFromOreDict("dustMeatRaw", 1), ItemUtils.getItemStackOfAmountFromOreDict("dustTinyBone", 1), 0); } } - - private static void addGregtechFluidRecipe(ItemStack input){ + + private static void addGregtechFluidRecipe(final ItemStack input){ if (LoadedMods.Gregtech){ - GT_Values.RA.addFluidExtractionRecipe(input, null, FluidUtils.getFluidStack("fishoil", 4), 0, (64/4), 4); //4eu/t total eu used = 64 so time = 64/4 - } + GT_Values.RA.addFluidExtractionRecipe(input, null, FluidUtils.getFluidStack("fishoil", 4), 0, (64/4), 4); //4eu/t total eu used = 64 so time = 64/4 + } } - + } diff --git a/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_New.java b/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_New.java index 5b744623c7..4405709888 100644 --- a/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_New.java +++ b/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_New.java @@ -6,17 +6,17 @@ import net.minecraft.item.ItemStack; public class Growthcraft_New { - public static void addTrapJunk(ItemStack loot, int lootChance){ - FishTrapRegistry.instance().addTrapJunk(new FishTrapEntry(loot, lootChance)); + public static void addTrapJunk(final ItemStack loot, final int lootChance){ + FishTrapRegistry.instance().addTrapJunk(new FishTrapEntry(loot, lootChance)); } - public static void addTrapTreasure(ItemStack loot, int lootChance){ - FishTrapRegistry.instance().addTrapTreasure(new FishTrapEntry(loot, lootChance)); + public static void addTrapTreasure(final ItemStack loot, final int lootChance){ + FishTrapRegistry.instance().addTrapTreasure(new FishTrapEntry(loot, lootChance)); } - public static void addTrapFish(ItemStack loot, int lootChance){ + public static void addTrapFish(final ItemStack loot, final int lootChance){ FishTrapRegistry.instance().addTrapFish(new FishTrapEntry(loot, lootChance)); } diff --git a/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_Old.java b/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_Old.java index d7521fc579..f988abd53a 100644 --- a/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_Old.java +++ b/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/Growthcraft_Old.java @@ -6,17 +6,17 @@ import net.minecraft.item.ItemStack; public class Growthcraft_Old { - public static void addTrapJunk(ItemStack loot, int lootChance){ - FishTrapRegistry.instance().addTrapJunk(new FishTrapEntry(loot, lootChance)); + public static void addTrapJunk(final ItemStack loot, final int lootChance){ + FishTrapRegistry.instance().addTrapJunk(new FishTrapEntry(loot, lootChance)); } - public static void addTrapTreasure(ItemStack loot, int lootChance){ - FishTrapRegistry.instance().addTrapTreasure(new FishTrapEntry(loot, lootChance)); + public static void addTrapTreasure(final ItemStack loot, final int lootChance){ + FishTrapRegistry.instance().addTrapTreasure(new FishTrapEntry(loot, lootChance)); } - public static void addTrapFish(ItemStack loot, int lootChance){ + public static void addTrapFish(final ItemStack loot, final int lootChance){ FishTrapRegistry.instance().addTrapFish(new FishTrapEntry(loot, lootChance)); } diff --git a/src/Java/gtPlusPlus/xmod/ic2/HANDLER_IC2.java b/src/Java/gtPlusPlus/xmod/ic2/HANDLER_IC2.java index 97f37a8628..bb97132ab4 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/HANDLER_IC2.java +++ b/src/Java/gtPlusPlus/xmod/ic2/HANDLER_IC2.java @@ -9,20 +9,20 @@ public class HANDLER_IC2{ public static void preInit() { if (LoadedMods.IndustrialCraft2){ IC2_Items.register(); - //new BlockRTG(InternalName.beer); - } + //new BlockRTG(InternalName.beer); + } } public static void init() { if (LoadedMods.IndustrialCraft2){ - - } + + } } public static void postInit() { if (LoadedMods.IndustrialCraft2){ RECIPE_IC2.initRecipes(); - } + } } } diff --git a/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/BlockRTG.java b/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/BlockRTG.java index 1287b81e49..7038d98a7d 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/BlockRTG.java +++ b/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/BlockRTG.java @@ -1,5 +1,13 @@ package gtPlusPlus.xmod.ic2.block.RTGGenerator; +import java.util.List; +import java.util.Random; + +import org.apache.commons.lang3.mutable.MutableObject; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.xmod.ic2.block.kieticgenerator.tileentity.TileEntityKineticWindGenerator; import gtPlusPlus.xmod.ic2.item.IC2_Items; @@ -10,10 +18,6 @@ import ic2.core.block.BlockMultiID; import ic2.core.block.TileEntityBlock; import ic2.core.block.reactor.tileentity.TileEntityNuclearReactorElectric; import ic2.core.init.InternalName; - -import java.util.List; -import java.util.Random; - import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -21,21 +25,15 @@ import net.minecraft.item.*; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import org.apache.commons.lang3.mutable.MutableObject; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class BlockRTG extends BlockMultiID { - public BlockRTG(InternalName internalName1) + public BlockRTG(final InternalName internalName1) { super(internalName1, Material.iron, ItemGenerators.class); - setCreativeTab(AddToCreativeTab.tabMachines); - setHardness(3.0F); - setStepSound(soundTypeMetal); + this.setCreativeTab(AddToCreativeTab.tabMachines); + this.setHardness(3.0F); + this.setStepSound(soundTypeMetal); IC2_Items.blockRTG = new ItemStack(this, 1, 0); IC2_Items.blockKineticGenerator = new ItemStack(this, 1, 1); @@ -45,14 +43,14 @@ extends BlockMultiID } @Override - public void getSubBlocks(Item j, CreativeTabs tabs, List itemList) { - Item item = Item.getItemFromBlock(this); + public void getSubBlocks(final Item j, final CreativeTabs tabs, final List itemList) { + final Item item = Item.getItemFromBlock(this); if (!item.getHasSubtypes()) { itemList.add(new ItemStack(this)); } else { for (int i = 0; i < 16; i++) { - ItemStack is = new ItemStack(this, 1, i); + final ItemStack is = new ItemStack(this, 1, i); if (is.getItem().getUnlocalizedName(is) == null) { break; } @@ -63,36 +61,36 @@ extends BlockMultiID @Override - public String getTextureFolder(int id) + public String getTextureFolder(final int id) { return "generator"; } @Override - public int damageDropped(int meta) + public int damageDropped(final int meta) { switch (meta) { - case 2: + case 2: return 2; } return 0; } @Override - public Class<? extends TileEntity> getTeClass(int meta, MutableObject<Class<?>[]> ctorArgTypes, MutableObject<Object[]> ctorArgs) + public Class<? extends TileEntity> getTeClass(final int meta, final MutableObject<Class<?>[]> ctorArgTypes, final MutableObject<Object[]> ctorArgs) { try { switch (meta) - { - case 0: - return TileEntityRTG.class; - case 1: + { + case 0: + return TileEntityRTG.class; + case 1: return TileEntityKineticWindGenerator.class; } } - catch (Exception e) + catch (final Exception e) { throw new RuntimeException(e); } @@ -100,75 +98,75 @@ extends BlockMultiID } /* - * + * * { - case 0: + case 0: return TileEntityGenerator.class; - case 1: + case 1: return TileEntityGeoGenerator.class; - case 2: + case 2: return TileEntityWaterGenerator.class; - case 3: + case 3: return TileEntitySolarGenerator.class; - case 4: + case 4: return TileEntityWindGenerator.class; - case 5: + case 5: return TileEntityNuclearReactorElectric.class; - case 6: + case 6: return TileEntityRTGenerator.class; - case 7: + case 7: return TileEntitySemifluidGenerator.class; - case 8: + case 8: return TileEntityStirlingGenerator.class; - case 9: + case 9: return TileEntityKineticGenerator.class; } - * + * * (non-Javadoc) * @see net.minecraft.block.Block#randomDisplayTick(net.minecraft.world.World, int, int, int, java.util.Random) */ @Override - public void randomDisplayTick(World world, int x, int y, int z, Random random) + public void randomDisplayTick(final World world, final int x, final int y, final int z, final Random random) { if (!IC2.platform.isRendering()) { return; } - int meta = world.getBlockMetadata(x, y, z); - if ((meta == 0) && (isActive(world, x, y, z))) + final int meta = world.getBlockMetadata(x, y, z); + if ((meta == 0) && (this.isActive(world, x, y, z))) { - TileEntityBlock te = (TileEntityBlock)getOwnTe(world, x, y, z); + final TileEntityBlock te = (TileEntityBlock)this.getOwnTe(world, x, y, z); if (te == null) { return; } - int l = te.getFacing(); - float f = x + 0.5F; - float f1 = y + 0.0F + random.nextFloat() * 6.0F / 16.0F; - float f2 = z + 0.5F; - float f3 = 0.52F; - float f4 = random.nextFloat() * 0.6F - 0.3F; + final int l = te.getFacing(); + final float f = x + 0.5F; + final float f1 = y + 0.0F + ((random.nextFloat() * 6.0F) / 16.0F); + final float f2 = z + 0.5F; + final float f3 = 0.52F; + final float f4 = (random.nextFloat() * 0.6F) - 0.3F; switch (l) { - case 4: + case 4: world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); break; - case 5: + case 5: world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); break; - case 2: + case 2: world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D); break; - case 3: + case 3: world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D); } } else if (meta == 5) { - TileEntityNuclearReactorElectric te = (TileEntityNuclearReactorElectric)getOwnTe(world, x, y, z); + final TileEntityNuclearReactorElectric te = (TileEntityNuclearReactorElectric)this.getOwnTe(world, x, y, z); if (te == null) { return; } @@ -188,7 +186,7 @@ extends BlockMultiID } @Override - public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int side, float a, float b, float c) + public boolean onBlockActivated(final World world, final int i, final int j, final int k, final EntityPlayer entityplayer, final int side, final float a, final float b, final float c) { if ((entityplayer.getCurrentEquippedItem() != null) && (entityplayer.getCurrentEquippedItem().isItemEqual(Ic2Items.reactorChamber))) { return false; @@ -198,7 +196,7 @@ extends BlockMultiID @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack stack) + public EnumRarity getRarity(final ItemStack stack) { return stack.getItemDamage() == 5 ? EnumRarity.uncommon : EnumRarity.common; } diff --git a/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/TileEntityRTG.java b/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/TileEntityRTG.java index cea09bdd5c..d057da8715 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/TileEntityRTG.java +++ b/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/TileEntityRTG.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.ic2.block.RTGGenerator; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.xmod.ic2.block.RTGGenerator.gui.CONTAINER_RTG; import gtPlusPlus.xmod.ic2.block.RTGGenerator.gui.GUI_RTG; import ic2.core.ContainerBase; @@ -10,8 +12,6 @@ import ic2.core.block.invslot.InvSlotConsumableId; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class TileEntityRTG extends TileEntityRTGenerator @@ -24,26 +24,26 @@ extends TileEntityRTGenerator } @Override - public int gaugeFuelScaled(int i) + public int gaugeFuelScaled(final int i) { return i; } @Override - public boolean gainEnergy() - { - int counter = 0; - for (int i = 0; i < this.fuelSlot.size(); i++) { - if (this.fuelSlot.get(i) != null) { - counter++; - } - } - if (counter == 0) { - return false; - } - this.storage += (int)Math.pow(2.0D, counter - 1); - return true; - } + public boolean gainEnergy() + { + int counter = 0; + for (int i = 0; i < this.fuelSlot.size(); i++) { + if (this.fuelSlot.get(i) != null) { + counter++; + } + } + if (counter == 0) { + return false; + } + this.storage += (int)Math.pow(2.0D, counter - 1); + return true; + } @Override public boolean gainFuel() @@ -62,16 +62,16 @@ extends TileEntityRTGenerator { return "RTG"; } - + @Override - public ContainerBase<TileEntityRTGenerator> getGuiContainer(EntityPlayer entityPlayer) + public ContainerBase<TileEntityRTGenerator> getGuiContainer(final EntityPlayer entityPlayer) { return new CONTAINER_RTG(entityPlayer, this); } @Override @SideOnly(Side.CLIENT) - public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin) + public GuiScreen getGui(final EntityPlayer entityPlayer, final boolean isAdmin) { return new GUI_RTG(new CONTAINER_RTG(entityPlayer, this)); } @@ -82,5 +82,5 @@ extends TileEntityRTGenerator return true; } - + } diff --git a/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/gui/CONTAINER_RTG.java b/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/gui/CONTAINER_RTG.java index e9c7b5cc81..eae0c3dd9c 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/gui/CONTAINER_RTG.java +++ b/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/gui/CONTAINER_RTG.java @@ -1,34 +1,33 @@ package gtPlusPlus.xmod.ic2.block.RTGGenerator.gui; +import java.util.List; + import gtPlusPlus.xmod.ic2.block.RTGGenerator.TileEntityRTG; import ic2.core.block.generator.container.ContainerRTGenerator; import ic2.core.slot.SlotInvSlot; - -import java.util.List; - import net.minecraft.entity.player.EntityPlayer; public class CONTAINER_RTG extends ContainerRTGenerator { - public CONTAINER_RTG(EntityPlayer entityPlayer, TileEntityRTG tileEntity1) + public CONTAINER_RTG(final EntityPlayer entityPlayer, final TileEntityRTG tileEntity1) { super(entityPlayer, tileEntity1); for (int i = 0; i < 4; i++) { - addSlotToContainer(new SlotInvSlot(tileEntity1.fuelSlot, i, 36 + i * 18, 18)); + this.addSlotToContainer(new SlotInvSlot(tileEntity1.fuelSlot, i, 36 + (i * 18), 18)); } for (int i = 4; i < 8; i++) { - addSlotToContainer(new SlotInvSlot(tileEntity1.fuelSlot, i, 36 + (i - 4) * 18, 36)); + this.addSlotToContainer(new SlotInvSlot(tileEntity1.fuelSlot, i, 36 + ((i - 4) * 18), 36)); } for (int i = 8; i < 12; i++) { - addSlotToContainer(new SlotInvSlot(tileEntity1.fuelSlot, i, 36 + (i - 8) * 18, 54)); + this.addSlotToContainer(new SlotInvSlot(tileEntity1.fuelSlot, i, 36 + ((i - 8) * 18), 54)); } } @Override public List<String> getNetworkedFields() { - List<String> ret = super.getNetworkedFields(); + final List<String> ret = super.getNetworkedFields(); ret.add("storage"); diff --git a/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/gui/GUI_RTG.java b/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/gui/GUI_RTG.java index 34ac0af814..72edb4403d 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/gui/GUI_RTG.java +++ b/src/Java/gtPlusPlus/xmod/ic2/block/RTGGenerator/gui/GUI_RTG.java @@ -1,5 +1,9 @@ package gtPlusPlus.xmod.ic2.block.RTGGenerator.gui; +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.xmod.ic2.block.RTGGenerator.TileEntityRTG; import ic2.core.IC2; import ic2.core.block.generator.gui.GuiRTGenerator; @@ -7,45 +11,40 @@ import ic2.core.util.GuiTooltipHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) public class GUI_RTG - extends GuiRTGenerator +extends GuiRTGenerator { - public CONTAINER_RTG container; - - public GUI_RTG(CONTAINER_RTG container1) - { - super(container1); - - this.container = container1; - this.name = "RTG Mach II"; - } - - @Override -protected void drawGuiContainerForegroundLayer(int par1, int par2) - { - this.fontRendererObj.drawString(this.name, (this.xSize - this.fontRendererObj.getStringWidth(this.name)) / 2, 4, 4210752); - - GuiTooltipHelper.drawAreaTooltip(par1 - this.guiLeft, par2 - this.guiTop, StatCollector.translateToLocalFormatted("ic2.generic.text.bufferEU", new Object[] { Double.valueOf(((TileEntityRTG)this.container.base).storage) }), 117, 38, 150, 48); - } - - @Override -protected void drawGuiContainerBackgroundLayer(float f, int x, int y) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(background); - int j = (this.width - this.xSize) / 2; - int k = (this.height - this.ySize) / 2; - drawTexturedModalRect(j, k, 0, 0, this.xSize, this.ySize); - - int i1 = ((TileEntityRTG)this.container.base).gaugeStorageScaled(31); - drawTexturedModalRect(j + 119, k + 40, 179, 3, i1, 8); - } - - private static final ResourceLocation background = new ResourceLocation(IC2.textureDomain, "textures/gui/GUIRTGenerator.png"); + public CONTAINER_RTG container; + + public GUI_RTG(final CONTAINER_RTG container1) + { + super(container1); + + this.container = container1; + this.name = "RTG Mach II"; + } + + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) + { + this.fontRendererObj.drawString(this.name, (this.xSize - this.fontRendererObj.getStringWidth(this.name)) / 2, 4, 4210752); + + GuiTooltipHelper.drawAreaTooltip(par1 - this.guiLeft, par2 - this.guiTop, StatCollector.translateToLocalFormatted("ic2.generic.text.bufferEU", new Object[] { Double.valueOf(((TileEntityRTG)this.container.base).storage) }), 117, 38, 150, 48); + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float f, final int x, final int y) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(background); + final int j = (this.width - this.xSize) / 2; + final int k = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(j, k, 0, 0, this.xSize, this.ySize); + + final int i1 = ((TileEntityRTG)this.container.base).gaugeStorageScaled(31); + this.drawTexturedModalRect(j + 119, k + 40, 179, 3, i1, 8); + } + + private static final ResourceLocation background = new ResourceLocation(IC2.textureDomain, "textures/gui/GUIRTGenerator.png"); } diff --git a/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/IC2_BlockKineticGenerator.java b/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/IC2_BlockKineticGenerator.java index 74d94011ea..db608e25b2 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/IC2_BlockKineticGenerator.java +++ b/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/IC2_BlockKineticGenerator.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.ic2.block.kieticgenerator; +import org.apache.commons.lang3.mutable.MutableObject; + +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import ic2.core.block.BlockMultiID; import ic2.core.block.kineticgenerator.tileentity.TileEntityManualKineticGenerator; @@ -12,65 +15,61 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import org.apache.commons.lang3.mutable.MutableObject; - -import cpw.mods.fml.common.registry.GameRegistry; - public class IC2_BlockKineticGenerator - extends BlockMultiID +extends BlockMultiID { - public IC2_BlockKineticGenerator(InternalName internalName1) - { - super(internalName1, Material.iron, ItemKineticGenerator.class); - - setHardness(3.0F); - setStepSound(Block.soundTypeMetal); - this.setCreativeTab(AddToCreativeTab.tabMachines); - - GameRegistry.registerTileEntity(TileEntityWindKineticGenerator.class, "Advanced Kinetic Wind Generator"); - - } - - @Override -public String getTextureFolder(int id) - { - return "kineticgenerator"; - } - - @Override -public int damageDropped(int meta) - { - return meta; - } - - @Override -public Class<? extends TileEntity> getTeClass(int meta, MutableObject<Class<?>[]> ctorArgTypes, MutableObject<Object[]> ctorArgs) - { - try - { - switch (meta) - { - case 0: - return TileEntityWindKineticGenerator.class; - } - } - catch (Exception e) - { - throw new RuntimeException(e); - } - return null; - } - - @Override -public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float a, float b, float c) - { - if (entityPlayer.isSneaking()) { - return false; - } - TileEntity te = getOwnTe(world, x, y, z); - if ((te != null) && ((te instanceof TileEntityManualKineticGenerator))) { - return ((TileEntityManualKineticGenerator)te).playerKlicked(entityPlayer); - } - return super.onBlockActivated(world, x, y, z, entityPlayer, side, a, b, c); - } + public IC2_BlockKineticGenerator(final InternalName internalName1) + { + super(internalName1, Material.iron, ItemKineticGenerator.class); + + this.setHardness(3.0F); + this.setStepSound(Block.soundTypeMetal); + this.setCreativeTab(AddToCreativeTab.tabMachines); + + GameRegistry.registerTileEntity(TileEntityWindKineticGenerator.class, "Advanced Kinetic Wind Generator"); + + } + + @Override + public String getTextureFolder(final int id) + { + return "kineticgenerator"; + } + + @Override + public int damageDropped(final int meta) + { + return meta; + } + + @Override + public Class<? extends TileEntity> getTeClass(final int meta, final MutableObject<Class<?>[]> ctorArgTypes, final MutableObject<Object[]> ctorArgs) + { + try + { + switch (meta) + { + case 0: + return TileEntityWindKineticGenerator.class; + } + } + catch (final Exception e) + { + throw new RuntimeException(e); + } + return null; + } + + @Override + public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer entityPlayer, final int side, final float a, final float b, final float c) + { + if (entityPlayer.isSneaking()) { + return false; + } + final TileEntity te = this.getOwnTe(world, x, y, z); + if ((te != null) && ((te instanceof TileEntityManualKineticGenerator))) { + return ((TileEntityManualKineticGenerator)te).playerKlicked(entityPlayer); + } + return super.onBlockActivated(world, x, y, z, entityPlayer, side, a, b, c); + } } diff --git a/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/IC2_TEComponent.java b/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/IC2_TEComponent.java index f356441921..3f42cea00a 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/IC2_TEComponent.java +++ b/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/IC2_TEComponent.java @@ -1,48 +1,47 @@ package gtPlusPlus.xmod.ic2.block.kieticgenerator; -import ic2.core.block.TileEntityBlock; - import java.io.DataInput; import java.io.IOException; +import ic2.core.block.TileEntityBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; public abstract class IC2_TEComponent { - protected final TileEntityBlock parent; - - public IC2_TEComponent(TileEntityBlock parent) - { - this.parent = parent; - } - - public abstract String getDefaultName(); - - public void readFromNbt(NBTTagCompound nbt) {} - - public NBTTagCompound writeToNbt() - { - return null; - } - - public void onLoaded() {} - - public void onUnloaded() {} - - public void onNeighborUpdate(Block srcBlock) {} - - public void onContainerUpdate(String name, EntityPlayerMP player) {} - - public void onNetworkUpdate(DataInput is) - throws IOException - {} - - public boolean enableWorldTick() - { - return false; - } - - public void onWorldTick() {} + protected final TileEntityBlock parent; + + public IC2_TEComponent(final TileEntityBlock parent) + { + this.parent = parent; + } + + public abstract String getDefaultName(); + + public void readFromNbt(final NBTTagCompound nbt) {} + + public NBTTagCompound writeToNbt() + { + return null; + } + + public void onLoaded() {} + + public void onUnloaded() {} + + public void onNeighborUpdate(final Block srcBlock) {} + + public void onContainerUpdate(final String name, final EntityPlayerMP player) {} + + public void onNetworkUpdate(final DataInput is) + throws IOException + {} + + public boolean enableWorldTick() + { + return false; + } + + public void onWorldTick() {} } diff --git a/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/container/ContainerKineticWindgenerator.java b/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/container/ContainerKineticWindgenerator.java index b3ceea52d4..37f9436983 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/container/ContainerKineticWindgenerator.java +++ b/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/container/ContainerKineticWindgenerator.java @@ -1,27 +1,27 @@ package gtPlusPlus.xmod.ic2.block.kieticgenerator.container; +import java.util.List; + import ic2.core.ContainerFullInv; import ic2.core.block.kineticgenerator.tileentity.TileEntityWindKineticGenerator; import ic2.core.slot.SlotInvSlot; - -import java.util.List; - import net.minecraft.entity.player.EntityPlayer; public class ContainerKineticWindgenerator - extends ContainerFullInv<TileEntityWindKineticGenerator> +extends ContainerFullInv<TileEntityWindKineticGenerator> { - public ContainerKineticWindgenerator(EntityPlayer entityPlayer, TileEntityWindKineticGenerator tileEntity1) - { - super(entityPlayer, tileEntity1, 166); - - addSlotToContainer(new SlotInvSlot(tileEntity1.rotorSlot, 0, 80, 26)); - } - - public List<String> getNetworkedFields() - { - List<String> ret = super.getNetworkedFields(); - ret.add("windStrength"); - return ret; - } + public ContainerKineticWindgenerator(final EntityPlayer entityPlayer, final TileEntityWindKineticGenerator tileEntity1) + { + super(entityPlayer, tileEntity1, 166); + + this.addSlotToContainer(new SlotInvSlot(tileEntity1.rotorSlot, 0, 80, 26)); + } + + @Override + public List<String> getNetworkedFields() + { + final List<String> ret = super.getNetworkedFields(); + ret.add("windStrength"); + return ret; + } } diff --git a/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/gui/GuiKineticWindGenerator.java b/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/gui/GuiKineticWindGenerator.java index f677e7fcfb..2d9dadb9b8 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/gui/GuiKineticWindGenerator.java +++ b/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/gui/GuiKineticWindGenerator.java @@ -1,76 +1,76 @@ package gtPlusPlus.xmod.ic2.block.kieticgenerator.gui; +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import ic2.core.IC2; import ic2.core.block.kineticgenerator.container.ContainerWindKineticGenerator; -import ic2.core.block.kineticgenerator.tileentity.TileEntityWindKineticGenerator; import ic2.core.util.GuiTooltipHelper; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - @SideOnly(Side.CLIENT) public class GuiKineticWindGenerator - extends GuiContainer +extends GuiContainer { - public ContainerWindKineticGenerator container; - public String name; - - public GuiKineticWindGenerator(ContainerWindKineticGenerator container1) - { - super(container1); - - this.container = container1; - this.name = StatCollector.translateToLocal("ic2.WindKineticGenerator.gui.name"); - } - - protected void drawGuiContainerForegroundLayer(int par1, int par2) - { - this.fontRendererObj.drawString(this.name, (this.xSize - this.fontRendererObj.getStringWidth(this.name)) / 2, 6, 4210752); - if (((TileEntityWindKineticGenerator)this.container.base).checkrotor()) - { - if (!((TileEntityWindKineticGenerator)this.container.base).rotorspace()) - { - this.fontRendererObj.drawString(StatCollector.translateToLocal("ic2.WindKineticGenerator.gui.rotorspace"), 20, 52, 2157374); - } - else if ((((TileEntityWindKineticGenerator)this.container.base).checkrotor()) && (!((TileEntityWindKineticGenerator)this.container.base).guiisminWindStrength())) - { - this.fontRendererObj.drawString(StatCollector.translateToLocal("ic2.WindKineticGenerator.gui.windweak1"), 27, 52, 2157374); - this.fontRendererObj.drawString(StatCollector.translateToLocal("ic2.WindKineticGenerator.gui.windweak2"), 24, 69, 2157374); - } - else - { - this.fontRendererObj.drawString(StatCollector.translateToLocalFormatted("ic2.WindKineticGenerator.gui.output", new Object[] { Integer.valueOf(((TileEntityWindKineticGenerator)this.container.base).getKuOutput()) }), 55, 52, 2157374); - this.fontRendererObj.drawString(((TileEntityWindKineticGenerator)this.container.base).getRotorhealth() + " %", 46, 70, 2157374); - if (((TileEntityWindKineticGenerator)this.container.base).guiisoverload()) - { - GuiTooltipHelper.drawAreaTooltip(par1 - this.guiLeft, par2 - this.guiTop, StatCollector.translateToLocal("ic2.WindKineticGenerator.error.overload"), 44, 20, 79, 45); - GuiTooltipHelper.drawAreaTooltip(par1 - this.guiLeft, par2 - this.guiTop, StatCollector.translateToLocal("ic2.WindKineticGenerator.error.overload2"), 102, 20, 131, 45); - } - } - } - else { - this.fontRendererObj.drawString(StatCollector.translateToLocal("ic2.WindKineticGenerator.gui.rotormiss"), 27, 52, 2157374); - } - } - - protected void drawGuiContainerBackgroundLayer(float f, int x, int y) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(background); - int j = (this.width - this.xSize) / 2; - int k = (this.height - this.ySize) / 2; - drawTexturedModalRect(j, k, 0, 0, this.xSize, this.ySize); - if ((((TileEntityWindKineticGenerator)this.container.base).guiisoverload()) && (((TileEntityWindKineticGenerator)this.container.base).checkrotor())) - { - drawTexturedModalRect(j + 44, k + 20, 176, 0, 30, 26); - drawTexturedModalRect(j + 102, k + 20, 176, 0, 30, 26); - } - } - - private static final ResourceLocation background = new ResourceLocation(IC2.textureDomain, "textures/gui/GUIWindKineticGenerator.png"); + public ContainerWindKineticGenerator container; + public String name; + + public GuiKineticWindGenerator(final ContainerWindKineticGenerator container1) + { + super(container1); + + this.container = container1; + this.name = StatCollector.translateToLocal("ic2.WindKineticGenerator.gui.name"); + } + + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) + { + this.fontRendererObj.drawString(this.name, (this.xSize - this.fontRendererObj.getStringWidth(this.name)) / 2, 6, 4210752); + if (this.container.base.checkrotor()) + { + if (!this.container.base.rotorspace()) + { + this.fontRendererObj.drawString(StatCollector.translateToLocal("ic2.WindKineticGenerator.gui.rotorspace"), 20, 52, 2157374); + } + else if ((this.container.base.checkrotor()) && (!this.container.base.guiisminWindStrength())) + { + this.fontRendererObj.drawString(StatCollector.translateToLocal("ic2.WindKineticGenerator.gui.windweak1"), 27, 52, 2157374); + this.fontRendererObj.drawString(StatCollector.translateToLocal("ic2.WindKineticGenerator.gui.windweak2"), 24, 69, 2157374); + } + else + { + this.fontRendererObj.drawString(StatCollector.translateToLocalFormatted("ic2.WindKineticGenerator.gui.output", new Object[] { Integer.valueOf(this.container.base.getKuOutput()) }), 55, 52, 2157374); + this.fontRendererObj.drawString(this.container.base.getRotorhealth() + " %", 46, 70, 2157374); + if (this.container.base.guiisoverload()) + { + GuiTooltipHelper.drawAreaTooltip(par1 - this.guiLeft, par2 - this.guiTop, StatCollector.translateToLocal("ic2.WindKineticGenerator.error.overload"), 44, 20, 79, 45); + GuiTooltipHelper.drawAreaTooltip(par1 - this.guiLeft, par2 - this.guiTop, StatCollector.translateToLocal("ic2.WindKineticGenerator.error.overload2"), 102, 20, 131, 45); + } + } + } + else { + this.fontRendererObj.drawString(StatCollector.translateToLocal("ic2.WindKineticGenerator.gui.rotormiss"), 27, 52, 2157374); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float f, final int x, final int y) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(background); + final int j = (this.width - this.xSize) / 2; + final int k = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(j, k, 0, 0, this.xSize, this.ySize); + if ((this.container.base.guiisoverload()) && (this.container.base.checkrotor())) + { + this.drawTexturedModalRect(j + 44, k + 20, 176, 0, 30, 26); + this.drawTexturedModalRect(j + 102, k + 20, 176, 0, 30, 26); + } + } + + private static final ResourceLocation background = new ResourceLocation(IC2.textureDomain, "textures/gui/GUIWindKineticGenerator.png"); } diff --git a/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/tileentity/TileEntityKineticWindGenerator.java b/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/tileentity/TileEntityKineticWindGenerator.java index e2140f9fce..29206c398d 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/tileentity/TileEntityKineticWindGenerator.java +++ b/src/Java/gtPlusPlus/xmod/ic2/block/kieticgenerator/tileentity/TileEntityKineticWindGenerator.java @@ -1,5 +1,10 @@ package gtPlusPlus.xmod.ic2.block.kieticgenerator.tileentity; +import java.util.List; +import java.util.Vector; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import ic2.api.energy.tile.IKineticSource; import ic2.api.item.IKineticRotor; import ic2.api.item.IKineticRotor.GearboxType; @@ -8,12 +13,7 @@ import ic2.core.block.invslot.InvSlotConsumableKineticRotor; import ic2.core.block.kineticgenerator.container.ContainerWindKineticGenerator; import ic2.core.block.kineticgenerator.gui.GuiWindKineticGenerator; import ic2.core.block.kineticgenerator.tileentity.TileEntityWindKineticGenerator; -import ic2.core.network.NetworkManager; import ic2.core.util.Util; - -import java.util.List; -import java.util.Vector; - import net.minecraft.block.Block; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; @@ -22,8 +22,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.world.ChunkCache; import net.minecraftforge.common.util.ForgeDirection; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class TileEntityKineticWindGenerator extends TileEntityWindKineticGenerator @@ -40,63 +38,63 @@ implements IKineticSource, IHasGui public TileEntityKineticWindGenerator() { - this.updateTicker = IC2.random.nextInt(getTickRate()); + this.updateTicker = IC2.random.nextInt(this.getTickRate()); this.rotorSlot = new InvSlotConsumableKineticRotor(this, "rotorslot", 0, null, 1, null, GearboxType.WIND); } - + public void update2Entity() { super.updateEntity(); assert (IC2.platform.isSimulating()); - if (this.updateTicker++ % getTickRate() != 0) { + if ((this.updateTicker++ % this.getTickRate()) != 0) { return; } boolean needsInvUpdate = false; if (!this.rotorSlot.isEmpty()) { - if (checkSpace(1, true) == 0) + if (this.checkSpace(1, true) == 0) { - if (getActive() != true) { - setActive(true); + if (this.getActive() != true) { + this.setActive(true); } needsInvUpdate = true; } else { - if (getActive()) { - setActive(false); + if (this.getActive()) { + this.setActive(false); } needsInvUpdate = true; } } else { - if (getActive()) { - setActive(false); + if (this.getActive()) { + this.setActive(false); } needsInvUpdate = true; } - if (getActive()) + if (this.getActive()) { - this.crossSection = (getRotorDiameter() / 2 * 2 * 2 + 1); + this.crossSection = (((this.getRotorDiameter() / 2) * 2 * 2) + 1); this.crossSection *= this.crossSection; - this.obstructedCrossSection = checkSpace(getRotorDiameter() * 3, false); - if ((this.obstructedCrossSection > 0) && (this.obstructedCrossSection <= (getRotorDiameter() + 1) / 2)) { + this.obstructedCrossSection = this.checkSpace(this.getRotorDiameter() * 3, false); + if ((this.obstructedCrossSection > 0) && (this.obstructedCrossSection <= ((this.getRotorDiameter() + 1) / 2))) { this.obstructedCrossSection = 0; } else if (this.obstructedCrossSection < 0) { this.obstructedCrossSection = this.crossSection; } - this.windStrength = calcWindStrength(); + this.windStrength = this.calcWindStrength(); - float speed = (float)Util.limit((this.windStrength - getMinWindStrength()) / getMaxWindStrength(), 0.0D, 2.0D); + final float speed = (float)Util.limit((this.windStrength - this.getMinWindStrength()) / this.getMaxWindStrength(), 0.0D, 2.0D); - setRotationSpeed(speed*2); - if (this.windStrength >= getMinWindStrength()) { - if (this.windStrength <= getMaxWindStrength()) { + this.setRotationSpeed(speed*2); + if (this.windStrength >= this.getMinWindStrength()) { + if (this.windStrength <= this.getMaxWindStrength()) { this.rotorSlot.damage(1, false); } else { this.rotorSlot.damage(4, false); @@ -110,7 +108,7 @@ implements IKineticSource, IHasGui @Override public List<String> getNetworkedFields() { - List<String> ret = new Vector<String>(1); + final List<String> ret = new Vector<>(1); ret.add("rotationSpeed"); ret.add("rotorSlot"); @@ -120,35 +118,35 @@ implements IKineticSource, IHasGui } @Override - public ContainerBase<TileEntityWindKineticGenerator> getGuiContainer(EntityPlayer entityPlayer) + public ContainerBase<TileEntityWindKineticGenerator> getGuiContainer(final EntityPlayer entityPlayer) { return new ContainerWindKineticGenerator(entityPlayer, this); } @Override @SideOnly(Side.CLIENT) - public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin) + public GuiScreen getGui(final EntityPlayer entityPlayer, final boolean isAdmin) { return new GuiWindKineticGenerator(new ContainerWindKineticGenerator(entityPlayer, this)); } @Override - public boolean facingMatchesDirection(ForgeDirection direction) + public boolean facingMatchesDirection(final ForgeDirection direction) { - return direction.ordinal() == getFacing(); + return direction.ordinal() == this.getFacing(); } @Override - public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) + public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side) { if ((side == 0) || (side == 1)) { return false; } - return getFacing() != side; + return this.getFacing() != side; } @Override - public void setFacing(short side) + public void setFacing(final short side) { super.setFacing(side); } @@ -162,22 +160,22 @@ implements IKineticSource, IHasGui public String getRotorhealth() { if (!this.rotorSlot.isEmpty()) { - return StatCollector.translateToLocalFormatted("ic2.WindKineticGenerator.gui.rotorhealth", new Object[] { Integer.valueOf((int)(100.0F - this.rotorSlot.get().getItemDamage() / this.rotorSlot.get().getMaxDamage() * 100.0F)) }); + return StatCollector.translateToLocalFormatted("ic2.WindKineticGenerator.gui.rotorhealth", new Object[] { Integer.valueOf((int)(100.0F - ((this.rotorSlot.get().getItemDamage() / this.rotorSlot.get().getMaxDamage()) * 100.0F))) }); } return ""; } @Override - public int maxrequestkineticenergyTick(ForgeDirection directionFrom) + public int maxrequestkineticenergyTick(final ForgeDirection directionFrom) { - return getKuOutput(); + return this.getKuOutput(); } @Override - public int requestkineticenergy(ForgeDirection directionFrom, int requestkineticenergy) + public int requestkineticenergy(final ForgeDirection directionFrom, final int requestkineticenergy) { - if (facingMatchesDirection(directionFrom.getOpposite())) { - return Math.min(requestkineticenergy, getKuOutput()); + if (this.facingMatchesDirection(directionFrom.getOpposite())) { + return Math.min(requestkineticenergy, this.getKuOutput()); } return 0; } @@ -189,18 +187,18 @@ implements IKineticSource, IHasGui } @Override - public void onGuiClosed(EntityPlayer entityPlayer) {} + public void onGuiClosed(final EntityPlayer entityPlayer) {} @Override - public boolean shouldRenderInPass(int pass) + public boolean shouldRenderInPass(final int pass) { return pass == 0; } @Override - public int checkSpace(int length, boolean onlyrotor) + public int checkSpace(int length, final boolean onlyrotor) { - int box = getRotorDiameter() / 2; + int box = this.getRotorDiameter() / 2; int lentemp = 0; if (onlyrotor) { @@ -210,36 +208,36 @@ implements IKineticSource, IHasGui if (!onlyrotor) { box *= 2; } - ForgeDirection fwdDir = ForgeDirection.VALID_DIRECTIONS[getFacing()]; - ForgeDirection rightDir = fwdDir.getRotation(ForgeDirection.DOWN); + final ForgeDirection fwdDir = ForgeDirection.VALID_DIRECTIONS[this.getFacing()]; + final ForgeDirection rightDir = fwdDir.getRotation(ForgeDirection.DOWN); - int xMaxDist = Math.abs(length * fwdDir.offsetX + box * rightDir.offsetX); + final int xMaxDist = Math.abs((length * fwdDir.offsetX) + (box * rightDir.offsetX)); - int zMaxDist = Math.abs(length * fwdDir.offsetZ + box * rightDir.offsetZ); + final int zMaxDist = Math.abs((length * fwdDir.offsetZ) + (box * rightDir.offsetZ)); - ChunkCache chunkCache = new ChunkCache(this.worldObj, this.xCoord - xMaxDist, this.yCoord - box, this.zCoord - zMaxDist, this.xCoord + xMaxDist, this.yCoord + box, this.zCoord + zMaxDist, 0); + final ChunkCache chunkCache = new ChunkCache(this.worldObj, this.xCoord - xMaxDist, this.yCoord - box, this.zCoord - zMaxDist, this.xCoord + xMaxDist, this.yCoord + box, this.zCoord + zMaxDist, 0); int ret = 0; for (int up = -box; up <= box; up++) { - int y = this.yCoord + up; + final int y = this.yCoord + up; for (int right = -box; right <= box; right++) { boolean occupied = false; for (int fwd = lentemp - length; fwd <= length; fwd++) { - int x = this.xCoord + fwd * fwdDir.offsetX + right * rightDir.offsetX; + final int x = this.xCoord + (fwd * fwdDir.offsetX) + (right * rightDir.offsetX); - int z = this.zCoord + fwd * fwdDir.offsetZ + right * rightDir.offsetZ; + final int z = this.zCoord + (fwd * fwdDir.offsetZ) + (right * rightDir.offsetZ); assert (Math.abs(x - this.xCoord) <= xMaxDist); assert (Math.abs(z - this.zCoord) <= zMaxDist); - Block block = chunkCache.getBlock(x, y, z); + final Block block = chunkCache.getBlock(x, y, z); if (!block.isAir(chunkCache, x, y, z)) { occupied = true; @@ -265,15 +263,15 @@ implements IKineticSource, IHasGui @Override public boolean rotorspace() { - return checkSpace(1, true) == 0; + return this.checkSpace(1, true) == 0; } - private void setRotationSpeed(float speed) + private void setRotationSpeed(final float speed) { if (this.rotationSpeed != speed) { this.rotationSpeed = speed; - ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "rotationSpeed"); + IC2.network.get().updateTileEntityField(this, "rotationSpeed"); } } @@ -299,10 +297,10 @@ implements IKineticSource, IHasGui { if (this.rotationSpeed > 0.0F) { - long period = (long) (5.0E+008F / this.rotationSpeed); + final long period = (long) (5.0E+008F / this.rotationSpeed); - return (float)(System.nanoTime() % period) / (float)period * 360.0F; + return ((float)(System.nanoTime() % period) / (float)period) * 360.0F; } return 0.0F; } @@ -310,7 +308,7 @@ implements IKineticSource, IHasGui @Override public float getefficiency() { - ItemStack stack = this.rotorSlot.get(); + final ItemStack stack = this.rotorSlot.get(); if ((stack != null) && ((stack.getItem() instanceof IKineticRotor))) { return (float) (((IKineticRotor)stack.getItem()).getEfficiency(stack)*1.5); } @@ -320,7 +318,7 @@ implements IKineticSource, IHasGui @Override public int getMinWindStrength() { - ItemStack stack = this.rotorSlot.get(); + final ItemStack stack = this.rotorSlot.get(); if ((stack != null) && ((stack.getItem() instanceof IKineticRotor))) { return ((IKineticRotor)stack.getItem()).getMinWindStrength(stack)/2; } @@ -330,7 +328,7 @@ implements IKineticSource, IHasGui @Override public int getMaxWindStrength() { - ItemStack stack = this.rotorSlot.get(); + final ItemStack stack = this.rotorSlot.get(); if ((stack != null) && ((stack.getItem() instanceof IKineticRotor))) { return ((IKineticRotor)stack.getItem()).getMaxWindStrength(stack)*2; } @@ -340,7 +338,7 @@ implements IKineticSource, IHasGui @Override public int getRotorDiameter() { - ItemStack stack = this.rotorSlot.get(); + final ItemStack stack = this.rotorSlot.get(); if ((stack != null) && ((stack.getItem() instanceof IKineticRotor))) { return ((IKineticRotor)stack.getItem()).getDiameter(stack)/2; } @@ -350,7 +348,7 @@ implements IKineticSource, IHasGui @Override public ResourceLocation getRotorRenderTexture() { - ItemStack stack = this.rotorSlot.get(); + final ItemStack stack = this.rotorSlot.get(); if ((stack != null) && ((stack.getItem() instanceof IKineticRotor))) { return ((IKineticRotor)stack.getItem()).getRotorRenderTexture(stack); } @@ -360,7 +358,7 @@ implements IKineticSource, IHasGui @Override public boolean guiisoverload() { - if (this.windStrength > getMaxWindStrength()) { + if (this.windStrength > this.getMaxWindStrength()) { return true; } return false; @@ -369,14 +367,14 @@ implements IKineticSource, IHasGui @Override public boolean guiisminWindStrength() { - return this.windStrength >= getMinWindStrength(); + return this.windStrength >= this.getMinWindStrength(); } @Override public int getKuOutput() { - if ((this.windStrength >= getMinWindStrength()) && (getActive())) { - return (int)(this.windStrength * 50.0D * getefficiency()); + if ((this.windStrength >= this.getMinWindStrength()) && (this.getActive())) { + return (int)(this.windStrength * 50.0D * this.getefficiency()); } return 0; } diff --git a/src/Java/gtPlusPlus/xmod/ic2/item/IC2_ItemGradual.java b/src/Java/gtPlusPlus/xmod/ic2/item/IC2_ItemGradual.java index e258d437d3..5aecd9c5ec 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/item/IC2_ItemGradual.java +++ b/src/Java/gtPlusPlus/xmod/ic2/item/IC2_ItemGradual.java @@ -1,39 +1,38 @@ package gtPlusPlus.xmod.ic2.item; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.CoreItem; - import java.util.List; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.*; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.item.base.CoreItem; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.*; public class IC2_ItemGradual extends CoreItem { - public IC2_ItemGradual(String internalName) + public IC2_ItemGradual(final String internalName) { super(internalName, AddToCreativeTab.tabMachines, 1, 10000, "", EnumRarity.uncommon); - setNoRepair(); + this.setNoRepair(); } @Override - public boolean isDamaged(ItemStack stack) + public boolean isDamaged(final ItemStack stack) { - return getDamage(stack) > 1; + return this.getDamage(stack) > 1; } @Override - public boolean showDurabilityBar(ItemStack stack) + public boolean showDurabilityBar(final ItemStack stack) { return true; } @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tabs, List itemList) + public void getSubItems(final Item item, final CreativeTabs tabs, final List itemList) { itemList.add(new ItemStack(this, 1, 1)); } diff --git a/src/Java/gtPlusPlus/xmod/ic2/item/IC2_ItemGradualInteger.java b/src/Java/gtPlusPlus/xmod/ic2/item/IC2_ItemGradualInteger.java index 4922e0f806..004713f092 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/item/IC2_ItemGradualInteger.java +++ b/src/Java/gtPlusPlus/xmod/ic2/item/IC2_ItemGradualInteger.java @@ -7,47 +7,47 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; public class IC2_ItemGradualInteger - extends IC2_ItemGradual - implements ICustomDamageItem +extends IC2_ItemGradual +implements ICustomDamageItem { - private final int maxDmg; - - public IC2_ItemGradualInteger(String internalName, int maxdmg) - { - super(internalName); - - this.maxDmg = maxdmg; - } - - @Override -public int getCustomDamage(ItemStack stack) - { - NBTTagCompound nbt = StackUtil.getOrCreateNbtData(stack); - return nbt.getInteger("advDmg"); - } - - @Override -public int getMaxCustomDamage(ItemStack stack) - { - return this.maxDmg; - } - - @Override -public void setCustomDamage(ItemStack stack, int damage) - { - NBTTagCompound nbt = StackUtil.getOrCreateNbtData(stack); - nbt.setInteger("advDmg", 0); - - int maxStackDamage = stack.getMaxDamage(); - if (maxStackDamage > 2) { - //stack.setItemDamage(1 + (int)Util.map(damage, this.maxDmg, maxStackDamage - 2)); - } - } - - @Override -public boolean applyCustomDamage(ItemStack stack, int damage, EntityLivingBase src) - { - setCustomDamage(stack, getCustomDamage(stack) + damage); - return true; - } + private final int maxDmg; + + public IC2_ItemGradualInteger(final String internalName, final int maxdmg) + { + super(internalName); + + this.maxDmg = maxdmg; + } + + @Override + public int getCustomDamage(final ItemStack stack) + { + final NBTTagCompound nbt = StackUtil.getOrCreateNbtData(stack); + return nbt.getInteger("advDmg"); + } + + @Override + public int getMaxCustomDamage(final ItemStack stack) + { + return this.maxDmg; + } + + @Override + public void setCustomDamage(final ItemStack stack, final int damage) + { + final NBTTagCompound nbt = StackUtil.getOrCreateNbtData(stack); + nbt.setInteger("advDmg", 0); + + final int maxStackDamage = stack.getMaxDamage(); + if (maxStackDamage > 2) { + //stack.setItemDamage(1 + (int)Util.map(damage, this.maxDmg, maxStackDamage - 2)); + } + } + + @Override + public boolean applyCustomDamage(final ItemStack stack, final int damage, final EntityLivingBase src) + { + this.setCustomDamage(stack, this.getCustomDamage(stack) + damage); + return true; + } } diff --git a/src/Java/gtPlusPlus/xmod/ic2/item/IC2_ItemIC2.java b/src/Java/gtPlusPlus/xmod/ic2/item/IC2_ItemIC2.java index b257124345..9d4990e76c 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/item/IC2_ItemIC2.java +++ b/src/Java/gtPlusPlus/xmod/ic2/item/IC2_ItemIC2.java @@ -1,22 +1,22 @@ package gtPlusPlus.xmod.ic2.item; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import net.minecraft.item.*; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class IC2_ItemIC2 extends Item { - public IC2_ItemIC2(String internalName) + public IC2_ItemIC2(final String internalName) { - setUnlocalizedName(internalName); - setCreativeTab(AddToCreativeTab.tabMachines); - setTextureName(CORE.MODID + ":" + internalName); + this.setUnlocalizedName(internalName); + this.setCreativeTab(AddToCreativeTab.tabMachines); + this.setTextureName(CORE.MODID + ":" + internalName); GameRegistry.registerItem(this, internalName); } @@ -73,18 +73,18 @@ extends Item } @Override - public String getUnlocalizedName(ItemStack itemStack) + public String getUnlocalizedName(final ItemStack itemStack) { - return getUnlocalizedName(); + return this.getUnlocalizedName(); } @Override - public String getItemStackDisplayName(ItemStack itemStack) + public String getItemStackDisplayName(final ItemStack itemStack) { - return StatCollector.translateToLocal(getUnlocalizedName(itemStack)); + return StatCollector.translateToLocal(this.getUnlocalizedName(itemStack)); } - public IC2_ItemIC2 setRarity(int aRarity) + public IC2_ItemIC2 setRarity(final int aRarity) { this.rarity = aRarity; return this; @@ -92,7 +92,7 @@ extends Item @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack stack) + public EnumRarity getRarity(final ItemStack stack) { return EnumRarity.values()[this.rarity]; } diff --git a/src/Java/gtPlusPlus/xmod/ic2/item/IC2_Items.java b/src/Java/gtPlusPlus/xmod/ic2/item/IC2_Items.java index bf6f3bc1cd..2e9cec3c33 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/item/IC2_Items.java +++ b/src/Java/gtPlusPlus/xmod/ic2/item/IC2_Items.java @@ -24,7 +24,7 @@ public class IC2_Items { public static ItemStack shaft_Material_2; //TungstenSteel public static ItemStack shaft_Material_3; //Vibrant Alloy public static ItemStack shaft_Material_4; //Iridium - + public static ItemStack blockRTG; public static ItemStack blockKineticGenerator; diff --git a/src/Java/gtPlusPlus/xmod/ic2/item/ItemGenerators.java b/src/Java/gtPlusPlus/xmod/ic2/item/ItemGenerators.java index 2d73638ce9..046324a4ac 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/item/ItemGenerators.java +++ b/src/Java/gtPlusPlus/xmod/ic2/item/ItemGenerators.java @@ -1,55 +1,54 @@ package gtPlusPlus.xmod.ic2.item; -import ic2.core.item.block.ItemBlockIC2; - import java.util.List; +import ic2.core.item.block.ItemBlockIC2; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; public class ItemGenerators - extends ItemBlockIC2 +extends ItemBlockIC2 { - public ItemGenerators(Block block) - { - super(block); - - setMaxDamage(0); - setHasSubtypes(true); - } - - @Override -public int getMetadata(int i) - { - return i; - } - - @Override -public String getUnlocalizedName(ItemStack itemstack) - { - int meta = itemstack.getItemDamage(); - switch (meta) - { - case 0: - return "ic2.blockRTGenerator2"; - case 1: - return "ic2.blockKineticGenerator2"; - } - return null; - } - - @Override -public void addInformation(ItemStack itemStack, EntityPlayer player, List info, boolean b) - { - int meta = itemStack.getItemDamage(); - switch (meta) - { - case 0: - info.add(StatCollector.translateToLocal("ic2.item.tooltip.PowerOutput") + " 1-32 EU/t " + StatCollector.translateToLocal("ic2.item.tooltip.max")); break; - case 1: - info.add(StatCollector.translateToLocal("ic2.item.tooltip.PowerOutput") + " 1-512 EU/t " + StatCollector.translateToLocal("ic2.item.tooltip.max")); - } - } + public ItemGenerators(final Block block) + { + super(block); + + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + @Override + public int getMetadata(final int i) + { + return i; + } + + @Override + public String getUnlocalizedName(final ItemStack itemstack) + { + final int meta = itemstack.getItemDamage(); + switch (meta) + { + case 0: + return "ic2.blockRTGenerator2"; + case 1: + return "ic2.blockKineticGenerator2"; + } + return null; + } + + @Override + public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List info, final boolean b) + { + final int meta = itemStack.getItemDamage(); + switch (meta) + { + case 0: + info.add(StatCollector.translateToLocal("ic2.item.tooltip.PowerOutput") + " 1-32 EU/t " + StatCollector.translateToLocal("ic2.item.tooltip.max")); break; + case 1: + info.add(StatCollector.translateToLocal("ic2.item.tooltip.PowerOutput") + " 1-512 EU/t " + StatCollector.translateToLocal("ic2.item.tooltip.max")); + } + } } diff --git a/src/Java/gtPlusPlus/xmod/ic2/item/RotorBase.java b/src/Java/gtPlusPlus/xmod/ic2/item/RotorBase.java index dbea1dc299..9a8cdd5df1 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/item/RotorBase.java +++ b/src/Java/gtPlusPlus/xmod/ic2/item/RotorBase.java @@ -1,13 +1,12 @@ package gtPlusPlus.xmod.ic2.item; +import java.util.List; + import ic2.api.item.IKineticRotor; import ic2.core.block.kineticgenerator.gui.GuiWaterKineticGenerator; import ic2.core.block.kineticgenerator.gui.GuiWindKineticGenerator; import ic2.core.init.InternalName; import ic2.core.item.resources.ItemWindRotor; - -import java.util.List; - import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -21,16 +20,16 @@ public class RotorBase extends ItemWindRotor{ private final int radius; private final float efficiency; private final ResourceLocation renderTexture; - private final boolean water; + private final boolean water; - public RotorBase(InternalName internalName, int Radius, int durability, float efficiency, int minWindStrength, int maxWindStrength, ResourceLocation RenderTexture) + public RotorBase(final InternalName internalName, final int Radius, final int durability, final float efficiency, final int minWindStrength, final int maxWindStrength, final ResourceLocation RenderTexture) { super(internalName, Radius, durability, efficiency, minWindStrength, maxWindStrength, RenderTexture); - setMaxStackSize(1); - setMaxDamage(durability); + this.setMaxStackSize(1); + this.setMaxDamage(durability); this.radius = Radius; this.efficiency = efficiency; @@ -41,7 +40,7 @@ public class RotorBase extends ItemWindRotor{ } @Override - public void addInformation(ItemStack itemStack, EntityPlayer player, List info, boolean b) + public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List info, final boolean b) { info.add(StatCollector.translateToLocalFormatted("ic2.itemrotor.wind.info", new Object[] { Integer.valueOf(this.minWindStrength), Integer.valueOf(this.maxWindStrength) })); IKineticRotor.GearboxType type = null; @@ -62,36 +61,37 @@ public class RotorBase extends ItemWindRotor{ } @Override - public int getDiameter(ItemStack stack) + public int getDiameter(final ItemStack stack) { return this.radius; } @Override - public ResourceLocation getRotorRenderTexture(ItemStack stack) + public ResourceLocation getRotorRenderTexture(final ItemStack stack) { return this.renderTexture; } @Override - public float getEfficiency(ItemStack stack) + public float getEfficiency(final ItemStack stack) { return this.efficiency; } @Override - public int getMinWindStrength(ItemStack stack) + public int getMinWindStrength(final ItemStack stack) { return this.minWindStrength; } @Override - public int getMaxWindStrength(ItemStack stack) + public int getMaxWindStrength(final ItemStack stack) { return this.maxWindStrength; } - public boolean isAcceptedType(ItemStack stack, IKineticRotor.GearboxType type) + @Override + public boolean isAcceptedType(final ItemStack stack, final IKineticRotor.GearboxType type) { return (type == IKineticRotor.GearboxType.WIND) || (this.water); } diff --git a/src/Java/gtPlusPlus/xmod/ic2/item/RotorIridium.java b/src/Java/gtPlusPlus/xmod/ic2/item/RotorIridium.java index f35b1e88f0..e76d689533 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/item/RotorIridium.java +++ b/src/Java/gtPlusPlus/xmod/ic2/item/RotorIridium.java @@ -1,13 +1,12 @@ package gtPlusPlus.xmod.ic2.item; +import java.util.List; + import ic2.api.item.IKineticRotor; import ic2.core.block.kineticgenerator.gui.GuiWaterKineticGenerator; import ic2.core.block.kineticgenerator.gui.GuiWindKineticGenerator; import ic2.core.init.InternalName; import ic2.core.util.StackUtil; - -import java.util.List; - import net.minecraft.client.Minecraft; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -23,16 +22,16 @@ public class RotorIridium extends RotorBase{ private final int radius; private final float efficiency; private final ResourceLocation renderTexture; - private final boolean water; + private final boolean water; - public RotorIridium(InternalName internalName, int Radius, int durability, float efficiency, int minWindStrength, int maxWindStrength, ResourceLocation RenderTexture) + public RotorIridium(final InternalName internalName, final int Radius, final int durability, final float efficiency, final int minWindStrength, final int maxWindStrength, final ResourceLocation RenderTexture) { super(internalName, Radius, durability, efficiency, minWindStrength, maxWindStrength, RenderTexture); - - - setMaxStackSize(1); - setMaxDamage(Integer.MAX_VALUE); + + + this.setMaxStackSize(1); + this.setMaxDamage(Integer.MAX_VALUE); this.radius = Radius; this.efficiency = efficiency; @@ -43,7 +42,7 @@ public class RotorIridium extends RotorBase{ } @Override - public void addInformation(ItemStack itemStack, EntityPlayer player, List info, boolean b) + public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List info, final boolean b) { info.add(StatCollector.translateToLocalFormatted("ic2.itemrotor.wind.info", new Object[] { Integer.valueOf(this.minWindStrength), Integer.valueOf(this.maxWindStrength) })); IKineticRotor.GearboxType type = null; @@ -59,63 +58,64 @@ public class RotorIridium extends RotorBase{ @Override public String getTextureFolder() - { - return "rotors"; - } - - @Override - public int getDiameter(ItemStack stack) - { - return this.radius; - } - - @Override - public ResourceLocation getRotorRenderTexture(ItemStack stack) - { - return this.renderTexture; - } - - @Override - public float getEfficiency(ItemStack stack) - { - return this.efficiency; - } - - @Override - public int getMinWindStrength(ItemStack stack) - { - return this.minWindStrength; - } - - @Override - public int getMaxWindStrength(ItemStack stack) - { - return this.maxWindStrength; - } - - public boolean isAcceptedType(ItemStack stack, IKineticRotor.GearboxType type) - { - return (type == IKineticRotor.GearboxType.WIND) || (this.water); - } - - - @Override - public void setCustomDamage(ItemStack stack, int damage) - { - NBTTagCompound nbt = StackUtil.getOrCreateNbtData(stack); - nbt.setInteger("advDmg", 0); - - int maxStackDamage = stack.getMaxDamage(); - if (maxStackDamage > 2) { - //stack.setItemDamage(1 + (int)Util.map(damage, this.maxDmg, maxStackDamage - 2)); - } - } - - @Override - public boolean applyCustomDamage(ItemStack stack, int damage, EntityLivingBase src) - { - setCustomDamage(stack, getCustomDamage(stack) + damage); - return true; - } + { + return "rotors"; + } + + @Override + public int getDiameter(final ItemStack stack) + { + return this.radius; + } + + @Override + public ResourceLocation getRotorRenderTexture(final ItemStack stack) + { + return this.renderTexture; + } + + @Override + public float getEfficiency(final ItemStack stack) + { + return this.efficiency; + } + + @Override + public int getMinWindStrength(final ItemStack stack) + { + return this.minWindStrength; + } + + @Override + public int getMaxWindStrength(final ItemStack stack) + { + return this.maxWindStrength; + } + + @Override + public boolean isAcceptedType(final ItemStack stack, final IKineticRotor.GearboxType type) + { + return (type == IKineticRotor.GearboxType.WIND) || (this.water); + } + + + @Override + public void setCustomDamage(final ItemStack stack, final int damage) + { + final NBTTagCompound nbt = StackUtil.getOrCreateNbtData(stack); + nbt.setInteger("advDmg", 0); + + final int maxStackDamage = stack.getMaxDamage(); + if (maxStackDamage > 2) { + //stack.setItemDamage(1 + (int)Util.map(damage, this.maxDmg, maxStackDamage - 2)); + } } - + + @Override + public boolean applyCustomDamage(final ItemStack stack, final int damage, final EntityLivingBase src) + { + this.setCustomDamage(stack, this.getCustomDamage(stack) + damage); + return true; + } +} + diff --git a/src/Java/gtPlusPlus/xmod/ic2/recipe/RECIPE_IC2.java b/src/Java/gtPlusPlus/xmod/ic2/recipe/RECIPE_IC2.java index bf55a6cbf7..730e3c9032 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/recipe/RECIPE_IC2.java +++ b/src/Java/gtPlusPlus/xmod/ic2/recipe/RECIPE_IC2.java @@ -11,12 +11,12 @@ import gtPlusPlus.xmod.ic2.item.IC2_Items; import net.minecraft.item.ItemStack; public class RECIPE_IC2 { - + public static String plate_T1 = "plateEnergeticAlloy"; public static String plate_T2 = "plateTungstenSteel"; public static String plate_T3 = "plateVibrantAlloy"; public static String plate_T4 = "plateAlloyIridium"; - + public static ItemStack block_T1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.EnergeticAlloy, 1L); public static ItemStack block_T2 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.TungstenSteel, 1L); public static ItemStack block_T3 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.VibrantAlloy, 1L); @@ -26,12 +26,12 @@ public class RECIPE_IC2 { public static String ingot_T2 = "ingotTungstenSteel"; public static String ingot_T3 = "ingotVibrantAlloy"; public static String ingot_T4 = "ingotIridium"; - + private static ItemStack rotor_blade_T1 = ItemUtils.getSimpleStack(IC2_Items.rotor_Blade_Material_1.getItem()); private static ItemStack rotor_blade_T2 = ItemUtils.getSimpleStack(IC2_Items.rotor_Blade_Material_2.getItem()); private static ItemStack rotor_blade_T3 = ItemUtils.getSimpleStack(IC2_Items.rotor_Blade_Material_3.getItem()); private static ItemStack rotor_blade_T4 = ItemUtils.getSimpleStack(IC2_Items.rotor_Blade_Material_4.getItem()); - + private static ItemStack shaft_T1 = ItemUtils.getSimpleStack(IC2_Items.shaft_Material_1.getItem()); private static ItemStack shaft_T2 = ItemUtils.getSimpleStack(IC2_Items.shaft_Material_2.getItem()); private static ItemStack shaft_T3 = ItemUtils.getSimpleStack(IC2_Items.shaft_Material_3.getItem()); @@ -41,14 +41,14 @@ public class RECIPE_IC2 { private static ItemStack rotor_T2 = ItemUtils.getSimpleStack(IC2_Items.rotor_Material_2.getItem()); private static ItemStack rotor_T3 = ItemUtils.getSimpleStack(IC2_Items.rotor_Material_3.getItem()); private static ItemStack rotor_T4 = ItemUtils.getSimpleStack(IC2_Items.rotor_Material_4.getItem()); - + private static void checkForEnderIO(){ if(!LoadedMods.EnderIO){ plate_T1 = "plateMagnalium"; plate_T2 = "plateTungstenSteel"; plate_T3 = "plateUltimet"; plate_T4 = "plateAlloyIridium"; - + block_T1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Magnalium, 1L); block_T2 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.TungstenSteel, 1L); block_T3 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Ultimet, 1L); @@ -60,44 +60,44 @@ public class RECIPE_IC2 { ingot_T4 = "ingotIridium"; } } - + public static void initRecipes(){ - + //Rotor Blade Recipes RecipeUtils.recipeBuilder( plate_T1, ingot_T1, plate_T1, plate_T1, ingot_T1, plate_T1, plate_T1, ingot_T1, plate_T1, rotor_blade_T1); - + RecipeUtils.recipeBuilder( plate_T2, ingot_T2, plate_T2, plate_T2, ingot_T2, plate_T2, plate_T2, ingot_T2, plate_T2, rotor_blade_T2); - + RecipeUtils.recipeBuilder( plate_T3, ingot_T3, plate_T3, plate_T3, ingot_T3, plate_T3, plate_T3, ingot_T3, plate_T3, rotor_blade_T3); - + RecipeUtils.recipeBuilder( plate_T4, ingot_T4, plate_T4, plate_T4, ingot_T4, plate_T4, plate_T4, ingot_T4, plate_T4, rotor_blade_T4); - + //Shaft Extruder Recipe GT_ModHandler.addCraftingRecipe(GregtechItemList.Shape_Extruder_WindmillShaft.get(1L, new Object[0]), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"hXS", "XPX", "fXd", Character.valueOf('P'), ItemList.Shape_Extruder_Rod, Character.valueOf('X'), OrePrefixes.plate.get(Materials.DarkIron), Character.valueOf('S'), OrePrefixes.screw.get(Materials.DarkIron)}); GT_ModHandler.addCraftingRecipe(GregtechItemList.Shape_Extruder_WindmillShaft.get(1L, new Object[0]), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"hXS", "XPX", "fXd", Character.valueOf('P'), ItemList.Shape_Extruder_Rod, Character.valueOf('X'), OrePrefixes.plate.get(Materials.TungstenSteel), Character.valueOf('S'), OrePrefixes.screw.get(Materials.TungstenSteel)}); GT_ModHandler.addCraftingRecipe(GregtechItemList.Shape_Extruder_WindmillShaft.get(1L, new Object[0]), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"hXS", "XPX", "fXd", Character.valueOf('P'), ItemList.Shape_Extruder_Rod, Character.valueOf('X'), OrePrefixes.plate.get(Materials.Molybdenum), Character.valueOf('S'), OrePrefixes.screw.get(Materials.Molybdenum)}); Utils.LOG_INFO("Added recipe item for GT5 Extruder: Shaft Shape"); - + //Shaft Recipes GT_Values.RA.addExtruderRecipe(GT_Utility.copyAmount(9L, block_T1), GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), shaft_T1, 2560, 250); if (LoadedMods.EnderIO){ - Utils.LOG_INFO("Added recipe for GT5 Extruder: Windmill Shaft [Energetic]"); + Utils.LOG_INFO("Added recipe for GT5 Extruder: Windmill Shaft [Energetic]"); } else { Utils.LOG_INFO("Added recipe for GT5 Extruder: Windmill Shaft [Magnalium]"); @@ -106,41 +106,41 @@ public class RECIPE_IC2 { Utils.LOG_INFO("Added recipe for GT5 Extruder: Windmill Shaft [TungstenSteel]"); GT_Values.RA.addExtruderRecipe(GT_Utility.copyAmount(9L, block_T3), GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), shaft_T3, 10240, 2000); if (LoadedMods.EnderIO){ - Utils.LOG_INFO("Added recipe for GT5 Extruder: Windmill Shaft [Vibrant]"); + Utils.LOG_INFO("Added recipe for GT5 Extruder: Windmill Shaft [Vibrant]"); } else { Utils.LOG_INFO("Added recipe for GT5 Extruder: Windmill Shaft [Ultimet]"); } GT_Values.RA.addExtruderRecipe(GT_Utility.copyAmount(9L, block_T4), GregtechItemList.Shape_Extruder_WindmillShaft.get(0L, new Object[0]), shaft_T4, 20480, 4000); Utils.LOG_INFO("Added recipe for GT5 Extruder: Windmill Shaft [Iridium]"); - + //Rotor Recipes RecipeUtils.recipeBuilder( null, rotor_blade_T1, null, rotor_blade_T1, shaft_T1, rotor_blade_T1, null, rotor_blade_T1, null, rotor_T1); - + RecipeUtils.recipeBuilder( null, rotor_blade_T2, null, rotor_blade_T2, shaft_T2, rotor_blade_T2, null, rotor_blade_T2, null, rotor_T2); - + RecipeUtils.recipeBuilder( null, rotor_blade_T3, null, rotor_blade_T3, shaft_T3, rotor_blade_T3, null, rotor_blade_T3, null, rotor_T3); - + RecipeUtils.recipeBuilder( null, rotor_blade_T4, null, rotor_blade_T4, shaft_T4, rotor_blade_T4, null, rotor_blade_T4, null, - rotor_T4); - + rotor_T4); + } - - - + + + } diff --git a/src/Java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java b/src/Java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java index 6804737ebf..0344691eeb 100644 --- a/src/Java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java +++ b/src/Java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java @@ -8,20 +8,20 @@ import gtPlusPlus.xmod.thermalfoundation.recipe.TF_Gregtech_Recipes; public class HANDLER_TF{ - public static void preInit(){ + public static void preInit(){ if (LoadedMods.CoFHCore && !LoadedMods.ThermalFoundation){ TF_Fluids.preInit(); TF_Items.preInit(); TF_Blocks.preInit(); - } + } } public static void init(){ if (LoadedMods.CoFHCore && !LoadedMods.ThermalFoundation){ TF_Fluids.init(); - TF_Blocks.init(); + TF_Blocks.init(); TF_Items.init(); - } + } } public static void postInit(){ @@ -31,7 +31,7 @@ public class HANDLER_TF{ TF_Blocks.postInit(); if(LoadedMods.Gregtech){ TF_Gregtech_Recipes.run(); - } - } - } + } + } + } } diff --git a/src/Java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Cryotheum.java b/src/Java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Cryotheum.java index e47daa9f28..edbd1c91f5 100644 --- a/src/Java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Cryotheum.java +++ b/src/Java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Cryotheum.java @@ -1,10 +1,14 @@ package gtPlusPlus.xmod.thermalfoundation.block; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; - import java.util.Random; +import cofh.core.fluid.BlockFluidInteractive; +import cofh.lib.util.BlockWrapper; +import cofh.lib.util.helpers.DamageHelper; +import cofh.lib.util.helpers.ServerHelper; +import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; import net.minecraft.block.Block; import net.minecraft.block.material.*; import net.minecraft.entity.Entity; @@ -16,169 +20,168 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import cofh.core.fluid.BlockFluidInteractive; -import cofh.lib.util.BlockWrapper; -import cofh.lib.util.helpers.DamageHelper; -import cofh.lib.util.helpers.ServerHelper; -import cpw.mods.fml.common.registry.GameRegistry; public class TF_Block_Fluid_Cryotheum - extends BlockFluidInteractive +extends BlockFluidInteractive { - Random random = new Random(); - public static final int LEVELS = 5; - public static final Material materialFluidCryotheum = new MaterialLiquid(MapColor.iceColor); - private static boolean enableSourceFall = true; - private static boolean effect = true; - - public TF_Block_Fluid_Cryotheum() - { - super(CORE.MODID, TF_Fluids.fluidCryotheum, materialFluidCryotheum, "cryotheum"); - setQuantaPerBlock(5); - setTickRate(15); - - setHardness(1000.0F); - setLightOpacity(1); - setParticleColor(0.15F, 0.7F, 1.0F); - } - - public boolean preInit() - { - GameRegistry.registerBlock(this, "FluidCryotheum"); - - addInteraction(Blocks.grass, Blocks.dirt); - addInteraction(Blocks.water, 0, Blocks.ice); - addInteraction(Blocks.water, Blocks.snow); - addInteraction(Blocks.flowing_water, 0, Blocks.ice); - addInteraction(Blocks.flowing_water, Blocks.snow); - addInteraction(Blocks.lava, 0, Blocks.obsidian); - addInteraction(Blocks.lava, Blocks.stone); - addInteraction(Blocks.flowing_lava, 0, Blocks.obsidian); - addInteraction(Blocks.flowing_lava, Blocks.stone); - addInteraction(Blocks.leaves, Blocks.air); - addInteraction(Blocks.tallgrass, Blocks.air); - addInteraction(Blocks.fire, Blocks.air); - //addInteraction(TFBlocks.blockFluidGlowstone, 0, Blocks.glowstone); - - String str1 = "Fluid.Cryotheum"; - String str2 = "Enable this for Fluid Cryotheum to be worse than lava, except cold."; - effect = true; - - str2 = "Enable this for Fluid Cryotheum Source blocks to gradually fall downwards."; - enableSourceFall = true; - - return true; - } - - public void onEntityCollidedWithBlock(World paramWorld, int paramInt1, int paramInt2, int paramInt3, Entity paramEntity) - { - paramEntity.extinguish(); - if (!effect) { - return; - } - if ((paramEntity.motionY < -0.05D) || (paramEntity.motionY > 0.05D)) { - paramEntity.motionY *= 0.05D; - } - if ((paramEntity.motionZ < -0.05D) || (paramEntity.motionZ > 0.05D)) { - paramEntity.motionZ *= 0.05D; - } - if ((paramEntity.motionX < -0.05D) || (paramEntity.motionX > 0.05D)) { - paramEntity.motionX *= 0.05D; - } - if (ServerHelper.isClientWorld(paramWorld)) { - return; - } - if (paramWorld.getTotalWorldTime() % 8L != 0L) { - return; - } - if (((paramEntity instanceof EntityZombie)) || ((paramEntity instanceof EntityCreeper))) - { - EntitySnowman localEntitySnowman = new EntitySnowman(paramWorld); - localEntitySnowman.setLocationAndAngles(paramEntity.posX, paramEntity.posY, paramEntity.posZ, paramEntity.rotationYaw, paramEntity.rotationPitch); - paramWorld.spawnEntityInWorld(localEntitySnowman); - - paramEntity.setDead(); - } - else if (/*((paramEntity instanceof EntityBlizz)) ||*/((paramEntity instanceof EntitySnowman))) - { - ((EntityLivingBase)paramEntity).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 120, 0)); - ((EntityLivingBase)paramEntity).addPotionEffect(new PotionEffect(Potion.regeneration.id, 120, 0)); - } - else if ((paramEntity instanceof EntityBlaze)) - { - paramEntity.attackEntityFrom(DamageHelper.cryotheum, 10.0F); - } - else - { - boolean bool = paramEntity.velocityChanged; - paramEntity.attackEntityFrom(DamageHelper.cryotheum, 2.0F); - paramEntity.velocityChanged = bool; - } - } - - public int getLightValue(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) - { - return TF_Fluids.fluidCryotheum.getLuminosity(); - } - - public void updateTick(World paramWorld, int paramInt1, int paramInt2, int paramInt3, Random paramRandom) - { - if (effect) { - checkForInteraction(paramWorld, paramInt1, paramInt2, paramInt3); - } - if ((enableSourceFall) && (paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3) == 0)) - { - Block localBlock = paramWorld.getBlock(paramInt1, paramInt2 + this.densityDir, paramInt3); - int i = paramWorld.getBlockMetadata(paramInt1, paramInt2 + this.densityDir, paramInt3); - if ((localBlock == this) && (i != 0)) - { - paramWorld.setBlock(paramInt1, paramInt2 + this.densityDir, paramInt3, this, 0, 3); - paramWorld.setBlockToAir(paramInt1, paramInt2, paramInt3); - return; - } - } - super.updateTick(paramWorld, paramInt1, paramInt2, paramInt3, paramRandom); - } - - protected void checkForInteraction(World paramWorld, int paramInt1, int paramInt2, int paramInt3) - { - if (paramWorld.getBlock(paramInt1, paramInt2, paramInt3) != this) { - return; - } - int i = paramInt1; - int j = paramInt2; - int k = paramInt3; - for (int m = 0; m < 6; m++) - { - i = paramInt1 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][0]; - j = paramInt2 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][1]; - k = paramInt3 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][2]; - - interactWithBlock(paramWorld, i, j, k); - } - interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 - 1); - interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 + 1); - interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 - 1); - interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 + 1); - } - - protected void interactWithBlock(World paramWorld, int paramInt1, int paramInt2, int paramInt3) - { - Block localBlock = paramWorld.getBlock(paramInt1, paramInt2, paramInt3); - if ((localBlock == Blocks.air) || (localBlock == this)) { - return; - } - int i = paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3); - if (hasInteraction(localBlock, i)) - { - BlockWrapper localBlockWrapper = getInteraction(localBlock, i); - paramWorld.setBlock(paramInt1, paramInt2, paramInt3, localBlockWrapper.block, localBlockWrapper.metadata, 3); - } - else if ((paramWorld.isSideSolid(paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) && (paramWorld.isAirBlock(paramInt1, paramInt2 + 1, paramInt3))) - { - paramWorld.setBlock(paramInt1, paramInt2 + 1, paramInt3, Blocks.snow_layer, 0, 3); - } - } - - protected void triggerInteractionEffects(World paramWorld, int paramInt1, int paramInt2, int paramInt3) {} + Random random = new Random(); + public static final int LEVELS = 5; + public static final Material materialFluidCryotheum = new MaterialLiquid(MapColor.iceColor); + private static boolean enableSourceFall = true; + private static boolean effect = true; + + public TF_Block_Fluid_Cryotheum() + { + super(CORE.MODID, TF_Fluids.fluidCryotheum, materialFluidCryotheum, "cryotheum"); + this.setQuantaPerBlock(5); + this.setTickRate(15); + + this.setHardness(1000.0F); + this.setLightOpacity(1); + this.setParticleColor(0.15F, 0.7F, 1.0F); + } + + @Override + public boolean preInit() + { + GameRegistry.registerBlock(this, "FluidCryotheum"); + + this.addInteraction(Blocks.grass, Blocks.dirt); + this.addInteraction(Blocks.water, 0, Blocks.ice); + this.addInteraction(Blocks.water, Blocks.snow); + this.addInteraction(Blocks.flowing_water, 0, Blocks.ice); + this.addInteraction(Blocks.flowing_water, Blocks.snow); + this.addInteraction(Blocks.lava, 0, Blocks.obsidian); + this.addInteraction(Blocks.lava, Blocks.stone); + this.addInteraction(Blocks.flowing_lava, 0, Blocks.obsidian); + this.addInteraction(Blocks.flowing_lava, Blocks.stone); + this.addInteraction(Blocks.leaves, Blocks.air); + this.addInteraction(Blocks.tallgrass, Blocks.air); + this.addInteraction(Blocks.fire, Blocks.air); + //addInteraction(TFBlocks.blockFluidGlowstone, 0, Blocks.glowstone); + + final String str1 = "Fluid.Cryotheum"; + String str2 = "Enable this for Fluid Cryotheum to be worse than lava, except cold."; + effect = true; + + str2 = "Enable this for Fluid Cryotheum Source blocks to gradually fall downwards."; + enableSourceFall = true; + + return true; + } + + @Override + public void onEntityCollidedWithBlock(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3, final Entity paramEntity) + { + paramEntity.extinguish(); + if (!effect) { + return; + } + if ((paramEntity.motionY < -0.05D) || (paramEntity.motionY > 0.05D)) { + paramEntity.motionY *= 0.05D; + } + if ((paramEntity.motionZ < -0.05D) || (paramEntity.motionZ > 0.05D)) { + paramEntity.motionZ *= 0.05D; + } + if ((paramEntity.motionX < -0.05D) || (paramEntity.motionX > 0.05D)) { + paramEntity.motionX *= 0.05D; + } + if (ServerHelper.isClientWorld(paramWorld)) { + return; + } + if ((paramWorld.getTotalWorldTime() % 8L) != 0L) { + return; + } + if (((paramEntity instanceof EntityZombie)) || ((paramEntity instanceof EntityCreeper))) + { + final EntitySnowman localEntitySnowman = new EntitySnowman(paramWorld); + localEntitySnowman.setLocationAndAngles(paramEntity.posX, paramEntity.posY, paramEntity.posZ, paramEntity.rotationYaw, paramEntity.rotationPitch); + paramWorld.spawnEntityInWorld(localEntitySnowman); + + paramEntity.setDead(); + } + else if (/*((paramEntity instanceof EntityBlizz)) ||*/((paramEntity instanceof EntitySnowman))) + { + ((EntityLivingBase)paramEntity).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 120, 0)); + ((EntityLivingBase)paramEntity).addPotionEffect(new PotionEffect(Potion.regeneration.id, 120, 0)); + } + else if ((paramEntity instanceof EntityBlaze)) + { + paramEntity.attackEntityFrom(DamageHelper.cryotheum, 10.0F); + } + else + { + final boolean bool = paramEntity.velocityChanged; + paramEntity.attackEntityFrom(DamageHelper.cryotheum, 2.0F); + paramEntity.velocityChanged = bool; + } + } + + @Override + public int getLightValue(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, final int paramInt3) + { + return TF_Fluids.fluidCryotheum.getLuminosity(); + } + + @Override + public void updateTick(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3, final Random paramRandom) + { + if (effect) { + this.checkForInteraction(paramWorld, paramInt1, paramInt2, paramInt3); + } + if ((enableSourceFall) && (paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3) == 0)) + { + final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2 + this.densityDir, paramInt3); + final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2 + this.densityDir, paramInt3); + if ((localBlock == this) && (i != 0)) + { + paramWorld.setBlock(paramInt1, paramInt2 + this.densityDir, paramInt3, this, 0, 3); + paramWorld.setBlockToAir(paramInt1, paramInt2, paramInt3); + return; + } + } + super.updateTick(paramWorld, paramInt1, paramInt2, paramInt3, paramRandom); + } + + protected void checkForInteraction(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) + { + if (paramWorld.getBlock(paramInt1, paramInt2, paramInt3) != this) { + return; + } + int i = paramInt1; + int j = paramInt2; + int k = paramInt3; + for (int m = 0; m < 6; m++) + { + i = paramInt1 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][0]; + j = paramInt2 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][1]; + k = paramInt3 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][2]; + + this.interactWithBlock(paramWorld, i, j, k); + } + this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 - 1); + this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 + 1); + this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 - 1); + this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 + 1); + } + + protected void interactWithBlock(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) + { + final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2, paramInt3); + if ((localBlock == Blocks.air) || (localBlock == this)) { + return; + } + final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3); + if (this.hasInteraction(localBlock, i)) + { + final BlockWrapper localBlockWrapper = this.getInteraction(localBlock, i); + paramWorld.setBlock(paramInt1, paramInt2, paramInt3, localBlockWrapper.block, localBlockWrapper.metadata, 3); + } + else if ((paramWorld.isSideSolid(paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) && (paramWorld.isAirBlock(paramInt1, paramInt2 + 1, paramInt3))) + { + paramWorld.setBlock(paramInt1, paramInt2 + 1, paramInt3, Blocks.snow_layer, 0, 3); + } + } + + protected void triggerInteractionEffects(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) {} } diff --git a/src/Java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Pyrotheum.java b/src/Java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Pyrotheum.java index 1c1da75909..2f9d00527d 100644 --- a/src/Java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Pyrotheum.java +++ b/src/Java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Pyrotheum.java @@ -1,10 +1,13 @@ package gtPlusPlus.xmod.thermalfoundation.block; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; - import java.util.Random; +import cofh.core.fluid.BlockFluidInteractive; +import cofh.lib.util.BlockWrapper; +import cofh.lib.util.helpers.ServerHelper; +import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; import net.minecraft.block.Block; import net.minecraft.block.material.*; import net.minecraft.entity.Entity; @@ -14,167 +17,171 @@ import net.minecraft.init.Blocks; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import cofh.core.fluid.BlockFluidInteractive; -import cofh.lib.util.BlockWrapper; -import cofh.lib.util.helpers.ServerHelper; -import cpw.mods.fml.common.registry.GameRegistry; public class TF_Block_Fluid_Pyrotheum - extends BlockFluidInteractive +extends BlockFluidInteractive { - Random random = new Random(); - public static final int LEVELS = 5; - public static final Material materialFluidPyrotheum = new MaterialLiquid(MapColor.tntColor); - private static boolean effect = true; - private static boolean enableSourceFall = true; - - public TF_Block_Fluid_Pyrotheum() - { - super(CORE.MODID, TF_Fluids.fluidPyrotheum, Material.lava, "pyrotheum"); - setQuantaPerBlock(5); - setTickRate(10); - - setHardness(1000.0F); - setLightOpacity(1); - setParticleColor(1.0F, 0.7F, 0.15F); - } - - public boolean preInit() - { - GameRegistry.registerBlock(this, "FluidPyrotheum"); - - addInteraction(Blocks.cobblestone, Blocks.stone); - addInteraction(Blocks.grass, Blocks.dirt); - addInteraction(Blocks.sand, Blocks.glass); - addInteraction(Blocks.water, Blocks.stone); - addInteraction(Blocks.flowing_water, Blocks.stone); - addInteraction(Blocks.clay, Blocks.hardened_clay); - addInteraction(Blocks.ice, Blocks.stone); - addInteraction(Blocks.snow, Blocks.air); - addInteraction(Blocks.snow_layer, Blocks.air); - for (int i = 0; i < 8; i++) { - addInteraction(Blocks.stone_stairs, i, Blocks.stone_brick_stairs, i); - } - String str1 = "Fluid.Pyrotheum"; - String str2 = "Enable this for Fluid Pyrotheum to be worse than lava."; - effect = true; - - str2 = "Enable this for Fluid Pyrotheum Source blocks to gradually fall downwards."; - enableSourceFall = true; - - return true; - } - - public void onEntityCollidedWithBlock(World paramWorld, int paramInt1, int paramInt2, int paramInt3, Entity paramEntity) - { - if (!effect) { - return; - } - if (ServerHelper.isClientWorld(paramWorld)) { - return; - } - if (!(paramEntity instanceof EntityPlayer)) { - if ((paramEntity instanceof EntityCreeper)) - { - paramWorld.createExplosion(paramEntity, paramEntity.posX, paramEntity.posY, paramEntity.posZ, 6.0F, paramEntity.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); - paramEntity.setDead(); - } - } - } - - public int getLightValue(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) - { - return TF_Fluids.fluidPyrotheum.getLuminosity(); - } - - public int getFireSpreadSpeed(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3, ForgeDirection paramForgeDirection) - { - return effect ? 800 : 0; - } - - public int getFlammability(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3, ForgeDirection paramForgeDirection) - { - return 0; - } - - public boolean isFlammable(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3, ForgeDirection paramForgeDirection) - { - return (effect) && (paramForgeDirection.ordinal() > ForgeDirection.UP.ordinal()) && (paramIBlockAccess.getBlock(paramInt1, paramInt2 - 1, paramInt3) != this); - } - - public boolean isFireSource(World paramWorld, int paramInt1, int paramInt2, int paramInt3, ForgeDirection paramForgeDirection) - { - return effect; - } - - public void updateTick(World paramWorld, int paramInt1, int paramInt2, int paramInt3, Random paramRandom) - { - if (effect) { - checkForInteraction(paramWorld, paramInt1, paramInt2, paramInt3); - } - if ((enableSourceFall) && (paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3) == 0)) - { - Block localBlock = paramWorld.getBlock(paramInt1, paramInt2 + this.densityDir, paramInt3); - int i = paramWorld.getBlockMetadata(paramInt1, paramInt2 + this.densityDir, paramInt3); - if (((localBlock == this) && (i != 0)) || (localBlock.isFlammable(paramWorld, paramInt1, paramInt2 + this.densityDir, paramInt3, ForgeDirection.UP))) - { - paramWorld.setBlock(paramInt1, paramInt2 + this.densityDir, paramInt3, this, 0, 3); - paramWorld.setBlockToAir(paramInt1, paramInt2, paramInt3); - return; - } - } - super.updateTick(paramWorld, paramInt1, paramInt2, paramInt3, paramRandom); - } - - protected void checkForInteraction(World paramWorld, int paramInt1, int paramInt2, int paramInt3) - { - if (paramWorld.getBlock(paramInt1, paramInt2, paramInt3) != this) { - return; - } - int i = paramInt1; - int j = paramInt2; - int k = paramInt3; - for (int m = 0; m < 6; m++) - { - i = paramInt1 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][0]; - j = paramInt2 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][1]; - k = paramInt3 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][2]; - - interactWithBlock(paramWorld, i, j, k); - } - interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 - 1); - interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 + 1); - interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 - 1); - interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 + 1); - } - - protected void interactWithBlock(World paramWorld, int paramInt1, int paramInt2, int paramInt3) - { - Block localBlock = paramWorld.getBlock(paramInt1, paramInt2, paramInt3); - if ((localBlock == Blocks.air) || (localBlock == this)) { - return; - } - int i = paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3); - if (hasInteraction(localBlock, i)) - { - BlockWrapper localBlockWrapper = getInteraction(localBlock, i); - paramWorld.setBlock(paramInt1, paramInt2, paramInt3, localBlockWrapper.block, localBlockWrapper.metadata, 3); - triggerInteractionEffects(paramWorld, paramInt1, paramInt2, paramInt3); - } - else if (localBlock.isFlammable(paramWorld, paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) - { - paramWorld.setBlock(paramInt1, paramInt2, paramInt3, Blocks.fire); - } - else if ((paramWorld.isSideSolid(paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) && (paramWorld.isAirBlock(paramInt1, paramInt2 + 1, paramInt3))) - { - paramWorld.setBlock(paramInt1, paramInt2 + 1, paramInt3, Blocks.fire, 0, 3); - } - } - - protected void triggerInteractionEffects(World paramWorld, int paramInt1, int paramInt2, int paramInt3) - { - if (this.random.nextInt(16) == 0) { - paramWorld.playSoundEffect(paramInt1 + 0.5F, paramInt2 + 0.5F, paramInt3 + 0.5F, "random.fizz", 0.5F, 2.2F + (paramWorld.rand.nextFloat() - paramWorld.rand.nextFloat()) * 0.8F); - } - } + Random random = new Random(); + public static final int LEVELS = 5; + public static final Material materialFluidPyrotheum = new MaterialLiquid(MapColor.tntColor); + private static boolean effect = true; + private static boolean enableSourceFall = true; + + public TF_Block_Fluid_Pyrotheum() + { + super(CORE.MODID, TF_Fluids.fluidPyrotheum, Material.lava, "pyrotheum"); + this.setQuantaPerBlock(5); + this.setTickRate(10); + + this.setHardness(1000.0F); + this.setLightOpacity(1); + this.setParticleColor(1.0F, 0.7F, 0.15F); + } + + @Override + public boolean preInit() + { + GameRegistry.registerBlock(this, "FluidPyrotheum"); + + this.addInteraction(Blocks.cobblestone, Blocks.stone); + this.addInteraction(Blocks.grass, Blocks.dirt); + this.addInteraction(Blocks.sand, Blocks.glass); + this.addInteraction(Blocks.water, Blocks.stone); + this.addInteraction(Blocks.flowing_water, Blocks.stone); + this.addInteraction(Blocks.clay, Blocks.hardened_clay); + this.addInteraction(Blocks.ice, Blocks.stone); + this.addInteraction(Blocks.snow, Blocks.air); + this.addInteraction(Blocks.snow_layer, Blocks.air); + for (int i = 0; i < 8; i++) { + this.addInteraction(Blocks.stone_stairs, i, Blocks.stone_brick_stairs, i); + } + final String str1 = "Fluid.Pyrotheum"; + String str2 = "Enable this for Fluid Pyrotheum to be worse than lava."; + effect = true; + + str2 = "Enable this for Fluid Pyrotheum Source blocks to gradually fall downwards."; + enableSourceFall = true; + + return true; + } + + @Override + public void onEntityCollidedWithBlock(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3, final Entity paramEntity) + { + if (!effect) { + return; + } + if (ServerHelper.isClientWorld(paramWorld)) { + return; + } + if (!(paramEntity instanceof EntityPlayer)) { + if ((paramEntity instanceof EntityCreeper)) + { + paramWorld.createExplosion(paramEntity, paramEntity.posX, paramEntity.posY, paramEntity.posZ, 6.0F, paramEntity.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); + paramEntity.setDead(); + } + } + } + + @Override + public int getLightValue(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, final int paramInt3) + { + return TF_Fluids.fluidPyrotheum.getLuminosity(); + } + + @Override + public int getFireSpreadSpeed(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, final int paramInt3, final ForgeDirection paramForgeDirection) + { + return effect ? 800 : 0; + } + + @Override + public int getFlammability(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, final int paramInt3, final ForgeDirection paramForgeDirection) + { + return 0; + } + + @Override + public boolean isFlammable(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, final int paramInt3, final ForgeDirection paramForgeDirection) + { + return (effect) && (paramForgeDirection.ordinal() > ForgeDirection.UP.ordinal()) && (paramIBlockAccess.getBlock(paramInt1, paramInt2 - 1, paramInt3) != this); + } + + @Override + public boolean isFireSource(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3, final ForgeDirection paramForgeDirection) + { + return effect; + } + + @Override + public void updateTick(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3, final Random paramRandom) + { + if (effect) { + this.checkForInteraction(paramWorld, paramInt1, paramInt2, paramInt3); + } + if ((enableSourceFall) && (paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3) == 0)) + { + final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2 + this.densityDir, paramInt3); + final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2 + this.densityDir, paramInt3); + if (((localBlock == this) && (i != 0)) || (localBlock.isFlammable(paramWorld, paramInt1, paramInt2 + this.densityDir, paramInt3, ForgeDirection.UP))) + { + paramWorld.setBlock(paramInt1, paramInt2 + this.densityDir, paramInt3, this, 0, 3); + paramWorld.setBlockToAir(paramInt1, paramInt2, paramInt3); + return; + } + } + super.updateTick(paramWorld, paramInt1, paramInt2, paramInt3, paramRandom); + } + + protected void checkForInteraction(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) + { + if (paramWorld.getBlock(paramInt1, paramInt2, paramInt3) != this) { + return; + } + int i = paramInt1; + int j = paramInt2; + int k = paramInt3; + for (int m = 0; m < 6; m++) + { + i = paramInt1 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][0]; + j = paramInt2 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][1]; + k = paramInt3 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][2]; + + this.interactWithBlock(paramWorld, i, j, k); + } + this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 - 1); + this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 + 1); + this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 - 1); + this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 + 1); + } + + protected void interactWithBlock(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) + { + final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2, paramInt3); + if ((localBlock == Blocks.air) || (localBlock == this)) { + return; + } + final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3); + if (this.hasInteraction(localBlock, i)) + { + final BlockWrapper localBlockWrapper = this.getInteraction(localBlock, i); + paramWorld.setBlock(paramInt1, paramInt2, paramInt3, localBlockWrapper.block, localBlockWrapper.metadata, 3); + this.triggerInteractionEffects(paramWorld, paramInt1, paramInt2, paramInt3); + } + else if (localBlock.isFlammable(paramWorld, paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) + { + paramWorld.setBlock(paramInt1, paramInt2, paramInt3, Blocks.fire); + } + else if ((paramWorld.isSideSolid(paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) && (paramWorld.isAirBlock(paramInt1, paramInt2 + 1, paramInt3))) + { + paramWorld.setBlock(paramInt1, paramInt2 + 1, paramInt3, Blocks.fire, 0, 3); + } + } + + protected void triggerInteractionEffects(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) + { + if (this.random.nextInt(16) == 0) { + paramWorld.playSoundEffect(paramInt1 + 0.5F, paramInt2 + 0.5F, paramInt3 + 0.5F, "random.fizz", 0.5F, 2.2F + ((paramWorld.rand.nextFloat() - paramWorld.rand.nextFloat()) * 0.8F)); + } + } } diff --git a/src/Java/gtPlusPlus/xmod/thermalfoundation/block/TF_Blocks.java b/src/Java/gtPlusPlus/xmod/thermalfoundation/block/TF_Blocks.java index 867f8c7f7d..522bafd053 100644 --- a/src/Java/gtPlusPlus/xmod/thermalfoundation/block/TF_Blocks.java +++ b/src/Java/gtPlusPlus/xmod/thermalfoundation/block/TF_Blocks.java @@ -4,23 +4,23 @@ import cofh.core.fluid.BlockFluidCoFHBase; public class TF_Blocks { - - public static BlockFluidCoFHBase blockFluidPyrotheum; - public static BlockFluidCoFHBase blockFluidCryotheum; - - - public static void preInit() - { - blockFluidPyrotheum = new TF_Block_Fluid_Pyrotheum(); - blockFluidCryotheum = new TF_Block_Fluid_Cryotheum(); - blockFluidPyrotheum.preInit(); - blockFluidCryotheum.preInit(); - } - - public static void init() {} - - public static void postInit() - { - - } + + public static BlockFluidCoFHBase blockFluidPyrotheum; + public static BlockFluidCoFHBase blockFluidCryotheum; + + + public static void preInit() + { + blockFluidPyrotheum = new TF_Block_Fluid_Pyrotheum(); + blockFluidCryotheum = new TF_Block_Fluid_Cryotheum(); + blockFluidPyrotheum.preInit(); + blockFluidCryotheum.preInit(); + } + + public static void init() {} + + public static void postInit() + { + + } } diff --git a/src/Java/gtPlusPlus/xmod/thermalfoundation/fluid/TF_Fluids.java b/src/Java/gtPlusPlus/xmod/thermalfoundation/fluid/TF_Fluids.java index 6753b213e1..caf33ff381 100644 --- a/src/Java/gtPlusPlus/xmod/thermalfoundation/fluid/TF_Fluids.java +++ b/src/Java/gtPlusPlus/xmod/thermalfoundation/fluid/TF_Fluids.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.thermalfoundation.fluid; +import cofh.core.util.fluid.DispenserEmptyBucketHandler; +import cofh.core.util.fluid.DispenserFilledBucketHandler; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.thermalfoundation.item.TF_Items; @@ -8,8 +10,6 @@ import net.minecraft.init.Items; import net.minecraft.item.EnumRarity; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; -import cofh.core.util.fluid.DispenserEmptyBucketHandler; -import cofh.core.util.fluid.DispenserFilledBucketHandler; public class TF_Fluids { @@ -19,28 +19,28 @@ public class TF_Fluids public static void preInit() { if (!LoadedMods.ThermalFoundation){ - Utils.LOG_INFO("Adding in our own versions of Thermal Foundation Fluids - Non-GT"); - Fluid pyrotheum = FluidRegistry.getFluid("pyrotheum"); - Fluid cryotheum = FluidRegistry.getFluid("cryotheum"); - - if (pyrotheum == null){ - Utils.LOG_INFO("Registering Blazing Pyrotheum as it does not exist."); - fluidPyrotheum = new Fluid("pyrotheum").setLuminosity(15).setDensity(2000).setViscosity(1200).setTemperature(4000).setRarity(EnumRarity.rare); - registerFluid(fluidPyrotheum, "pyrotheum"); - } - else { - Utils.LOG_INFO("Registering Blazing Pyrotheum as it is an already existing Fluid."); - fluidPyrotheum = pyrotheum; - } - if (cryotheum == null){ - Utils.LOG_INFO("Registering Gelid Cryotheum as it does not exist."); - fluidCryotheum = new Fluid("cryotheum").setLuminosity(0).setDensity(4000).setViscosity(3000).setTemperature(50).setRarity(EnumRarity.rare); - registerFluid(fluidCryotheum, "cryotheum"); - } - else { - Utils.LOG_INFO("Registering Gelid Cryotheum as it is an already existing Fluid."); - fluidCryotheum = cryotheum; - } + Utils.LOG_INFO("Adding in our own versions of Thermal Foundation Fluids - Non-GT"); + final Fluid pyrotheum = FluidRegistry.getFluid("pyrotheum"); + final Fluid cryotheum = FluidRegistry.getFluid("cryotheum"); + + if (pyrotheum == null){ + Utils.LOG_INFO("Registering Blazing Pyrotheum as it does not exist."); + fluidPyrotheum = new Fluid("pyrotheum").setLuminosity(15).setDensity(2000).setViscosity(1200).setTemperature(4000).setRarity(EnumRarity.rare); + registerFluid(fluidPyrotheum, "pyrotheum"); + } + else { + Utils.LOG_INFO("Registering Blazing Pyrotheum as it is an already existing Fluid."); + fluidPyrotheum = pyrotheum; + } + if (cryotheum == null){ + Utils.LOG_INFO("Registering Gelid Cryotheum as it does not exist."); + fluidCryotheum = new Fluid("cryotheum").setLuminosity(0).setDensity(4000).setViscosity(3000).setTemperature(50).setRarity(EnumRarity.rare); + registerFluid(fluidCryotheum, "cryotheum"); + } + else { + Utils.LOG_INFO("Registering Gelid Cryotheum as it is an already existing Fluid."); + fluidCryotheum = cryotheum; + } } else { Utils.LOG_INFO("Thermal Foundation is already loaded, no need to add our own Cryotheum/Pyrotheum."); @@ -51,7 +51,7 @@ public class TF_Fluids public static void postInit() {} - public static void registerFluid(Fluid paramFluid, String paramString) + public static void registerFluid(final Fluid paramFluid, final String paramString) { if (!FluidRegistry.isFluidRegistered(paramString)) { FluidRegistry.registerFluid(paramFluid); diff --git a/src/Java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java b/src/Java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java index a4d22ad1bf..5ca30f28d2 100644 --- a/src/Java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java +++ b/src/Java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java @@ -1,5 +1,10 @@ package gtPlusPlus.xmod.thermalfoundation.item; +import cofh.core.item.ItemBase; +import cofh.core.item.ItemBucket; +import cofh.core.util.energy.FurnaceFuelHandler; +import cofh.core.util.fluid.BucketHandler; +import cofh.lib.util.helpers.ItemHelper; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -8,11 +13,6 @@ import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidContainerRegistry; -import cofh.core.item.ItemBase; -import cofh.core.item.ItemBucket; -import cofh.core.util.energy.FurnaceFuelHandler; -import cofh.core.util.fluid.BucketHandler; -import cofh.lib.util.helpers.ItemHelper; public class TF_Items { diff --git a/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java b/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java index 5bce19d85a..c3efae0782 100644 --- a/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java +++ b/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java @@ -19,12 +19,12 @@ public class TF_Gregtech_Recipes { private static void start(){ //Get Items to work with - ItemStack dust_Cryotheum = TF_Items.itemDustCryotheum.copy(); - ItemStack dust_Pyrotheum = TF_Items.itemDustPyrotheum.copy(); - ItemStack dust_Blizz = TF_Items.itemDustBlizz.copy(); - ItemStack dust_Blizz3 = ItemUtils.simpleMetaStack(TF_Items.itemMaterial, 2, 3); - ItemStack rod_Blizz = TF_Items.itemRodBlizz.copy(); - FluidStack moltenRedstone = getFluidStack("molten.redstone", 250); + final ItemStack dust_Cryotheum = TF_Items.itemDustCryotheum.copy(); + final ItemStack dust_Pyrotheum = TF_Items.itemDustPyrotheum.copy(); + final ItemStack dust_Blizz = TF_Items.itemDustBlizz.copy(); + final ItemStack dust_Blizz3 = ItemUtils.simpleMetaStack(TF_Items.itemMaterial, 2, 3); + final ItemStack rod_Blizz = TF_Items.itemRodBlizz.copy(); + final FluidStack moltenRedstone = getFluidStack("molten.redstone", 250); //Gelid Cryotheum Utils.LOG_INFO("Adding Recipes for Gelid Cryotheum"); @@ -41,17 +41,17 @@ public class TF_Gregtech_Recipes { GT_ModHandler.addPulverisationRecipe(rod_Blizz, dust_Blizz3, new ItemStack(Items.snowball, 1), 50, false); //Blazing Pyrotheum - Utils.LOG_INFO("Adding Recipes for Blazing Pyrotheum"); - GT_Values.RA.addFluidExtractionRecipe(dust_Pyrotheum, GT_Values.NI, getFluidStack("pyrotheum", 250), 10000, 200, 240); + Utils.LOG_INFO("Adding Recipes for Blazing Pyrotheum"); + GT_Values.RA.addFluidExtractionRecipe(dust_Pyrotheum, GT_Values.NI, getFluidStack("pyrotheum", 250), 10000, 200, 240); } - private static FluidStack getFluidStack(String fluidName, int amount){ + private static FluidStack getFluidStack(final String fluidName, final int amount){ Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName); try { return FluidRegistry.getFluidStack(fluidName, amount); - } - catch (Throwable e){ + } + catch (final Throwable e){ return null; } |