From 55f64675b42ac8d3c557cc850f78664bee006f6f Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sat, 28 Jan 2023 19:32:44 -0800 Subject: [ci skip] spotlessApply with the new settings --- .../gtPlusPlus/core/util/MovingAverageLong.java | 3 + src/main/java/gtPlusPlus/core/util/Utils.java | 224 +- src/main/java/gtPlusPlus/core/util/data/AES.java | 4 +- .../java/gtPlusPlus/core/util/data/ArrayUtils.java | 16 +- .../java/gtPlusPlus/core/util/data/EnumUtils.java | 9 +- .../java/gtPlusPlus/core/util/data/FileUtils.java | 14 +- .../gtPlusPlus/core/util/data/LocaleUtils.java | 19 +- .../gtPlusPlus/core/util/data/StringUtils.java | 5 +- .../gtPlusPlus/core/util/debug/DEBUG_INIT.java | 14 +- .../core/util/debug/DEBUG_ITEM_ShapeSpawner.java | 12 +- .../util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java | 138 +- .../core/util/debug/DEBUG_ScreenOverlay.java | 24 +- .../core/util/debug/DEBUG_TimerThread.java | 32 +- .../core/util/debug/UtilityGL11Debug.java | 2323 +++++++++++--------- .../java/gtPlusPlus/core/util/math/MathUtils.java | 136 +- .../core/util/minecraft/EnchantingUtils.java | 3 +- .../core/util/minecraft/EnergyUtils.java | 12 +- .../core/util/minecraft/EntityUtils.java | 193 +- .../gtPlusPlus/core/util/minecraft/FluidUtils.java | 274 +-- .../gtPlusPlus/core/util/minecraft/FoodUtils.java | 3 +- .../core/util/minecraft/HazmatUtils.java | 87 +- .../core/util/minecraft/InventoryUtils.java | 35 +- .../gtPlusPlus/core/util/minecraft/ItemUtils.java | 277 +-- .../gtPlusPlus/core/util/minecraft/LangUtils.java | 27 +- .../core/util/minecraft/MaterialUtils.java | 205 +- .../core/util/minecraft/MiningUtils.java | 63 +- .../core/util/minecraft/ModularArmourUtils.java | 9 +- .../gtPlusPlus/core/util/minecraft/NBTUtils.java | 90 +- .../core/util/minecraft/OreDictUtils.java | 1 + .../core/util/minecraft/PlayerUtils.java | 31 +- .../core/util/minecraft/RecipeUtils.java | 295 +-- .../core/util/minecraft/ShapelessUtils.java | 4 +- .../util/minecraft/gregtech/PollutionUtils.java | 10 +- .../gregtech/material/MaterialBuilder.java | 291 +-- .../gregtech/recipehandlers/GregtechRecipe.java | 3 +- .../core/util/minecraft/network/CustomPacket.java | 8 +- .../core/util/minecraft/network/PacketBuilder.java | 3 +- .../util/minecraft/network/PacketDispatcher.java | 36 +- .../core/util/minecraft/network/PacketHandler.java | 18 +- .../util/minecraft/network/PacketTileEntity.java | 14 +- .../minecraft/particles/BlockBreakParticles.java | 3 +- .../particles/EntityParticleFXMysterious.java | 11 +- .../gtPlusPlus/core/util/player/PlayerCache.java | 40 +- .../core/util/reflect/AddGregtechRecipe.java | 158 +- .../gtPlusPlus/core/util/reflect/ProxyFinder.java | 3 +- .../core/util/reflect/ReflectionUtils.java | 134 +- .../gtPlusPlus/core/util/sys/KeyboardUtils.java | 5 +- src/main/java/gtPlusPlus/core/util/sys/Log.java | 1 + .../java/gtPlusPlus/core/util/sys/SystemUtils.java | 4 +- 49 files changed, 2524 insertions(+), 2800 deletions(-) (limited to 'src/main/java/gtPlusPlus/core/util') diff --git a/src/main/java/gtPlusPlus/core/util/MovingAverageLong.java b/src/main/java/gtPlusPlus/core/util/MovingAverageLong.java index fee1fe84bc..202f10072a 100644 --- a/src/main/java/gtPlusPlus/core/util/MovingAverageLong.java +++ b/src/main/java/gtPlusPlus/core/util/MovingAverageLong.java @@ -4,9 +4,11 @@ import java.math.BigInteger; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.Arrays; + import net.minecraft.nbt.NBTTagCompound; public class MovingAverageLong { + private final long[] storage; private int ptr; @@ -39,6 +41,7 @@ public class MovingAverageLong { /** * if read failed, the internal states would not be changed. + * * @return true if successful, false otherwise. */ public boolean read(NBTTagCompound tagCompound, String key) { diff --git a/src/main/java/gtPlusPlus/core/util/Utils.java b/src/main/java/gtPlusPlus/core/util/Utils.java index 2242b7e673..b95574fc60 100644 --- a/src/main/java/gtPlusPlus/core/util/Utils.java +++ b/src/main/java/gtPlusPlus/core/util/Utils.java @@ -1,35 +1,5 @@ package gtPlusPlus.core.util; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.registry.EntityRegistry; -import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; -import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.enums.TC_Aspects; -import gregtech.api.enums.TC_Aspects.TC_AspectStack; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.core.util.sys.SystemUtils; -import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner; -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.io.ByteArrayOutputStream; @@ -49,7 +19,9 @@ import java.util.List; import java.util.Map; import java.util.Timer; import java.util.TimerTask; + import javax.xml.bind.DatatypeConverter; + import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; @@ -68,8 +40,40 @@ import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; + import org.apache.commons.lang3.EnumUtils; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.registry.EntityRegistry; +import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; +import gregtech.api.enums.TC_Aspects; +import gregtech.api.enums.TC_Aspects.TC_AspectStack; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.data.Pair; +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.NBTUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.core.util.sys.SystemUtils; +import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner; +import ic2.core.Ic2Items; +import ic2.core.init.InternalName; +import ic2.core.item.resources.ItemCell; + public class Utils { public static final int WILDCARD_VALUE = Short.MAX_VALUE; @@ -83,6 +87,7 @@ public class Utils { } static class ShortTimerTask extends TimerTask { + @Override public void run() { Logger.WARNING("Timer expired."); @@ -174,9 +179,8 @@ public class Utils { 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()))); } // Register an event to both busses. @@ -217,12 +221,10 @@ public class Utils { } /* - * public static void recipeBuilderBlock(ItemStack slot_1, ItemStack slot_2, - * ItemStack slot_3, ItemStack slot_4, ItemStack slot_5, ItemStack slot_6, - * ItemStack slot_7, ItemStack slot_8, ItemStack slot_9, Block resultBlock){ - * GameRegistry.addRecipe(new ItemStack(resultBlock), new Object[] {"ABC", - * "DEF", "GHI", '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 void recipeBuilderBlock(ItemStack slot_1, ItemStack slot_2, ItemStack slot_3, ItemStack slot_4, + * ItemStack slot_5, ItemStack slot_6, ItemStack slot_7, ItemStack slot_8, ItemStack slot_9, Block resultBlock){ + * GameRegistry.addRecipe(new ItemStack(resultBlock), new Object[] {"ABC", "DEF", "GHI", + * '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(final Block currentBlock, final World currentWorld) { @@ -242,8 +244,7 @@ public class Utils { /** * - * @param colourStr - * e.g. "#FFFFFF" + * @param colourStr e.g. "#FFFFFF" * @return String - formatted "rgb(0,0,0)" */ public static String hex2RgbFormatted(final String hexString) { @@ -265,8 +266,7 @@ public class Utils { /** * - * @param colourStr - * e.g. "#FFFFFF" + * @param colourStr e.g. "#FFFFFF" * @return */ public static Color hex2Rgb(final String colorStr) { @@ -278,8 +278,7 @@ public class Utils { /** * - * @param colourInt - * e.g. 0XFFFFFF + * @param colourInt e.g. 0XFFFFFF * @return Colour */ public static Color hex2Rgb(final int colourInt) { @@ -288,15 +287,13 @@ public class Utils { /** * - * @param colourInt - * e.g. 0XFFFFFF + * @param colourInt e.g. 0XFFFFFF * @return short[] */ 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() - }; + final short[] rgba = { (short) rgb.getRed(), (short) rgb.getGreen(), (short) rgb.getBlue(), + (short) rgb.getAlpha() }; return rgba; } @@ -336,8 +333,8 @@ public class Utils { GTplusplus.proxy.generateMysteriousParticles(entity); } - public static void spawnFX( - final World world, final int x, final int y, final int z, final 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("")) { particleName2 = particleName; @@ -404,8 +401,7 @@ public class Utils { } /* - * Original Code by Chandana Napagoda - - * https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator. + * Original Code by Chandana Napagoda - https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator. * html */ public static Map hexColourGenerator(final int colorCount) { @@ -417,21 +413,16 @@ public class Utils { for (int a = 0; (a < colorCount) && (maxColorValue >= countValue); a++) { if (a != 0) { countValue += devidedvalue; - hexColorMap.put( - a, - Integer.toHexString(0x10000 | countValue).substring(1).toUpperCase()); + hexColorMap.put(a, Integer.toHexString(0x10000 | countValue).substring(1).toUpperCase()); } else { - hexColorMap.put( - a, - Integer.toHexString(0x10000 | countValue).substring(1).toUpperCase()); + hexColorMap.put(a, Integer.toHexString(0x10000 | countValue).substring(1).toUpperCase()); } } return hexColorMap; } /* - * Original Code by Chandana Napagoda - - * https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator. + * Original Code by Chandana Napagoda - https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator. * html */ public static Map hexColourGeneratorRandom(final int colorCount) { @@ -521,7 +512,9 @@ public class Utils { final ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]); Logger.WARNING("Successfully created " + temp.getDisplayName() + "s."); FluidContainerRegistry.registerFluidContainer( - FluidUtils.getFluidStack(s.toLowerCase(), 1000), temp.copy(), Ic2Items.cell.copy()); + FluidUtils.getFluidStack(s.toLowerCase(), 1000), + temp.copy(), + Ic2Items.cell.copy()); ItemUtils.addItemToOreDictionary(temp.copy(), "cell" + s); return temp; } catch (final Exception e) { @@ -547,7 +540,9 @@ public class Utils { final ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]); Logger.WARNING("Successfully created " + temp.getDisplayName() + "s."); FluidContainerRegistry.registerFluidContainer( - FluidUtils.getFluidStack(s.toLowerCase(), 1000), temp.copy(), Ic2Items.cell.copy()); + FluidUtils.getFluidStack(s.toLowerCase(), 1000), + temp.copy(), + Ic2Items.cell.copy()); // ItemUtils.addItemToOreDictionary(temp.copy(), "cell"+s); return temp; } catch (final Exception e) { @@ -647,8 +642,8 @@ public class Utils { return compareModVersion(currentVersion, expectedVersion, "//."); } - public static Versioning compareModVersion( - final String currentVersion, final String expectedVersion, final String delimiter) { + 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]; @@ -693,8 +688,8 @@ public class Utils { 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); + final ToolMaterial temp = EnumHelper + .addToolMaterial(name, harvestLevel, durability, efficiency, damage, enchantability); return temp; } @@ -705,16 +700,26 @@ public class Utils { final float damage = material.vToolQuality; final int efficiency = material.vToolQuality; // int enchantability = material.mEnchantmentToolsLevel; - Logger.INFO("ToolMaterial stats for " + material.getLocalizedName() + " | harvestLevel:" + harvestLevel - + " | durability:" + durability + " | toolQuality:" + damage + " | toolSpeed:" + damage); + Logger.INFO( + "ToolMaterial stats for " + material.getLocalizedName() + + " | harvestLevel:" + + harvestLevel + + " | durability:" + + durability + + " | toolQuality:" + + damage + + " | toolSpeed:" + + damage); final ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, 0); return temp; } public static enum Versioning { + EQUAL(0), NEWER(1), OLDER(-1); + private final int versioningInfo; private Versioning(final int versionStatus) { @@ -728,11 +733,7 @@ public class Utils { public static String addBookTitleLocalization(final String aTitle) { return GT_LanguageManager.addStringLocalization( - new StringBuilder() - .append("Book.") - .append(aTitle) - .append(".Name") - .toString(), + new StringBuilder().append("Book.").append(aTitle).append(".Name").toString(), aTitle, !GregTech_API.sPostloadFinished); } @@ -741,17 +742,8 @@ public class Utils { String[] aLocalizationPages = new String[aPages.length]; for (byte i = 0; i < aPages.length; i = (byte) (i + 1)) { aLocalizationPages[i] = GT_LanguageManager.addStringLocalization( - new StringBuilder() - .append("Book.") - .append(aTitle) - .append(".Page") - .append( - (i < 10) - ? new StringBuilder() - .append("0") - .append(i) - .toString() - : Byte.valueOf(i)) + new StringBuilder().append("Book.").append(aTitle).append(".Page") + .append((i < 10) ? new StringBuilder().append("0").append(i).toString() : Byte.valueOf(i)) .toString(), aPages[i], !GregTech_API.sPostloadFinished); @@ -759,19 +751,14 @@ public class Utils { return aLocalizationPages; } - public static ItemStack getWrittenBook( - final ItemStack aBook, - final int aID, - final String aMapping, - final String aTitle, - final String aAuthor, - final String[] aPages) { + public static ItemStack getWrittenBook(final ItemStack aBook, final int aID, final String aMapping, + final String aTitle, final String aAuthor, final String[] aPages) { if (GT_Utility.isStringInvalid(aMapping)) { return null; } ItemStack rStack = CORE.sBookList.get(aMapping); if (rStack != null) { - return GT_Utility.copyAmount(1L, new Object[] {rStack}); + return GT_Utility.copyAmount(1L, new Object[] { rStack }); } if ((GT_Utility.isStringInvalid(aTitle)) || (GT_Utility.isStringInvalid(aAuthor)) || (aPages.length <= 0)) { return null; @@ -791,45 +778,36 @@ public class Utils { tNBTList.appendTag(new NBTTagString(aPages[i])); } else { Logger.INFO("WARNING: String for written Book too long! -> " + aPages[i]); - GT_Log.err.println(new StringBuilder() - .append("WARNING: String for written Book too long! -> ") - .append(aPages[i]) - .toString()); + GT_Log.err.println( + new StringBuilder().append("WARNING: String for written Book too long! -> ") + .append(aPages[i]).toString()); } } else { Logger.INFO("WARNING: Too much Pages for written Book! -> " + aTitle); - GT_Log.err.println(new StringBuilder() - .append("WARNING: Too much Pages for written Book! -> ") - .append(aTitle) - .toString()); + GT_Log.err.println( + new StringBuilder().append("WARNING: Too much Pages for written Book! -> ").append(aTitle) + .toString()); break; } } - tNBTList.appendTag(new NBTTagString(new StringBuilder() - .append("Credits to ") - .append(aAuthor) - .append(" for writing this Book. This was Book Nr. ") - .append(aID) - .append(" at its creation. Gotta get 'em all!") - .toString())); + tNBTList.appendTag( + new NBTTagString( + new StringBuilder().append("Credits to ").append(aAuthor) + .append(" for writing this Book. This was Book Nr. ").append(aID) + .append(" at its creation. Gotta get 'em all!").toString())); tNBT.setTag("pages", tNBTList); rStack.setTagCompound(tNBT); - GT_Log.out.println(new StringBuilder() - .append("GT++_Mod: Added Book to Book++ List - Mapping: '") - .append(aMapping) - .append("' - Name: '") - .append(aTitle) - .append("' - Author: '") - .append(aAuthor) - .append("'") - .toString()); + GT_Log.out.println( + new StringBuilder().append("GT++_Mod: Added Book to Book++ List - Mapping: '").append(aMapping) + .append("' - Name: '").append(aTitle).append("' - Author: '").append(aAuthor).append("'") + .toString()); NBTUtils.createIntegerTagCompound(rStack, "stats", "mMeta", vMeta); CORE.sBookList.put(aMapping, rStack); Logger.INFO("Creating book: " + aTitle + " by " + aAuthor + ". Using Meta " + vMeta + "."); - return GT_Utility.copy(new Object[] {rStack}); + return GT_Utility.copy(new Object[] { rStack }); } - @SuppressWarnings({"unused", "unchecked"}) + @SuppressWarnings({ "unused", "unchecked" }) public static Pair getGregtechVersion() { Pair version; if (GT_Mod.VERSION == 509) { @@ -915,12 +893,10 @@ public class Utils { out.writeObject(bytes); out.flush(); result = bos.toByteArray(); - } catch (IOException e) { - } finally { + } catch (IOException e) {} finally { try { bos.close(); - } catch (IOException e) { - } + } catch (IOException e) {} } return calculateChecksumMD5(result); } diff --git a/src/main/java/gtPlusPlus/core/util/data/AES.java b/src/main/java/gtPlusPlus/core/util/data/AES.java index e782a48148..8f9580c760 100644 --- a/src/main/java/gtPlusPlus/core/util/data/AES.java +++ b/src/main/java/gtPlusPlus/core/util/data/AES.java @@ -7,13 +7,13 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.Base64; + import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class AES { - private final String secret; - ; + private final String secret;; private final SecretKeySpec secretKey; diff --git a/src/main/java/gtPlusPlus/core/util/data/ArrayUtils.java b/src/main/java/gtPlusPlus/core/util/data/ArrayUtils.java index 8630ac5abf..75a3daacad 100644 --- a/src/main/java/gtPlusPlus/core/util/data/ArrayUtils.java +++ b/src/main/java/gtPlusPlus/core/util/data/ArrayUtils.java @@ -1,15 +1,17 @@ package gtPlusPlus.core.util.data; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; + import net.minecraft.item.ItemStack; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; + public class ArrayUtils { public static V[] expandArray(final V[] someArray, final V newValueToAdd) { @@ -36,10 +38,12 @@ public class ArrayUtils { return newArray; } - /*public static Object getMostCommonElement(List list) { - Optional r = list.stream().map(V::getTextureSet).collect(Collectors.groupingBy(Function.identity(), Collectors.counting())).entrySet().stream().max(Map.Entry.comparingByValue()).map(Map.Entry::getKey); - return r.get(); - }*/ + /* + * public static Object getMostCommonElement(List list) { Optional r = + * list.stream().map(V::getTextureSet).collect(Collectors.groupingBy(Function.identity(), + * Collectors.counting())).entrySet().stream().max(Map.Entry.comparingByValue()).map(Map.Entry::getKey); return + * r.get(); } + */ public static Object[] removeNulls(final Object[] v) { List list = new ArrayList(Arrays.asList(v)); diff --git a/src/main/java/gtPlusPlus/core/util/data/EnumUtils.java b/src/main/java/gtPlusPlus/core/util/data/EnumUtils.java index 2a74edb5aa..71d0c16e14 100644 --- a/src/main/java/gtPlusPlus/core/util/data/EnumUtils.java +++ b/src/main/java/gtPlusPlus/core/util/data/EnumUtils.java @@ -6,9 +6,8 @@ import com.google.common.base.Optional; public class EnumUtils { /** - * Returns the value of an Enum if it exists. - * If value is not found, case-insensitive search will occur. - * If value still not found, an IllegalArgumentException is thrown. + * Returns the value of an Enum if it exists. If value is not found, case-insensitive search will occur. If value + * still not found, an IllegalArgumentException is thrown. **/ public static > T getValue(Class enumeration, String name) { Optional j = Enums.getIfPresent(enumeration, name); @@ -22,8 +21,8 @@ public class EnumUtils { } /** - * Finds the value of the given enumeration by name, case-insensitive. - * Throws an IllegalArgumentException if no match is found. + * Finds the value of the given enumeration by name, case-insensitive. Throws an IllegalArgumentException if no + * match is found. **/ private static > T valueOfIgnoreCase(Class enumeration, String name) { diff --git a/src/main/java/gtPlusPlus/core/util/data/FileUtils.java b/src/main/java/gtPlusPlus/core/util/data/FileUtils.java index 19f868c2a9..cec639a76c 100644 --- a/src/main/java/gtPlusPlus/core/util/data/FileUtils.java +++ b/src/main/java/gtPlusPlus/core/util/data/FileUtils.java @@ -1,7 +1,5 @@ package gtPlusPlus.core.util.data; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; @@ -13,6 +11,9 @@ import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.List; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.Utils; + public class FileUtils { private static final Charset utf8 = StandardCharsets.UTF_8; @@ -90,16 +91,15 @@ public class FileUtils { return newSize > oldSize; } } - } catch (IOException e) { - } + } catch (IOException e) {} return false; } /** - * Reads the contents of a file line by line to a List of Strings using the default encoding for the VM. - * The file is always closed. + * Reads the contents of a file line by line to a List of Strings using the default encoding for the VM. The file is + * always closed. * - * @param file the file to read, must not be {@code null} + * @param file the file to read, must not be {@code null} * @return the list of Strings representing each line in the file, never {@code null} * @throws IOException in case of an I/O error * @since 1.3 diff --git a/src/main/java/gtPlusPlus/core/util/data/LocaleUtils.java b/src/main/java/gtPlusPlus/core/util/data/LocaleUtils.java index a67262c4bd..2ad38d1de5 100644 --- a/src/main/java/gtPlusPlus/core/util/data/LocaleUtils.java +++ b/src/main/java/gtPlusPlus/core/util/data/LocaleUtils.java @@ -1,14 +1,16 @@ package gtPlusPlus.core.util.data; +import java.io.*; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.registry.GameData; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; -import java.io.*; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; public class LocaleUtils { @@ -41,8 +43,7 @@ public class LocaleUtils { } } - } catch (Throwable T) { - } + } catch (Throwable T) {} } writeToFile("Dumping Blocks from " + mod.getModId() + "."); for (Object B : GameData.getBlockRegistry()) { @@ -61,8 +62,7 @@ public class LocaleUtils { } } - } catch (Throwable T) { - } + } catch (Throwable T) {} } return true; @@ -76,7 +76,6 @@ public class LocaleUtils { writer.write(S); writer.newLine(); writer.close(); - } catch (IOException e) { - } + } catch (IOException e) {} } } diff --git a/src/main/java/gtPlusPlus/core/util/data/StringUtils.java b/src/main/java/gtPlusPlus/core/util/data/StringUtils.java index af40dbae41..d837901ea8 100644 --- a/src/main/java/gtPlusPlus/core/util/data/StringUtils.java +++ b/src/main/java/gtPlusPlus/core/util/data/StringUtils.java @@ -82,6 +82,7 @@ public class StringUtils { // Can call this Enum for formatting. public static enum TextUtils { + blue('1'), green('2'), teal('3'), @@ -136,12 +137,12 @@ public class StringUtils { /** * Is this a special regex character for delimination? (.$|()[]{}^?*+\\) + * * @param aChar - The char to test * @return - Is this a special character? */ public static boolean isSpecialCharacter(char aChar) { - if (aChar == '"' - || aChar == '.' + if (aChar == '"' || aChar == '.' || aChar == '$' || aChar == '|' || aChar == '(' diff --git a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_INIT.java b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_INIT.java index a6441ee558..56c93d4a4d 100644 --- a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_INIT.java +++ b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_INIT.java @@ -10,12 +10,14 @@ public class DEBUG_INIT { } public static void registerItems() { - /*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"); - ModItems.itemBaseItemWithCharge = new BaseItemWithCharge("itemBaseItemWithCharge", 0, 1000); - GameRegistry.registerItem(ModItems.itemBaseItemWithCharge, "itemBaseItemWithCharge");*/ + /* + * 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"); + * ModItems.itemBaseItemWithCharge = new BaseItemWithCharge("itemBaseItemWithCharge", 0, 1000); + * GameRegistry.registerItem(ModItems.itemBaseItemWithCharge, "itemBaseItemWithCharge"); + */ } public static void registerTEs() {} diff --git a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java index cd8ca0e536..07f8d6385a 100644 --- a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java +++ b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java @@ -2,11 +2,8 @@ package gtPlusPlus.core.util.debug; import static net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.BaseItemGeneric; import java.util.List; + import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -14,6 +11,11 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.item.base.BaseItemGeneric; + public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric { public DEBUG_ITEM_ShapeSpawner(String s, CreativeTabs c, int stackSize, int maxDmg) { @@ -42,7 +44,7 @@ public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric { } } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { list.add(EnumChatFormatting.GOLD + "For Testing Gregtech Shapes!"); diff --git a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java index 9cff0758a7..53159a9412 100644 --- a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java +++ b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java @@ -2,6 +2,13 @@ package gtPlusPlus.core.util.debug; import static gregtech.api.enums.GT_Values.V; +import java.util.ArrayList; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; @@ -19,32 +26,14 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; -import java.util.ArrayList; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -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 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 mInputHatches = new ArrayList<>(); @@ -58,14 +47,14 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { 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); + 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); + DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance = GregTech_API.sMachineFile + .get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); } public static boolean isValidMetaTileEntity(final MetaTileEntity aMetaTileEntity) { @@ -264,13 +253,10 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { if (tStack != null) { try { GT_Mod.achievements.issueAchivementHatch( - aBaseMetaTileEntity - .getWorld() - .getPlayerEntityByName( - aBaseMetaTileEntity.getOwnerName()), + aBaseMetaTileEntity.getWorld().getPlayerEntityByName( + aBaseMetaTileEntity.getOwnerName()), tStack); - } catch (final Exception e) { - } + } catch (final Exception e) {} this.addOutput(tStack); } } @@ -301,8 +287,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { if ((this.mOutputFluids != null) && (this.mOutputFluids.length > 0)) { if (this.mOutputFluids.length > 1) { GT_Mod.achievements.issueAchievement( - aBaseMetaTileEntity - .getWorld() + aBaseMetaTileEntity.getWorld() .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant"); } @@ -310,8 +295,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { } } } else { - if (((aTick % 100) == 0) - || aBaseMetaTileEntity.hasWorkJustBeenEnabled() + if (((aTick % 100) == 0) || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { if (aBaseMetaTileEntity.isAllowedToWork()) { @@ -329,14 +313,14 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { 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.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); } } @@ -405,8 +389,8 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { 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. + * 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(); @@ -426,8 +410,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { } public int getRepairStatus() { - return (this.mWrench ? 1 : 0) - + (this.mScrewdriver ? 1 : 0) + return (this.mWrench ? 1 : 0) + (this.mScrewdriver ? 1 : 0) + (this.mSoftHammer ? 1 : 0) + (this.mHardHammer ? 1 : 0) + (this.mSolderingTool ? 1 : 0) @@ -467,8 +450,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { break; } } - if ((this.mInventory[1] != null) - && (this.getBaseMetaTileEntity().getRandomNumber(2) == 0) + 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(); @@ -612,8 +594,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { } final FluidStack tLiquid = aLiquid.copy(); for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { - if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) - ? tHatch.outputsSteam() + if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) { final int tAmount = tHatch.fill(tLiquid, false); if (tAmount >= tLiquid.amount) { @@ -628,8 +609,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { private void addFluidOutputs(final FluidStack[] mOutputFluids2) { for (int i = 0; i < mOutputFluids2.length; i++) { - if ((this.mOutputHatches.size() > i) - && (this.mOutputHatches.get(i) != null) + 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); @@ -662,8 +642,8 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { return false; } aStack = GT_Utility.copy(aStack); - // FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); - // if (aLiquid == null) { + // 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--) { @@ -680,17 +660,17 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { } } } - // }else { - // for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { - // if (isValidMetaTileEntity(tHatch) && + // }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; - // } - // } - // } - // } + // int tAmount = tHatch.fill(aLiquid, false); + // if (tAmount >= aLiquid.amount) { + // return tHatch.fill(aLiquid, true) >= aLiquid.amount; + // } + // } + // } + // } return false; } @@ -705,8 +685,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { 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 (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) { if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); return true; @@ -718,8 +697,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { 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 (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) { if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); return true; @@ -937,15 +915,9 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { @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()) - }; + return new String[] { "Progress:", (this.mProgresstime / 20) + "secs", (this.mMaxProgresstime / 20) + "secs", + "Efficiency:", (this.mEfficiency / 100.0F) + "%", "Problems:", + "" + (this.getIdealStatus() - this.getRepairStatus()) }; } @Override @@ -954,14 +926,14 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { } @Override - public boolean allowPullStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + 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) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return false; } diff --git a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java index de29c35820..16b6979dcb 100644 --- a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java +++ b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java @@ -1,6 +1,5 @@ package gtPlusPlus.core.util.debug; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -8,6 +7,8 @@ import net.minecraft.client.gui.ScaledResolution; import net.minecraft.item.Item; import net.minecraftforge.client.event.RenderGameOverlayEvent; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + public class DEBUG_ScreenOverlay extends Gui { int width, height; @@ -29,17 +30,16 @@ public class DEBUG_ScreenOverlay extends Gui { heldItem = this.mc.thePlayer.getHeldItem().getItem(); if (heldItem != null) { - /*if (heldItem instanceof StaballoyPickaxe){ - - int dmg =((StaballoyPickaxe) heldItem).getDamage(((StaballoyPickaxe) heldItem).thisPickaxe); - - ((StaballoyPickaxe) heldItem).checkFacing(((StaballoyPickaxe) heldItem).localWorld); - str = "DAMAGE: "+ dmg +" | FACING: "+((StaballoyPickaxe) heldItem).FACING+" | FACING_HORIZONTAL: "+((StaballoyPickaxe) heldItem).FACING_HORIZONTAL+" | LOOKING DIRECTION: "+((StaballoyPickaxe) heldItem).lookingDirection; - - drawString(fontRender, str, (this.width - fontRender.getStringWidth(str)) / 2, this.height / 10, 0xFFAA00); - }*/ + /* + * if (heldItem instanceof StaballoyPickaxe){ int dmg =((StaballoyPickaxe) + * heldItem).getDamage(((StaballoyPickaxe) heldItem).thisPickaxe); ((StaballoyPickaxe) + * heldItem).checkFacing(((StaballoyPickaxe) heldItem).localWorld); str = "DAMAGE: "+ dmg + * +" | FACING: "+((StaballoyPickaxe) heldItem).FACING+" | FACING_HORIZONTAL: "+((StaballoyPickaxe) + * heldItem).FACING_HORIZONTAL+" | LOOKING DIRECTION: "+((StaballoyPickaxe) heldItem).lookingDirection; + * drawString(fontRender, str, (this.width - fontRender.getStringWidth(str)) / 2, this.height / 10, + * 0xFFAA00); } + */ } - } catch (final NullPointerException e) { - } + } catch (final NullPointerException e) {} } } diff --git a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java index 004657ebcc..fa53c290fc 100644 --- a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java +++ b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java @@ -1,13 +1,15 @@ package gtPlusPlus.core.util.debug; -import gtPlusPlus.api.objects.Logger; import java.util.concurrent.TimeUnit; + import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import gtPlusPlus.api.objects.Logger; + public class DEBUG_TimerThread implements Runnable { private final World world; @@ -26,8 +28,18 @@ public class DEBUG_TimerThread implements Runnable { final int stepX = Minecraft.getMinecraft().objectMouseOver.blockX; final int stepY = Minecraft.getMinecraft().objectMouseOver.blockY; final int stepZ = Minecraft.getMinecraft().objectMouseOver.blockZ; - Logger.INFO("Clicked on a Block @ " + "[X:" + stepX + "][Y:" + stepY + "][Z:" + stepZ + "]" + " with xDir:" - + xDir + " zDir:" + zDir); + Logger.INFO( + "Clicked on a Block @ " + "[X:" + + stepX + + "][Y:" + + stepY + + "][Z:" + + stepZ + + "]" + + " with xDir:" + + xDir + + " zDir:" + + zDir); this.world.setBlock(stepX, stepY, stepZ, Blocks.bedrock, 0, 3); Logger.INFO("Makng it Bedrock for future investment."); // for (int i = -1; i <= 1; i++) { @@ -43,8 +55,18 @@ public class DEBUG_TimerThread implements Runnable { // stepZ = stepZ+j; // for (int h = -1; h <= 1; h++) { // stepY = stepY+h; - Logger.INFO("Placing Block @ " + "[X:" + i + "][Y:" + h + "][Z:" + j + "]" + " with xDir:" + xDir - + " zDir:" + zDir); + Logger.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 { diff --git a/src/main/java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java b/src/main/java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java index cf3580f5b7..e774824fbf 100644 --- a/src/main/java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java +++ b/src/main/java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java @@ -1,21 +1,19 @@ package gtPlusPlus.core.util.debug; import java.nio.ByteBuffer; + import org.lwjgl.BufferUtils; import org.lwjgl.opengl.GL11; /** - * User: The Grey Ghost - * Date: 9/02/14 + * User: The Grey Ghost Date: 9/02/14 */ public class UtilityGL11Debug { + 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) { + + 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; @@ -33,1064 +31,1265 @@ public class UtilityGL11Debug { public static UtilityGL11Debug instance = new UtilityGL11Debug(); 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 dumpAllIsEnabled() // Call This - { + { for (int i = 0; i < instance.propertyList.length; ++i) { if (instance.propertyList[i].fetchCommand == "glIsEnabled()") { diff --git a/src/main/java/gtPlusPlus/core/util/math/MathUtils.java b/src/main/java/gtPlusPlus/core/util/math/MathUtils.java index 98032fc43f..5a04502ae8 100644 --- a/src/main/java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/main/java/gtPlusPlus/core/util/math/MathUtils.java @@ -1,14 +1,15 @@ package gtPlusPlus.core.util.math; +import java.text.NumberFormat; +import java.util.Map; +import java.util.Random; + import gregtech.api.enums.GT_Values; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; -import java.text.NumberFormat; -import java.util.Map; -import java.util.Random; public class MathUtils { @@ -22,12 +23,11 @@ public class MathUtils { } /** - * Returns a psuedo-random number between min and max, inclusive. - * The difference between min and max can be at most + * Returns a psuedo-random number between min and max, inclusive. The difference between min and max can be at most * Integer.MAX_VALUE - 1. * * @param min Minimim value - * @param max Maximim value. Must be greater than min. + * @param max Maximim value. Must be greater than min. * @return Integer between min and max, inclusive. * @see java.util.Random#nextInt(int) */ @@ -42,12 +42,11 @@ public class MathUtils { } /** - * Returns a psuedo-random number between min and max, inclusive. - * The difference between min and max can be at most + * Returns a psuedo-random number between min and max, inclusive. The difference between min and max can be at most * Long.MAX_VALUE - 1. * * @param min Minimim value - * @param max Maximim value. Must be greater than min. + * @param max Maximim value. Must be greater than min. * @return Long between min and max, inclusive. * @see java.util.Random#nextLong(long) */ @@ -68,12 +67,11 @@ public class MathUtils { } /** - * Returns a psuedo-random number between min and max, inclusive. - * The difference between min and max can be at most + * Returns a psuedo-random number between min and max, inclusive. The difference between min and max can be at most * Double.MAX_VALUE - 1. * * @param min Minimim value - * @param max Maximim value. Must be greater than min. + * @param max Maximim value. Must be greater than min. * @return Double between min and max, inclusive. * @see java.util.Random#nextDouble(double) */ @@ -94,12 +92,11 @@ public class MathUtils { } /** - * Returns a psuedo-random number between min and max, inclusive. - * The difference between min and max can be at most + * Returns a psuedo-random number between min and max, inclusive. The difference between min and max can be at most * Float.MAX_VALUE - 1. * * @param min Minimim value - * @param max Maximim value. Must be greater than min. + * @param max Maximim value. Must be greater than min. * @return Float between min and max, inclusive. * @see java.util.Random#nextFloat(float) */ @@ -120,12 +117,10 @@ public class MathUtils { } /** - * Returns a percentage. - * The returned number is the % of X in Y. - * Supports Doubles. + * Returns a percentage. The returned number is the % of X in Y. Supports Doubles. * * @param current Current value. - * @param max Maximim value. Must be greater than min. + * @param max Maximim value. Must be greater than min. * @return double between min and max, inclusive. */ public static double findPercentage(final double current, final double max) { @@ -133,12 +128,10 @@ public class MathUtils { } /** - * Returns a percentage. - * The returned number is the % of X in Y. - * Supports Floats. + * Returns a percentage. The returned number is the % of X in Y. Supports Floats. * * @param current Current value. - * @param max Maximim value. Must be greater than min. + * @param max Maximim value. Must be greater than min. * @return double between min and max, inclusive. */ public static float findPercentage(final float current, final float max) { @@ -151,9 +144,7 @@ public class MathUtils { // Smooth Rounding Function /** - * Returns a double. - * The returned number is d rounded to the nearest d.01. - * Supports Doubles. + * Returns a double. The returned number is d rounded to the nearest d.01. Supports Doubles. * * @param current Current value. * @return double Rounded value. @@ -164,9 +155,7 @@ public class MathUtils { // Smooth Rounding Function (Nearest 5) /** - * Returns a double. - * The returned number is d rounded to the nearest d.5. - * Supports Doubles. + * Returns a double. The returned number is d rounded to the nearest d.5. Supports Doubles. * * @param current Current value. * @return double Rounded value. @@ -177,9 +166,7 @@ public class MathUtils { // Smooth Rounding Function /** - * Returns a integer. - * The returned number is d rounded to the nearest flat integer. - * Supports Doubles as input. + * 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. @@ -203,9 +190,7 @@ public class MathUtils { // Smooth Rounding Function /** - * Returns a long. - * The returned number is d rounded to the nearest flat long. - * Supports Doubles as input. + * Returns a long. The returned number is d rounded to the nearest flat long. Supports Doubles as input. * * @param current Current value. * @return long Rounded value. @@ -215,12 +200,10 @@ public class MathUtils { } /** - * Returns a boolean. - * The returned boolean is wether or not X evenly fits in to Y. - * Supports ints. + * Returns a boolean. The returned boolean is wether or not X evenly fits in to Y. Supports ints. * * @param x Value A. - * @param y Value B. Must be greater than min. + * @param y Value B. Must be greater than min. * @return boolean Whether or not it divides evenly. */ public static boolean divideXintoY(final int x, final int y) { @@ -231,9 +214,7 @@ public class MathUtils { } /** - * Returns a boolean. - * The returned boolean is based on the odd/eveness of the input. - * Supports ints. + * 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. @@ -246,9 +227,7 @@ public class MathUtils { } /** - * Returns an int. - * The returned number is the value on i + 273.15F. - * Supports ints. + * Returns an int. The returned number is the value on i + 273.15F. Supports ints. * * @param i Temp in Celcius. * @return int The celcius temp returned as Kelvin, rounded to the readest whole. @@ -259,9 +238,7 @@ public class MathUtils { } /** - * Returns a hexInteger. - * The returned number is the hex value of the input. - * Supports ints. + * Returns a hexInteger. The returned number is the hex value of the input. Supports ints. * * @param input Current value. * @return hexInteger. @@ -273,12 +250,10 @@ public class MathUtils { } /** - * Returns a hexInteger. - * The returned value is between min and max. - * Supports ints. + * Returns a hexInteger. The returned value is between min and max. Supports ints. * * @param min Minimum value. - * @param max Maximium value. Must be greater than min. + * @param max Maximium value. Must be greater than min. * @return hexInteger between min and max, inclusive. */ public static int generateRandomHexValue(final int min, final int max) { @@ -286,8 +261,7 @@ public class MathUtils { } /** - * Returns a random hex value. - * The returned value is between 000000-ffffff. + * Returns a random hex value. The returned value is between 000000-ffffff. * * @return hexInteger between min and max, inclusive. */ @@ -370,8 +344,7 @@ public class MathUtils { } public static int safeInt(long number) { - return number > GT_Values.V[GT_Values.V.length - 1] - ? safeInt(GT_Values.V[GT_Values.V.length - 1], 1) + return number > GT_Values.V[GT_Values.V.length - 1] ? safeInt(GT_Values.V[GT_Values.V.length - 1], 1) : number < Integer.MIN_VALUE ? Integer.MIN_VALUE : (int) number; } @@ -534,6 +507,7 @@ public class MathUtils { /** * Inverts the value, making Positives into Negatives and vice versa. + * * @param aPositive - An int value, either positive or negative. * @return - Inverted int Value. */ @@ -669,9 +643,10 @@ public class MathUtils { /** * Balances a number within a range. + * * @param aInput - The number to balance - * @param aMin - The minimum bounds - * @param aMax - The maximum bounds + * @param aMin - The minimum bounds + * @param aMax - The maximum bounds * @return - An Integer which will be between the bounds, or a boundary value. */ public static int balance(int aInput, int aMin, int aMax) { @@ -680,9 +655,10 @@ public class MathUtils { /** * Balances a number within a range. + * * @param aInput - The number to balance - * @param aMin - The minimum bounds - * @param aMax - The maximum bounds + * @param aMin - The minimum bounds + * @param aMax - The maximum bounds * @return - A Number which will be between the bounds, or a boundary value. */ public static Number balance(Number aInput, Number aMin, Number aMax) { @@ -691,21 +667,23 @@ public class MathUtils { /** * Balances a number within a range. + * * @param aInput - The number to balance - * @param aMin - The minimum bounds - * @param aMax - The maximum bounds + * @param aMin - The minimum bounds + * @param aMax - The maximum bounds * @return - An Integer which will be between the bounds, or a boundary value. */ public static int balanceInt(Number aInput, Number aMin, Number aMax) { - return MathUtils.safeCast_LongToInt( - (long) balance(max(min(aInput, aMax), aMin), Integer.MIN_VALUE, Integer.MAX_VALUE)); + return MathUtils + .safeCast_LongToInt((long) balance(max(min(aInput, aMax), aMin), Integer.MIN_VALUE, Integer.MAX_VALUE)); } /** * Balances a number within a range. + * * @param aInput - The number to balance - * @param aMin - The minimum bounds - * @param aMax - The maximum bounds + * @param aMin - The minimum bounds + * @param aMax - The maximum bounds * @return - A Long which will be between the bounds, or a boundary value. */ public static long balanceLong(Number aInput, Number aMin, Number aMax) { @@ -724,28 +702,24 @@ public class MathUtils { } /** - * Returns the smaller of two {@code Number}s. That is, - * the result the argument closer to the value of - * {@link Long#MIN_VALUE}. If the arguments have the same - * value, the result is that same value. + * Returns the smaller of two {@code Number}s. That is, the result the argument closer to the value of + * {@link Long#MIN_VALUE}. If the arguments have the same value, the result is that same value. * - * @param a an argument. - * @param b another argument. - * @return the smaller of {@code a} and {@code b}. + * @param a an argument. + * @param b another argument. + * @return the smaller of {@code a} and {@code b}. */ public static Number min(Number a, Number b) { return (a.longValue() <= b.longValue()) ? a : b; } /** - * Returns the greater of two {@code Number}s. That is, the - * result is the argument closer to the value of - * {@link Long#MAX_VALUE}. If the arguments have the same value, - * the result is that same value. + * Returns the greater of two {@code Number}s. That is, the result is the argument closer to the value of + * {@link Long#MAX_VALUE}. If the arguments have the same value, the result is that same value. * - * @param a an argument. - * @param b another argument. - * @return the larger of {@code a} and {@code b}. + * @param a an argument. + * @param b another argument. + * @return the larger of {@code a} and {@code b}. */ public static Number max(Number a, Number b) { return (a.longValue() >= b.longValue()) ? a : b; @@ -759,7 +733,7 @@ public class MathUtils { public static int[] splitLongIntoTwoIntegers(long aNum) { int a = (int) (aNum >> 32); int b = (int) aNum; - return new int[] {a, b}; + return new int[] { a, b }; } public static String formatNumbers(long aNumber) { diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/EnchantingUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/EnchantingUtils.java index 3871d11941..e3219369e8 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/EnchantingUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/EnchantingUtils.java @@ -1,9 +1,10 @@ package gtPlusPlus.core.util.minecraft; -import gtPlusPlus.api.objects.Logger; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import gtPlusPlus.api.objects.Logger; + public class EnchantingUtils { public static final int XP_PER_BOTTLE = 8; diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/EnergyUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/EnergyUtils.java index 207faeefce..1d86a7482f 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/EnergyUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/EnergyUtils.java @@ -1,11 +1,12 @@ package gtPlusPlus.core.util.minecraft; +import net.minecraft.item.ItemRedstone; +import net.minecraft.item.ItemStack; + import gregtech.api.util.GT_ModHandler; import ic2.api.item.IElectricItem; import ic2.api.item.IElectricItemManager; import ic2.api.item.ISpecialElectricItem; -import net.minecraft.item.ItemRedstone; -import net.minecraft.item.ItemStack; public class EnergyUtils { @@ -37,8 +38,8 @@ public class EnergyUtils { public static boolean discharge(ItemStack aStack, int aEnergyToDrain, int aTier) { if (isElectricItem(aStack)) { int tTier = ((IElectricItem) aStack.getItem()).getTier(aStack); - int aDischargeValue = - GT_ModHandler.dischargeElectricItem(aStack, aEnergyToDrain, tTier, true, false, false); + int aDischargeValue = GT_ModHandler + .dischargeElectricItem(aStack, aEnergyToDrain, tTier, true, false, false); // Logger.INFO("Trying to drain "+aDischargeValue); return aDischargeValue > 0; } else { @@ -119,5 +120,6 @@ public class EnergyUtils { } } - public static class RF {} + public static class RF { + } } diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/EntityUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/EntityUtils.java index 9c6fab90cd..e154a059e2 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/EntityUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/EntityUtils.java @@ -1,19 +1,11 @@ package gtPlusPlus.core.util.minecraft; -import cpw.mods.fml.common.registry.EntityRegistry; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.AABB; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.handler.events.EntityDeathHandler; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import ic2.core.IC2Potion; -import ic2.core.item.armor.ItemArmorHazmat; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; import java.util.Map; + import net.minecraft.block.Block; import net.minecraft.entity.*; import net.minecraft.entity.player.EntityPlayer; @@ -25,6 +17,16 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; +import cpw.mods.fml.common.registry.EntityRegistry; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.minecraft.AABB; +import gtPlusPlus.api.objects.minecraft.BlockPos; +import gtPlusPlus.core.handler.events.EntityDeathHandler; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import ic2.core.IC2Potion; +import ic2.core.item.armor.ItemArmorHazmat; + public class EntityUtils { public static void setEntityOnFire(final Entity aEntity, final int length) { @@ -81,14 +83,14 @@ public class EntityUtils { } // TODO - public static void registerEntityToBiomeSpawns( - final Class 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 void registerEntityToBiomeSpawns(final Class 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( - final int stackSize, final int radiationLevel, final World world, final Entity entityHolding) { + public static boolean applyRadiationDamageToEntity(final int stackSize, final int radiationLevel, final World world, + final Entity entityHolding) { if (!world.isRemote) { if ((radiationLevel > 0) && (entityHolding instanceof EntityLivingBase)) { final EntityLivingBase entityLiving = (EntityLivingBase) entityHolding; @@ -99,9 +101,7 @@ public class EntityUtils { if (entityLiving.getActivePotionEffect(IC2Potion.radiation) != null) { // Utils.LOG_INFO("t"); duration = (radiationLevel * 5) - + entityLiving - .getActivePotionEffect(IC2Potion.radiation) - .getDuration(); + + entityLiving.getActivePotionEffect(IC2Potion.radiation).getDuration(); } else { // Utils.LOG_INFO("f"); duration = radiationLevel * 30; @@ -117,114 +117,101 @@ public class EntityUtils { } public static boolean isWearingFullFrostHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!HazmatUtils.providesProtetion_Frost(aEntity.getEquipmentInSlot(i))) { - return false; - } + for (byte i = 1; i < 5; i++) if (!HazmatUtils.providesProtetion_Frost(aEntity.getEquipmentInSlot(i))) { + return false; + } return true; } public static boolean isWearingFullHeatHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!HazmatUtils.providesProtetion_Fire(aEntity.getEquipmentInSlot(i))) { - return false; - } + for (byte i = 1; i < 5; i++) if (!HazmatUtils.providesProtetion_Fire(aEntity.getEquipmentInSlot(i))) { + return false; + } return true; } public static boolean isWearingFullBioHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!HazmatUtils.providesProtetion_Biohazard(aEntity.getEquipmentInSlot(i))) { - return false; - } + for (byte i = 1; i < 5; i++) if (!HazmatUtils.providesProtetion_Biohazard(aEntity.getEquipmentInSlot(i))) { + return false; + } return true; } public static boolean isWearingFullRadioHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!HazmatUtils.providesProtetion_Radiation(aEntity.getEquipmentInSlot(i))) { - return false; - } + for (byte i = 1; i < 5; i++) if (!HazmatUtils.providesProtetion_Radiation(aEntity.getEquipmentInSlot(i))) { + return false; + } return true; } public static boolean isWearingFullElectroHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!HazmatUtils.providesProtetion_Electricity(aEntity.getEquipmentInSlot(i))) { - return false; - } + for (byte i = 1; i < 5; i++) if (!HazmatUtils.providesProtetion_Electricity(aEntity.getEquipmentInSlot(i))) { + return false; + } return true; } public static boolean isWearingFullGasHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!HazmatUtils.providesProtetion_Gas(aEntity.getEquipmentInSlot(i))) { - return false; - } + for (byte i = 1; i < 5; i++) if (!HazmatUtils.providesProtetion_Gas(aEntity.getEquipmentInSlot(i))) { + return false; + } return true; } public static boolean applyRadioactivity(EntityLivingBase aEntity, int aLevel, int aAmountOfItems) { - if (aLevel > 0 - && aEntity != null + if (aLevel > 0 && aEntity != null && aEntity.getCreatureAttribute() != EnumCreatureAttribute.UNDEAD && aEntity.getCreatureAttribute() != EnumCreatureAttribute.ARTHROPOD && !ItemArmorHazmat.hasCompleteHazmat(aEntity)) { PotionEffect tEffect = null; - aEntity.addPotionEffect(new PotionEffect( - Potion.moveSlowdown.id, - aLevel * 140 * aAmountOfItems - + Math.max( + aEntity.addPotionEffect( + new PotionEffect( + Potion.moveSlowdown.id, + aLevel * 140 * aAmountOfItems + Math.max( 0, - ((tEffect = aEntity.getActivePotionEffect(Potion.moveSlowdown)) == null - ? 0 + ((tEffect = aEntity.getActivePotionEffect(Potion.moveSlowdown)) == null ? 0 : tEffect.getDuration())), - Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect( - Potion.digSlowdown.id, - aLevel * 150 * aAmountOfItems - + Math.max( + Math.max(0, (5 * aLevel) / 7))); + aEntity.addPotionEffect( + new PotionEffect( + Potion.digSlowdown.id, + aLevel * 150 * aAmountOfItems + Math.max( 0, - ((tEffect = aEntity.getActivePotionEffect(Potion.digSlowdown)) == null - ? 0 + ((tEffect = aEntity.getActivePotionEffect(Potion.digSlowdown)) == null ? 0 : tEffect.getDuration())), - Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect( - Potion.confusion.id, - aLevel * 130 * aAmountOfItems - + Math.max( + Math.max(0, (5 * aLevel) / 7))); + aEntity.addPotionEffect( + new PotionEffect( + Potion.confusion.id, + aLevel * 130 * aAmountOfItems + Math.max( 0, - ((tEffect = aEntity.getActivePotionEffect(Potion.confusion)) == null - ? 0 + ((tEffect = aEntity.getActivePotionEffect(Potion.confusion)) == null ? 0 : tEffect.getDuration())), - Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect( - Potion.weakness.id, - aLevel * 150 * aAmountOfItems - + Math.max( + Math.max(0, (5 * aLevel) / 7))); + aEntity.addPotionEffect( + new PotionEffect( + Potion.weakness.id, + aLevel * 150 * aAmountOfItems + Math.max( 0, - ((tEffect = aEntity.getActivePotionEffect(Potion.weakness)) == null - ? 0 + ((tEffect = aEntity.getActivePotionEffect(Potion.weakness)) == null ? 0 : tEffect.getDuration())), - Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect( - Potion.hunger.id, - aLevel * 130 * aAmountOfItems - + Math.max( + Math.max(0, (5 * aLevel) / 7))); + aEntity.addPotionEffect( + new PotionEffect( + Potion.hunger.id, + aLevel * 130 * aAmountOfItems + Math.max( 0, - ((tEffect = aEntity.getActivePotionEffect(Potion.hunger)) == null - ? 0 + ((tEffect = aEntity.getActivePotionEffect(Potion.hunger)) == null ? 0 : tEffect.getDuration())), - Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect( - IC2Potion.radiation.id, - aLevel * 180 * aAmountOfItems - + Math.max( + Math.max(0, (5 * aLevel) / 7))); + aEntity.addPotionEffect( + new PotionEffect( + IC2Potion.radiation.id, + aLevel * 180 * aAmountOfItems + Math.max( 0, - ((tEffect = aEntity.getActivePotionEffect(Potion.potionTypes[24])) == null - ? 0 + ((tEffect = aEntity.getActivePotionEffect(Potion.potionTypes[24])) == null ? 0 : tEffect.getDuration())), - Math.max(0, (5 * aLevel) / 7))); + Math.max(0, (5 * aLevel) / 7))); return true; } return false; @@ -258,8 +245,7 @@ public class EntityUtils { } else { try { dealFireDamage.invoke(entity, amount); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - } + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {} } return false; } @@ -269,10 +255,10 @@ public class EntityUtils { } public static boolean isTileEntityRegistered(Class aTileClass, String aTileName) { - Field aRegistry = ReflectionUtils.getField( - ReflectionUtils.getClass("net.minecraft.tileentity.TileEntity"), "nameToClassMap"); - Field aRegistry2 = ReflectionUtils.getField( - ReflectionUtils.getClass("net.minecraft.tileentity.TileEntity"), "classToNameMap"); + Field aRegistry = ReflectionUtils + .getField(ReflectionUtils.getClass("net.minecraft.tileentity.TileEntity"), "nameToClassMap"); + Field aRegistry2 = ReflectionUtils + .getField(ReflectionUtils.getClass("net.minecraft.tileentity.TileEntity"), "classToNameMap"); try { Object o = aRegistry.get(null); if (o != null) { @@ -298,16 +284,16 @@ public class EntityUtils { } public static double getDistance(Entity p1, Entity p2) { - return Math.sqrt( - Math.pow(p1.posX - p2.posX, 2) + Math.pow(p1.posY - p2.posY, 2) + Math.pow(p1.posZ - p2.posZ, 2)); + return Math + .sqrt(Math.pow(p1.posX - p2.posX, 2) + Math.pow(p1.posY - p2.posY, 2) + Math.pow(p1.posZ - p2.posZ, 2)); } public static AutoMap getEntitiesWithinBoundingBoxExcluding(Entity aExclusion, AABB aBoundingBox) { if (aExclusion == null) { return new AutoMap(); } else { - List aEntities = - aBoundingBox.world().getEntitiesWithinAABBExcludingEntity(aExclusion, aBoundingBox.get()); + List aEntities = aBoundingBox.world() + .getEntitiesWithinAABBExcludingEntity(aExclusion, aBoundingBox.get()); return new AutoMap(aEntities); } } @@ -322,10 +308,12 @@ public class EntityUtils { } /** - * Provides the ability to provide custom drops upon the death of EntityLivingBase objects. Simplified function with static Max drop size of 1. + * Provides the ability to provide custom drops upon the death of EntityLivingBase objects. Simplified function with + * static Max drop size of 1. + * * @param aMobClass - The Base Class you want to drop this item. - * @param aStack - The ItemStack, stack size is not respected. - * @param aChance - Chance out of 10000, where 100 is 1%. (1 = 0.01% - this is ok) + * @param aStack - The ItemStack, stack size is not respected. + * @param aChance - Chance out of 10000, where 100 is 1%. (1 = 0.01% - this is ok) */ public static void registerDropsForMob(Class aMobClass, ItemStack aStack, int aChance) { registerDropsForMob(aMobClass, aStack, 1, aChance); @@ -333,10 +321,11 @@ public class EntityUtils { /** * Provides the ability to provide custom drops upon the death of EntityLivingBase objects. - * @param aMobClass - The Base Class you want to drop this item. - * @param aStack - The ItemStack, stack size is not respected. + * + * @param aMobClass - The Base Class you want to drop this item. + * @param aStack - The ItemStack, stack size is not respected. * @param aMaxAmount - The maximum size of the ItemStack which drops. - * @param aChance - Chance out of 10000, where 100 is 1%. (1 = 0.01% - this is ok) + * @param aChance - Chance out of 10000, where 100 is 1%. (1 = 0.01% - this is ok) */ public static void registerDropsForMob(Class aMobClass, ItemStack aStack, int aMaxAmount, int aChance) { EntityDeathHandler.registerDropsForMob(aMobClass, aStack, aMaxAmount, aChance); diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/FluidUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/FluidUtils.java index 2125eff0e5..f5920b5549 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/FluidUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/FluidUtils.java @@ -1,5 +1,16 @@ package gtPlusPlus.core.util.minecraft; +import java.util.HashMap; + +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidContainerItem; + import gregtech.api.enums.Dyes; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; @@ -14,15 +25,6 @@ import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import java.util.HashMap; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; public class FluidUtils { @@ -75,6 +77,7 @@ public class FluidUtils { @Deprecated /** * Do not use - Gives third tier steam - Not implemented + * * @param amount * @return */ @@ -99,8 +102,7 @@ public class FluidUtils { public static FluidStack getHydrofluoricAcidGT(int amount) { if (sGregtechHydrofluoricAcid == null) { FluidStack aGTHF = FluidUtils.getFluidStack("hydrofluoricacid_gt5u", 1); - sGregtechHydrofluoricAcid = - aGTHF != null ? aGTHF.getFluid() : getHydrofluoricAcid(1).getFluid(); + sGregtechHydrofluoricAcid = aGTHF != null ? aGTHF.getFluid() : getHydrofluoricAcid(1).getFluid(); } return FluidUtils.getFluidStack(sGregtechHydrofluoricAcid, amount); } @@ -109,8 +111,7 @@ public class FluidUtils { if (sGregtechHydrofluoricAcid == null) { getHydrofluoricAcidGT(1); } - return sGregtechHydrofluoricAcid != null - && sGregtechHydrofluoricAcid != getHydrofluoricAcid(1).getFluid(); + return sGregtechHydrofluoricAcid != null && sGregtechHydrofluoricAcid != getHydrofluoricAcid(1).getFluid(); } private static FluidStack createFluidStack(Fluid aFluid, int aAmount) { @@ -151,7 +152,7 @@ public class FluidUtils { public static FluidStack[] getFluidStackArray(final String fluidName, final int amount) { Logger.WARNING("Trying to get a fluid stack of " + fluidName); try { - final FluidStack[] singleFluid = {getFluidStack(fluidName, amount)}; + final FluidStack[] singleFluid = { getFluidStack(fluidName, amount) }; return singleFluid; } catch (final Throwable e) { return null; @@ -161,21 +162,15 @@ public class FluidUtils { public static FluidStack[] getFluidStackArray(final FluidStack fluidName, final int amount) { Logger.WARNING("Trying to get a fluid stack of " + fluidName); try { - final FluidStack[] singleFluid = {getFluidStack(fluidName, amount)}; + final FluidStack[] singleFluid = { getFluidStack(fluidName, amount) }; return singleFluid; } catch (final Throwable e) { return null; } } - public static Fluid addGtFluid( - final String aName, - final String aLocalized, - final GT_Materials aMaterial, - final int aState, - final long aTemperatureK, - final ItemStack aFullContainer, - final ItemStack aEmptyContainer, + public static Fluid addGtFluid(final String aName, final String aLocalized, final GT_Materials aMaterial, + final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { return addGtFluid( aName, @@ -189,21 +184,14 @@ public class FluidUtils { true); } - public static Fluid addGtFluid( - final String aName, - final String aLocalized, - final GT_Materials aMaterial, - final int aState, - final long aTemperatureK, - final ItemStack aFullContainer, - final ItemStack aEmptyContainer, - final int aFluidAmount, - final boolean aGenerateCell) { + public static Fluid addGtFluid(final String aName, final String aLocalized, final GT_Materials aMaterial, + final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, + final int aFluidAmount, final boolean aGenerateCell) { Fluid g = addGTFluid( aName, "fluid.autogenerated", aLocalized, - aMaterial != null ? aMaterial.mRGBa : new short[] {255, 255, 255, 0}, + aMaterial != null ? aMaterial.mRGBa : new short[] { 255, 255, 255, 0 }, aState, aTemperatureK, aFullContainer, @@ -232,16 +220,9 @@ public class FluidUtils { return null; } - 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, - final boolean aGenerateCell) { + 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, final boolean aGenerateCell) { return addGTFluid( "molten." + aName, "molten.autogenerated", @@ -255,16 +236,9 @@ public class FluidUtils { aGenerateCell); } - 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, - final boolean aGenerateCell) { + 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, final boolean aGenerateCell) { return addGTFluid( "fluid." + aName, "fluid.autogenerated", @@ -278,16 +252,9 @@ public class FluidUtils { aGenerateCell); } - public static Fluid addGTFluidNoPrefix( - final String aName, - final String aLocalized, - final short[] aRGBa, - final int aState, - final long aTemperatureK, - final ItemStack aFullContainer, - final ItemStack aEmptyContainer, - final int aFluidAmount, - final boolean aGenerateCell) { + public static Fluid addGTFluidNoPrefix(final String aName, final String aLocalized, final short[] aRGBa, + final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, + final int aFluidAmount, final boolean aGenerateCell) { return addGTFluid( aName, "fluid.autogenerated", @@ -300,17 +267,11 @@ public class FluidUtils { aFluidAmount, aGenerateCell); } + // Gass - public static Fluid addGtGas( - final String aName, - final String aLocalized, - final short[] aRGBa, - final int aState, - final long aTemperatureK, - final ItemStack aFullContainer, - final ItemStack aEmptyContainer, - final int aFluidAmount, - final boolean aGenerateCell) { + public static Fluid addGtGas(final String aName, final String aLocalized, final short[] aRGBa, final int aState, + final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, + final int aFluidAmount, final boolean aGenerateCell) { return addGTFluid( aName, "fluid.autogenerated", @@ -325,8 +286,7 @@ public class FluidUtils { } public static Fluid addGTPlasma(final Material aMaterial) { - if (aMaterial.getLocalizedName().toLowerCase().contains("clay") - || (aMaterial.getComposites().size() > 1) + if (aMaterial.getLocalizedName().toLowerCase().contains("clay") || (aMaterial.getComposites().size() > 1) || aMaterial.getLocalizedName().toLowerCase().contains("wrought")) { return null; } @@ -351,8 +311,7 @@ public class FluidUtils { } if (temp != null) { return addGTFluid( - "plasma." - + Utils.sanitizeString(aMaterial.getLocalizedName().toLowerCase()), + "plasma." + Utils.sanitizeString(aMaterial.getLocalizedName().toLowerCase()), "plasma.autogenerated", aMaterial.getLocalizedName() + " Plasma", aMaterial.getRGBA(), @@ -366,17 +325,9 @@ public class FluidUtils { return null; } - public static Fluid addGTFluid( - String aName, - final String aTexture, - final String aLocalized, - final short[] aRGBa, - final int aState, - final long aTemperatureK, - ItemStack aFullContainer, - final ItemStack aEmptyContainer, - final int aFluidAmount, - final boolean aGenerateFilledCell) { + public static Fluid addGTFluid(String aName, final String aTexture, final String aLocalized, final short[] aRGBa, + final int aState, final long aTemperatureK, ItemStack aFullContainer, final ItemStack aEmptyContainer, + final int aFluidAmount, final boolean aGenerateFilledCell) { String aNameOriginal = aName; Logger.INFO("Generating Fluid for " + aName); @@ -472,10 +423,11 @@ public class FluidUtils { if ((rFluid.getTemperature() == new Fluid("test").getTemperature()) || (rFluid.getTemperature() <= 0)) { rFluid.setTemperature((int) (aTemperatureK)); } - if ((aFullContainer != null) - && (aEmptyContainer != null) + if ((aFullContainer != null) && (aEmptyContainer != null) && !FluidContainerRegistry.registerFluidContainer( - new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { + new FluidStack(rFluid, aFluidAmount), + aFullContainer, + aEmptyContainer)) { CORE.RA.addFluidCannerRecipe(CI.emptyCells(1), aFullContainer, new FluidStack(rFluid, aFluidAmount)); } else { // Utils.LOG_INFO("Failed creating recipes to fill/empty cells of "+aName+"."); @@ -484,15 +436,13 @@ public class FluidUtils { } public static boolean valid(final Object aStack) { - return (aStack != null) - && (aStack instanceof ItemStack) + 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) + return (aStack == null) || !(aStack instanceof ItemStack) || (((ItemStack) aStack).getItem() == null) || (((ItemStack) aStack).stackSize < 0); } @@ -507,10 +457,9 @@ public class FluidUtils { 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(aStack2.getTagCompound())))) + && (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)); } @@ -559,8 +508,7 @@ public class FluidUtils { if (equal(aStack, ItemUtils.getEmptyCell(), true)) { return null; } - if (aCheckIFluidContainerItems - && (aStack.getItem() instanceof IFluidContainerItem) + 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); @@ -575,25 +523,21 @@ public class FluidUtils { return null; } - public static ItemStack container( - final ItemStack aStack, final boolean aCheckIFluidContainerItems, final int aStacksize) { + public static ItemStack container(final ItemStack aStack, final boolean aCheckIFluidContainerItems, + final int aStacksize) { return amount(aStacksize, container(aStack, aCheckIFluidContainerItems)); } - public static final Fluid generateFluid( - final String unlocalizedName, - final String localizedName, - final int MeltingPoint, - final short[] RGBA, - boolean aGenerateCell) { + public static final Fluid generateFluid(final String unlocalizedName, final String localizedName, + final int MeltingPoint, final short[] RGBA, boolean aGenerateCell) { FluidStack aFStack = (FluidUtils.getFluidStack("molten" + "." + unlocalizedName.toLowerCase(), 1)); if (aFStack == null) { Logger.WARNING("Generating our own fluid."); - /* ItemStack cell = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1); - if (cell == null){ - final Item temp = new BaseItemComponent(unlocalizedName, localizedName, RGBA); - cell = ItemUtils.getSimpleStack(temp); - }*/ + /* + * ItemStack cell = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1); if (cell + * == null){ final Item temp = new BaseItemComponent(unlocalizedName, localizedName, RGBA); cell = + * ItemUtils.getSimpleStack(temp); } + */ final Fluid gtFluid = FluidUtils.addGTFluid( unlocalizedName, "Molten " + localizedName, @@ -612,50 +556,44 @@ public class FluidUtils { } } - public static final Fluid generateFluidNonMolten( - final String unlocalizedName, - final String localizedName, - final int MeltingPoint, - final short[] RGBA, - final boolean aGenerateCell) { + public static final Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, + final int MeltingPoint, final short[] RGBA, final boolean aGenerateCell) { return generateFluidNonMolten(unlocalizedName, localizedName, MeltingPoint, RGBA, null, null, 0, aGenerateCell); } - public static final Fluid generateFluidNonMolten( - final String unlocalizedName, - final String localizedName, - final int MeltingPoint, - final short[] RGBA, - final ItemStack dustStack, - final ItemStack dustStack2) { + public static final Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, + final int MeltingPoint, final short[] RGBA, final ItemStack dustStack, final ItemStack dustStack2) { return generateFluidNonMolten( - unlocalizedName, localizedName, MeltingPoint, RGBA, dustStack, dustStack2, 144, true); + unlocalizedName, + localizedName, + MeltingPoint, + RGBA, + dustStack, + dustStack2, + 144, + true); } - public static final Fluid generateFluidNonMolten( - final String unlocalizedName, - final String localizedName, - final int MeltingPoint, - final short[] RGBA, - final ItemStack dustStack, - final ItemStack dustStack2, + public static final Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, + final int MeltingPoint, final short[] RGBA, final ItemStack dustStack, final ItemStack dustStack2, final boolean aGenerateCell) { return generateFluidNonMolten( - unlocalizedName, localizedName, MeltingPoint, RGBA, dustStack, dustStack2, 144, aGenerateCell); + unlocalizedName, + localizedName, + MeltingPoint, + RGBA, + dustStack, + dustStack2, + 144, + aGenerateCell); } - public static final Fluid generateFluidNonMolten( - final String unlocalizedName, - final String localizedName, - final int MeltingPoint, - final short[] RGBA, - ItemStack dustStack, - final ItemStack dustStack2, - final int amountPerItem, - final boolean aGenerateCell) { + public static final Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, + final int MeltingPoint, final short[] RGBA, ItemStack dustStack, final ItemStack dustStack2, + final int amountPerItem, final boolean aGenerateCell) { if (dustStack == null) { - dustStack = - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust" + Utils.sanitizeString(localizedName), 1); + dustStack = ItemUtils + .getItemStackOfAmountFromOreDictNoBroken("dust" + Utils.sanitizeString(localizedName), 1); } FluidStack aFStack = (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1)); if (aFStack == null) { @@ -678,7 +616,7 @@ public class FluidUtils { FluidUtils.getFluidStack(gtFluid, amountPerItem), // Fluid Output 1 * 20, // Duration 16 // Eu Tick - ); + ); } if (dustStack2 != null) { CORE.RA.addFluidExtractionRecipe( @@ -686,7 +624,7 @@ public class FluidUtils { FluidUtils.getFluidStack(gtFluid, amountPerItem), // Fluid Output 1 * 20, // Duration 16 // Eu Tick - ); + ); } return gtFluid; @@ -696,17 +634,13 @@ public class FluidUtils { } } - public static final Fluid generateFluidNoPrefix( - final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA) { + public static final Fluid generateFluidNoPrefix(final String unlocalizedName, final String localizedName, + final int MeltingPoint, final short[] RGBA) { return generateFluidNoPrefix(unlocalizedName, localizedName, MeltingPoint, RGBA, true); } - public static final Fluid generateFluidNoPrefix( - final String unlocalizedName, - final String localizedName, - final int MeltingPoint, - final short[] RGBA, - final boolean aGenerateCell) { + public static final Fluid generateFluidNoPrefix(final String unlocalizedName, final String localizedName, + final int MeltingPoint, final short[] RGBA, final boolean aGenerateCell) { Fluid gtFluid; if (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null) { Logger.WARNING("Generating our own fluid."); @@ -724,18 +658,14 @@ public class FluidUtils { gtFluid = FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1).getFluid(); } // Generate a Cell if we need to - // if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ - // new BaseItemCell(unlocalizedName, localizedName, RGBA, gtFluid); - // } + // if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ + // new BaseItemCell(unlocalizedName, localizedName, RGBA, gtFluid); + // } return gtFluid; } - public static final Fluid generateGas( - final String unlocalizedName, - final String localizedName, - final int MeltingPoint, - final short[] RGBA, - final boolean aGenerateCell) { + public static final Fluid generateGas(final String unlocalizedName, final String localizedName, + final int MeltingPoint, final short[] RGBA, final boolean aGenerateCell) { Fluid gtFluid; if (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null) { Logger.WARNING("Generating our own gas."); @@ -753,9 +683,10 @@ public class FluidUtils { gtFluid = FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1).getFluid(); } // Generate a Cell if we need to - /* if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ - new BaseItemCell(unlocalizedName, localizedName, RGBA, gtFluid); - }*/ + /* + * if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ new + * BaseItemCell(unlocalizedName, localizedName, RGBA, gtFluid); } + */ return gtFluid; } @@ -774,8 +705,7 @@ public class FluidUtils { FluidStack aFStack4 = (FluidUtils.getFluidStack(aFluidName, 1)); FluidStack aFStack5 = (FluidUtils.getFluidStack("liquid_" + aFluidName.toLowerCase(), 1)); FluidStack aFStack6 = (FluidUtils.getFluidStack("liquid" + "." + aFluidName.toLowerCase(), 1)); - return aFStack1 != null - || aFStack2 != null + return aFStack1 != null || aFStack2 != null || aFStack3 != null || aFStack4 != null || aFStack5 != null diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/FoodUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/FoodUtils.java index 129548d1db..2825ac80fd 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/FoodUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/FoodUtils.java @@ -1,6 +1,5 @@ package gtPlusPlus.core.util.minecraft; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.init.Items; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; @@ -8,6 +7,8 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; +import gtPlusPlus.core.util.reflect.ReflectionUtils; + public class FoodUtils { public static final Class IEdibleClass; diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java index 6c1442cb0d..80536189ce 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java @@ -2,6 +2,15 @@ package gtPlusPlus.core.util.minecraft; import static gregtech.api.GregTech_API.*; +import java.lang.reflect.Field; +import java.util.HashMap; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; + import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gregtech.api.objects.GT_HashSet; import gregtech.api.objects.GT_ItemStack; @@ -17,13 +26,6 @@ import ic2.core.Ic2Items; import ic2.core.item.armor.ItemArmorHazmat; import ic2.core.item.armor.ItemArmorNanoSuit; import ic2.core.item.armor.ItemArmorQuantumSuit; -import java.lang.reflect.Field; -import java.util.HashMap; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; public class HazmatUtils { @@ -204,38 +206,28 @@ public class HazmatUtils { if (LoadedMods.isModLoaded("ThaumicTinkerer")) { /* - AutoMap aItems = new AutoMap(); - Class aMainTT = ReflectionUtils.getClass("thaumic.tinkerer.common.ThaumicTinkerer"); - Class aItemRegistryTT = ReflectionUtils.getClass("thaumic.tinkerer.common.registry.TTRegistry"); - Field aRegistryInstance = ReflectionUtils.getField(aMainTT, "registry"); - Object aRegistry = ReflectionUtils.getFieldValue(aRegistryInstance); - Method aFuckingStupidMethodHandlingMethod = ReflectionUtils.getMethod(aItemRegistryTT, "getFirstItemFromClass", new Class[] {Class.class}); - Item aIchorHelm = (Item) ReflectionUtils.invokeNonBool(aRegistry, aFuckingStupidMethodHandlingMethod, new Object[] {ReflectionUtils.getClass("thaumic.tinkerer.common.item.kami.armor.ItemGemHelm")}); - Item aIchorChest = (Item) ReflectionUtils.invokeNonBool(aRegistry, aFuckingStupidMethodHandlingMethod, new Object[] {ReflectionUtils.getClass("thaumic.tinkerer.common.item.kami.armor.ItemGemChest")}); - Item aIchorLegs = (Item) ReflectionUtils.invokeNonBool(aRegistry, aFuckingStupidMethodHandlingMethod, new Object[] {ReflectionUtils.getClass("thaumic.tinkerer.common.item.kami.armor.ItemGemLegs")}); - Item aIchorBoots = (Item) ReflectionUtils.invokeNonBool(aRegistry, aFuckingStupidMethodHandlingMethod, new Object[] {ReflectionUtils.getClass("thaumic.tinkerer.common.item.kami.armor.ItemGemBoots")}); - aItems.add(aIchorHelm); - aItems.add(aIchorChest); - aItems.add(aIchorLegs); - aItems.add(aIchorBoots); - AutoMap aItemMap = new AutoMap(); - int aIndex = 0; - for (Item aItem : aItems) { - Item aItemObject = null; - if (aItem != null) { - aItemMap.add(ItemUtils.getSimpleStack(aItemObject)); - } - else { - Logger.INFO("[Hazmat] Could not get item "+aIndex+" from "+aItemRegistryTT.getName()); - } - aIndex++; - } - Logger.INFO("[Hazmat] Registering "+aItemMap.size()+" Thaumic Tinkerer Items as hazmat gear."); - for (ItemStack aItem : aItemMap) { - addProtection(aItem); - } - Logger.INFO("[Hazmat] Registered Thaumic Tinkerer Items as hazmat gear."); - */ + * AutoMap aItems = new AutoMap(); Class aMainTT = + * ReflectionUtils.getClass("thaumic.tinkerer.common.ThaumicTinkerer"); Class aItemRegistryTT = + * ReflectionUtils.getClass("thaumic.tinkerer.common.registry.TTRegistry"); Field aRegistryInstance = + * ReflectionUtils.getField(aMainTT, "registry"); Object aRegistry = + * ReflectionUtils.getFieldValue(aRegistryInstance); Method aFuckingStupidMethodHandlingMethod = + * ReflectionUtils.getMethod(aItemRegistryTT, "getFirstItemFromClass", new Class[] {Class.class}); Item + * aIchorHelm = (Item) ReflectionUtils.invokeNonBool(aRegistry, aFuckingStupidMethodHandlingMethod, new + * Object[] {ReflectionUtils.getClass("thaumic.tinkerer.common.item.kami.armor.ItemGemHelm")}); Item + * aIchorChest = (Item) ReflectionUtils.invokeNonBool(aRegistry, aFuckingStupidMethodHandlingMethod, new + * Object[] {ReflectionUtils.getClass("thaumic.tinkerer.common.item.kami.armor.ItemGemChest")}); Item + * aIchorLegs = (Item) ReflectionUtils.invokeNonBool(aRegistry, aFuckingStupidMethodHandlingMethod, new + * Object[] {ReflectionUtils.getClass("thaumic.tinkerer.common.item.kami.armor.ItemGemLegs")}); Item + * aIchorBoots = (Item) ReflectionUtils.invokeNonBool(aRegistry, aFuckingStupidMethodHandlingMethod, new + * Object[] {ReflectionUtils.getClass("thaumic.tinkerer.common.item.kami.armor.ItemGemBoots")}); + * aItems.add(aIchorHelm); aItems.add(aIchorChest); aItems.add(aIchorLegs); aItems.add(aIchorBoots); + * AutoMap aItemMap = new AutoMap(); int aIndex = 0; for (Item aItem : aItems) { Item + * aItemObject = null; if (aItem != null) { aItemMap.add(ItemUtils.getSimpleStack(aItemObject)); } else { + * Logger.INFO("[Hazmat] Could not get item "+aIndex+" from "+aItemRegistryTT.getName()); } aIndex++; } + * Logger.INFO("[Hazmat] Registering "+aItemMap.size()+" Thaumic Tinkerer Items as hazmat gear."); for + * (ItemStack aItem : aItemMap) { addProtection(aItem); } + * Logger.INFO("[Hazmat] Registered Thaumic Tinkerer Items as hazmat gear."); + */ Logger.INFO("[Hazmat] Did not register Thaumic Tinkerer Items as hazmat gear."); } @@ -321,10 +313,8 @@ public class HazmatUtils { } /** - * Static function to replace - * {@link #ic2.core.item.armor.ItemArmorHazmat.hasCompleteHazmat(EntityLivingBase)}. - * Because IC2 doesn't let us register things ourself, anything registered via - * GT/GT++ will return true. + * Static function to replace {@link #ic2.core.item.armor.ItemArmorHazmat.hasCompleteHazmat(EntityLivingBase)}. + * Because IC2 doesn't let us register things ourself, anything registered via GT/GT++ will return true. * * @param living - Entity Wearing Armour * @return - Does {@link EntityLivingBase} have a full hazmat suit on? @@ -403,8 +393,8 @@ public class HazmatUtils { } /** - * Registers the {@link ItemStack} to all types of protection. Provides full - * hazmat protection. Frost, Fire, Bio, Gas, Radioaton & Electricity. + * Registers the {@link ItemStack} to all types of protection. Provides full hazmat protection. Frost, Fire, Bio, + * Gas, Radioaton & Electricity. * * @param aStack - The Armour to provide protection. * @return - Did we register this ItemStack properly? @@ -478,10 +468,9 @@ public class HazmatUtils { } /** - * Does this item provide hazmat protection? (Protection against Frost, Heat, - * Bio, Gas, Rads, Elec) An item may return false even if it protects against - * all six damage types. This is because it's not actually registered as hazmat - * correct. + * Does this item provide hazmat protection? (Protection against Frost, Heat, Bio, Gas, Rads, Elec) An item may + * return false even if it protects against all six damage types. This is because it's not actually registered as + * hazmat correct. * * @param aStack - The item to check for protection * @return diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/InventoryUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/InventoryUtils.java index 8fc5b90b62..c4a0cf411a 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/InventoryUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/InventoryUtils.java @@ -1,10 +1,7 @@ package gtPlusPlus.core.util.minecraft; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.data.AutoMap; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.inventory.IInventory; @@ -13,6 +10,11 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.data.AutoMap; + public class InventoryUtils { private static final Random mRandom = new Random(); @@ -20,8 +22,7 @@ public class InventoryUtils { public static void dropInventoryItems(World world, int x, int y, int z, Block block) { TileEntity tileentity = world.getTileEntity(x, y, z); - if (tileentity != null - && tileentity instanceof IInventory + if (tileentity != null && tileentity instanceof IInventory && ((IInventory) tileentity).getSizeInventory() > 0) { IInventory aTileInv = (IInventory) tileentity; @@ -36,9 +37,8 @@ public class InventoryUtils { float f1 = mRandom.nextFloat() * 0.8F + 0.1F; EntityItem entityitem; - for (float f2 = mRandom.nextFloat() * 0.8F + 0.1F; - itemstack.stackSize > 0; - world.spawnEntityInWorld(entityitem)) { + for (float f2 = mRandom.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; world + .spawnEntityInWorld(entityitem)) { int j1 = mRandom.nextInt(21) + 10; if (j1 > itemstack.stackSize) { @@ -58,8 +58,8 @@ public class InventoryUtils { entityitem.motionZ = (float) mRandom.nextGaussian() * f3; if (itemstack.hasTagCompound()) { - entityitem.getEntityItem().setTagCompound((NBTTagCompound) - itemstack.getTagCompound().copy()); + entityitem.getEntityItem() + .setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); } } } @@ -75,7 +75,9 @@ public class InventoryUtils { public static void sortInventoryItems(IGregTechTileEntity aBaseMetaTileEntity) { IInventory mInv = aBaseMetaTileEntity.getIInventory( - aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()); + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord()); AutoMap aInvContents = new AutoMap(); int aSize = mInv.getSizeInventory(); for (int slot = 0; slot < aSize; slot++) { @@ -87,7 +89,14 @@ public class InventoryUtils { if (mInventory[j] != null && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) { GT_Utility.moveStackFromSlotAToSlotB( - aBaseMetaTileEntity, aBaseMetaTileEntity, j, i, (byte) 64, (byte) 1, (byte) 64, (byte) 1); + aBaseMetaTileEntity, + aBaseMetaTileEntity, + j, + i, + (byte) 64, + (byte) 1, + (byte) 64, + (byte) 1); } } } diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/ItemUtils.java index cb79bf12dd..13e88ab30f 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -1,5 +1,25 @@ package gtPlusPlus.core.util.minecraft; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.minecraft.block.Block; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentData; +import net.minecraft.init.Items; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; import gregtech.api.enums.GT_Values; @@ -35,24 +55,6 @@ import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import net.minecraft.block.Block; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentData; -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; -import net.minecraft.item.Item.ToolMaterial; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; public class ItemUtils { @@ -136,8 +138,8 @@ public class ItemUtils { return temp != null ? temp : null; } - public static void getItemForOreDict( - final String FQRN, final String oreDictName, final String itemName, final int meta) { + public static void getItemForOreDict(final String FQRN, final String oreDictName, final String itemName, + final int meta) { try { Item em = null; final Item em1 = getItemFromFQRN(FQRN); @@ -151,9 +153,8 @@ public class ItemUtils { GT_OreDictUnificator.registerOre(oreDictName, metaStack); /* - * ItemStack itemStackWithMeta = new ItemStack(em,1,meta); - * GT_OreDictUnificator.registerOre(oreDictName, new - * ItemStack(itemStackWithMeta.getItem())); + * ItemStack itemStackWithMeta = new ItemStack(em,1,meta); GT_OreDictUnificator.registerOre(oreDictName, + * new ItemStack(itemStackWithMeta.getItem())); */ } } catch (final NullPointerException e) { @@ -176,8 +177,8 @@ public class ItemUtils { addItemToOreDictionary(stack, oreDictName, false); } - public static ItemStack getItemStackWithMeta( - final boolean MOD, final String FQRN, final String itemName, final int meta, final 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; @@ -281,14 +282,14 @@ public class ItemUtils { } public static Item getItemFromFQRN(final String fqrn) // fqrn = fully qualified resource name - { + { final String[] fqrnSplit = fqrn.split(":"); return GameRegistry.findItem(fqrnSplit[0], fqrnSplit[1]); } - public static ItemStack getItemStackFromFQRN( - final String fqrn, final int Size) // fqrn = fully qualified resource name - { + public static ItemStack getItemStackFromFQRN(final String fqrn, final int Size) // fqrn = fully qualified resource + // name + { Logger.INFO("Trying to split string '" + fqrn + "'."); final String[] fqrnSplit = fqrn.split(":"); if (fqrnSplit.length < 2) { @@ -311,8 +312,8 @@ public class ItemUtils { return null; } - public static void generateSpawnEgg( - final String entityModID, final String parSpawnName, final int colourEgg, final int colourOverlay) { + 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"); @@ -332,7 +333,7 @@ public class ItemUtils { String mTemp = oredictName; if (oredictName.contains("-") || oredictName.contains("_")) { - mTemp = Utils.sanitizeString(mTemp, new char[] {'-', '_'}); + mTemp = Utils.sanitizeString(mTemp, new char[] { '-', '_' }); } else { mTemp = Utils.sanitizeString(mTemp); } @@ -379,7 +380,7 @@ public class ItemUtils { try { if (oredictName.contains("-") || oredictName.contains("_")) { - oredictName = Utils.sanitizeString(oredictName, new char[] {'-', '_'}); + oredictName = Utils.sanitizeString(oredictName, new char[] { '-', '_' }); } else { oredictName = Utils.sanitizeString(oredictName); } @@ -422,18 +423,17 @@ public class ItemUtils { } // NullFormula - public static Item[] generateSpecialUseDusts( - final String unlocalizedName, final String materialName, final int Colour) { + public static Item[] generateSpecialUseDusts(final String unlocalizedName, final String materialName, + final int Colour) { return generateSpecialUseDusts(unlocalizedName, materialName, "NullFormula", Colour); } - public static Item[] generateSpecialUseDusts( - final String unlocalizedName, final String materialName, String mChemForm, final int Colour) { + public static Item[] generateSpecialUseDusts(final String unlocalizedName, final String materialName, + String mChemForm, final int Colour) { final Item[] output = { - new BaseItemDustUnique("itemDust" + unlocalizedName, materialName, mChemForm, Colour, "Dust"), - new BaseItemDustUnique("itemDustSmall" + unlocalizedName, materialName, mChemForm, Colour, "Small"), - new BaseItemDustUnique("itemDustTiny" + unlocalizedName, materialName, mChemForm, Colour, "Tiny") - }; + new BaseItemDustUnique("itemDust" + unlocalizedName, materialName, mChemForm, Colour, "Dust"), + new BaseItemDustUnique("itemDustSmall" + unlocalizedName, materialName, mChemForm, Colour, "Small"), + new BaseItemDustUnique("itemDustTiny" + unlocalizedName, materialName, mChemForm, Colour, "Tiny") }; // Generate Shaped/Shapeless Recipes @@ -479,7 +479,16 @@ public class ItemUtils { if (ItemUtils.checkForInvalidItems(smallDust) && ItemUtils.checkForInvalidItems(normalDust)) { if (RecipeUtils.addShapedRecipe( - smallDust, smallDust, null, smallDust, smallDust, null, null, null, null, normalDust)) { + smallDust, + smallDust, + null, + smallDust, + smallDust, + null, + null, + null, + null, + normalDust)) { Logger.WARNING("4 Small dust to 1 Dust Recipe: " + materialName + " - Success"); } else { Logger.WARNING("4 Small dust to 1 Dust Recipe: " + materialName + " - Failed"); @@ -504,33 +513,32 @@ public class ItemUtils { return output; } - public static Item generateSpecialUsePlate( - final String internalName, final String displayName, final short[] rgb, final int radioactivity) { + public static Item generateSpecialUsePlate(final String internalName, final String displayName, final short[] rgb, + final int radioactivity) { return generateSpecialUsePlate( - internalName, displayName, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), radioactivity); + internalName, + displayName, + Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), + radioactivity); } - public static Item generateSpecialUsePlate( - final String internalName, - final String displayName, - final String mFormula, - final short[] rgb, - final int radioactivity) { + public static Item generateSpecialUsePlate(final String internalName, final String displayName, + final String mFormula, final short[] rgb, final int radioactivity) { return generateSpecialUsePlate( - internalName, displayName, mFormula, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), radioactivity); + internalName, + displayName, + mFormula, + Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), + radioactivity); } - public static Item generateSpecialUsePlate( - final String internalName, final String displayName, final int rgb, final int radioactivity) { + public static Item generateSpecialUsePlate(final String internalName, final String displayName, final int rgb, + final int radioactivity) { return new BaseItemPlate_OLD(internalName, displayName, rgb, radioactivity); } - public static Item generateSpecialUsePlate( - final String internalName, - final String displayName, - final String mFormula, - final int rgb, - final int radioactivity) { + public static Item generateSpecialUsePlate(final String internalName, final String displayName, + final String mFormula, final int rgb, final int radioactivity) { return new BaseItemPlate_OLD(internalName, displayName, mFormula, rgb, radioactivity); } @@ -538,8 +546,8 @@ public class ItemUtils { return generateSpecialUseDusts(material, onlyLargeDust, false); } - public static Item[] generateSpecialUseDusts( - final Material material, final boolean onlyLargeDust, final boolean disableExtraRecipes) { + public static Item[] generateSpecialUseDusts(final Material material, final boolean onlyLargeDust, + final boolean disableExtraRecipes) { final String materialName = material.getLocalizedName(); final String unlocalizedName = Utils.sanitizeString(materialName); final int Colour = material.getRgbAsHex(); @@ -548,23 +556,26 @@ public class ItemUtils { Item[] output = null; if (onlyLargeDust == false) { output = new Item[] { - new BaseItemDustUnique( - "itemDust" + unlocalizedName, materialName, isChemFormvalid ? aChemForm : "", Colour, "Dust"), - new BaseItemDustUnique( - "itemDustSmall" + unlocalizedName, - materialName, - isChemFormvalid ? aChemForm : "", - Colour, - "Small"), - new BaseItemDustUnique( - "itemDustTiny" + unlocalizedName, - materialName, - isChemFormvalid ? aChemForm : "", - Colour, - "Tiny") - }; + new BaseItemDustUnique( + "itemDust" + unlocalizedName, + materialName, + isChemFormvalid ? aChemForm : "", + Colour, + "Dust"), + new BaseItemDustUnique( + "itemDustSmall" + unlocalizedName, + materialName, + isChemFormvalid ? aChemForm : "", + Colour, + "Small"), + new BaseItemDustUnique( + "itemDustTiny" + unlocalizedName, + materialName, + isChemFormvalid ? aChemForm : "", + Colour, + "Tiny") }; } else { - output = new Item[] {new BaseItemDustUnique("itemDust" + unlocalizedName, materialName, Colour, "Dust")}; + output = new Item[] { new BaseItemDustUnique("itemDust" + unlocalizedName, materialName, Colour, "Dust") }; } new RecipeGen_DustGeneration(material, disableExtraRecipes); @@ -596,13 +607,8 @@ public class ItemUtils { null); } - public static MultiPickaxeBase generateMultiPick( - final boolean GT_Durability, - final ToolMaterial customMaterial, - final String name, - final int durability, - final short[] rgba, - final 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) { Logger.WARNING("Generating a Multi-Pick out of " + name); final short[] rgb = rgba; int dur = customMaterial.getMaxUses(); @@ -612,8 +618,11 @@ public class ItemUtils { Logger.WARNING("Using gregtech durability value, " + name + " is now " + dur + "."); } else if (dur <= 0) { dur = durability; - Logger.WARNING("Determined durability too low, " + name + " is now " + dur - + " based on the GT material durability."); + Logger.WARNING( + "Determined durability too low, " + name + + " is now " + + dur + + " based on the GT material durability."); } if (dur <= 0) { Logger.WARNING("Still too low, " + name + " will now go unused."); @@ -630,7 +639,11 @@ public class ItemUtils { } final MultiPickaxeBase MP_Redstone = new MultiPickaxeBase( - name + " Multipick", (customMaterial), dur, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), enchantment); + name + " Multipick", + (customMaterial), + dur, + Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), + enchantment); if (MP_Redstone.isValid) { return MP_Redstone; @@ -642,21 +655,25 @@ public class ItemUtils { 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); + GT_Durability, + customMaterial, + material.mDefaultLocalName, + material.mDurability, + material.mRGBa); } public static MultiSpadeBase generateMultiShovel(final Material material) { final ToolMaterial customMaterial = Utils.generateToolMaterial(material); return generateMultiShovel( - true, customMaterial, material.getLocalizedName(), (int) material.vDurability, material.getRGBA()); + true, + customMaterial, + material.getLocalizedName(), + (int) material.vDurability, + material.getRGBA()); } - public static MultiSpadeBase generateMultiShovel( - final boolean GT_Durability, - final ToolMaterial customMaterial, - final String name, - final int durability, - final short[] rgba) { + public static MultiSpadeBase generateMultiShovel(final boolean GT_Durability, final ToolMaterial customMaterial, + final String name, final int durability, final short[] rgba) { Logger.WARNING("Generating a Multi-Spade out of " + name); final short[] rgb = rgba; int dur = customMaterial.getMaxUses(); @@ -666,15 +683,21 @@ public class ItemUtils { Logger.WARNING("Using gregtech durability value, " + name + " is now " + dur + "."); } else if (dur <= 0) { dur = durability; - Logger.WARNING("Determined durability too low, " + name + " is now " + dur - + " based on the GT material durability."); + Logger.WARNING( + "Determined durability too low, " + name + + " is now " + + dur + + " based on the GT material durability."); } if (dur <= 0) { Logger.WARNING("Still too low, " + name + " will now go unused."); return null; } final MultiSpadeBase MP_Redstone = new MultiSpadeBase( - name + " Multispade", (customMaterial), dur, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2])); + name + " Multispade", + (customMaterial), + dur, + Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2])); if (MP_Redstone.isValid) { return MP_Redstone; @@ -849,7 +872,11 @@ public class ItemUtils { public static ItemStack getGregtechCircuit(final int Meta) { return ItemUtils.getItemStackWithMeta( - LoadedMods.Gregtech, "gregtech:gt.integrated_circuit", "Gregtech Circuit", Meta, 0); + LoadedMods.Gregtech, + "gregtech:gt.integrated_circuit", + "Gregtech Circuit", + Meta, + 0); } public static ItemStack[] getBlockDrops(final ArrayList blockDrops) { @@ -1024,7 +1051,7 @@ public class ItemUtils { } public static boolean checkForInvalidItems(ItemStack mInput) { - return checkForInvalidItems(new ItemStack[] {mInput}); + return checkForInvalidItems(new ItemStack[] { mInput }); } public static boolean checkForInvalidItems(ItemStack[] mInput) { @@ -1034,8 +1061,7 @@ public class ItemUtils { /** * * @param mInputs - * @return {@link Boolean} - True if {@link ItemStack}[] only contains valid - * items. + * @return {@link Boolean} - True if {@link ItemStack}[] only contains valid items. */ public static boolean checkForInvalidItems(ItemStack[] mInputs, ItemStack[] mOutputs) { if (mInputs == null || mOutputs == null) { @@ -1051,10 +1077,10 @@ public class ItemUtils { return false; } else if (stack.getItem() == ModItems.ZZZ_Empty || stack.getItem().getClass() == ModItems.ZZZ_Empty.getClass()) { - return false; - } else { - continue; - } + return false; + } else { + continue; + } } else { continue; } @@ -1072,10 +1098,10 @@ public class ItemUtils { return false; } else if (stack.getItem() == ModItems.ZZZ_Empty || stack.getItem().getClass() == ModItems.ZZZ_Empty.getClass()) { - return false; - } else { - continue; - } + return false; + } else { + continue; + } } else { continue; } @@ -1105,9 +1131,8 @@ public class ItemUtils { } /* - for (int o = 0; o < aInputInventory.getSizeInventory(); o++) { - aTemp.setInventorySlotContents(o, g[o]); - }*/ + * for (int o = 0; o < aInputInventory.getSizeInventory(); o++) { aTemp.setInventorySlotContents(o, g[o]); } + */ return aTemp; } @@ -1121,7 +1146,7 @@ public class ItemUtils { for (int i = 0; i < aInvSize; i++) { for (int i2 = 0; i2 < aInvSize; i2++) { if (i != i2) { - ItemStack[] t1 = new ItemStack[] {aInputs[i], aInputs[i2]}; + ItemStack[] t1 = new ItemStack[] { aInputs[i], aInputs[i2] }; if (t1[0] == null || t1[1] == null) { continue; } else if (!GT_Utility.areStacksEqual(t1[0], t1[1])) { @@ -1174,10 +1199,8 @@ public class ItemUtils { } String aDisplay = null; try { - aDisplay = ("" - + StatCollector.translateToLocal( - aStack.getItem().getUnlocalizedNameInefficiently(aStack) + ".name")) - .trim(); + aDisplay = ("" + StatCollector + .translateToLocal(aStack.getItem().getUnlocalizedNameInefficiently(aStack) + ".name")).trim(); if (aStack.hasTagCompound()) { if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("display", 10)) { NBTTagCompound nbttagcompound = aStack.stackTagCompound.getCompoundTag("display"); @@ -1221,8 +1244,7 @@ public class ItemUtils { final Item mItem = aStack.getItem(); final Item aSkookum = ItemUtils.getItemFromFQRN("miscutils:gt.plusplus.metatool.01"); final Class aSkookClass = aSkookum.getClass(); - if (aSkookClass.isInstance(mItem) - || mItem instanceof GT_MetaGenerated_Tool_01 + if (aSkookClass.isInstance(mItem) || mItem instanceof GT_MetaGenerated_Tool_01 || mItem instanceof MetaGeneratedGregtechTools || mItem instanceof Gregtech_MetaTool || mItem == aSkookum) { @@ -1232,12 +1254,10 @@ public class ItemUtils { } public static boolean isToolWrench(ItemStack aWrench) { - if (isItemGregtechTool(aWrench) - && (aWrench.getItemDamage() == 16 - || aWrench.getItemDamage() == 120 - || aWrench.getItemDamage() == 122 - || aWrench.getItemDamage() == 124 - || aWrench.getItemDamage() == 7734)) { + if (isItemGregtechTool(aWrench) && (aWrench.getItemDamage() == 16 || aWrench.getItemDamage() == 120 + || aWrench.getItemDamage() == 122 + || aWrench.getItemDamage() == 124 + || aWrench.getItemDamage() == 7734)) { return true; } return false; @@ -1344,8 +1364,7 @@ public class ItemUtils { public static boolean isControlCircuit(ItemStack aStack) { if (aStack != null) { Item aItem = aStack.getItem(); - if (aItem == CI.getNumberedBioCircuit(0).getItem() - || aItem == CI.getNumberedCircuit(0).getItem() + if (aItem == CI.getNumberedBioCircuit(0).getItem() || aItem == CI.getNumberedCircuit(0).getItem() || aItem == CI.getNumberedAdvancedCircuit(0).getItem()) { return true; } diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/LangUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/LangUtils.java index 8517d129b2..fc728960fd 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/LangUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/LangUtils.java @@ -1,19 +1,21 @@ package gtPlusPlus.core.util.minecraft; -import cpw.mods.fml.common.registry.LanguageRegistry; -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; import java.util.Properties; + import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; +import cpw.mods.fml.common.registry.LanguageRegistry; +import gregtech.api.util.GT_LanguageManager; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.reflect.ReflectionUtils; + public class LangUtils { public static boolean rewriteEntryForLanguageRegistry(String aKey, String aNewValue) { @@ -89,10 +91,9 @@ public class LangUtils { mLocaleCache.remove(mCacheKey); String mNew; try { - mNew = ("" - + StatCollector.translateToLocal( - aStack.getItem().getUnlocalizedNameInefficiently(aStack) + ".name")) - .trim(); + mNew = ("" + StatCollector + .translateToLocal(aStack.getItem().getUnlocalizedNameInefficiently(aStack) + ".name")) + .trim(); if (aStack.hasTagCompound()) { if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("display", 10)) { NBTTagCompound nbttagcompound = aStack.stackTagCompound.getCompoundTag("display"); @@ -115,13 +116,11 @@ public class LangUtils { Logger.INFO("Cached New Value. UnlocalName: " + unlocalizedName); String blockName = StatCollector.translateToLocal(unlocalizedName + ".name"); Logger.INFO("Cached New Value. TranslatedName: " + unlocalizedName); - if (blockName.toLowerCase().contains(".name") - || blockName.toLowerCase().contains("|")) { + if (blockName.toLowerCase().contains(".name") || blockName.toLowerCase().contains("|")) { try { - blockName = ("" - + StatCollector.translateToLocal( - aStack.getItem().getUnlocalizedNameInefficiently(aStack) + ".name")) - .trim(); + blockName = ("" + StatCollector + .translateToLocal(aStack.getItem().getUnlocalizedNameInefficiently(aStack) + ".name")) + .trim(); if (aStack.hasTagCompound()) { if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("display", 10)) { NBTTagCompound nbttagcompound = aStack.stackTagCompound.getCompoundTag("display"); diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/MaterialUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/MaterialUtils.java index 3d42bcda84..daabb97b69 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/MaterialUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/MaterialUtils.java @@ -1,5 +1,10 @@ package gtPlusPlus.core.util.minecraft; +import java.util.*; + +import net.minecraft.item.*; +import net.minecraftforge.oredict.OreDictionary; + import gregtech.api.enums.*; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; @@ -17,44 +22,16 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.data.*; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; -import java.util.*; -import net.minecraft.item.*; -import net.minecraftforge.oredict.OreDictionary; public class MaterialUtils { public static short firstID = 791; - @SuppressWarnings({"rawtypes", "unused"}) - private static Class[][] commonTypes = { - { - Materials.class, - int.class, - TextureSet.class, - float.class, - int.class, - int.class, - int.class, - int.class, - int.class, - int.class, - int.class, - String.class, - int.class, - int.class, - int.class, - int.class, - boolean.class, - boolean.class, - int.class, - int.class, - int.class, - Dyes.class, - int.class, - List.class, - List.class - } - }; + @SuppressWarnings({ "rawtypes", "unused" }) + private static Class[][] commonTypes = { { Materials.class, int.class, TextureSet.class, float.class, int.class, + int.class, int.class, int.class, int.class, int.class, int.class, String.class, int.class, int.class, + int.class, int.class, boolean.class, boolean.class, int.class, int.class, int.class, Dyes.class, int.class, + List.class, List.class } }; public static List oreDictValuesForEntry(final String oredictName) { List oredictItemNames; @@ -80,8 +57,8 @@ public class MaterialUtils { return generateMaterialFromGtENUM(material, customRGB, null); } - public static Material generateMaterialFromGtENUM( - final Materials material, short[] customRGB, TextureSet aCustomTextures) { + public static Material generateMaterialFromGtENUM(final Materials material, short[] customRGB, + TextureSet aCustomTextures) { String aMaterialKey = getMaterialName(material).toLowerCase(); if (mGeneratedMaterialMap.containsKey(aMaterialKey)) { return mGeneratedMaterialMap.get(aMaterialKey); @@ -153,10 +130,9 @@ public class MaterialUtils { Logger.MATERIALS("[Debug] State set as gas."); materialState = MaterialState.GAS; } /* - else if (material.getPlasma(1) != null){ - Logger.MATERIALS("[Debug] State set as plasma."); - materialState = MaterialState.PLASMA; - }*/ else { + * else if (material.getPlasma(1) != null){ Logger.MATERIALS("[Debug] State set as plasma."); + * materialState = MaterialState.PLASMA; } + */ else { Logger.MATERIALS( "[Debug] State set as solid. This material has no alternative states, so for safety we wont generate anything."); materialState = MaterialState.SOLID; @@ -167,10 +143,8 @@ public class MaterialUtils { final String tempname = name.substring(7, name.length()); name = "Infused " + tempname; } - if (hasValidRGBA(rgba) - || (element == Element.H) - || ((material == Materials.InfusedAir) - || (material == Materials.InfusedFire) + if (hasValidRGBA(rgba) || (element == Element.H) + || ((material == Materials.InfusedAir) || (material == Materials.InfusedFire) || (material == Materials.InfusedEarth) || (material == Materials.InfusedWater))) { // ModItems.itemBaseDecidust = UtilsItems.generateDecidust(material); @@ -193,8 +167,10 @@ public class MaterialUtils { mGeneratedMaterialMap.put(aMaterialKey, M); return M; } else { - Logger.DEBUG_MATERIALS("Failed to generate GT++ material instance for " + material.name() - + " | Valid RGB? " + (hasValidRGBA(rgba))); + Logger.DEBUG_MATERIALS( + "Failed to generate GT++ material instance for " + material.name() + + " | Valid RGB? " + + (hasValidRGBA(rgba))); } } catch (Throwable t) { Logger.DEBUG_MATERIALS("Failed to generate GT++ material instance for " + material.name()); @@ -203,11 +179,8 @@ public class MaterialUtils { return null; } - public static Material generateQuickMaterial( - final String materialName, - final MaterialState defaultState, - final short[] colour, - final int sRadioactivity) { + public static Material generateQuickMaterial(final String materialName, final MaterialState defaultState, + final short[] colour, final int sRadioactivity) { String aMaterialKey = materialName.toLowerCase(); if (mGeneratedMaterialMap.containsKey(aMaterialKey)) { return mGeneratedMaterialMap.get(aMaterialKey); @@ -239,39 +212,15 @@ public class MaterialUtils { return aMeltingPoint < 1000 ? 0 : (MathUtils.roundToClosestInt(aMeltingPoint / 1000f)); - /*if ((aMeltingPoint >= 0) && (aMeltingPoint <= 1000)){ - return 1; - } - else if((aMeltingPoint >= 1001) && (aMeltingPoint <= 2000)){ - return 2; - } - else if((aMeltingPoint >= 2001) && (aMeltingPoint <= 3000)){ - return 3; - } - else if((aMeltingPoint >= 3001) && (aMeltingPoint <= 4000)){ - return 4; - } - else if((aMeltingPoint >= 4001) && (aMeltingPoint <= 5000)){ - return 5; - } - else if((aMeltingPoint >= 5001) && (aMeltingPoint <= 6000)){ - return 6; - } - else if((aMeltingPoint >= 6001) && (aMeltingPoint <= 7000)){ - return 7; - } - else if((aMeltingPoint >= 7001) && (aMeltingPoint <= 8000)){ - return 8; - } - else if((aMeltingPoint >= 8001) && (aMeltingPoint <= 9000)){ - return 9; - } - else if((aMeltingPoint >= 9001) && (aMeltingPoint <= 9999)){ - return 10; - } - else { - return 0; - }*/ + /* + * if ((aMeltingPoint >= 0) && (aMeltingPoint <= 1000)){ return 1; } else if((aMeltingPoint >= 1001) && + * (aMeltingPoint <= 2000)){ return 2; } else if((aMeltingPoint >= 2001) && (aMeltingPoint <= 3000)){ return 3; + * } else if((aMeltingPoint >= 3001) && (aMeltingPoint <= 4000)){ return 4; } else if((aMeltingPoint >= 4001) && + * (aMeltingPoint <= 5000)){ return 5; } else if((aMeltingPoint >= 5001) && (aMeltingPoint <= 6000)){ return 6; + * } else if((aMeltingPoint >= 6001) && (aMeltingPoint <= 7000)){ return 7; } else if((aMeltingPoint >= 7001) && + * (aMeltingPoint <= 8000)){ return 8; } else if((aMeltingPoint >= 8001) && (aMeltingPoint <= 9000)){ return 9; + * } else if((aMeltingPoint >= 9001) && (aMeltingPoint <= 9999)){ return 10; } else { return 0; } + */ } public static int getVoltageForTier(int aTier) { @@ -312,10 +261,9 @@ public class MaterialUtils { return Integer.MAX_VALUE; } - /*else { - int newTier = aTier - 1; - return (int) ((4*(Math.pow(4, newTier)))*7.5); - }*/ + /* + * else { int newTier = aTier - 1; return (int) ((4*(Math.pow(4, newTier)))*7.5); } + */ } private static Materials getMaterialByName(String materialName) { @@ -338,14 +286,11 @@ public class MaterialUtils { String mName = null; try { - mName = (String) ReflectionUtils.getField(Materials.class, "mDefaultLocalName") - .get(mat); + mName = (String) ReflectionUtils.getField(Materials.class, "mDefaultLocalName").get(mat); if (mName == null) { - mName = (String) - ReflectionUtils.getField(Materials.class, "mName").get(mat); + mName = (String) ReflectionUtils.getField(Materials.class, "mName").get(mat); } - } catch (IllegalArgumentException | IllegalAccessException e) { - } + } catch (IllegalArgumentException | IllegalAccessException e) {} if (mName == null || mName.equals("")) { mName = mat.name(); @@ -365,9 +310,12 @@ public class MaterialUtils { } } return aCounter.getResults(); - /*Optional r = list.stream().map(Material::getTextureSet).collect(Collectors.groupingBy(Function.identity(), Collectors.counting())).entrySet().stream().max(Map.Entry.comparingByValue()).map(Map.Entry::getKey); - TextureSet o = (r != null && r.isPresent() && r.get() != null) ? r.get() : null; - return o;*/ + /* + * Optional r = + * list.stream().map(Material::getTextureSet).collect(Collectors.groupingBy(Function.identity(), + * Collectors.counting())).entrySet().stream().max(Map.Entry.comparingByValue()).map(Map.Entry::getKey); + * TextureSet o = (r != null && r.isPresent() && r.get() != null) ? r.get() : null; return o; + */ } public static Materials getMaterial(String aMaterialName, String aFallbackMaterialName) { @@ -376,8 +324,11 @@ public class MaterialUtils { g = getMaterial(aFallbackMaterialName); } if (g == null) { - Logger.INFO("Failed finding material '" + aMaterialName + "' & fallback '" + aFallbackMaterialName - + "', returning _NULL."); + Logger.INFO( + "Failed finding material '" + aMaterialName + + "' & fallback '" + + aFallbackMaterialName + + "', returning _NULL."); CORE.crash(); // g = Materials._NULL; } @@ -399,49 +350,14 @@ public class MaterialUtils { public static AutoMap getCompoundMaterialsRecursively(Material aMat) { return getCompoundMaterialsRecursively_Speiger(aMat); /* - AutoMap aDataSet = new AutoMap(); - final int HARD_LIMIT = 1000; - int mLoopCounter = 0; - if (aMat.getComposites().size() > 0) { - try { - List xList = Lists.newLinkedList(); - for (MaterialStack kj : aMat.getComposites()) { - xList.add(kj.getStackMaterial()); - } - if (xList.isEmpty()) { - aDataSet.put(aMat); - return aDataSet; - } - ListIterator listIterator = xList.listIterator(); - while(listIterator.hasNext()){ - Material e = listIterator.next(); - listIterator.remove(); - if (mLoopCounter > HARD_LIMIT) { - break; - } - - if (e.getComposites().isEmpty()) { - aDataSet.put(e); - } - else { - for (MaterialStack x : e.getComposites()) { - listIterator.add(x.getStackMaterial()); - } - } - mLoopCounter++; - - - }} - catch (Throwable t) { - aDataSet.put(aMat); - t.printStackTrace(); - } - } - if (aDataSet.isEmpty()) { - aDataSet.put(aMat); - return aDataSet; - } - return aDataSet; + * AutoMap aDataSet = new AutoMap(); final int HARD_LIMIT = 1000; int mLoopCounter = 0; if + * (aMat.getComposites().size() > 0) { try { List xList = Lists.newLinkedList(); for (MaterialStack kj + * : aMat.getComposites()) { xList.add(kj.getStackMaterial()); } if (xList.isEmpty()) { aDataSet.put(aMat); + * return aDataSet; } ListIterator listIterator = xList.listIterator(); while(listIterator.hasNext()){ + * Material e = listIterator.next(); listIterator.remove(); if (mLoopCounter > HARD_LIMIT) { break; } if + * (e.getComposites().isEmpty()) { aDataSet.put(e); } else { for (MaterialStack x : e.getComposites()) { + * listIterator.add(x.getStackMaterial()); } } mLoopCounter++; }} catch (Throwable t) { aDataSet.put(aMat); + * t.printStackTrace(); } } if (aDataSet.isEmpty()) { aDataSet.put(aMat); return aDataSet; } return aDataSet; */ } public static AutoMap getCompoundMaterialsRecursively_Speiger(Material toSearch) { @@ -476,8 +392,8 @@ public class MaterialUtils { generateComponentAndAssignToAMaterial(aType, aMaterial, true); } - public static void generateComponentAndAssignToAMaterial( - ComponentTypes aType, Material aMaterial, boolean generateRecipes) { + public static void generateComponentAndAssignToAMaterial(ComponentTypes aType, Material aMaterial, + boolean generateRecipes) { Item aGC; if (aType == ComponentTypes.PLATEHEAVY) { aGC = new BaseItemPlateHeavy(aMaterial); @@ -530,8 +446,7 @@ public class MaterialUtils { } public static boolean isNullGregtechMaterial(Materials aGregtechMaterial) { - if (aGregtechMaterial == Materials._NULL - || aGregtechMaterial.equals(Materials._NULL) + if (aGregtechMaterial == Materials._NULL || aGregtechMaterial.equals(Materials._NULL) || aGregtechMaterial.name().equals(Materials._NULL.name())) { return true; } diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/MiningUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/MiningUtils.java index cdfe1e5076..22469c0387 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/MiningUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/MiningUtils.java @@ -1,14 +1,16 @@ package gtPlusPlus.core.util.minecraft; -import gregtech.common.GT_Worldgen_GT_Ore_Layer; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import java.util.HashMap; + import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; +import gregtech.common.GT_Worldgen_GT_Ore_Layer; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.util.reflect.ReflectionUtils; + public class MiningUtils { public static Boolean canPickaxeBlock(final Block currentBlock, final World currentWorld) { @@ -31,8 +33,7 @@ public class MiningUtils { try { final Block block = world.getBlock(X, Y, Z); if (canPickaxeBlock(block, world)) { - if ((block != Blocks.bedrock) - && (block.getBlockHardness(world, X, Y, Z) != -1) + if ((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)) { @@ -140,9 +141,8 @@ public class MiningUtils { for (GT_Worldgen_GT_Ore_Layer h : g) { try { - aTextWorldGen = - (String) ReflectionUtils.getField(GT_Worldgen_GT_Ore_Layer.class, "aTextWorldgen") - .get(h); + aTextWorldGen = (String) ReflectionUtils + .getField(GT_Worldgen_GT_Ore_Layer.class, "aTextWorldgen").get(h); } catch (IllegalArgumentException | IllegalAccessException e) { aTextWorldGen = h.mWorldGenName; } @@ -174,38 +174,31 @@ public class MiningUtils { if (ReflectionUtils.getClass("micdoodle8.mods.galacticraft.core.util.ConfigManagerCore") != null && mMoonID == -99) { mMoonID = ReflectionUtils.getField( - ReflectionUtils.getClass("micdoodle8.mods.galacticraft.core.util.ConfigManagerCore"), - "idDimensionMoon") - .getInt(null); + ReflectionUtils.getClass("micdoodle8.mods.galacticraft.core.util.ConfigManagerCore"), + "idDimensionMoon").getInt(null); } - } catch (IllegalArgumentException | IllegalAccessException e) { - } + } catch (IllegalArgumentException | IllegalAccessException e) {} // Gets Mars ID try { if (ReflectionUtils.getClass("micdoodle8.mods.galacticraft.planets.mars.ConfigManagerMars") != null && mMarsID == -99) { mMarsID = ReflectionUtils.getField( - ReflectionUtils.getClass("micdoodle8.mods.galacticraft.planets.mars.ConfigManagerMars"), - "dimensionIDMars") - .getInt(null); + ReflectionUtils.getClass("micdoodle8.mods.galacticraft.planets.mars.ConfigManagerMars"), + "dimensionIDMars").getInt(null); } - } catch (IllegalArgumentException | IllegalAccessException e) { - } + } catch (IllegalArgumentException | IllegalAccessException e) {} // Get Comets ID try { if (ReflectionUtils.getClass("micdoodle8.mods.galacticraft.planets.asteroids.ConfigManagerAsteroids") - != null - && mCometsID == -99) { + != null && mCometsID == -99) { mCometsID = ReflectionUtils.getField( - ReflectionUtils.getClass( - "micdoodle8.mods.galacticraft.planets.asteroids.ConfigManagerAsteroids"), - "dimensionIDAsteroids") - .getInt(null); + ReflectionUtils + .getClass("micdoodle8.mods.galacticraft.planets.asteroids.ConfigManagerAsteroids"), + "dimensionIDAsteroids").getInt(null); } - } catch (IllegalArgumentException | IllegalAccessException e) { - } + } catch (IllegalArgumentException | IllegalAccessException e) {} // Clear Cache Ores_Overworld.clear(); @@ -235,18 +228,10 @@ public class MiningUtils { if (x.mOverworld || x.mNether || (x.mEnd || aEndAsteroids)) { continue; } - /*if (x.mMoon) { - Ores_Moon.put(x); - continue; - } - if (x.mMars) { - Ores_Mars.put(x); - continue; - } - if (x.mAsteroid) { - Ores_Comets.put(x); - continue; - }*/ + /* + * if (x.mMoon) { Ores_Moon.put(x); continue; } if (x.mMars) { Ores_Mars.put(x); continue; } if + * (x.mAsteroid) { Ores_Comets.put(x); continue; } + */ Ores_Misc.put(x); continue; } else { diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/ModularArmourUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/ModularArmourUtils.java index c4eb8cff64..a806a9a80c 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/ModularArmourUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/ModularArmourUtils.java @@ -1,11 +1,12 @@ package gtPlusPlus.core.util.minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + import baubles.api.BaubleType; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.Pair; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; public class ModularArmourUtils { @@ -18,12 +19,14 @@ public class ModularArmourUtils { } public static enum Modifiers { + BOOST_HP("skill.hpboost"), BOOST_DEF("skill.defenceboost"), BOOST_SPEED("skill.speedboost"), BOOST_MINING("skill.miningboost"), BOOST_DAMAGE("skill.damageboost"), BOOST_HOLY("skill.holyboost"); + private String MODIFIER_NAME; private Modifiers(final String mModifier) { @@ -43,9 +46,11 @@ public class ModularArmourUtils { } public static enum BT { + TYPE_AMULET(BaubleType.AMULET, 0), TYPE_RING(BaubleType.RING, 1), TYPE_BELT(BaubleType.BELT, 2); + private final BaubleType mType; private final int mID; private final String mBaubleType; diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/NBTUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/NBTUtils.java index c235cd0e0b..9bedcf1539 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/NBTUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/NBTUtils.java @@ -2,18 +2,20 @@ package gtPlusPlus.core.util.minecraft; import static gtPlusPlus.core.item.ModItems.ZZZ_Empty; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import java.util.HashMap; import java.util.Map; + import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.reflect.ReflectionUtils; + public class NBTUtils { public static NBTTagCompound getNBT(ItemStack aStack) { @@ -120,8 +122,7 @@ public class NBTUtils { if (copyTags) { for (int i = 0; i < stored.length; i++) { if (stored[i] != null && stored[i].hasTagCompound()) { - rStack.setTagCompound( - (NBTTagCompound) stored[i].getTagCompound().copy()); + rStack.setTagCompound((NBTTagCompound) stored[i].getTagCompound().copy()); break; } } @@ -131,13 +132,12 @@ public class NBTUtils { if (rNBT == null) rNBT = new NBTTagCompound(); for (int i = 0; i < 9; i++) { ItemStack tStack = stored[i]; - if (tStack != null - && GT_Utility.getContainerItem(tStack, true) == null + if (tStack != null && GT_Utility.getContainerItem(tStack, true) == null && !(tStack.getItem() instanceof GT_MetaGenerated_Tool)) { tStack = GT_Utility.copyAmount(1, tStack); if (GT_Utility.isStackValid(tStack)) { - GT_ModHandler.dischargeElectricItem( - tStack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false, true); + GT_ModHandler + .dischargeElectricItem(tStack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false, true); tNBT.setTag("Ingredient." + i, tStack.writeToNBT(new NBTTagCompound())); } } @@ -227,8 +227,7 @@ public class NBTUtils { } } } - } catch (Throwable t) { - } + } catch (Throwable t) {} return false; } @@ -518,32 +517,53 @@ public class NBTUtils { Map mInternalMap = ReflectionUtils.getField(aNBT, "tagMap"); if (mInternalMap != null) { for (Map.Entry e : mInternalMap.entrySet()) { - Logger.INFO("Key: " + e.getKey().toString() + " | Value: " - + e.getValue().toString()); + Logger.INFO("Key: " + e.getKey().toString() + " | Value: " + e.getValue().toString()); if (e.getValue().getClass() == String.class) { createStringTagCompound( - aStack, "mEntityTag", (String) e.getKey(), (String) e.getValue()); + aStack, + "mEntityTag", + (String) e.getKey(), + (String) e.getValue()); } else if (e.getValue().getClass() == Boolean.class || e.getValue().getClass() == boolean.class) { - createBooleanTagCompound( - aStack, "mEntityTag", (String) e.getKey(), (Boolean) e.getValue()); - } else if (e.getValue().getClass() == Integer.class - || e.getValue().getClass() == int.class) { - createIntegerTagCompound( - aStack, "mEntityTag", (String) e.getKey(), (Integer) e.getValue()); - } else if (e.getValue().getClass() == Double.class - || e.getValue().getClass() == double.class) { - createDoubleTagCompound( - aStack, "mEntityTag", (String) e.getKey(), (Double) e.getValue()); - } else if (e.getValue().getClass() == Long.class - || e.getValue().getClass() == long.class) { - createLongTagCompound(aStack, "mEntityTag", (String) e.getKey(), (Long) e.getValue()); - } else if (e.getValue().getClass() == Float.class - || e.getValue().getClass() == float.class) { - createFloatTagCompound(aStack, "mEntityTag", (String) e.getKey(), (Float) e.getValue()); - } else { - - } + createBooleanTagCompound( + aStack, + "mEntityTag", + (String) e.getKey(), + (Boolean) e.getValue()); + } else + if (e.getValue().getClass() == Integer.class || e.getValue().getClass() == int.class) { + createIntegerTagCompound( + aStack, + "mEntityTag", + (String) e.getKey(), + (Integer) e.getValue()); + } else if (e.getValue().getClass() == Double.class + || e.getValue().getClass() == double.class) { + createDoubleTagCompound( + aStack, + "mEntityTag", + (String) e.getKey(), + (Double) e.getValue()); + } else + if (e.getValue().getClass() == Long.class + || e.getValue().getClass() == long.class) { + createLongTagCompound( + aStack, + "mEntityTag", + (String) e.getKey(), + (Long) e.getValue()); + } else + if (e.getValue().getClass() == Float.class + || e.getValue().getClass() == float.class) { + createFloatTagCompound( + aStack, + "mEntityTag", + (String) e.getKey(), + (Float) e.getValue()); + } else { + + } } return true; } diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/OreDictUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/OreDictUtils.java index 359b336889..59f231b486 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/OreDictUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/OreDictUtils.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.util.minecraft; import java.util.List; + import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/PlayerUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/PlayerUtils.java index 038672c259..4ce4af0922 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/PlayerUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/PlayerUtils.java @@ -1,10 +1,7 @@ package gtPlusPlus.core.util.minecraft; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import java.util.*; + import net.minecraft.client.Minecraft; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -17,6 +14,11 @@ import net.minecraft.util.IChatComponent; import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; + public class PlayerUtils { public static final Map mCachedFakePlayers = new WeakHashMap(); @@ -42,9 +44,7 @@ public class PlayerUtils { try { final List i = new ArrayList<>(); final Iterator iterator = MinecraftServer.getServer() - .getConfigurationManager() - .playerEntityList - .iterator(); + .getConfigurationManager().playerEntityList.iterator(); while (iterator.hasNext()) { i.add((iterator.next())); } @@ -53,8 +53,7 @@ public class PlayerUtils { return temp; } } - } catch (final Throwable e) { - } + } catch (final Throwable e) {} return null; } @@ -81,8 +80,7 @@ public class PlayerUtils { return temp; } } - } catch (final NullPointerException e) { - } + } catch (final NullPointerException e) {} return null; } @@ -226,11 +224,9 @@ public class PlayerUtils { // Cache Fake Player if (aPlayer instanceof FakePlayer || (mThaumcraftFakePlayer != null && mThaumcraftFakePlayer.isInstance(aPlayer)) - || (aPlayer.getCommandSenderName() == null - || aPlayer.getCommandSenderName().length() <= 0) - || (aPlayer.isEntityInvulnerable() - && !aPlayer.canCommandSenderUseCommand(0, "") - && (aChunkLocation == null) + || (aPlayer.getCommandSenderName() == null || aPlayer.getCommandSenderName().length() <= 0) + || (aPlayer.isEntityInvulnerable() && !aPlayer.canCommandSenderUseCommand(0, "") + && (aChunkLocation == null) || (aChunkLocation.posX == 0 && aChunkLocation.posY == 0 && aChunkLocation.posZ == 0))) { mCachedFakePlayers.put(aPlayer.getUniqueID().toString(), aPlayer); } @@ -260,8 +256,7 @@ public class PlayerUtils { cacheFakePlayer(p); return false; } - if (p.isEntityInvulnerable() - && !p.canCommandSenderUseCommand(0, "") + if (p.isEntityInvulnerable() && !p.canCommandSenderUseCommand(0, "") && (aChunkLocation.posX == 0 && aChunkLocation.posY == 0 && aChunkLocation.posZ == 0)) { cacheFakePlayer(p); return false; diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/RecipeUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/RecipeUtils.java index ba55ce262a..294fea996e 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/RecipeUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/RecipeUtils.java @@ -1,5 +1,20 @@ package gtPlusPlus.core.util.minecraft; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.ShapelessRecipes; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; + import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.Materials; import gregtech.api.objects.ItemData; @@ -19,48 +34,24 @@ import gtPlusPlus.core.handler.Recipes.RegistrationHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.data.ArrayUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; public class RecipeUtils { + public static int mInvalidID = 1; - 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, - 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, ItemStack resultItem) { // Old Debug Code, useful for finding recipes loading too early. - /*if (gtPlusPlus.GTplusplus.CURRENT_LOAD_PHASE != GTplusplus.INIT_PHASE.POST_INIT) { - Logger.RECIPE(ReflectionUtils.getMethodName(1)); - Logger.RECIPE(ReflectionUtils.getMethodName(2)); - Logger.RECIPE(ReflectionUtils.getMethodName(3)); - Logger.RECIPE(ReflectionUtils.getMethodName(4)); - Logger.RECIPE(ReflectionUtils.getMethodName(5)); - Logger.RECIPE(ReflectionUtils.getMethodName(6)); - Logger.RECIPE(ReflectionUtils.getMethodName(7)); - Logger.RECIPE(ReflectionUtils.getMethodName(8)); - Logger.RECIPE(ReflectionUtils.getMethodName(9)); - FMLCommonHandler.instance().exitJava(1, true); - }*/ + /* + * if (gtPlusPlus.GTplusplus.CURRENT_LOAD_PHASE != GTplusplus.INIT_PHASE.POST_INIT) { + * Logger.RECIPE(ReflectionUtils.getMethodName(1)); Logger.RECIPE(ReflectionUtils.getMethodName(2)); + * Logger.RECIPE(ReflectionUtils.getMethodName(3)); Logger.RECIPE(ReflectionUtils.getMethodName(4)); + * Logger.RECIPE(ReflectionUtils.getMethodName(5)); Logger.RECIPE(ReflectionUtils.getMethodName(6)); + * Logger.RECIPE(ReflectionUtils.getMethodName(7)); Logger.RECIPE(ReflectionUtils.getMethodName(8)); + * Logger.RECIPE(ReflectionUtils.getMethodName(9)); FMLCommonHandler.instance().exitJava(1, true); } + */ if (resultItem == null) { Logger.RECIPE( @@ -69,8 +60,7 @@ public class RecipeUtils { resultItem.setItemDamage(mInvalidID++); RegistrationHandler.recipesFailed++; // return false; - } else if ((slot_1 == null) - && (slot_2 == null) + } else if ((slot_1 == null) && (slot_2 == null) && (slot_3 == null) && (slot_4 == null) && (slot_5 == null) @@ -78,16 +68,16 @@ public class RecipeUtils { && (slot_7 == null) && (slot_8 == null) && (slot_9 == null)) { - Logger.RECIPE("[Fix] Found a recipe with 0 inputs, yet had a valid output."); - Logger.RECIPE( - "[Fix] Error found while adding a recipe for: " + resultItem != null - ? resultItem.getDisplayName() - : "Bad Output Item" + " | Please report this issue on Github."); - RegistrationHandler.recipesFailed++; - return false; - } + Logger.RECIPE("[Fix] Found a recipe with 0 inputs, yet had a valid output."); + Logger.RECIPE( + "[Fix] Error found while adding a recipe for: " + resultItem != null + ? resultItem.getDisplayName() + : "Bad Output Item" + " | Please report this issue on Github."); + RegistrationHandler.recipesFailed++; + return false; + } - Object[] o = new Object[] {slot_1, slot_2, slot_3, slot_4, slot_5, slot_6, slot_7, slot_8, slot_9}; + Object[] o = new Object[] { slot_1, slot_2, slot_3, slot_4, slot_5, slot_6, slot_7, slot_8, slot_9 }; try { int size = COMPAT_HANDLER.mRecipesToGenerate.size(); @@ -108,8 +98,7 @@ public class RecipeUtils { // k.printStackTrace(); // k.getLocalizedMessage(); Logger.RECIPE( - "[Fix] Invalid Recipe detected for: " + resultItem != null - ? resultItem.getUnlocalizedName() + "[Fix] Invalid Recipe detected for: " + resultItem != null ? resultItem.getUnlocalizedName() : "INVALID OUTPUT ITEM"); if (!COMPAT_HANDLER.areInitItemsLoaded) { RegistrationHandler.recipesFailed++; @@ -120,17 +109,9 @@ public class RecipeUtils { } } - 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) { + 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(); final ArrayList validSlots = new ArrayList<>(); @@ -367,28 +348,17 @@ public class RecipeUtils { return false; } - public static boolean addShapedGregtechRecipeForTypes( - 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) { + public static boolean addShapedGregtechRecipeForTypes(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) { int using = 0, recipeSlotCurrent = 0; boolean[] hasMultiStack = new boolean[9]; - boolean inUse[] = {false, false, false}; + boolean inUse[] = { false, false, false }; ItemStack array[][] = new ItemStack[3][9]; - Object[] inputs = { - InputItem1, InputItem2, InputItem3, - InputItem4, InputItem5, InputItem6, - InputItem7, InputItem8, InputItem9 - }; + Object[] inputs = { InputItem1, InputItem2, InputItem3, InputItem4, InputItem5, InputItem6, InputItem7, + InputItem8, InputItem9 }; for (Object o : inputs) { if (o.getClass().isArray()) { @@ -418,27 +388,19 @@ public class RecipeUtils { return false; } - 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) { - - Object[] o = { - InputItem1, InputItem2, InputItem3, - InputItem4, InputItem5, InputItem6, - InputItem7, InputItem8, InputItem9 - }; + 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) { + + Object[] o = { InputItem1, InputItem2, InputItem3, InputItem4, InputItem5, InputItem6, InputItem7, InputItem8, + InputItem9 }; if (gtPlusPlus.GTplusplus.CURRENT_LOAD_PHASE != GTplusplus.INIT_PHASE.POST_INIT) { - CORE.crash("Load Phase " + gtPlusPlus.GTplusplus.CURRENT_LOAD_PHASE + " should be " - + GTplusplus.INIT_PHASE.POST_INIT + ". Unable to register recipe."); + CORE.crash( + "Load Phase " + gtPlusPlus.GTplusplus.CURRENT_LOAD_PHASE + + " should be " + + GTplusplus.INIT_PHASE.POST_INIT + + ". Unable to register recipe."); } int size = COMPAT_HANDLER.mGtRecipesToGenerate.size(); @@ -458,8 +420,11 @@ public class RecipeUtils { public static boolean addShapedGregtechRecipe(final Object[] inputs, ItemStack output) { if (inputs.length != 9) { - Logger.RECIPE("[Fix] Input array for " + output.getDisplayName() + " does not equal 9. " + inputs.length - + " is the actual size."); + Logger.RECIPE( + "[Fix] Input array for " + output.getDisplayName() + + " does not equal 9. " + + inputs.length + + " is the actual size."); RegistrationHandler.recipesFailed++; return false; } @@ -468,20 +433,20 @@ public class RecipeUtils { if (inputs[x] == null) { inputs[x] = " "; Logger.WARNING("Input slot " + x + " changed from NULL to a blank space."); - } else if (!(inputs[x] instanceof ItemStack) - && !(inputs[x] instanceof String) + } else if (!(inputs[x] instanceof ItemStack) && !(inputs[x] instanceof String) && !(inputs[x] instanceof Item)) { - if (output != null) { - Logger.RECIPE("[Fix] Invalid Item inserted into inputArray. Item:" + output.getDisplayName() - + " has a bad recipe. Please report to Alkalus."); - RegistrationHandler.recipesFailed++; - return false; - } else { - Logger.RECIPE("[Fix] Output is Null for a recipe. Report to Alkalus."); - output = ItemUtils.getItemStackOfAmountFromOreDict("sadibasdkjnad", 1); - RegistrationHandler.recipesFailed++; - } - } + if (output != null) { + Logger.RECIPE( + "[Fix] Invalid Item inserted into inputArray. Item:" + output.getDisplayName() + + " has a bad recipe. Please report to Alkalus."); + RegistrationHandler.recipesFailed++; + return false; + } else { + Logger.RECIPE("[Fix] Output is Null for a recipe. Report to Alkalus."); + output = ItemUtils.getItemStackOfAmountFromOreDict("sadibasdkjnad", 1); + RegistrationHandler.recipesFailed++; + } + } } int size = COMPAT_HANDLER.mGtRecipesToGenerate.size(); @@ -498,23 +463,12 @@ public class RecipeUtils { return false; } - public static boolean addShapelessGregtechRecipe( - 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) { - - Object[] inputItems = { - InputItem1, InputItem2, InputItem3, - InputItem4, InputItem5, InputItem6, - InputItem7, InputItem8, InputItem9 - }; + public static boolean addShapelessGregtechRecipe(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) { + + Object[] inputItems = { InputItem1, InputItem2, InputItem3, InputItem4, InputItem5, InputItem6, InputItem7, + InputItem8, InputItem9 }; return addShapelessGregtechRecipe(inputItems, OutputItem); } @@ -522,8 +476,9 @@ public class RecipeUtils { // Catch Invalid Recipes if (inputItems.length > 9 || inputItems.length < 1) { if (OutputItem != null) { - Logger.RECIPE("[Fix] Invalid input array for shapeless recipe, which should output " - + OutputItem.getDisplayName()); + Logger.RECIPE( + "[Fix] Invalid input array for shapeless recipe, which should output " + + OutputItem.getDisplayName()); } return false; } @@ -545,7 +500,16 @@ public class RecipeUtils { public static boolean generateMortarRecipe(ItemStack aStack, ItemStack aOutput) { return RecipeUtils.addShapedGregtechRecipe( - aStack, null, null, CI.craftingToolMortar, null, null, null, null, null, aOutput); + aStack, + null, + null, + CI.craftingToolMortar, + null, + null, + null, + null, + null, + aOutput); } public static boolean doesGregtechRecipeHaveEqualCells(GT_Recipe x) { @@ -591,6 +555,7 @@ public class RecipeUtils { } public static class InternalRecipeObject implements RunnableWithInfo { + final ItemStack mOutput; final ShapedOreRecipe mRecipe; public final boolean isValid; @@ -649,8 +614,7 @@ public class RecipeUtils { GameRegistry.addRecipe(mRecipe); } else { Logger.RECIPE( - "[Fix] Invalid shapped recipe outputting " + mOutput != null - ? mOutput.getDisplayName() + "[Fix] Invalid shapped recipe outputting " + mOutput != null ? mOutput.getDisplayName() : "Bad Output Item"); } } @@ -682,11 +646,8 @@ public class RecipeUtils { return removeRecipeByOutput(aOutput, true, false, false); } - public static boolean removeRecipeByOutput( - ItemStack aOutput, - boolean aIgnoreNBT, - boolean aNotRemoveShapelessRecipes, - boolean aOnlyRemoveNativeHandlers) { + public static boolean removeRecipeByOutput(ItemStack aOutput, boolean aIgnoreNBT, + boolean aNotRemoveShapelessRecipes, boolean aOnlyRemoveNativeHandlers) { if (aOutput == null) { return false; } else { @@ -700,14 +661,14 @@ public class RecipeUtils { if (!aNotRemoveShapelessRecipes || !(tRecipe instanceof ShapelessRecipes) && !(tRecipe instanceof ShapelessOreRecipe)) { if (aOnlyRemoveNativeHandlers) { - if (!gregtech.api.util.GT_ModHandler.sNativeRecipeClasses.contains( - tRecipe.getClass().getName())) { + if (!gregtech.api.util.GT_ModHandler.sNativeRecipeClasses + .contains(tRecipe.getClass().getName())) { continue; } - } else if (gregtech.api.util.GT_ModHandler.sSpecialRecipeClasses.contains( - tRecipe.getClass().getName())) { - continue; - } + } else if (gregtech.api.util.GT_ModHandler.sSpecialRecipeClasses + .contains(tRecipe.getClass().getName())) { + continue; + } ItemStack tStack = tRecipe.getRecipeOutput(); if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tStack), aOutput, aIgnoreNBT)) { @@ -731,19 +692,10 @@ public class RecipeUtils { GameRegistry.addSmelting(aStackInput, aStackOutput, aXpGained); } - public static boolean addShapedRecipe( - Object Input_1, - Object Input_2, - Object Input_3, - Object Input_4, - Object Input_5, - Object Input_6, - Object Input_7, - Object Input_8, - Object Input_9, - ItemStack aOutputStack) { + public static boolean addShapedRecipe(Object Input_1, Object Input_2, Object Input_3, Object Input_4, + Object Input_5, Object Input_6, Object Input_7, Object Input_8, Object Input_9, ItemStack aOutputStack) { return addShapedRecipe( - new Object[] {Input_1, Input_2, Input_3, Input_4, Input_5, Input_6, Input_7, Input_8, Input_9}, + new Object[] { Input_1, Input_2, Input_3, Input_4, Input_5, Input_6, Input_7, Input_8, Input_9 }, aOutputStack); } @@ -792,7 +744,7 @@ public class RecipeUtils { Logger.RECIPE("" + aRow2); Logger.RECIPE("" + aRow3); - String[] aStringData = new String[] {aRow1, aRow2, aRow3}; + String[] aStringData = new String[] { aRow1, aRow2, aRow3 }; Object[] aDataObject = new Object[19]; aDataObject[0] = aStringData; int aIndex = 0; @@ -804,10 +756,13 @@ public class RecipeUtils { if (aFullString.charAt(aIndex) != (' ')) { aDataObject[u] = aFullString.charAt(aIndex); aDataObject[u + 1] = Slots[aIndex]; - Logger.INFO("(" + aIndex + ") " + aFullString.charAt(aIndex) + " | " - + (Slots[aIndex] instanceof ItemStack - ? ItemUtils.getItemName((ItemStack) Slots[aIndex]) - : Slots[aIndex] instanceof String ? (String) Slots[aIndex] : "Unknown")); + Logger.INFO( + "(" + aIndex + + ") " + + aFullString.charAt(aIndex) + + " | " + + (Slots[aIndex] instanceof ItemStack ? ItemUtils.getItemName((ItemStack) Slots[aIndex]) + : Slots[aIndex] instanceof String ? (String) Slots[aIndex] : "Unknown")); } aIndex++; } @@ -819,17 +774,10 @@ public class RecipeUtils { ShapedOreRecipe aRecipe = new ShapedOreRecipe(aOutputStack, aDataObject); - /*ShapedOreRecipe aRecipe = new ShapedOreRecipe(aOutputStack, - aStringData, - 'a', Slots[0], - 'b', Slots[1], - 'c', Slots[2], - 'd', Slots[3], - 'e', Slots[4], - 'f', Slots[5], - 'g', Slots[6], - 'h', Slots[7], - 'i', Slots[8]);*/ + /* + * ShapedOreRecipe aRecipe = new ShapedOreRecipe(aOutputStack, aStringData, 'a', Slots[0], 'b', Slots[1], 'c', + * Slots[2], 'd', Slots[3], 'e', Slots[4], 'f', Slots[5], 'g', Slots[6], 'h', Slots[7], 'i', Slots[8]); + */ int size = COMPAT_HANDLER.mRecipesToGenerate.size(); COMPAT_HANDLER.mRecipesToGenerate.put(new InternalRecipeObject2(aRecipe)); @@ -866,8 +814,7 @@ public class RecipeUtils { GameRegistry.addRecipe(mRecipe); } else { Logger.INFO( - "[Fix] Invalid shapped recipe outputting " + mOutput != null - ? mOutput.getDisplayName() + "[Fix] Invalid shapped recipe outputting " + mOutput != null ? mOutput.getDisplayName() : "Bad Output Item"); } } diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/ShapelessUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/ShapelessUtils.java index 5994bf5f67..b2a705481b 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/ShapelessUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/ShapelessUtils.java @@ -1,13 +1,15 @@ package gtPlusPlus.core.util.minecraft; -import gtPlusPlus.api.objects.Logger; import java.util.ArrayList; + import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.ShapelessRecipes; +import gtPlusPlus.api.objects.Logger; + public class ShapelessUtils { public static boolean addShapelessRecipe(final ItemStack output, final Object... params) { diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java index 33ef1b89e3..639cd37f76 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java @@ -2,6 +2,12 @@ package gtPlusPlus.core.util.minecraft.gregtech; import static gtPlusPlus.core.lib.CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK; +import net.minecraft.item.ItemStack; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.fluids.FluidStack; + +import org.apache.commons.lang3.ArrayUtils; + import gregtech.GT_Mod; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -15,10 +21,6 @@ import gtPlusPlus.core.material.MISC_MATERIALS; import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.item.ItemStack; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.fluids.FluidStack; -import org.apache.commons.lang3.ArrayUtils; public class PollutionUtils { diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/gregtech/material/MaterialBuilder.java b/src/main/java/gtPlusPlus/core/util/minecraft/gregtech/material/MaterialBuilder.java index 1b35ead9f1..ecabeaa294 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/gregtech/material/MaterialBuilder.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/gregtech/material/MaterialBuilder.java @@ -1,244 +1,55 @@ package gtPlusPlus.core.util.minecraft.gregtech.material; public class MaterialBuilder { - /*public static final int DIESEL = 0, GAS = 1, THERMAL = 2, SEMIFLUID = 3, PLASMA = 4, MAGIC = 5; - - private int metaItemSubID; - private TextureSet iconSet; - private float toolSpeed = 1.0f; - private int durability = 0; - private int toolQuality = 0; - private int types = 0; - private int r = 255, g = 255, b = 255, a = 0; - private String name; - private String defaultLocalName; - private int fuelType = 0; - private int fuelPower = 0; - private int meltingPoint = 0; - private int blastFurnaceTemp = 0; - private boolean blastFurnaceRequired = false; - private boolean transparent = false; - private int oreValue = 1; - private int densityMultiplier = 1; - private int densityDivider = 1; - private Dyes color = Dyes._NULL; - private int extraData = 0; - private List materialList = new ArrayList(); - private List aspects = new ArrayList(); - private boolean canBeCracked = false; - private int liquidTemperature = 300; - private int gasTemperature = 300; - - public MaterialBuilder(int metaItemSubID, TextureSet iconSet, String defaultLocalName) { - this.metaItemSubID = metaItemSubID; - this.iconSet = iconSet; - this.name = defaultLocalName.replace(" ", "").replace("-", ""); - this.defaultLocalName = defaultLocalName; - } - - public Materials constructMaterial() { - return new Materials( - metaItemSubID, iconSet, toolSpeed, durability, toolQuality, types, r, g, b, a, name, defaultLocalName, fuelType, fuelPower, meltingPoint, blastFurnaceTemp, - blastFurnaceRequired, transparent, oreValue, densityMultiplier, densityDivider, color, extraData, materialList, aspects); - - } - - public MaterialBuilder setName(String name){ - this.name = name; - return this; - } - - public MaterialBuilder setTypes(int types){ - this.types = types; - return this; - } - - public MaterialBuilder addDustItems(){ - types = types | 1; - return this; - } - - public MaterialBuilder addMetalItems(){ - types = types | 2; - return this; - } - - public MaterialBuilder addGemItems(){ - types = types | 4; - return this; - } - - public MaterialBuilder addOreItems(){ - types = types | 8; - return this; - } - - public MaterialBuilder addCell(){ - types = types | 16; - return this; - } - - public MaterialBuilder addPlasma(){ - types = types | 32; - return this; - } - - public MaterialBuilder addToolHeadItems(){ - types = types | 64; - return this; - } - - public MaterialBuilder addGearItems(){ - types = types | 128; - return this; - } - - public MaterialBuilder addFluid(){ - return this; - } - - public MaterialBuilder addGas(){ - return this; - } - - - public MaterialBuilder setRGBA(int r, int g, int b, int a){ - this.r = r; - this.g = g; - this.b = b; - this.a = a; - return this; - } - - public MaterialBuilder setRGB(int r, int g, int b){ - this.r = r; - this.g = g; - this.b = b; - return this; - } - - public MaterialBuilder setTransparent(boolean transparent){ - this.transparent = transparent; - return this; - } - - public MaterialBuilder setColor(Dyes color){ - this.color = color; - return this; - } - - - public MaterialBuilder setToolSpeed(float toolSpeed) { - this.toolSpeed = toolSpeed; - return this; - } - - public MaterialBuilder setDurability(int durability) { - this.durability = durability; - return this; - } - - public MaterialBuilder setToolQuality(int toolQuality) { - this.toolQuality = toolQuality; - return this; - } - - - public MaterialBuilder setFuelType(int fuelType) { - this.fuelType = fuelType; - return this; - } - - public MaterialBuilder setFuelPower(int fuelPower) { - this.fuelPower = fuelPower; - return this; - } - - public MaterialBuilder setMeltingPoint(int meltingPoint) { - this.meltingPoint = meltingPoint; - return this; - } - - public MaterialBuilder setBlastFurnaceTemp(int blastFurnaceTemp) { - this.blastFurnaceTemp = blastFurnaceTemp; - return this; - } - - public MaterialBuilder setBlastFurnaceRequired(boolean blastFurnaceRequired) { - this.blastFurnaceRequired = blastFurnaceRequired; - return this; - } - - public MaterialBuilder setOreValue(int oreValue) { - this.oreValue = oreValue; - return this; - } - - public MaterialBuilder setDensityMultiplier(int densityMultiplier) { - this.densityMultiplier = densityMultiplier; - return this; - } - - public MaterialBuilder setDensityDivider(int densityDivider) { - this.densityDivider = densityDivider; - return this; - } - - public MaterialBuilder setExtraData(int extraData) { - this.extraData = extraData; - return this; - } - - public MaterialBuilder addElectrolyzerRecipe(){ - extraData = extraData | 1; - return this; - } - - public MaterialBuilder addCentrifugeRecipe(){ - extraData = extraData | 2; - return this; - } - - public MaterialBuilder setMaterialList(List materialList) { - this.materialList = materialList; - return this; - } - - public MaterialBuilder setMaterialList(MaterialStack ... materials) { - this.materialList = Arrays.asList(materials); - return this; - } - - public MaterialBuilder setAspects(List aspects) { - this.aspects = aspects; - return this; - } - - public int getLiquidTemperature() { - return liquidTemperature; - } - - public MaterialBuilder setLiquidTemperature(int liquidTemperature) { - this.liquidTemperature = liquidTemperature; - return this; - } - - public int getGasTemperature() { - return gasTemperature; - } - - public MaterialBuilder setGasTemperature(int gasTemperature) { - this.gasTemperature = gasTemperature; - return this; - } - - public boolean canBeCracked() { - return canBeCracked; - } - - public MaterialBuilder setCanBeCracked(boolean canBeCracked) { - this.canBeCracked = canBeCracked; - return this; - } - */ + /* + * public static final int DIESEL = 0, GAS = 1, THERMAL = 2, SEMIFLUID = 3, PLASMA = 4, MAGIC = 5; private int + * metaItemSubID; private TextureSet iconSet; private float toolSpeed = 1.0f; private int durability = 0; private + * int toolQuality = 0; private int types = 0; private int r = 255, g = 255, b = 255, a = 0; private String name; + * private String defaultLocalName; private int fuelType = 0; private int fuelPower = 0; private int meltingPoint = + * 0; private int blastFurnaceTemp = 0; private boolean blastFurnaceRequired = false; private boolean transparent = + * false; private int oreValue = 1; private int densityMultiplier = 1; private int densityDivider = 1; private Dyes + * color = Dyes._NULL; private int extraData = 0; private List materialList = new + * ArrayList(); private List aspects = new + * ArrayList(); private boolean canBeCracked = false; private int liquidTemperature = + * 300; private int gasTemperature = 300; public MaterialBuilder(int metaItemSubID, TextureSet iconSet, String + * defaultLocalName) { this.metaItemSubID = metaItemSubID; this.iconSet = iconSet; this.name = + * defaultLocalName.replace(" ", "").replace("-", ""); this.defaultLocalName = defaultLocalName; } public Materials + * constructMaterial() { return new Materials( metaItemSubID, iconSet, toolSpeed, durability, toolQuality, types, r, + * g, b, a, name, defaultLocalName, fuelType, fuelPower, meltingPoint, blastFurnaceTemp, blastFurnaceRequired, + * transparent, oreValue, densityMultiplier, densityDivider, color, extraData, materialList, aspects); } public + * MaterialBuilder setName(String name){ this.name = name; return this; } public MaterialBuilder setTypes(int + * types){ this.types = types; return this; } public MaterialBuilder addDustItems(){ types = types | 1; return this; + * } public MaterialBuilder addMetalItems(){ types = types | 2; return this; } public MaterialBuilder addGemItems(){ + * types = types | 4; return this; } public MaterialBuilder addOreItems(){ types = types | 8; return this; } public + * MaterialBuilder addCell(){ types = types | 16; return this; } public MaterialBuilder addPlasma(){ types = types | + * 32; return this; } public MaterialBuilder addToolHeadItems(){ types = types | 64; return this; } public + * MaterialBuilder addGearItems(){ types = types | 128; return this; } public MaterialBuilder addFluid(){ return + * this; } public MaterialBuilder addGas(){ return this; } public MaterialBuilder setRGBA(int r, int g, int b, int + * a){ this.r = r; this.g = g; this.b = b; this.a = a; return this; } public MaterialBuilder setRGB(int r, int g, + * int b){ this.r = r; this.g = g; this.b = b; return this; } public MaterialBuilder setTransparent(boolean + * transparent){ this.transparent = transparent; return this; } public MaterialBuilder setColor(Dyes color){ + * this.color = color; return this; } public MaterialBuilder setToolSpeed(float toolSpeed) { this.toolSpeed = + * toolSpeed; return this; } public MaterialBuilder setDurability(int durability) { this.durability = durability; + * return this; } public MaterialBuilder setToolQuality(int toolQuality) { this.toolQuality = toolQuality; return + * this; } public MaterialBuilder setFuelType(int fuelType) { this.fuelType = fuelType; return this; } public + * MaterialBuilder setFuelPower(int fuelPower) { this.fuelPower = fuelPower; return this; } public MaterialBuilder + * setMeltingPoint(int meltingPoint) { this.meltingPoint = meltingPoint; return this; } public MaterialBuilder + * setBlastFurnaceTemp(int blastFurnaceTemp) { this.blastFurnaceTemp = blastFurnaceTemp; return this; } public + * MaterialBuilder setBlastFurnaceRequired(boolean blastFurnaceRequired) { this.blastFurnaceRequired = + * blastFurnaceRequired; return this; } public MaterialBuilder setOreValue(int oreValue) { this.oreValue = oreValue; + * return this; } public MaterialBuilder setDensityMultiplier(int densityMultiplier) { this.densityMultiplier = + * densityMultiplier; return this; } public MaterialBuilder setDensityDivider(int densityDivider) { + * this.densityDivider = densityDivider; return this; } public MaterialBuilder setExtraData(int extraData) { + * this.extraData = extraData; return this; } public MaterialBuilder addElectrolyzerRecipe(){ extraData = extraData + * | 1; return this; } public MaterialBuilder addCentrifugeRecipe(){ extraData = extraData | 2; return this; } + * public MaterialBuilder setMaterialList(List materialList) { this.materialList = materialList; + * return this; } public MaterialBuilder setMaterialList(MaterialStack ... materials) { this.materialList = + * Arrays.asList(materials); return this; } public MaterialBuilder setAspects(List + * aspects) { this.aspects = aspects; return this; } public int getLiquidTemperature() { return liquidTemperature; } + * public MaterialBuilder setLiquidTemperature(int liquidTemperature) { this.liquidTemperature = liquidTemperature; + * return this; } public int getGasTemperature() { return gasTemperature; } public MaterialBuilder + * setGasTemperature(int gasTemperature) { this.gasTemperature = gasTemperature; return this; } public boolean + * canBeCracked() { return canBeCracked; } public MaterialBuilder setCanBeCracked(boolean canBeCracked) { + * this.canBeCracked = canBeCracked; return this; } + */ } diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java b/src/main/java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java index cbd92c3f4e..58045150f1 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/gregtech/recipehandlers/GregtechRecipe.java @@ -1,3 +1,4 @@ package gtPlusPlus.core.util.minecraft.gregtech.recipehandlers; -public final class GregtechRecipe {} +public final class GregtechRecipe { +} diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/network/CustomPacket.java b/src/main/java/gtPlusPlus/core/util/minecraft/network/CustomPacket.java index 6a7a33bd8e..cb75d78bfc 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/network/CustomPacket.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/network/CustomPacket.java @@ -1,14 +1,16 @@ package gtPlusPlus.core.util.minecraft.network; -import cpw.mods.fml.common.network.internal.FMLProxyPacket; -import io.netty.buffer.Unpooled; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; + import mods.railcraft.common.util.misc.Game; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; +import io.netty.buffer.Unpooled; public abstract class CustomPacket { + public static final String CHANNEL_NAME = "GTPP"; public enum PacketType { @@ -22,7 +24,7 @@ public abstract class CustomPacket { data.writeByte(this.getID()); this.writeData(data); } catch (IOException var4) { - Game.logThrowable("Error constructing packet: {0}", var4, new Object[] {this.getClass()}); + Game.logThrowable("Error constructing packet: {0}", var4, new Object[] { this.getClass() }); } return new FMLProxyPacket(Unpooled.wrappedBuffer(bytes.toByteArray()), "GTPP"); } diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketBuilder.java b/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketBuilder.java index 30e981b1a0..d9b565591c 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketBuilder.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketBuilder.java @@ -1,8 +1,9 @@ package gtPlusPlus.core.util.minecraft.network; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.world.WorldServer; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + public class PacketBuilder { private static PacketBuilder instance; diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketDispatcher.java b/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketDispatcher.java index 4b6fc5aa85..69d94a4f13 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketDispatcher.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketDispatcher.java @@ -1,17 +1,20 @@ package gtPlusPlus.core.util.minecraft.network; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import cpw.mods.fml.relauncher.ReflectionHelper; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.preloader.DevHelper; import java.lang.reflect.Method; + import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.Packet; import net.minecraft.server.management.PlayerManager; import net.minecraft.world.WorldServer; +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import cpw.mods.fml.relauncher.ReflectionHelper; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.preloader.DevHelper; + @SuppressWarnings("unchecked") public class PacketDispatcher { + private static final Class playerInstanceClass; private static final Method getOrCreateChunkWatcher; private static final Method sendToAllPlayersWatchingChunk; @@ -38,15 +41,18 @@ public class PacketDispatcher { public static void sendToWatchers(CustomPacket packet, WorldServer world, int worldX, int worldZ) { try { - Object playerInstance = - getOrCreateChunkWatcher.invoke(world.getPlayerManager(), worldX >> 4, worldZ >> 4, false); + Object playerInstance = getOrCreateChunkWatcher + .invoke(world.getPlayerManager(), worldX >> 4, worldZ >> 4, false); if (playerInstance != null) { sendToAllPlayersWatchingChunk.invoke(playerInstance, packet.getPacket()); } } catch (Exception var5) { - Logger.ERROR("Reflection Failure in PacketDispatcher.sendToWatchers() {0} {1}" + 20 + var5 - + new Object[] {getOrCreateChunkWatcher.getName() + sendToAllPlayersWatchingChunk.getName()}); + Logger.ERROR( + "Reflection Failure in PacketDispatcher.sendToWatchers() {0} {1}" + 20 + + var5 + + new Object[] { + getOrCreateChunkWatcher.getName() + sendToAllPlayersWatchingChunk.getName() }); throw new RuntimeException(var5); } } @@ -59,13 +65,17 @@ public class PacketDispatcher { try { a = DevHelper.getForgeMethod( - PlayerManager.class, "getOrCreateChunkWatcher", int.class, int.class, boolean.class); + PlayerManager.class, + "getOrCreateChunkWatcher", + int.class, + int.class, + boolean.class); } catch (Throwable t) { a = ReflectionHelper.findMethod( playerInstanceClass, (Object) null, - new String[] {"func_72690_a", "getOrCreateChunkWatcher"}, - new Class[] {Integer.TYPE, Integer.TYPE, Boolean.TYPE}); + new String[] { "func_72690_a", "getOrCreateChunkWatcher" }, + new Class[] { Integer.TYPE, Integer.TYPE, Boolean.TYPE }); } try { b = DevHelper.getForgeMethod(PlayerManager.class, "sendToAllPlayersWatchingChunk", Packet.class); @@ -73,8 +83,8 @@ public class PacketDispatcher { b = ReflectionHelper.findMethod( playerInstanceClass, (Object) null, - new String[] {"func_151251_a", "sendToAllPlayersWatchingChunk"}, - new Class[] {Packet.class}); + new String[] { "func_151251_a", "sendToAllPlayersWatchingChunk" }, + new Class[] { Packet.class }); } getOrCreateChunkWatcher = a; diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketHandler.java b/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketHandler.java index bd7e1fbcb8..535c192bbe 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketHandler.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketHandler.java @@ -1,5 +1,13 @@ package gtPlusPlus.core.util.minecraft.network; +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.IOException; +import java.util.Arrays; + +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.NetHandlerPlayServer; + import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.network.FMLEventChannel; import cpw.mods.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent; @@ -7,14 +15,9 @@ import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent; import cpw.mods.fml.common.network.NetworkRegistry; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.minecraft.network.CustomPacket.PacketType; -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; -import java.io.IOException; -import java.util.Arrays; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.network.NetHandlerPlayServer; public class PacketHandler { + public static final PacketHandler INSTANCE = new PacketHandler(); private static final PacketType[] packetTypes = PacketType.values(); final FMLEventChannel channel; @@ -63,7 +66,8 @@ public class PacketHandler { ((CustomPacket) pkt).readData(data); } } catch (IOException var7) { - Logger.ERROR("Exception in PacketHandler.onPacketData: {0}" + var7 + new Object[] {Arrays.toString(bData)}); + Logger.ERROR( + "Exception in PacketHandler.onPacketData: {0}" + var7 + new Object[] { Arrays.toString(bData) }); } } } diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketTileEntity.java b/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketTileEntity.java index 265d78a7f4..03a1251053 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketTileEntity.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/network/PacketTileEntity.java @@ -1,19 +1,23 @@ package gtPlusPlus.core.util.minecraft.network; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.api.interfaces.IGregtechPacketEntity; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; + import mods.railcraft.common.util.misc.Game; + import net.minecraft.client.Minecraft; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.api.interfaces.IGregtechPacketEntity; + public class PacketTileEntity extends CustomPacket { + private IGregTechTileEntity tile; private IGregtechPacketEntity ptile; diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/particles/BlockBreakParticles.java b/src/main/java/gtPlusPlus/core/util/minecraft/particles/BlockBreakParticles.java index f848ea49be..ff28f59eb2 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/particles/BlockBreakParticles.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/particles/BlockBreakParticles.java @@ -1,9 +1,10 @@ package gtPlusPlus.core.util.minecraft.particles; -import gtPlusPlus.xmod.forestry.HANDLER_FR; import net.minecraft.block.Block; import net.minecraft.world.World; +import gtPlusPlus.xmod.forestry.HANDLER_FR; + public class BlockBreakParticles { public BlockBreakParticles(final World world, final int x, final int y, final int z, final Block block) { diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/particles/EntityParticleFXMysterious.java b/src/main/java/gtPlusPlus/core/util/minecraft/particles/EntityParticleFXMysterious.java index 6c21e8addf..ad7e407c57 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/particles/EntityParticleFXMysterious.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/particles/EntityParticleFXMysterious.java @@ -4,14 +4,9 @@ import net.minecraft.client.particle.EntityAuraFX; import net.minecraft.world.World; public class EntityParticleFXMysterious extends EntityAuraFX { - public EntityParticleFXMysterious( - final World parWorld, - final double parX, - final double parY, - final double parZ, - final double parMotionX, - final double parMotionY, - final double parMotionZ) { + + 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; diff --git a/src/main/java/gtPlusPlus/core/util/player/PlayerCache.java b/src/main/java/gtPlusPlus/core/util/player/PlayerCache.java index 7159345d86..1ce69a51fd 100644 --- a/src/main/java/gtPlusPlus/core/util/player/PlayerCache.java +++ b/src/main/java/gtPlusPlus/core/util/player/PlayerCache.java @@ -1,12 +1,14 @@ package gtPlusPlus.core.util.player; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; import java.io.*; import java.util.*; + import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; + public class PlayerCache { private static final File cache = new File("PlayerCache.dat"); @@ -45,21 +47,12 @@ public class PlayerCache { final HashMap playerInfo = new HashMap<>(); playerInfo.put(playerName, UUID.fromString(playerUUIDasString)); - /*try { - Utils.LOG_INFO("Attempting to load "+cache.getName()); - properties.load(new FileInputStream(cache)); - if (properties == null || properties.equals(null)){ - Utils.LOG_INFO("Please wait."); - } - else { - Utils.LOG_INFO("Loaded PlayerCache.dat"); - properties.setProperty(playerName+"_", playerUUIDasString); - FileOutputStream fr=new FileOutputStream(cache); - properties.store(fr, "Player Cache."); - fr.close(); - } - - } */ + /* + * try { Utils.LOG_INFO("Attempting to load "+cache.getName()); properties.load(new FileInputStream(cache)); if + * (properties == null || properties.equals(null)){ Utils.LOG_INFO("Please wait."); } else { + * Utils.LOG_INFO("Loaded PlayerCache.dat"); properties.setProperty(playerName+"_", playerUUIDasString); + * FileOutputStream fr=new FileOutputStream(cache); properties.store(fr, "Player Cache."); fr.close(); } } + */ try { final FileOutputStream fos = new FileOutputStream("PlayerCache.dat"); @@ -75,22 +68,21 @@ public class PlayerCache { } /** - * Reads a "properties" file, and returns it as a Map - * (a collection of key/value pairs). + * 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. + * 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 - * from the value in the properties file. + * @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 readPropertiesFileAsMapOld() throws Exception { final String delimiter = "="; - @SuppressWarnings({"rawtypes", "unchecked"}) + @SuppressWarnings({ "rawtypes", "unchecked" }) final Map map = new HashMap<>(); final BufferedReader reader = new BufferedReader(new FileReader(cache)); String line; diff --git a/src/main/java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java b/src/main/java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java index 9aafe15528..11217e1e47 100644 --- a/src/main/java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java +++ b/src/main/java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java @@ -1,16 +1,18 @@ package gtPlusPlus.core.util.reflect; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.internal.IGT_RecipeAdder; import gregtech.api.util.GT_Recipe; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.minecraft.FluidUtils; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; public final class AddGregtechRecipe { @@ -18,14 +20,12 @@ public final class AddGregtechRecipe { int aModifiedTime = (int) (aRecipe.mDuration * 0.8); - if (aRecipe.mInputs == null - || aRecipe.mFluidInputs == null + if (aRecipe.mInputs == null || aRecipe.mFluidInputs == null || aRecipe.mFluidOutputs == null || aRecipe.mOutputs == null) { return false; } - if (aRecipe.mInputs.length > 2 - || aRecipe.mFluidInputs.length > 1 + if (aRecipe.mInputs.length > 2 || aRecipe.mFluidInputs.length > 1 || aRecipe.mFluidOutputs.length > 1 || aRecipe.mOutputs.length > 9) { return false; @@ -67,14 +67,8 @@ public final class AddGregtechRecipe { aRecipe.mEUt); } - public static boolean addCokeAndPyrolyseRecipes( - ItemStack input1, - int circuitNumber, - FluidStack inputFluid1, - ItemStack output1, - FluidStack outputFluid1, - int timeInSeconds, - int euTick) { + public static boolean addCokeAndPyrolyseRecipes(ItemStack input1, int circuitNumber, FluidStack inputFluid1, + ItemStack output1, FluidStack outputFluid1, int timeInSeconds, int euTick) { // Seconds Conversion int TIME = timeInSeconds * 20; int TIMEPYRO = TIME + (TIME / 5); @@ -84,14 +78,8 @@ public final class AddGregtechRecipe { return false; } - public static boolean PyrolyseOven( - final ItemStack p0, - final FluidStack p1, - final int p2, - final ItemStack p3, - final FluidStack p4, - final int p5, - final int p6) { + public static boolean PyrolyseOven(final ItemStack p0, final FluidStack p1, final int p2, final ItemStack p3, + final FluidStack p4, final int p5, final int p6) { try { IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA; @@ -110,76 +98,40 @@ public final class AddGregtechRecipe { return (boolean) addRecipe.invoke(IGT_RecipeAdder, p0, p1, p2, p3, p4, p5, p6); } } - } catch (SecurityException - | NoSuchMethodException - | IllegalAccessException - | IllegalArgumentException + } catch (SecurityException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { return false; } return false; } - public static boolean addAssemblylineRecipe( - ItemStack aResearchItem, - int aResearchTime, - ItemStack[] aInputs, - FluidStack[] aFluidInputs, - ItemStack aOutput, - int aDuration, - int aEUt) { + public static boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, + FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt) { /* - try { - IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA; - if (IGT_RecipeAdder != null){ - Class classRA = IGT_RecipeAdder.getClass(); - - for(Method current : classRA.getDeclaredMethods()){ - //Utils.LOG_INFO("-----------------------------------------------"); - ////Utils.LOG_INFO("Found method: "+current.getName()); - //Utils.LOG_INFO("With Parameters: "); - //Utils.LOG_INFO("==============================================="); - for (Class P : current.getParameterTypes()){ - //Utils.LOG_INFO(""+P.getName()); - //Utils.LOG_INFO(""+P.getClass().getName()); - } - //Utils.LOG_INFO("==============================================="); - } - - try { - Method testRA = GT_Values.RA.getClass().getMethod("addAssemblylineRecipe", GT_Values.RA.getClass(), aResearchItem.getClass(), int.class, aInputs.getClass(), aFluidInputs.getClass(), aOutput.getClass(), int.class, int.class); - testRA.invoke(aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt); - } - catch (Throwable masndj){ - masndj.printStackTrace(); - } - - - Method addRecipe = classRA.getDeclaredMethod( - "addAssemblylineRecipe", - ItemStack.class, - int.class, - ItemStack.class, - FluidStack.class, - ItemStack.class, - int.class, - int.class); - if (addRecipe != null){ - return (boolean) addRecipe.invoke(aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt); - } - } - } - catch (SecurityException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - Utils.LOG_INFO("[Assembly Line] - Failed to add recipe, due to GT not being .09 branch. Research: "+aResearchItem.getDisplayName()+" | Result: "+aOutput.getDisplayName()); - e.printStackTrace(); - return false; - } - Utils.LOG_INFO("[Assembly Line] - Failed to add recipe. Research: "+aResearchItem.getDisplayName()+" | Result: "+aOutput.getDisplayName()); + * try { IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA; if (IGT_RecipeAdder != null){ Class classRA = IGT_RecipeAdder.getClass(); for(Method current : classRA.getDeclaredMethods()){ + * //Utils.LOG_INFO("-----------------------------------------------"); + * ////Utils.LOG_INFO("Found method: "+current.getName()); //Utils.LOG_INFO("With Parameters: "); + * //Utils.LOG_INFO("==============================================="); for (Class P : + * current.getParameterTypes()){ //Utils.LOG_INFO(""+P.getName()); //Utils.LOG_INFO(""+P.getClass().getName()); + * } //Utils.LOG_INFO("==============================================="); } try { Method testRA = + * GT_Values.RA.getClass().getMethod("addAssemblylineRecipe", GT_Values.RA.getClass(), aResearchItem.getClass(), + * int.class, aInputs.getClass(), aFluidInputs.getClass(), aOutput.getClass(), int.class, int.class); + * testRA.invoke(aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt); } catch + * (Throwable masndj){ masndj.printStackTrace(); } Method addRecipe = classRA.getDeclaredMethod( + * "addAssemblylineRecipe", ItemStack.class, int.class, ItemStack.class, FluidStack.class, ItemStack.class, + * int.class, int.class); if (addRecipe != null){ return (boolean) addRecipe.invoke(aResearchItem, + * aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt); } } } catch (SecurityException | + * NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + * Utils.LOG_INFO("[Assembly Line] - Failed to add recipe, due to GT not being .09 branch. Research: " + * +aResearchItem.getDisplayName()+" | Result: "+aOutput.getDisplayName()); e.printStackTrace(); return false; } + * Utils.LOG_INFO("[Assembly Line] - Failed to add recipe. Research: "+aResearchItem.getDisplayName() + * +" | Result: "+aOutput.getDisplayName()); */ return false; } - public static boolean addCircuitAssemblerRecipe( - ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput, int aDuration, int aEUt) { + public static boolean addCircuitAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput, + int aDuration, int aEUt) { if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { try { IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA; @@ -197,16 +149,16 @@ public final class AddGregtechRecipe { boolean[] didAdd = new boolean[3]; FluidStack moltenMetal = FluidUtils.getFluidStack("molten.tin", 144); // Tin - didAdd[0] = (boolean) - addRecipe.invoke(IGT_RecipeAdder, aInputs, moltenMetal, aOutput, aDuration, aEUt); + didAdd[0] = (boolean) addRecipe + .invoke(IGT_RecipeAdder, aInputs, moltenMetal, aOutput, aDuration, aEUt); moltenMetal = FluidUtils.getFluidStack("molten.lead", 144); // Lead - didAdd[1] = (boolean) - addRecipe.invoke(IGT_RecipeAdder, aInputs, moltenMetal, aOutput, aDuration, aEUt); + didAdd[1] = (boolean) addRecipe + .invoke(IGT_RecipeAdder, aInputs, moltenMetal, aOutput, aDuration, aEUt); moltenMetal = FluidUtils.getFluidStack("molten.solderingalloy", 144 / 2); // Soldering Alloy - didAdd[2] = (boolean) - addRecipe.invoke(IGT_RecipeAdder, aInputs, moltenMetal, aOutput, aDuration, aEUt); + didAdd[2] = (boolean) addRecipe + .invoke(IGT_RecipeAdder, aInputs, moltenMetal, aOutput, aDuration, aEUt); if (didAdd[0] && didAdd[1] && didAdd[2]) { return true; @@ -214,15 +166,12 @@ public final class AddGregtechRecipe { return false; } } else { - return (boolean) - addRecipe.invoke(IGT_RecipeAdder, aInputs, aFluidInput, aOutput, aDuration, aEUt); + return (boolean) addRecipe + .invoke(IGT_RecipeAdder, aInputs, aFluidInput, aOutput, aDuration, aEUt); } } } - } catch (SecurityException - | NoSuchMethodException - | IllegalAccessException - | IllegalArgumentException + } catch (SecurityException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { return false; } @@ -230,14 +179,8 @@ public final class AddGregtechRecipe { return false; } - public static boolean addChemicalRecipeForBasicMachineOnly( - final ItemStack p0, - final ItemStack p1, - final FluidStack p2, - final FluidStack p3, - final ItemStack p4, - final ItemStack p5, - final int p6, + public static boolean addChemicalRecipeForBasicMachineOnly(final ItemStack p0, final ItemStack p1, + final FluidStack p2, final FluidStack p3, final ItemStack p4, final ItemStack p5, final int p6, final int p7) { if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { @@ -261,10 +204,7 @@ public final class AddGregtechRecipe { return (boolean) addRecipe.invoke(IGT_RecipeAdder, p0, p1, p2, p3, p4, p5, p6, p7); } } - } catch (SecurityException - | NoSuchMethodException - | IllegalAccessException - | IllegalArgumentException + } catch (SecurityException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { } diff --git a/src/main/java/gtPlusPlus/core/util/reflect/ProxyFinder.java b/src/main/java/gtPlusPlus/core/util/reflect/ProxyFinder.java index 6c3be2e6df..6752153bec 100644 --- a/src/main/java/gtPlusPlus/core/util/reflect/ProxyFinder.java +++ b/src/main/java/gtPlusPlus/core/util/reflect/ProxyFinder.java @@ -1,8 +1,9 @@ package gtPlusPlus.core.util.reflect; -import cpw.mods.fml.common.SidedProxy; import java.lang.reflect.Field; +import cpw.mods.fml.common.SidedProxy; + public class ProxyFinder { public static Object getServerProxy(final Object modInstance) throws ReflectiveOperationException { diff --git a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index f770cb0e97..1c238691ac 100644 --- a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -1,9 +1,5 @@ package gtPlusPlus.core.util.reflect; -import com.google.common.reflect.ClassPath; -import com.gtnewhorizon.gtnhlib.reflect.Fields; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.data.StringUtils; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -19,9 +15,16 @@ import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; + import org.apache.commons.lang3.ArrayUtils; -@SuppressWarnings({"unchecked", "rawtypes"}) +import com.google.common.reflect.ClassPath; +import com.gtnewhorizon.gtnhlib.reflect.Fields; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.data.StringUtils; + +@SuppressWarnings({ "unchecked", "rawtypes" }) public class ReflectionUtils { public static Map> mCachedClasses = new LinkedHashMap<>(); @@ -82,8 +85,10 @@ public class ReflectionUtils { } private static Fields.ClassFields.Field cacheAccessor(Field f) { - return mCachedFieldAccessors.computeIfAbsent(f, (field) -> Fields.ofClass(field.getDeclaringClass()) - .getUntypedField(Fields.LookupType.DECLARED_IN_HIERARCHY, field.getName())); + return mCachedFieldAccessors.computeIfAbsent( + f, + (field) -> Fields.ofClass(field.getDeclaringClass()) + .getUntypedField(Fields.LookupType.DECLARED_IN_HIERARCHY, field.getName())); } private static boolean cacheClass(Class aClass) { @@ -131,8 +136,8 @@ public class ReflectionUtils { if (aConstructor == null) { return false; } - CachedConstructor y = - mCachedConstructors.get(aClass.getName() + "." + ArrayUtils.toString(aConstructor.getParameterTypes())); + CachedConstructor y = mCachedConstructors + .get(aClass.getName() + "." + ArrayUtils.toString(aConstructor.getParameterTypes())); if (y == null) { mCachedConstructors.put( aClass.getName() + "." + ArrayUtils.toString(aConstructor.getParameterTypes()), @@ -144,6 +149,7 @@ public class ReflectionUtils { /** * Returns a cached {@link Constructor} object. + * * @param aClass - Class containing the Constructor. * @param aTypes - Varags Class Types for objects constructor. * @return - Valid, non-final, {@link Method} object, or {@link null}. @@ -172,6 +178,7 @@ public class ReflectionUtils { /** * Returns a cached {@link Class} object. + * * @param aClassCanonicalName - The canonical name of the underlying class. * @return - Valid, {@link Class} object, or {@link null}. */ @@ -192,9 +199,10 @@ public class ReflectionUtils { /** * Returns a cached {@link Method} object. Wraps {@link #getMethod(Class, String, Class...)}. - * @param aObject - Object containing the Method. + * + * @param aObject - Object containing the Method. * @param aMethodName - Method's name in {@link String} form. - * @param aTypes - Class Array of Types for {@link Method}'s constructor. + * @param aTypes - Class Array of Types for {@link Method}'s constructor. * @return - Valid, non-final, {@link Method} object, or {@link null}. */ public static Method getMethod(Object aObject, String aMethodName, Class[] aTypes) { @@ -203,9 +211,10 @@ public class ReflectionUtils { /** * Returns a cached {@link Method} object. - * @param aClass - Class containing the Method. + * + * @param aClass - Class containing the Method. * @param aMethodName - Method's name in {@link String} form. - * @param aTypes - Varags Class Types for {@link Method}'s constructor. + * @param aTypes - Varags Class Types for {@link Method}'s constructor. * @return - Valid, non-final, {@link Method} object, or {@link null}. */ public static Method getMethod(Class aClass, String aMethodName, Class... aTypes) { @@ -242,7 +251,8 @@ public class ReflectionUtils { /** * Returns a cached {@link Field} object. - * @param aClass - Class containing the Method. + * + * @param aClass - Class containing the Method. * @param aFieldName - Field name in {@link String} form. * @return - Valid, non-final, {@link Field} object, or {@link null}. */ @@ -260,8 +270,7 @@ public class ReflectionUtils { cacheField(aClass, u); return u; } - } catch (NoSuchFieldException e) { - } + } catch (NoSuchFieldException e) {} return null; } else { @@ -286,7 +295,8 @@ public class ReflectionUtils { /** * Returns a cached {@link Field} object. - * @param aInstance - {@link Object} to get the field instance from. + * + * @param aInstance - {@link Object} to get the field instance from. * @param aFieldName - Field name in {@link String} form. * @return - Valid, non-final, {@link Field} object, or {@link null}. */ @@ -308,6 +318,7 @@ public class ReflectionUtils { /** * Returns the class of the objects type parameter + * * @param o - Object to examine paramters on * @return - a Class or null */ @@ -320,15 +331,13 @@ public class ReflectionUtils { } public static void makeFieldAccessible(final Field field) { - if (!Modifier.isPublic(field.getModifiers()) - || !Modifier.isPublic(field.getDeclaringClass().getModifiers())) { + if (!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers())) { field.setAccessible(true); } } public static void makeMethodAccessible(final Method field) { - if (!Modifier.isPublic(field.getModifiers()) - || !Modifier.isPublic(field.getDeclaringClass().getModifiers())) { + if (!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers())) { field.setAccessible(true); } } @@ -336,6 +345,7 @@ public class ReflectionUtils { /** * Get the method name for a depth in call stack.
* Utility function + * * @param depth depth in the call stack (0 means current method, 1 means call method, ...) * @return Method name */ @@ -468,8 +478,8 @@ public class ReflectionUtils { if (objectInstance == null || methodName == null || parameters == null || values == null) { return false; } - Class mLocalClass = - (objectInstance instanceof Class ? (Class) objectInstance : objectInstance.getClass()); + Class mLocalClass = (objectInstance instanceof Class ? (Class) objectInstance + : objectInstance.getClass()); Logger.REFLECTION( "Trying to invoke " + methodName + " on an instance of " + mLocalClass.getCanonicalName() + "."); try { @@ -493,8 +503,7 @@ public class ReflectionUtils { return false; } String methodName = method.getName(); - String classname = objectInstance != null - ? objectInstance.getClass().getCanonicalName() + String classname = objectInstance != null ? objectInstance.getClass().getCanonicalName() : method.getDeclaringClass().getCanonicalName(); Logger.REFLECTION("Trying to invoke " + methodName + " on an instance of " + classname + "."); try { @@ -522,8 +531,7 @@ public class ReflectionUtils { return false; } String methodName = method.getName(); - String classname = objectInstance != null - ? objectInstance.getClass().getCanonicalName() + String classname = objectInstance != null ? objectInstance.getClass().getCanonicalName() : method.getDeclaringClass().getCanonicalName(); Logger.REFLECTION("Trying to invoke " + methodName + " on an instance of " + classname + "."); try { @@ -545,8 +553,8 @@ public class ReflectionUtils { if (objectInstance == null || methodName == null || parameters == null || values == null) { return false; } - Class mLocalClass = - (objectInstance instanceof Class ? (Class) objectInstance : objectInstance.getClass()); + Class mLocalClass = (objectInstance instanceof Class ? (Class) objectInstance + : objectInstance.getClass()); Logger.REFLECTION( "Trying to invoke " + methodName + " on an instance of " + mLocalClass.getCanonicalName() + "."); try { @@ -559,10 +567,7 @@ public class ReflectionUtils { } else { Logger.REFLECTION(methodName + " is null."); } - } catch (NoSuchMethodException - | SecurityException - | IllegalAccessException - | IllegalArgumentException + } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { Logger.REFLECTION( "Failed to Dynamically invoke " + methodName + " on an object of type: " + mLocalClass.getName()); @@ -577,8 +582,7 @@ public class ReflectionUtils { return false; } String methodName = method.getName(); - String classname = objectInstance != null - ? objectInstance.getClass().getCanonicalName() + String classname = objectInstance != null ? objectInstance.getClass().getCanonicalName() : method.getDeclaringClass().getCanonicalName(); Logger.REFLECTION("Trying to invoke " + methodName + " on an instance of " + classname + "."); try { @@ -595,8 +599,8 @@ public class ReflectionUtils { if (objectInstance == null || methodName == null || parameters == null || values == null) { return false; } - Class mLocalClass = - (objectInstance instanceof Class ? (Class) objectInstance : objectInstance.getClass()); + Class mLocalClass = (objectInstance instanceof Class ? (Class) objectInstance + : objectInstance.getClass()); Logger.REFLECTION( "Trying to invoke " + methodName + " on an instance of " + mLocalClass.getCanonicalName() + "."); try { @@ -607,10 +611,7 @@ public class ReflectionUtils { } else { Logger.REFLECTION(methodName + " is null."); } - } catch (NoSuchMethodException - | SecurityException - | IllegalAccessException - | IllegalArgumentException + } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { Logger.REFLECTION( "Failed to Dynamically invoke " + methodName + " on an object of type: " + mLocalClass.getName()); @@ -625,9 +626,7 @@ public class ReflectionUtils { */ /* - * * Below Code block is used for determining generic types associated with type - * */ // https://xebia.com/blog/acessing-generic-types-at-runtime-in-java/ @@ -692,9 +691,8 @@ public class ReflectionUtils { private static Class browseNestedTypes(Object instance, TypeVariable actualType) { Class instanceClass = instance.getClass(); List> nestedOuterTypes = new LinkedList>(); - for (Class enclosingClass = instanceClass.getEnclosingClass(); - enclosingClass != null; - enclosingClass = enclosingClass.getEnclosingClass()) { + for (Class enclosingClass = instanceClass.getEnclosingClass(); enclosingClass + != null; enclosingClass = enclosingClass.getEnclosingClass()) { try { Field this$0 = instanceClass.getDeclaredField("this$0"); Object outerInstance = this$0.get(instance); @@ -737,9 +735,7 @@ public class ReflectionUtils { } /* - * * End of Generics Block - * */ private static Field getField_Internal(final Class clazz, final String fieldName) throws NoSuchFieldException { @@ -766,9 +762,8 @@ public class ReflectionUtils { } /** - * if (isPresent("com.optionaldependency.DependencyClass")) || - * This block will never execute when the dependency is not present. There is - * therefore no more risk of code throwing NoClassDefFoundException. + * if (isPresent("com.optionaldependency.DependencyClass")) || This block will never execute when the dependency is + * not present. There is therefore no more risk of code throwing NoClassDefFoundException. */ private static boolean isClassPresent(final String className) { try { @@ -781,8 +776,8 @@ public class ReflectionUtils { } @Deprecated - public static Method getMethodViaReflection( - final Class lookupClass, final String methodName, final boolean invoke) throws Exception { + public static Method getMethodViaReflection(final Class lookupClass, final String methodName, + final boolean invoke) throws Exception { final Class lookup = lookupClass.getClass(); final Method m = lookup.getDeclaredMethod(methodName); m.setAccessible(true); // Abracadabra @@ -868,8 +863,9 @@ public class ReflectionUtils { } private static void dumpClassInfo(Class aClass) { - Logger.INFO("We ran into an error processing reflection in " + aClass.getName() - + ", dumping all data for debugging."); + Logger.INFO( + "We ran into an error processing reflection in " + aClass.getName() + + ", dumping all data for debugging."); // Get the methods Method[] methods = aClass.getDeclaredMethods(); Field[] fields = aClass.getDeclaredFields(); @@ -877,8 +873,8 @@ public class ReflectionUtils { Logger.INFO("Dumping all Methods."); for (Method method : methods) { - System.out.println( - method.getName() + " | " + StringUtils.getDataStringFromArray(method.getParameterTypes())); + System.out + .println(method.getName() + " | " + StringUtils.getDataStringFromArray(method.getParameterTypes())); } Logger.INFO("Dumping all Fields."); for (Field f : fields) { @@ -886,8 +882,11 @@ public class ReflectionUtils { } Logger.INFO("Dumping all Constructors."); for (Constructor c : consts) { - System.out.println(c.getName() + " | " + c.getParameterCount() + " | " - + StringUtils.getDataStringFromArray(c.getParameterTypes())); + System.out.println( + c.getName() + " | " + + c.getParameterCount() + + " | " + + StringUtils.getDataStringFromArray(c.getParameterTypes())); } } @@ -922,9 +921,7 @@ public class ReflectionUtils { try { final Object o = constructor.newInstance(); return (Class) o; - } catch (InstantiationException - | IllegalAccessException - | IllegalArgumentException + } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -966,8 +963,10 @@ public class ReflectionUtils { for (Class h : y) { Logger.REFLECTION("Found hidden inner class: " + h.getCanonicalName()); if (h.getSimpleName().toLowerCase().equals(aData[aData.length - 1].toLowerCase())) { - Logger.REFLECTION("Found correct class. [" + aData[aData.length - 1] - + "] Caching at correct location: " + string); + Logger.REFLECTION( + "Found correct class. [" + aData[aData.length - 1] + + "] Caching at correct location: " + + string); Logger.REFLECTION("Found at location: " + h.getCanonicalName()); ReflectionUtils.mCachedClasses.put(string, h); aClass = h; @@ -1017,8 +1016,7 @@ public class ReflectionUtils { public static T getFieldValue(Field field, Object instance) { try { return (T) field.get(instance); - } catch (IllegalArgumentException | IllegalAccessException e) { - } + } catch (IllegalArgumentException | IllegalAccessException e) {} return null; } @@ -1029,9 +1027,7 @@ public class ReflectionUtils { if (aInstance != null) { return aInstance; } - } catch (InstantiationException - | IllegalAccessException - | IllegalArgumentException + } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } diff --git a/src/main/java/gtPlusPlus/core/util/sys/KeyboardUtils.java b/src/main/java/gtPlusPlus/core/util/sys/KeyboardUtils.java index 3e26d8ff35..7b3baffc7e 100644 --- a/src/main/java/gtPlusPlus/core/util/sys/KeyboardUtils.java +++ b/src/main/java/gtPlusPlus/core/util/sys/KeyboardUtils.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.util.sys; import net.minecraft.client.Minecraft; + import org.lwjgl.input.Keyboard; public class KeyboardUtils { @@ -12,8 +13,8 @@ public class KeyboardUtils { } // prioritize CONTROL, but allow OPTION as well on Mac (note: GuiScreen's isCtrlKeyDown only checks for the // OPTION key on Mac) - boolean isCtrlKeyDown = - Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); + boolean isCtrlKeyDown = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) + || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); if (!isCtrlKeyDown && Minecraft.isRunningOnMac) isCtrlKeyDown = Keyboard.isKeyDown(Keyboard.KEY_LMETA) || Keyboard.isKeyDown(Keyboard.KEY_RMETA); diff --git a/src/main/java/gtPlusPlus/core/util/sys/Log.java b/src/main/java/gtPlusPlus/core/util/sys/Log.java index 026bb533c7..d9ffd5fa42 100644 --- a/src/main/java/gtPlusPlus/core/util/sys/Log.java +++ b/src/main/java/gtPlusPlus/core/util/sys/Log.java @@ -4,6 +4,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public final class Log { + public static final Logger LOGGER = LogManager.getLogger("MiscUtils"); public static void warn(final String msg) { diff --git a/src/main/java/gtPlusPlus/core/util/sys/SystemUtils.java b/src/main/java/gtPlusPlus/core/util/sys/SystemUtils.java index 662a3261c0..71ed513618 100644 --- a/src/main/java/gtPlusPlus/core/util/sys/SystemUtils.java +++ b/src/main/java/gtPlusPlus/core/util/sys/SystemUtils.java @@ -34,8 +34,7 @@ public class SystemUtils { } public static boolean isUnix() { - return (getOSString().indexOf("nix") >= 0 - || getOSString().indexOf("nux") >= 0 + return (getOSString().indexOf("nix") >= 0 || getOSString().indexOf("nux") >= 0 || getOSString().indexOf("aix") > 0); } @@ -66,6 +65,7 @@ public class SystemUtils { } public static enum OS { + MAC(1), WINDOWS(2), UNIX(3), -- cgit