diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/util')
37 files changed, 2556 insertions, 2406 deletions
diff --git a/src/Java/gtPlusPlus/core/util/BaseHandler.java b/src/Java/gtPlusPlus/core/util/BaseHandler.java index 63f22f3763..9457dc363f 100644 --- a/src/Java/gtPlusPlus/core/util/BaseHandler.java +++ b/src/Java/gtPlusPlus/core/util/BaseHandler.java @@ -3,9 +3,9 @@ package gtPlusPlus.core.util; public abstract class BaseHandler { public abstract void preInit(); - + public abstract void init(); - + public abstract void postInit(); - + } diff --git a/src/Java/gtPlusPlus/core/util/ClassUtils.java b/src/Java/gtPlusPlus/core/util/ClassUtils.java index dfd8ec898b..20ca894211 100644 --- a/src/Java/gtPlusPlus/core/util/ClassUtils.java +++ b/src/Java/gtPlusPlus/core/util/ClassUtils.java @@ -10,31 +10,31 @@ public class ClassUtils { // There is therefore no more risk of code throwing NoClassDefFoundException. executeCodeLinkingToDependency(); }*/ - public static boolean isPresent(String className) { + public static boolean isPresent(final String className) { try { Class.forName(className); return true; - } catch (Throwable ex) { + } catch (final Throwable ex) { // Class or one of its dependencies is not present... return false; } } - public static Method getMethodViaReflection(Class<?> lookupClass, String methodName, boolean invoke) throws Exception{ - Class<? extends Class> lookup = lookupClass.getClass(); - Method m = lookup.getDeclaredMethod(methodName); - m.setAccessible(true);// Abracadabra + public static Method getMethodViaReflection(final Class<?> lookupClass, final String methodName, final boolean invoke) throws Exception{ + final Class<? extends Class> lookup = lookupClass.getClass(); + final Method m = lookup.getDeclaredMethod(methodName); + m.setAccessible(true);// Abracadabra if (invoke){ m.invoke(lookup);// now its OK } return m; } - public static Class getNonPublicClass(String className){ + public static Class getNonPublicClass(final String className){ Class<?> c = null; try { c = Class.forName(className); - } catch (ClassNotFoundException e) { + } catch (final ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } @@ -59,7 +59,7 @@ public class ClassUtils { constructor.setAccessible(true);//ABRACADABRA! try { - Object o = constructor.newInstance(); + final Object o = constructor.newInstance(); return (Class) o; } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { diff --git a/src/Java/gtPlusPlus/core/util/Log.java b/src/Java/gtPlusPlus/core/util/Log.java index ea7076e453..aa0231b954 100644 --- a/src/Java/gtPlusPlus/core/util/Log.java +++ b/src/Java/gtPlusPlus/core/util/Log.java @@ -5,25 +5,25 @@ import org.apache.logging.log4j.Logger; public final class Log { - public static final Logger LOGGER = LogManager.getLogger("MiscUtils"); - - public static void warn(String msg) - { - LOGGER.warn(msg); - } - - public static void error(String msg) - { - LOGGER.error(msg); - } - - public static void info(String msg) - { - LOGGER.info(msg); - } - - public static void debug(String msg) - { - LOGGER.debug(msg); - } + public static final Logger LOGGER = LogManager.getLogger("MiscUtils"); + + public static void warn(final String msg) + { + LOGGER.warn(msg); + } + + public static void error(final String msg) + { + LOGGER.error(msg); + } + + public static void info(final String msg) + { + LOGGER.info(msg); + } + + public static void debug(final String msg) + { + LOGGER.debug(msg); + } } diff --git a/src/Java/gtPlusPlus/core/util/LoggingUtils.java b/src/Java/gtPlusPlus/core/util/LoggingUtils.java index 607771bc8e..3e8219d53a 100644 --- a/src/Java/gtPlusPlus/core/util/LoggingUtils.java +++ b/src/Java/gtPlusPlus/core/util/LoggingUtils.java @@ -5,47 +5,47 @@ import java.util.Date; public class LoggingUtils { - public static void profileLog(Object o){ - try { + public static void profileLog(final Object o){ + try { String content; - File file = new File("GregtechTimingsTC.txt"); + final File file = new File("GregtechTimingsTC.txt"); // if file doesnt exists, then create it if (!file.exists()) { file.createNewFile(); - FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); - BufferedWriter bw = new BufferedWriter(fw); + final FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); + final BufferedWriter bw = new BufferedWriter(fw); bw.write("============================================================"); bw.write(System.lineSeparator()); bw.close(); - } + } if (o instanceof String){ content = (String) o; - } - else { - content = o.toString(); - } - FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); - BufferedWriter bw = new BufferedWriter(fw); + } + else { + content = o.toString(); + } + final FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); + final BufferedWriter bw = new BufferedWriter(fw); bw.write(content); bw.write(System.lineSeparator()); bw.close(); System.out.println("Data Logged."); - } catch (IOException e) { + } catch (final IOException e) { System.out.println("Data logging failed."); } - } - - public static boolean logCurrentSystemTime(String message){ - Date date = new Date(System.currentTimeMillis()); - try { - profileLog(message+" | "+date.toString()); - return true; - } - catch (Throwable r) { - return false; - } - } - + + public static boolean logCurrentSystemTime(final String message){ + final Date date = new Date(System.currentTimeMillis()); + try { + profileLog(message+" | "+date.toString()); + return true; + } + catch (final Throwable r) { + return false; + } + + } + } diff --git a/src/Java/gtPlusPlus/core/util/Quality.java b/src/Java/gtPlusPlus/core/util/Quality.java index 1ce29c7a58..b866b2e28b 100644 --- a/src/Java/gtPlusPlus/core/util/Quality.java +++ b/src/Java/gtPlusPlus/core/util/Quality.java @@ -4,13 +4,13 @@ import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.util.EnumChatFormatting; public enum Quality { - + // Magic Blue // Rare Yellow // Set Green // Unique Gold/Purple // Trade-off Brown - + POOR("Poor", EnumChatFormatting.GRAY), COMMON("Common", EnumChatFormatting.WHITE), UNCOMMON("Uncommon", EnumChatFormatting.DARK_GREEN), @@ -31,27 +31,28 @@ public enum Quality { } public String getQuality() { - return LOOT; + return this.LOOT; } - + protected EnumChatFormatting getColour(){ - return COLOUR; + return this.COLOUR; } - + public String formatted(){ return this.COLOUR+this.LOOT; } - + public static Quality getRandomQuality(){ - int lootChance = MathUtils.randInt(0, 100); + final int lootChance = MathUtils.randInt(0, 100); if (lootChance <= 10){return Quality.POOR;} else if (lootChance <= 45){return Quality.COMMON;} else if (lootChance <= 65){return Quality.UNCOMMON;} else if (lootChance <= 82){return Quality.MAGIC;} else if (lootChance <= 92){return Quality.EPIC;} else if (lootChance <= 97){return Quality.RARE;} - else if (lootChance <= 99){return Quality.ARTIFACT;} - else return null; + else if (lootChance <= 99){return Quality.ARTIFACT;} else { + return null; + } } } diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index db8ed87231..72441660d2 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -1,6 +1,16 @@ package gtPlusPlus.core.util; -import gregtech.api.enums.*; +import java.awt.Color; +import java.awt.Graphics; +import java.lang.reflect.Method; +import java.util.*; + +import org.apache.commons.lang3.EnumUtils; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.FMLLog; +import gregtech.api.enums.Materials; +import gregtech.api.enums.TC_Aspects; import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.lib.CORE; @@ -12,14 +22,7 @@ import gtPlusPlus.core.util.math.MathUtils; import ic2.core.Ic2Items; import ic2.core.init.InternalName; import ic2.core.item.resources.ItemCell; - -import java.awt.Color; -import java.awt.Graphics; -import java.lang.reflect.Method; -import java.util.*; - import net.minecraft.block.Block; -import net.minecraft.block.Block.SoundType; import net.minecraft.entity.Entity; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; @@ -31,11 +34,6 @@ import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fluids.*; import net.minecraftforge.oredict.OreDictionary; -import org.apache.commons.lang3.EnumUtils; - -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.FMLLog; - public class Utils { public static final int WILDCARD_VALUE = Short.MAX_VALUE; @@ -55,27 +53,27 @@ public class Utils { if (CORE.MASTER_VERSION.toLowerCase().equals("offline")){ return false; - } + } if (CORE.MASTER_VERSION.equals(CORE.VERSION.toLowerCase())){ return true; - } + } return false; } - public static TC_AspectStack getTcAspectStack (TC_Aspects aspect, long size){ + public static TC_AspectStack getTcAspectStack (final TC_Aspects aspect, final long size){ return getTcAspectStack(aspect.name(), (int) size); } - public static TC_AspectStack getTcAspectStack (String aspect, long size){ + public static TC_AspectStack getTcAspectStack (final String aspect, final long size){ return getTcAspectStack(aspect, (int) size); } - public static TC_AspectStack getTcAspectStack (TC_Aspects aspect, int size){ + public static TC_AspectStack getTcAspectStack (final TC_Aspects aspect, final int size){ return getTcAspectStack(aspect.name(), size); } - public static TC_AspectStack getTcAspectStack (String aspect, int size){ + public static TC_AspectStack getTcAspectStack (final String aspect, final int size){ TC_AspectStack returnValue = null; @@ -89,13 +87,13 @@ public class Utils { else { Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITO"), size); - } - } catch (NoSuchFieldError r){ + } + } catch (final NoSuchFieldError r){ Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); } } else if (aspect.toUpperCase().equals("EXANIMUS")){ - //Adds in Compat for older GT Versions which Misspell aspects. + //Adds in Compat for older GT Versions which Misspell aspects. try { if (EnumUtils.isValidEnum(TC_Aspects.class, "EXANIMUS")){ Utils.LOG_WARNING("TC Aspect found - "+aspect); @@ -104,15 +102,15 @@ public class Utils { else { Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXAMINIS"), size); - } - } catch (NoSuchFieldError r){ + } + } catch (final NoSuchFieldError r){ Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); } } else if (aspect.toUpperCase().equals("PRAECANTATIO")){ - //Adds in Compat for older GT Versions which Misspell aspects. + //Adds in Compat for older GT Versions which Misspell aspects. try { if (EnumUtils.isValidEnum(TC_Aspects.class, "PRAECANTATIO")){ Utils.LOG_WARNING("TC Aspect found - "+aspect); @@ -121,10 +119,10 @@ public class Utils { else { Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTIO"), size); - } - } catch (NoSuchFieldError r){ + } + } catch (final NoSuchFieldError r){ Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); - } + } } else { Utils.LOG_WARNING("TC Aspect found - "+aspect); @@ -134,11 +132,11 @@ public class Utils { return returnValue; } - public static boolean containsMatch(boolean strict, ItemStack[] inputs, ItemStack... targets) + public static boolean containsMatch(final boolean strict, final ItemStack[] inputs, final ItemStack... targets) { - for (ItemStack input : inputs) + for (final ItemStack input : inputs) { - for (ItemStack target : targets) + for (final ItemStack target : targets) { if (itemMatches(target, input, strict)) { @@ -149,67 +147,67 @@ public class Utils { return false; } - public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict) + public static boolean itemMatches(final ItemStack target, final ItemStack input, final boolean strict) { - if (input == null || target == null) + if ((input == null) || (target == null)) { return false; } - return (target.getItem() == input.getItem() && ((target.getItemDamage() == WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage())); + return ((target.getItem() == input.getItem()) && (((target.getItemDamage() == WILDCARD_VALUE) && !strict) || (target.getItemDamage() == input.getItemDamage()))); } - //Non-Dev Comments - public static void LOG_INFO(String s){ + //Non-Dev Comments + public static void LOG_INFO(final String s){ //if (CORE.DEBUG){ FMLLog.info("GT++: "+s); //} } - //Non-Dev Comments - public static void LOG_MACHINE_INFO(String s){ + //Non-Dev Comments + public static void LOG_MACHINE_INFO(final String s){ if (CORE.configSwitches.MACHINE_INFO || ClientProxy.playerName.toLowerCase().contains("draknyte1")){ - FMLLog.info("GT++: Machine Info: "+s); + FMLLog.info("GT++: Machine Info: "+s); } } //Developer Comments - public static void LOG_WARNING(String s){ + public static void LOG_WARNING(final String s){ if (CORE.DEBUG){ FMLLog.warning("GT++: "+s); } } //Errors - public static void LOG_ERROR(String s){ + public static void LOG_ERROR(final String s){ if (CORE.DEBUG){ FMLLog.severe("GT++: "+s); } } //Developer Logger - public static void LOG_SPECIFIC_WARNING(String whatToLog, String msg, int line){ - //if (!CORE.DEBUG){ + public static void LOG_SPECIFIC_WARNING(final String whatToLog, final String msg, final int line){ + //if (!CORE.DEBUG){ FMLLog.warning("GT++ |"+line+"| "+whatToLog+" | "+msg); - //} + //} } - public static void paintBox(Graphics g, int MinA, int MinB, int MaxA, int MaxB){ - g.drawRect (MinA, MinB, MaxA, MaxB); + public static void paintBox(final Graphics g, final int MinA, final int MinB, final int MaxA, final int MaxB){ + g.drawRect (MinA, MinB, MaxA, MaxB); } // Send a message to all players on the server - public static void sendServerMessage(String translationKey) { + public static void sendServerMessage(final String translationKey) { sendServerMessage(new ChatComponentText(translationKey)); } // Send a message to all players on the server - public static void sendServerMessage(IChatComponent chatComponent) { + public static void sendServerMessage(final IChatComponent chatComponent) { MinecraftServer.getServer().getConfigurationManager().sendChatMsg(chatComponent); } /** * Returns if that Liquid is IC2Steam. */ - public static boolean isIC2Steam(FluidStack aFluid) { + public static boolean isIC2Steam(final FluidStack aFluid) { if (aFluid == null) { return false; } @@ -219,7 +217,7 @@ public class Utils { /** * Returns a Liquid Stack with given amount of IC2Steam. */ - public static FluidStack getIC2Steam(long aAmount) { + public static FluidStack getIC2Steam(final long aAmount) { return FluidRegistry.getFluidStack("ic2steam", (int)aAmount); } @@ -231,17 +229,17 @@ public class Utils { 'A',slot_1,'B',slot_2,'C',slot_3, 'D',slot_4,'E',slot_5,'F',slot_6, 'G',slot_7,'H',slot_8,'I',slot_9 - }); + }); }*/ - public static String checkCorrectMiningToolForBlock(Block currentBlock, World currentWorld){ + public static String checkCorrectMiningToolForBlock(final Block currentBlock, final World currentWorld){ String correctTool = ""; - if (!currentWorld.isRemote){ + if (!currentWorld.isRemote){ try { correctTool = currentBlock.getHarvestTool(0); Utils.LOG_WARNING(correctTool); - } catch (NullPointerException e){ + } catch (final NullPointerException e){ } } @@ -250,17 +248,17 @@ public class Utils { } /** - * + * * @param colourStr e.g. "#FFFFFF" * @return String - formatted "rgb(0,0,0)" */ - public static String hex2RgbFormatted(String hexString) { - Color c = new Color( - Integer.valueOf(hexString.substring(1, 3), 16), - Integer.valueOf(hexString.substring(3, 5), 16), + public static String hex2RgbFormatted(final String hexString) { + final Color c = new Color( + Integer.valueOf(hexString.substring(1, 3), 16), + Integer.valueOf(hexString.substring(3, 5), 16), Integer.valueOf(hexString.substring(5, 7), 16)); - StringBuffer sb = new StringBuffer(); + final StringBuffer sb = new StringBuffer(); sb.append("rgb("); sb.append(c.getRed()); sb.append(","); @@ -272,11 +270,11 @@ public class Utils { } /** - * + * * @param colourStr e.g. "#FFFFFF" - * @return + * @return */ - public static Color hex2Rgb(String colorStr) { + public static Color hex2Rgb(final String colorStr) { return new Color( Integer.valueOf( colorStr.substring( 1, 3 ), 16 ), Integer.valueOf( colorStr.substring( 3, 5 ), 16 ), @@ -284,72 +282,72 @@ public class Utils { } /** - * + * * @param colourInt e.g. 0XFFFFFF * @return Colour */ - public static Color hex2Rgb(int colourInt) { + public static Color hex2Rgb(final int colourInt) { return Color.decode(String.valueOf(colourInt)); } /** - * + * * @param colourInt e.g. 0XFFFFFF * @return short[] */ - public static short[] hex2RgbShort(int colourInt) { - Color rgb = Color.decode(String.valueOf(colourInt)); - short[] rgba = {(short) rgb.getRed(), (short) rgb.getGreen(), (short) rgb.getBlue(), (short) rgb.getAlpha()}; + public static short[] hex2RgbShort(final int colourInt) { + final Color rgb = Color.decode(String.valueOf(colourInt)); + final short[] rgba = {(short) rgb.getRed(), (short) rgb.getGreen(), (short) rgb.getBlue(), (short) rgb.getAlpha()}; return rgba; } - public static Timer ShortTimer(int seconds) { + public static Timer ShortTimer(final int seconds) { Timer timer; timer = new Timer(); timer.schedule(new ShortTimerTask(), seconds * 1000); return timer; } - public static String byteToHex(byte b) { - int i = b & 0xFF; + public static String byteToHex(final byte b) { + final int i = b & 0xFF; return Integer.toHexString(i); } - public static Object[] convertListToArray(List<Object> sourceList) { - Object[] targetArray = sourceList.toArray(new Object[sourceList.size()]); + public static Object[] convertListToArray(final List<Object> sourceList) { + final Object[] targetArray = sourceList.toArray(new Object[sourceList.size()]); return targetArray; } - public static List<Object> convertArrayToFixedSizeList(Object[] sourceArray) { - List<Object> targetList = Arrays.asList(sourceArray); + public static List<Object> convertArrayToFixedSizeList(final Object[] sourceArray) { + final List<Object> targetList = Arrays.asList(sourceArray); return targetList; } - public static List<Object> convertArrayToList(Object[] sourceArray) { - List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray)); + public static List<Object> convertArrayToList(final Object[] sourceArray) { + final List<Object> targetList = new ArrayList<>(Arrays.asList(sourceArray)); return targetList; } - public static List<Object> convertArrayListToList(ArrayList sourceArray) { - List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray)); + public static List<Object> convertArrayListToList(final ArrayList sourceArray) { + final List<Object> targetList = new ArrayList<>(Arrays.asList(sourceArray)); return targetList; } - public static void spawnCustomParticle(Entity entity){ + public static void spawnCustomParticle(final Entity entity){ GTplusplus.proxy.generateMysteriousParticles(entity); - } + } - public static void spawnFX(World world, int x, int y, int z, String particleName, Object particleName2){ + public static void spawnFX(final World world, final int x, final int y, final int z, final String particleName, Object particleName2){ if (!world.isRemote){ - if (particleName2 == null || particleName2.equals("")){ + if ((particleName2 == null) || particleName2.equals("")){ particleName2 = particleName; } - int l = MathUtils.randInt(0, 4); - double d0 = (double)((float)x + 0.5F); - double d1 = (double)((float)y + 0.7F); - double d2 = (double)((float)z + 0.5F); - double d3 = 0.2199999988079071D; - double d4 = 0.27000001072883606D; + final int l = MathUtils.randInt(0, 4); + final double d0 = x + 0.5F; + final double d1 = y + 0.7F; + final double d2 = z + 0.5F; + final double d3 = 0.2199999988079071D; + final double d4 = 0.27000001072883606D; if (l == 1) { @@ -377,14 +375,14 @@ public class Utils { } } - public static int rgbtoHexValue(int r, int g, int b){ - if (r > 255 || g > 255 || b > 255 || r < 0 || g < 0 || b < 0){ + public static int rgbtoHexValue(final int r, final int g, final int b){ + if ((r > 255) || (g > 255) || (b > 255) || (r < 0) || (g < 0) || (b < 0)){ return 0; } - Color c = new Color(r,g,b); - String temp = Integer.toHexString( c.getRGB() & 0xFFFFFF ).toUpperCase(); + final Color c = new Color(r,g,b); + String temp = Integer.toHexString( c.getRGB() & 0xFFFFFF ).toUpperCase(); - //System.out.println( "hex: " + Integer.toHexString( c.getRGB() & 0xFFFFFF ) + " hex value:"+temp); + //System.out.println( "hex: " + Integer.toHexString( c.getRGB() & 0xFFFFFF ) + " hex value:"+temp); temp = Utils.appenedHexNotationToString(String.valueOf(temp)); Utils.LOG_WARNING("Made "+temp+" - Hopefully it's not a mess."); Utils.LOG_WARNING("It will decode into "+Integer.decode(temp)+"."); @@ -394,26 +392,26 @@ public class Utils { /* * http://javadevnotes.com/java-left-pad-string-with-zeros-examples */ - public static String leftPadWithZeroes(String originalString, int length) { - StringBuilder sb = new StringBuilder(); - while (sb.length() + originalString.length() < length) { + public static String leftPadWithZeroes(final String originalString, final int length) { + final StringBuilder sb = new StringBuilder(); + while ((sb.length() + originalString.length()) < length) { sb.append('0'); } sb.append(originalString); - String paddedString = sb.toString(); + final String paddedString = sb.toString(); return paddedString; } /* * Original Code by Chandana Napagoda - https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator.html - */ - public static Map<Integer, String> hexColourGenerator(int colorCount){ - int maxColorValue = 16777215; + */ + public static Map<Integer, String> hexColourGenerator(final int colorCount){ + final int maxColorValue = 16777215; // this is decimal value of the "FFFFFF" - int devidedvalue = maxColorValue/colorCount; + final int devidedvalue = maxColorValue/colorCount; int countValue = 0; - HashMap<Integer, String> hexColorMap = new HashMap<Integer, String>(); - for(int a=0; a < colorCount && maxColorValue >= countValue ; a++){ + final HashMap<Integer, String> hexColorMap = new HashMap<>(); + for(int a=0; (a < colorCount) && (maxColorValue >= countValue) ; a++){ if(a != 0){ countValue+=devidedvalue; hexColorMap.put(a,Integer.toHexString( 0x10000 | countValue).substring(1).toUpperCase()); @@ -428,33 +426,33 @@ public class Utils { /* * Original Code by Chandana Napagoda - https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator.html */ - public static Map<Integer, String> hexColourGeneratorRandom(int colorCount){ - HashMap<Integer, String> hexColorMap = new HashMap<Integer, String>(); + public static Map<Integer, String> hexColourGeneratorRandom(final int colorCount){ + final HashMap<Integer, String> hexColorMap = new HashMap<>(); for(int a=0;a < colorCount; a++){ String code = ""+(int)(Math.random()*256); code = code+code+code; - int i = Integer.parseInt(code); + final int i = Integer.parseInt(code); hexColorMap.put(a,Integer.toHexString( 0x1000000 | i).substring(1).toUpperCase()); Utils.LOG_WARNING(""+Integer.toHexString( 0x1000000 | i).substring(1).toUpperCase()); } return hexColorMap; } - public static String appenedHexNotationToString(Object hexAsStringOrInt){ - String hexChar = "0x"; + public static String appenedHexNotationToString(final Object hexAsStringOrInt){ + final String hexChar = "0x"; String result; if (hexAsStringOrInt.getClass() == String.class){ if (((String) hexAsStringOrInt).length() != 6){ - String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6); + final String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6); result = temp; } result = hexChar+hexAsStringOrInt; return result; } - else if (hexAsStringOrInt.getClass() == Integer.class){ + else if (hexAsStringOrInt.getClass() == Integer.class){ if (((String) hexAsStringOrInt).length() != 6){ - String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6); + final String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6); result = temp; } result = hexChar+String.valueOf(hexAsStringOrInt); @@ -465,22 +463,22 @@ public class Utils { } } - public static Integer appenedHexNotationToInteger(int hexAsStringOrInt){ - String hexChar = "0x"; + public static Integer appenedHexNotationToInteger(final int hexAsStringOrInt){ + final String hexChar = "0x"; String result; Utils.LOG_WARNING(String.valueOf(hexAsStringOrInt)); result = hexChar+String.valueOf(hexAsStringOrInt); return Integer.getInteger(result); } - public static boolean doesEntryExistAlreadyInOreDictionary(String OreDictName){ + public static boolean doesEntryExistAlreadyInOreDictionary(final String OreDictName){ if (OreDictionary.getOres(OreDictName).size() != 0) { return true; } return false; } - public static boolean invertBoolean(boolean booleans){ + public static boolean invertBoolean(final boolean booleans){ if (booleans == true){ return false; } @@ -488,34 +486,34 @@ public class Utils { } private static short cellID = 15; - public static ItemStack createInternalNameAndFluidCell(String s){ + public static ItemStack createInternalNameAndFluidCell(final String s){ Utils.LOG_WARNING("1"); - InternalName yourName = EnumHelper.addEnum(InternalName.class, s, new Class[0], new Object[0]); + final InternalName yourName = EnumHelper.addEnum(InternalName.class, s, new Class[0], new Object[0]); Utils.LOG_WARNING("2 "+yourName.name()); - ItemCell item = (ItemCell)Ic2Items.cell.getItem(); + final ItemCell item = (ItemCell)Ic2Items.cell.getItem(); Utils.LOG_WARNING("3 "+item.getUnlocalizedName()); try { Utils.LOG_WARNING("4"); - Class<? extends ItemCell> clz = item.getClass(); + final Class<? extends ItemCell> clz = item.getClass(); Utils.LOG_WARNING("5 "+clz.getSimpleName()); - Method methode = clz.getDeclaredMethod("addCell", int.class, InternalName.class, Block[].class); + final Method methode = clz.getDeclaredMethod("addCell", int.class, InternalName.class, Block[].class); Utils.LOG_WARNING("6 "+methode.getName()); methode.setAccessible(true); Utils.LOG_WARNING("7 "+methode.isAccessible()); - ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]); + final ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]); Utils.LOG_WARNING("Successfully created "+temp.getDisplayName()+"s."); FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(s.toLowerCase(), 0), temp.copy(), Ic2Items.cell.copy()); ItemUtils.addItemToOreDictionary(temp.copy(), "cell"+s); return temp; } - catch(Exception e){ + catch(final Exception e){ e.printStackTrace(); } return null; } - public static String sanitizeString(String input){ + public static String sanitizeString(final String input){ String temp; String output; @@ -533,39 +531,39 @@ public class Utils { temp = temp.replace("[", ""); temp = temp.replace("]", ""); temp = temp.replace(" ", ""); - output = temp; + output = temp; return output; } - - public static String[] parseVersion(String version){ + + public static String[] parseVersion(final String version){ return parseVersion(version, "//."); } - - public static String[] parseVersion(String version, String delimiter){ - String[] versionArray = version.split(delimiter); + + public static String[] parseVersion(final String version, final String delimiter){ + final String[] versionArray = version.split(delimiter); return versionArray; } - - public static Versioning compareModVersion (String currentVersion, String expectedVersion){ + + public static Versioning compareModVersion (final String currentVersion, final String expectedVersion){ return compareModVersion(currentVersion, expectedVersion, "//."); } - - public static Versioning compareModVersion (String currentVersion, String expectedVersion, String delimiter){ - String[] a = parseVersion(currentVersion, delimiter); - String[] b = parseVersion(expectedVersion, delimiter); - int[] c = new int[a.length]; - int[] d = new int[b.length]; + + public static Versioning compareModVersion (final String currentVersion, final String expectedVersion, final String delimiter){ + final String[] a = parseVersion(currentVersion, delimiter); + final String[] b = parseVersion(expectedVersion, delimiter); + final int[] c = new int[a.length]; + final int[] d = new int[b.length]; for (int r=0;r<a.length;r++){ c[r]=Integer.parseInt(a[r]); } for (int r=0;r<b.length;r++){ d[r]=Integer.parseInt(b[r]); } - Versioning[] e = new Versioning[MathUtils.returnLargestNumber(c.length, d.length)]; + final Versioning[] e = new Versioning[MathUtils.returnLargestNumber(c.length, d.length)]; for (int r=0;r<e.length;r++){ - - + + if (c[r] > d[r]){ e[r] = Versioning.NEWER; } @@ -576,7 +574,7 @@ public class Utils { e[r] = Versioning.EQUAL; } } - + for (int r=0;r<e.length;r++){ if (e[0] == Versioning.NEWER){ return Versioning.NEWER; @@ -584,69 +582,69 @@ public class Utils { else if (e[0] == Versioning.OLDER){ return Versioning.OLDER; } - else { + else { if (e[r] == Versioning.OLDER){ - + } - + return Versioning.NEWER; } } - - return null; + + return null; } - - - public static ToolMaterial generateToolMaterialFromGT(Materials gtMaterial){ - String name = Utils.sanitizeString(gtMaterial.mDefaultLocalName); - int harvestLevel = gtMaterial.mToolQuality; - int durability = gtMaterial.mDurability; - float damage = gtMaterial.mToolQuality; - int efficiency = (int) gtMaterial.mToolSpeed; - int enchantability = gtMaterial.mEnchantmentToolsLevel; - ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, enchantability); + + + public static ToolMaterial generateToolMaterialFromGT(final Materials gtMaterial){ + final String name = Utils.sanitizeString(gtMaterial.mDefaultLocalName); + final int harvestLevel = gtMaterial.mToolQuality; + final int durability = gtMaterial.mDurability; + final float damage = gtMaterial.mToolQuality; + final int efficiency = (int) gtMaterial.mToolSpeed; + final int enchantability = gtMaterial.mEnchantmentToolsLevel; + final ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, enchantability); return temp; } - public static ToolMaterial generateToolMaterial(Material material){ - String name = material.getLocalizedName(); - int harvestLevel = material.vHarvestLevel; - int durability = (int) material.vDurability; - float damage = material.vToolQuality; - int efficiency = (int) material.vToolQuality; + public static ToolMaterial generateToolMaterial(final Material material){ + final String name = material.getLocalizedName(); + final int harvestLevel = material.vHarvestLevel; + final int durability = (int) material.vDurability; + final float damage = material.vToolQuality; + final int efficiency = material.vToolQuality; //int enchantability = material.mEnchantmentToolsLevel; Utils.LOG_INFO("ToolMaterial stats for "+material.getLocalizedName()+" | harvestLevel:"+harvestLevel+" | durability:"+durability+" | toolQuality:"+damage+" | toolSpeed:"+damage); - ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, 0); + final ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, 0); return temp; } - - - - - - - - - - - - + + + + + + + + + + + + public static enum Versioning { - EQUAL(0), - NEWER(1), - OLDER(-1); - private int versioningInfo; - private Versioning (final int versionStatus){ - this.versioningInfo = versionStatus; - } - public int getTexture() { - return versioningInfo; - } - } - + EQUAL(0), + NEWER(1), + OLDER(-1); + private final int versioningInfo; + private Versioning (final int versionStatus){ + this.versioningInfo = versionStatus; + } + public int getTexture() { + return this.versioningInfo; + } + } + } diff --git a/src/Java/gtPlusPlus/core/util/UtilsChatFormatting.java b/src/Java/gtPlusPlus/core/util/UtilsChatFormatting.java index 51589a1f5d..f340e9be59 100644 --- a/src/Java/gtPlusPlus/core/util/UtilsChatFormatting.java +++ b/src/Java/gtPlusPlus/core/util/UtilsChatFormatting.java @@ -8,146 +8,146 @@ import cpw.mods.fml.relauncher.SideOnly; public enum UtilsChatFormatting { - BLACK('0'), - DARK_BLUE('1'), - DARK_GREEN('2'), - DARK_AQUA('3'), - DARK_RED('4'), - DARK_PURPLE('5'), - GOLD('6'), - GRAY('7'), - DARK_GRAY('8'), - BLUE('9'), - GREEN('a'), - AQUA('b'), - RED('c'), - LIGHT_PURPLE('d'), - YELLOW('e'), - WHITE('f'), - OBFUSCATED('k', true), - BOLD('l', true), - STRIKETHROUGH('m', true), - UNDERLINE('n', true), - ITALIC('o', true), - RESET('r'); - /** Maps a formatting code (e.g., 'f') to its corresponding enum value (e.g., WHITE). */ - private static final Map<Character, UtilsChatFormatting> formattingCodeMapping = new HashMap<Character, UtilsChatFormatting>(); - /** Maps a name (e.g., 'underline') to its corresponding enum value (e.g., UNDERLINE). */ - private static final Map<String, UtilsChatFormatting> nameMapping = new HashMap<String, UtilsChatFormatting>(); - /** - * Matches formatting codes that indicate that the client should treat the following text as bold, recolored, - * obfuscated, etc. - */ - private static final Pattern formattingCodePattern = Pattern.compile("(?i)" + String.valueOf('\u00a7') + "[0-9A-FK-OR]"); - /** The formatting code that produces this format. */ - private final char formattingCode; - private final boolean fancyStyling; - /** - * The control string (section sign + formatting code) that can be inserted into client-side text to display - * subsequent text in this format. - */ - private final String controlString; - - private UtilsChatFormatting(char p_i1336_3_) - { - this(p_i1336_3_, false); - } - - private UtilsChatFormatting(char p_i1337_3_, boolean p_i1337_4_) - { - this.formattingCode = p_i1337_3_; - this.fancyStyling = p_i1337_4_; - this.controlString = "\u00a7" + p_i1337_3_; - } - - /** - * Gets the formatting code that produces this format. - */ - public char getFormattingCode() - { - return this.formattingCode; - } - - /** - * False if this is just changing the color or resetting; true otherwise. - */ - public boolean isFancyStyling() - { - return this.fancyStyling; - } - - /** - * Checks if typo is a color. - */ - public boolean isColor() - { - return !this.fancyStyling && this != RESET; - } - - /** - * Gets the friendly name of this value. - */ - public String getFriendlyName() - { - return this.name().toLowerCase(); - } - - @Override + BLACK('0'), + DARK_BLUE('1'), + DARK_GREEN('2'), + DARK_AQUA('3'), + DARK_RED('4'), + DARK_PURPLE('5'), + GOLD('6'), + GRAY('7'), + DARK_GRAY('8'), + BLUE('9'), + GREEN('a'), + AQUA('b'), + RED('c'), + LIGHT_PURPLE('d'), + YELLOW('e'), + WHITE('f'), + OBFUSCATED('k', true), + BOLD('l', true), + STRIKETHROUGH('m', true), + UNDERLINE('n', true), + ITALIC('o', true), + RESET('r'); + /** Maps a formatting code (e.g., 'f') to its corresponding enum value (e.g., WHITE). */ + private static final Map<Character, UtilsChatFormatting> formattingCodeMapping = new HashMap<>(); + /** Maps a name (e.g., 'underline') to its corresponding enum value (e.g., UNDERLINE). */ + private static final Map<String, UtilsChatFormatting> nameMapping = new HashMap<>(); + /** + * Matches formatting codes that indicate that the client should treat the following text as bold, recolored, + * obfuscated, etc. + */ + private static final Pattern formattingCodePattern = Pattern.compile("(?i)" + String.valueOf('\u00a7') + "[0-9A-FK-OR]"); + /** The formatting code that produces this format. */ + private final char formattingCode; + private final boolean fancyStyling; + /** + * The control string (section sign + formatting code) that can be inserted into client-side text to display + * subsequent text in this format. + */ + private final String controlString; + + private UtilsChatFormatting(final char p_i1336_3_) + { + this(p_i1336_3_, false); + } + + private UtilsChatFormatting(final char p_i1337_3_, final boolean p_i1337_4_) + { + this.formattingCode = p_i1337_3_; + this.fancyStyling = p_i1337_4_; + this.controlString = "\u00a7" + p_i1337_3_; + } + + /** + * Gets the formatting code that produces this format. + */ + public char getFormattingCode() + { + return this.formattingCode; + } + + /** + * False if this is just changing the color or resetting; true otherwise. + */ + public boolean isFancyStyling() + { + return this.fancyStyling; + } + + /** + * Checks if typo is a color. + */ + public boolean isColor() + { + return !this.fancyStyling && (this != RESET); + } + + /** + * Gets the friendly name of this value. + */ + public String getFriendlyName() + { + return this.name().toLowerCase(); + } + + @Override public String toString() - { - return this.controlString; - } - - /** - * Returns a copy of the given string, with formatting codes stripped away. - */ - @SideOnly(Side.CLIENT) - public static String getTextWithoutFormattingCodes(String p_110646_0_) - { - return p_110646_0_ == null ? null : formattingCodePattern.matcher(p_110646_0_).replaceAll(""); - } - - /** - * Gets a value by its friendly name; null if the given name does not map to a defined value. - */ - public static UtilsChatFormatting getValueByName(String p_96300_0_) - { - return p_96300_0_ == null ? null : (UtilsChatFormatting)nameMapping.get(p_96300_0_.toLowerCase()); - } - - /** - * Gets all the valid values. Args: @param par0: Whether or not to include color values. @param par1: Whether or not - * to include fancy-styling values (anything that isn't a color value or the "reset" value). - */ - public static Collection<String> getValidValues(boolean p_96296_0_, boolean p_96296_1_) - { - ArrayList<String> arraylist = new ArrayList<String>(); - UtilsChatFormatting[] aenumchatformatting = values(); - int i = aenumchatformatting.length; - - for (int j = 0; j < i; ++j) - { - UtilsChatFormatting enumchatformatting = aenumchatformatting[j]; - - if ((!enumchatformatting.isColor() || p_96296_0_) && (!enumchatformatting.isFancyStyling() || p_96296_1_)) - { - arraylist.add(enumchatformatting.getFriendlyName()); - } - } - - return arraylist; - } - - static - { - UtilsChatFormatting[] var0 = values(); - int var1 = var0.length; - - for (int var2 = 0; var2 < var1; ++var2) - { - UtilsChatFormatting var3 = var0[var2]; - formattingCodeMapping.put(Character.valueOf(var3.getFormattingCode()), var3); - nameMapping.put(var3.getFriendlyName(), var3); - } - } + { + return this.controlString; + } + + /** + * Returns a copy of the given string, with formatting codes stripped away. + */ + @SideOnly(Side.CLIENT) + public static String getTextWithoutFormattingCodes(final String p_110646_0_) + { + return p_110646_0_ == null ? null : formattingCodePattern.matcher(p_110646_0_).replaceAll(""); + } + + /** + * Gets a value by its friendly name; null if the given name does not map to a defined value. + */ + public static UtilsChatFormatting getValueByName(final String p_96300_0_) + { + return p_96300_0_ == null ? null : (UtilsChatFormatting)nameMapping.get(p_96300_0_.toLowerCase()); + } + + /** + * Gets all the valid values. Args: @param par0: Whether or not to include color values. @param par1: Whether or not + * to include fancy-styling values (anything that isn't a color value or the "reset" value). + */ + public static Collection<String> getValidValues(final boolean p_96296_0_, final boolean p_96296_1_) + { + final ArrayList<String> arraylist = new ArrayList<>(); + final UtilsChatFormatting[] aenumchatformatting = values(); + final int i = aenumchatformatting.length; + + for (int j = 0; j < i; ++j) + { + final UtilsChatFormatting enumchatformatting = aenumchatformatting[j]; + + if ((!enumchatformatting.isColor() || p_96296_0_) && (!enumchatformatting.isFancyStyling() || p_96296_1_)) + { + arraylist.add(enumchatformatting.getFriendlyName()); + } + } + + return arraylist; + } + + static + { + final UtilsChatFormatting[] var0 = values(); + final int var1 = var0.length; + + for (int var2 = 0; var2 < var1; ++var2) + { + final UtilsChatFormatting var3 = var0[var2]; + formattingCodeMapping.put(Character.valueOf(var3.getFormattingCode()), var3); + nameMapping.put(var3.getFriendlyName(), var3); + } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/UtilsRarity.java b/src/Java/gtPlusPlus/core/util/UtilsRarity.java index 19339b7717..78f3a10bdb 100644 --- a/src/Java/gtPlusPlus/core/util/UtilsRarity.java +++ b/src/Java/gtPlusPlus/core/util/UtilsRarity.java @@ -4,20 +4,20 @@ import net.minecraft.util.EnumChatFormatting; public enum UtilsRarity { - T1_poor(EnumChatFormatting.GRAY, "Poor"), - T2_normal(EnumChatFormatting.WHITE, "Common"), - T3_uncommon(EnumChatFormatting.GREEN, "Uncommon"), - T4_magic(EnumChatFormatting.BLUE, "Magic"), - T5_rare(EnumChatFormatting.LIGHT_PURPLE, "Rare"), - T6_epic(EnumChatFormatting.YELLOW, "Epic"), - T8_unique(EnumChatFormatting.GOLD, "Unique"); - - public final EnumChatFormatting rarityColor; - public final String rarityName; + T1_poor(EnumChatFormatting.GRAY, "Poor"), + T2_normal(EnumChatFormatting.WHITE, "Common"), + T3_uncommon(EnumChatFormatting.GREEN, "Uncommon"), + T4_magic(EnumChatFormatting.BLUE, "Magic"), + T5_rare(EnumChatFormatting.LIGHT_PURPLE, "Rare"), + T6_epic(EnumChatFormatting.YELLOW, "Epic"), + T8_unique(EnumChatFormatting.GOLD, "Unique"); - private UtilsRarity(EnumChatFormatting rarity, String name) - { - this.rarityColor = rarity; - this.rarityName = name; - } + public final EnumChatFormatting rarityColor; + public final String rarityName; + + private UtilsRarity(final EnumChatFormatting rarity, final String name) + { + this.rarityColor = rarity; + this.rarityName = name; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/UtilsText.java b/src/Java/gtPlusPlus/core/util/UtilsText.java index e91fa95e4c..6d26676ce3 100644 --- a/src/Java/gtPlusPlus/core/util/UtilsText.java +++ b/src/Java/gtPlusPlus/core/util/UtilsText.java @@ -20,13 +20,13 @@ public enum UtilsText { white('f'); private char colourValue; - private UtilsText (char value) + private UtilsText (final char value) { this.colourValue = value; } public String colour() { - return "§"+colourValue; + return "�"+this.colourValue; } } diff --git a/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java b/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java index ea02aaf1da..910c4597af 100644 --- a/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java +++ b/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java @@ -4,15 +4,15 @@ import java.util.Arrays; public class ArrayUtils { - public static void expandArray(Object[] someArray, Object newValueToAdd) { + public static void expandArray(final Object[] someArray, final Object newValueToAdd) { Object[] series = someArray; - series = addElement(series, newValueToAdd); + series = addElement(series, newValueToAdd); } - private static Object[] addElement(Object[] series, Object newValueToAdd) { - series = Arrays.copyOf(series, series.length + 1); - series[series.length - 1] = newValueToAdd; - return series; + private static Object[] addElement(Object[] series, final Object newValueToAdd) { + series = Arrays.copyOf(series, series.length + 1); + series[series.length - 1] = newValueToAdd; + return series; } - + } diff --git a/src/Java/gtPlusPlus/core/util/array/Pair.java b/src/Java/gtPlusPlus/core/util/array/Pair.java index 94437e6779..ec5971c449 100644 --- a/src/Java/gtPlusPlus/core/util/array/Pair.java +++ b/src/Java/gtPlusPlus/core/util/array/Pair.java @@ -1,21 +1,21 @@ package gtPlusPlus.core.util.array; -public class Pair<K,V> { - - private final K key; - private final V value; - +public class Pair<K,V> { + + private final K key; + private final V value; + public Pair(final K key, final V value){ this.key = key; this.value = value; } - + final public K getKey(){ - return key; - } - + return this.key; + } + final public V getValue(){ - return value; - } + return this.value; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/array/Triplet.java b/src/Java/gtPlusPlus/core/util/array/Triplet.java index 07f29ae6c8..2130491d5b 100644 --- a/src/Java/gtPlusPlus/core/util/array/Triplet.java +++ b/src/Java/gtPlusPlus/core/util/array/Triplet.java @@ -1,27 +1,27 @@ package gtPlusPlus.core.util.array; -public class Triplet<K,V,C> { - - private final K key; - private final V value; +public class Triplet<K,V,C> { + + private final K key; + private final V value; private final C count; - + public Triplet(final K key, final V value, final C value2){ this.key = key; this.value = value; this.count = value2; } - + final public K getKey(){ - return key; - } - + return this.key; + } + final public V getValue(){ - return value; - } - + return this.value; + } + final public C getSecondValue(){ - return count; - } + return this.count; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java index 74df9f90ba..28a47d9b14 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java @@ -11,20 +11,21 @@ public class DEBUG_BLOCK_ShapeSpawner extends DEBUG_MULTIBLOCK_ShapeSpawner { private static boolean controller; - public DEBUG_BLOCK_ShapeSpawner(int aID, String aName, String aNameRegional) { + public DEBUG_BLOCK_ShapeSpawner(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } - public DEBUG_BLOCK_ShapeSpawner(String aName) { + public DEBUG_BLOCK_ShapeSpawner(final String aName) { super(aName); } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new DEBUG_BLOCK_ShapeSpawner(this.mName); } - + + @Override public String[] getDescription() { return new String[]{ "Controller Block for the Testing", @@ -33,73 +34,73 @@ public class DEBUG_BLOCK_ShapeSpawner extends DEBUG_MULTIBLOCK_ShapeSpawner { @Override - public ITexture[] getTexture(IGregTechTileEntity arg0, byte arg1, - byte arg2, byte arg3, boolean arg4, boolean arg5) { + public ITexture[] getTexture(final IGregTechTileEntity arg0, final byte arg1, + final byte arg2, final byte arg3, final boolean arg4, final boolean arg5) { // TODO Auto-generated method stub return null; } @Override - public boolean isCorrectMachinePart(ItemStack aStack) { + public boolean isCorrectMachinePart(final ItemStack aStack) { // TODO Auto-generated method stub return false; } @Override - public boolean checkRecipe(ItemStack aStack) { + public boolean checkRecipe(final ItemStack aStack) { // TODO Auto-generated method stub return false; } @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - + public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { return false; } - + int stepX = aBaseMetaTileEntity.getXCoord(); - int stepY = aBaseMetaTileEntity.getYCoord(); + final int stepY = aBaseMetaTileEntity.getYCoord(); int stepZ = aBaseMetaTileEntity.getZCoord(); - int temp = 0; + final int temp = 0; - Utils.LOG_INFO("Starting Block located @ "+"[X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + Utils.LOG_INFO("Starting Block located @ "+"[X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); - int tAmount = 0; + final int tAmount = 0; switch (xDir) { case -1: stepX++; - Utils.LOG_INFO("Modifying stepX + accomodate a "+xDir+" xDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + Utils.LOG_INFO("Modifying stepX + accomodate a "+xDir+" xDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); break; case 1: stepX--; - Utils.LOG_INFO("Modifying stepX - accomodate a "+xDir+" xDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + Utils.LOG_INFO("Modifying stepX - accomodate a "+xDir+" xDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); break; } switch (zDir) { case -1: stepZ++; - Utils.LOG_INFO("Modifying stepZ + accomodate a "+zDir+" zDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + Utils.LOG_INFO("Modifying stepZ + accomodate a "+zDir+" zDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); break; case 1: stepZ--; - Utils.LOG_INFO("Modifying stepZ - accomodate a "+zDir+" zDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + Utils.LOG_INFO("Modifying stepZ - accomodate a "+zDir+" zDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); break; } - for (int i = stepX-1; i <= stepX+1; i++){ - for (int j = stepZ-1; j <= stepZ+1; j++){ - for (int h = stepY-1; h <= stepY+1; h++){ + for (int i = stepX-1; i <= (stepX+1); i++){ + for (int j = stepZ-1; j <= (stepZ+1); j++){ + for (int h = stepY-1; h <= (stepY+1); h++){ Utils.LOG_INFO("Block Facing - X:"+xDir+" Z:"+zDir); Utils.LOG_INFO("(h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))"); - Utils.LOG_INFO(" "+(h != 0)+" || "+(((xDir + i != 0)+" || "+(zDir + j != 0))+" && "+((i != 0)+" || "+(j != 0)))); + Utils.LOG_INFO(" "+(h != 0)+" || "+((((xDir + i) != 0)+" || "+((zDir + j) != 0))+" && "+((i != 0)+" || "+(j != 0)))); } } } @@ -107,19 +108,19 @@ public class DEBUG_BLOCK_ShapeSpawner extends DEBUG_MULTIBLOCK_ShapeSpawner { } @Override - public int getMaxEfficiency(ItemStack aStack) { + public int getMaxEfficiency(final ItemStack aStack) { // TODO Auto-generated method stub return 0; } @Override - public int getPollutionPerTick(ItemStack aStack) { + public int getPollutionPerTick(final ItemStack aStack) { // TODO Auto-generated method stub return 0; } @Override - public int getDamageToComponent(ItemStack aStack) { + public int getDamageToComponent(final ItemStack aStack) { // TODO Auto-generated method stub return 0; } @@ -131,7 +132,7 @@ public class DEBUG_BLOCK_ShapeSpawner extends DEBUG_MULTIBLOCK_ShapeSpawner { } @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { + public boolean explodesOnComponentBreak(final ItemStack aStack) { // TODO Auto-generated method stub return false; } diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java index 440949471c..8ac31a038f 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java @@ -1,12 +1,12 @@ package gtPlusPlus.core.util.debug; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.item.base.BaseItemWithCharge; import gtPlusPlus.core.item.general.BedLocator_Base; import gtPlusPlus.core.lib.CORE; import net.minecraftforge.common.MinecraftForge; -import cpw.mods.fml.common.registry.GameRegistry; public class DEBUG_INIT { @@ -21,7 +21,7 @@ public class DEBUG_INIT { ModItems.itemDebugShapeSpawner = new DEBUG_ITEM_ShapeSpawner("itemDebugShapeSpawner", AddToCreativeTab.tabMisc, 1, 500); GameRegistry.registerItem(ModItems.itemDebugShapeSpawner, "itemDebugShapeSpawner"); ModItems.itemBedLocator_Base = new BedLocator_Base("itemBedLocator_Base"); - GameRegistry.registerItem(ModItems.itemBedLocator_Base, "itemBedLocator_Base"); + GameRegistry.registerItem(ModItems.itemBedLocator_Base, "itemBedLocator_Base"); ModItems.itemBaseItemWithCharge = new BaseItemWithCharge("itemBaseItemWithCharge", 0, 1000); GameRegistry.registerItem(ModItems.itemBaseItemWithCharge, "itemBaseItemWithCharge"); } @@ -37,7 +37,7 @@ public class DEBUG_INIT { } public static void registerHandlers(){ - MinecraftForge.EVENT_BUS.register(new DEBUG_ScreenOverlay()); + MinecraftForge.EVENT_BUS.register(new DEBUG_ScreenOverlay()); } } diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java index bfaa7404e1..a35d2c26de 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java @@ -1,19 +1,19 @@ package gtPlusPlus.core.util.debug; import static net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.BaseItemGeneric; -import gtPlusPlus.core.util.Utils; import java.util.List; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.item.base.BaseItemGeneric; +import gtPlusPlus.core.util.Utils; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric{ @@ -26,30 +26,32 @@ public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric{ } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ - + public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player){ + if (!world.isRemote){ Utils.LOG_INFO("Constructing the shape for the "+"VACUUM FREEZER"); - Thread thread = new Thread(new DEBUG_TimerThread(world, player)); - thread.start(); + final Thread thread = new Thread(new DEBUG_TimerThread(world, player)); + thread.start(); } - return stack; + return stack; } - - - + + + @SuppressWarnings("static-method") @SubscribeEvent - public void playerInteractEventHandler(PlayerInteractEvent event) + public void playerInteractEventHandler(final PlayerInteractEvent event) { - if (event.isCanceled() || event.world.isRemote || event.action != RIGHT_CLICK_BLOCK) return; + if (event.isCanceled() || event.world.isRemote || (event.action != RIGHT_CLICK_BLOCK)) { + return; + } } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { list.add(EnumChatFormatting.GOLD+"For Testing Gregtech Shapes!"); super.addInformation(stack, aPlayer, list, bool); - } + } } diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java index 8e4c34bf1a..d31fb10b84 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java @@ -1,6 +1,9 @@ package gtPlusPlus.core.util.debug; import static gregtech.api.enums.GT_Values.V; + +import java.util.ArrayList; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.*; @@ -15,9 +18,6 @@ import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.*; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.common.items.GT_MetaGenerated_Tool_01; - -import java.util.ArrayList; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -26,768 +26,887 @@ import net.minecraftforge.fluids.FluidStack; public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { - public static boolean disableMaintenance; - public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false; - public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, mUpdate = 0, mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0; - public ItemStack[] mOutputItems = null; - public FluidStack[] mOutputFluids = null; - public ArrayList<GT_MetaTileEntity_Hatch_Input> mInputHatches = new ArrayList<GT_MetaTileEntity_Hatch_Input>(); - public ArrayList<GT_MetaTileEntity_Hatch_Output> mOutputHatches = new ArrayList<GT_MetaTileEntity_Hatch_Output>(); - public ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<GT_MetaTileEntity_Hatch_InputBus>(); - public ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<GT_MetaTileEntity_Hatch_OutputBus>(); - public ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch_Dynamo>(); - public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<GT_MetaTileEntity_Hatch_Muffler>(); - public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch_Energy>(); - public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<GT_MetaTileEntity_Hatch_Maintenance>(); - - public DEBUG_MULTIBLOCK_ShapeSpawner(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, 2); - this.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); - } - - public DEBUG_MULTIBLOCK_ShapeSpawner(String aName) { - super(aName, 2); - this.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); - } - - public static boolean isValidMetaTileEntity(MetaTileEntity aMetaTileEntity) { - return aMetaTileEntity.getBaseMetaTileEntity() != null && aMetaTileEntity.getBaseMetaTileEntity().getMetaTileEntity() == aMetaTileEntity && !aMetaTileEntity.getBaseMetaTileEntity().isDead(); - } - - @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { - return aSide != getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return aIndex > 0; - } - - @Override - public int getProgresstime() { - return mProgresstime; - } - - @Override - public int maxProgresstime() { - return mMaxProgresstime; - } - - @Override - public int increaseProgress(int aProgress) { - return aProgress; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mEUt", mEUt); - aNBT.setInteger("mProgresstime", mProgresstime); - aNBT.setInteger("mMaxProgresstime", mMaxProgresstime); - aNBT.setInteger("mEfficiencyIncrease", mEfficiencyIncrease); - aNBT.setInteger("mEfficiency", mEfficiency); - aNBT.setInteger("mPollution", mPollution); - aNBT.setInteger("mRuntime", mRuntime); - - if (mOutputItems != null) for (int i = 0; i < mOutputItems.length; i++) - if (mOutputItems[i] != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputItems[i].writeToNBT(tNBT); - aNBT.setTag("mOutputItem" + i, tNBT); - } - if (mOutputFluids != null) for (int i = 0; i < mOutputFluids.length; i++) - if (mOutputFluids[i] != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputFluids[i].writeToNBT(tNBT); - aNBT.setTag("mOutputFluids" + i, tNBT); - } - - aNBT.setBoolean("mWrench", mWrench); - aNBT.setBoolean("mScrewdriver", mScrewdriver); - aNBT.setBoolean("mSoftHammer", mSoftHammer); - aNBT.setBoolean("mHardHammer", mHardHammer); - aNBT.setBoolean("mSolderingTool", mSolderingTool); - aNBT.setBoolean("mCrowbar", mCrowbar); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - mEUt = aNBT.getInteger("mEUt"); - mProgresstime = aNBT.getInteger("mProgresstime"); - mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); - if (mMaxProgresstime > 0) mRunningOnLoad = true; - mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease"); - mEfficiency = aNBT.getInteger("mEfficiency"); - mPollution = aNBT.getInteger("mPollution"); - mRuntime = aNBT.getInteger("mRuntime"); - mOutputItems = new ItemStack[getAmountOfOutputs()]; - for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); - mOutputFluids = new FluidStack[getAmountOfOutputs()]; - for (int i = 0; i < mOutputFluids.length; i++) - mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); - mWrench = aNBT.getBoolean("mWrench"); - mScrewdriver = aNBT.getBoolean("mScrewdriver"); - mSoftHammer = aNBT.getBoolean("mSoftHammer"); - mHardHammer = aNBT.getBoolean("mHardHammer"); - mSolderingTool = aNBT.getBoolean("mSolderingTool"); - mCrowbar = aNBT.getBoolean("mCrowbar"); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiblockDisplay.png"); - } - - @Override - public byte getTileEntityBaseType() { - return 2; - } - - @Override - public void onMachineBlockUpdate() { - mUpdate = 50; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (mEfficiency < 0) mEfficiency = 0; - if (--mUpdate == 0 || --mStartUpCheck == 0) { - mInputHatches.clear(); - mInputBusses.clear(); - mOutputHatches.clear(); - mOutputBusses.clear(); - mDynamoHatches.clear(); - mEnergyHatches.clear(); - mMufflerHatches.clear(); - mMaintenanceHatches.clear(); - mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]); - } - if (mStartUpCheck < 0) { - if (mMachine) { - for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (!this.disableMaintenance) { - if (tHatch.mWrench) mWrench = true; - if (tHatch.mScrewdriver) mScrewdriver = true; - if (tHatch.mSoftHammer) mSoftHammer = true; - if (tHatch.mHardHammer) mHardHammer = true; - if (tHatch.mSolderingTool) mSolderingTool = true; - if (tHatch.mCrowbar) mCrowbar = true; - } else { - mWrench = true; - mScrewdriver = true; - mSoftHammer = true; - mHardHammer = true; - mSolderingTool = true; - mCrowbar = true; - } - - tHatch.mWrench = false; - tHatch.mScrewdriver = false; - tHatch.mSoftHammer = false; - tHatch.mHardHammer = false; - tHatch.mSolderingTool = false; - tHatch.mCrowbar = false; - } - } - if (getRepairStatus() > 0) { - if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) { - if (onRunningTick(mInventory[1])) { - if (!polluteEnvironment(getPollutionPerTick(mInventory[1]))) { - stopMachine(); - } - if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { - if (mOutputItems != null) for (ItemStack tStack : mOutputItems) - if (tStack != null) { - try { - GT_Mod.instance.achievements.issueAchivementHatch(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack); - } catch (Exception e) { - } - addOutput(tStack); - } - if (mOutputFluids != null && mOutputFluids.length == 1) { - for (FluidStack tStack : mOutputFluids) - if (tStack != null) { - addOutput(tStack); - } - } else if (mOutputFluids != null && mOutputFluids.length > 1) { - addFluidOutputs(mOutputFluids); - } - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); - mOutputItems = null; - mProgresstime = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - if (aBaseMetaTileEntity.isAllowedToWork()) checkRecipe(mInventory[1]); - if (mOutputFluids != null && mOutputFluids.length > 0) { - if (mOutputFluids.length > 1) { - GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant"); - } - } - } - } - } else { - if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { - - if (aBaseMetaTileEntity.isAllowedToWork()) { - checkRecipe(mInventory[1]); - } - if (mMaxProgresstime <= 0) mEfficiency = Math.max(0, mEfficiency - 1000); - } - } - } else { - stopMachine(); - } - } else { - stopMachine(); - } - } - aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); - aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); - } - } - - public boolean polluteEnvironment(int aPollutionLevel) { - mPollution += aPollutionLevel; - for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (mPollution >= 10000) { - if (tHatch.polluteEnvironment()) { - mPollution -= 10000; - } - } else { - break; - } - } - } - return mPollution < 10000; - } - - /** - * Called every tick the Machine runs - */ - public boolean onRunningTick(ItemStack aStack) { - if (mEUt > 0) { - addEnergyOutput(((long) mEUt * mEfficiency) / 10000); - return true; - } - if (mEUt < 0) { - if (!drainEnergyInput(((long) -mEUt * 10000) / Math.max(1000, mEfficiency))) { - stopMachine(); - return false; - } - } - return true; - } - - /** - * Checks if this is a Correct Machine Part for this kind of Machine (Turbine Rotor for example) - */ - public abstract boolean isCorrectMachinePart(ItemStack aStack); - - /** - * Checks the Recipe - */ - public abstract boolean checkRecipe(ItemStack aStack); - - /** - * Checks the Machine. You have to assign the MetaTileEntities for the Hatches here. - */ - public abstract boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack); - - /** - * Gets the maximum Efficiency that spare Part can get (0 - 10000) - */ - public abstract int getMaxEfficiency(ItemStack aStack); - - /** - * Gets the pollution this Device outputs to a Muffler per tick (10000 = one Pullution Block) - */ - public abstract int getPollutionPerTick(ItemStack aStack); - - /** - * Gets the damage to the ItemStack, usually 0 or 1. - */ - public abstract int getDamageToComponent(ItemStack aStack); - - /** - * Gets the Amount of possibly outputted Items for loading the Output Stack Array from NBT. - * This should be the largest Amount that can ever happen legitimately. - */ - public abstract int getAmountOfOutputs(); - - /** - * If it explodes when the Component has to be replaced. - */ - public abstract boolean explodesOnComponentBreak(ItemStack aStack); - - public void stopMachine() { - mOutputItems = null; - mEUt = 0; - mEfficiency = 0; - mProgresstime = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - getBaseMetaTileEntity().disableWorking(); - } - - public int getRepairStatus() { - return (mWrench ? 1 : 0) + (mScrewdriver ? 1 : 0) + (mSoftHammer ? 1 : 0) + (mHardHammer ? 1 : 0) + (mSolderingTool ? 1 : 0) + (mCrowbar ? 1 : 0); - } - - public int getIdealStatus() { - return 6; - } - - public boolean doRandomMaintenanceDamage() { - if (!isCorrectMachinePart(mInventory[1]) || getRepairStatus() == 0) { - stopMachine(); - return false; - } - if (mRuntime++ > 1000) { - mRuntime = 0; - if (getBaseMetaTileEntity().getRandomNumber(6000) == 0) { - switch (getBaseMetaTileEntity().getRandomNumber(6)) { - case 0: - mWrench = false; - break; - case 1: - mScrewdriver = false; - break; - case 2: - mSoftHammer = false; - break; - case 3: - mHardHammer = false; - break; - case 4: - mSolderingTool = false; - break; - case 5: - mCrowbar = false; - break; - } - } - if (mInventory[1] != null && getBaseMetaTileEntity().getRandomNumber(2) == 0 && !mInventory[1].getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.")) { - if (mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { - NBTTagCompound tNBT = mInventory[1].getTagCompound(); - if (tNBT != null) { - NBTTagCompound tNBT2 = tNBT.getCompoundTag("GT.CraftingComponents"); - if (!tNBT.getBoolean("mDis")) { - tNBT2 = new NBTTagCompound(); - Materials tMaterial = GT_MetaGenerated_Tool.getPrimaryMaterial(mInventory[1]); - ItemStack tTurbine = GT_OreDictUnificator.get(OrePrefixes.turbineBlade, tMaterial, 1); - int i = mInventory[1].getItemDamage(); - if (i == 170) { - ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Magnalium, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } else if (i == 172) { - ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.7", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.8", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Titanium, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } else if (i == 174) { - ItemStack tStack = GT_Utility.copyAmount(2, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.TungstenSteel, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } else if (i == 176) { - ItemStack tStack = GT_Utility.copyAmount(2, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.7", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.8", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Americium, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } - tNBT.setTag("GT.CraftingComponents", tNBT2); - tNBT.setBoolean("mDis", true); - mInventory[1].setTagCompound(tNBT); - - } - } - - ((GT_MetaGenerated_Tool) mInventory[1].getItem()).doDamage(mInventory[1], (long) Math.min(mEUt / 5, Math.pow(mEUt, 0.7))); - if (mInventory[1].stackSize == 0) mInventory[1] = null; - } - } - } - return true; - } - - public void explodeMultiblock() { - mInventory[1] = null; - for (MetaTileEntity tTileEntity : mInputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mOutputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mInputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mOutputHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mDynamoHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mMufflerHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mEnergyHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - for (MetaTileEntity tTileEntity : mMaintenanceHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); - getBaseMetaTileEntity().doExplosion(V[8]); - } - - public boolean addEnergyOutput(long aEU) { - if (aEU <= 0) return true; - for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(aEU, false)) { - return true; - } - } - } - return false; - } - - public long getMaxInputVoltage() { - long rVoltage = 0; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); - return rVoltage; - } - - public boolean drainEnergyInput(long aEU) { - if (aEU <= 0) return true; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) { - if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) return true; - } - return false; - } - - public boolean addOutput(FluidStack aLiquid) { - if (aLiquid == null) return false; - FluidStack tLiquid = aLiquid.copy(); - for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { - if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) { - int tAmount = tHatch.fill(tLiquid, false); - if (tAmount >= tLiquid.amount) { - return tHatch.fill(tLiquid, true) >= tLiquid.amount; - } else if (tAmount > 0) { - tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true); - } - } - } - return false; - } - - private void addFluidOutputs(FluidStack[] mOutputFluids2) { - for (int i = 0; i < mOutputFluids2.length; i++) { - if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) { - mOutputHatches.get(i).fill(mOutputFluids2[i], true); - } - } - - } - - public boolean depleteInput(FluidStack aLiquid) { - if (aLiquid == null) return false; - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - FluidStack tLiquid = tHatch.getFluid(); - if (tLiquid != null && tLiquid.isFluidEqual(aLiquid)) { - tLiquid = tHatch.drain(aLiquid.amount, false); - if (tLiquid != null && tLiquid.amount >= aLiquid.amount) { - tLiquid = tHatch.drain(aLiquid.amount, true); - return tLiquid != null && tLiquid.amount >= aLiquid.amount; - } - } - } - } - return false; - } - - public boolean addOutput(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return false; - aStack = GT_Utility.copy(aStack); -// FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); -// if (aLiquid == null) { - for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) { - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getSizeInventory() - 1; i >= 0; i--) { - if (tHatch.getBaseMetaTileEntity().addStackToSlot(i, aStack)) return true; - } - } - } - for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { - if (isValidMetaTileEntity(tHatch) && tHatch.outputsItems()) { - if (tHatch.getBaseMetaTileEntity().addStackToSlot(1, aStack)) return true; - } - } -// }else { -// for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { -// if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid)?tHatch.outputsSteam():tHatch.outputsLiquids()) { -// int tAmount = tHatch.fill(aLiquid, false); -// if (tAmount >= aLiquid.amount) { -// return tHatch.fill(aLiquid, true) >= aLiquid.amount; -// } -// } -// } -// } - return false; - } - - public boolean depleteInput(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) return false; - FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); - if (aLiquid != null) return depleteInput(aLiquid); - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { - tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); - return true; - } - } - } - } - for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { - tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); - return true; - } - } - } - } - } - return false; - } - - public ArrayList<ItemStack> getStoredOutputs() { - ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); - for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { - if (isValidMetaTileEntity(tHatch)) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1)); - } - } - for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) { - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); - } - } - } - return rList; - } - - public ArrayList<FluidStack> getStoredFluids() { - ArrayList<FluidStack> rList = new ArrayList<FluidStack>(); - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch) && tHatch.getFillableStack() != null) { - rList.add(tHatch.getFillableStack()); - } - } - return rList; - } - - public ArrayList<ItemStack> getStoredInputs() { - ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().getStackInSlot(0) != null) { - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(0)); - } - } - for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) { - tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null) - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); - } - } - } - return rList; - } - - public GT_Recipe_Map getRecipeMap() { - return null; - } - - public void updateSlots() { - for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) - if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); - for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) - if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); - } - - public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) - return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) - return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) - return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) - return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) - return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) - return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) - return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) - return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); - return false; - } - - public boolean addMaintenanceToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); - } - return false; - } - - public boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); - } - return false; - } - - public boolean addDynamoToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); - } - return false; - } - - public boolean addMufflerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); - } - return false; - } - - public boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); - return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); - } - return false; - } - - public boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; - return mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); - } - return false; - } - - @Override - public String[] getInfoData() { - return new String[]{"Progress:", (mProgresstime / 20) + "secs", (mMaxProgresstime / 20) + "secs", "Efficiency:", (mEfficiency / 100.0F) + "%", "Problems:", "" + (getIdealStatus() - getRepairStatus())}; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } + public static boolean disableMaintenance; + public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false; + public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, mUpdate = 0, mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0; + public ItemStack[] mOutputItems = null; + public FluidStack[] mOutputFluids = null; + public ArrayList<GT_MetaTileEntity_Hatch_Input> mInputHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Output> mOutputHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<>(); + public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<>(); + + public DEBUG_MULTIBLOCK_ShapeSpawner(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional, 2); + DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); + } + + public DEBUG_MULTIBLOCK_ShapeSpawner(final String aName) { + super(aName, 2); + DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); + } + + public static boolean isValidMetaTileEntity(final MetaTileEntity aMetaTileEntity) { + return (aMetaTileEntity.getBaseMetaTileEntity() != null) && (aMetaTileEntity.getBaseMetaTileEntity().getMetaTileEntity() == aMetaTileEntity) && !aMetaTileEntity.getBaseMetaTileEntity().isDead(); + } + + @Override + public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aCoverID) { + return aSide != this.getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return true; + } + + @Override + public boolean isAccessAllowed(final EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isValidSlot(final int aIndex) { + return aIndex > 0; + } + + @Override + public int getProgresstime() { + return this.mProgresstime; + } + + @Override + public int maxProgresstime() { + return this.mMaxProgresstime; + } + + @Override + public int increaseProgress(final int aProgress) { + return aProgress; + } + + @Override + public void saveNBTData(final NBTTagCompound aNBT) { + aNBT.setInteger("mEUt", this.mEUt); + aNBT.setInteger("mProgresstime", this.mProgresstime); + aNBT.setInteger("mMaxProgresstime", this.mMaxProgresstime); + aNBT.setInteger("mEfficiencyIncrease", this.mEfficiencyIncrease); + aNBT.setInteger("mEfficiency", this.mEfficiency); + aNBT.setInteger("mPollution", this.mPollution); + aNBT.setInteger("mRuntime", this.mRuntime); + + if (this.mOutputItems != null) { + for (int i = 0; i < this.mOutputItems.length; i++) { + if (this.mOutputItems[i] != null) { + final NBTTagCompound tNBT = new NBTTagCompound(); + this.mOutputItems[i].writeToNBT(tNBT); + aNBT.setTag("mOutputItem" + i, tNBT); + } + } + } + if (this.mOutputFluids != null) { + for (int i = 0; i < this.mOutputFluids.length; i++) { + if (this.mOutputFluids[i] != null) { + final NBTTagCompound tNBT = new NBTTagCompound(); + this.mOutputFluids[i].writeToNBT(tNBT); + aNBT.setTag("mOutputFluids" + i, tNBT); + } + } + } + + aNBT.setBoolean("mWrench", this.mWrench); + aNBT.setBoolean("mScrewdriver", this.mScrewdriver); + aNBT.setBoolean("mSoftHammer", this.mSoftHammer); + aNBT.setBoolean("mHardHammer", this.mHardHammer); + aNBT.setBoolean("mSolderingTool", this.mSolderingTool); + aNBT.setBoolean("mCrowbar", this.mCrowbar); + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + this.mEUt = aNBT.getInteger("mEUt"); + this.mProgresstime = aNBT.getInteger("mProgresstime"); + this.mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); + if (this.mMaxProgresstime > 0) { + this.mRunningOnLoad = true; + } + this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease"); + this.mEfficiency = aNBT.getInteger("mEfficiency"); + this.mPollution = aNBT.getInteger("mPollution"); + this.mRuntime = aNBT.getInteger("mRuntime"); + this.mOutputItems = new ItemStack[this.getAmountOfOutputs()]; + for (int i = 0; i < this.mOutputItems.length; i++) { + this.mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); + } + this.mOutputFluids = new FluidStack[this.getAmountOfOutputs()]; + for (int i = 0; i < this.mOutputFluids.length; i++) { + this.mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); + } + this.mWrench = aNBT.getBoolean("mWrench"); + this.mScrewdriver = aNBT.getBoolean("mScrewdriver"); + this.mSoftHammer = aNBT.getBoolean("mSoftHammer"); + this.mHardHammer = aNBT.getBoolean("mHardHammer"); + this.mSolderingTool = aNBT.getBoolean("mSolderingTool"); + this.mCrowbar = aNBT.getBoolean("mCrowbar"); + } + + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); + } + + @Override + public byte getTileEntityBaseType() { + return 2; + } + + @Override + public void onMachineBlockUpdate() { + this.mUpdate = 50; + } + + @Override + public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if (this.mEfficiency < 0) { + this.mEfficiency = 0; + } + if ((--this.mUpdate == 0) || (--this.mStartUpCheck == 0)) { + this.mInputHatches.clear(); + this.mInputBusses.clear(); + this.mOutputHatches.clear(); + this.mOutputBusses.clear(); + this.mDynamoHatches.clear(); + this.mEnergyHatches.clear(); + this.mMufflerHatches.clear(); + this.mMaintenanceHatches.clear(); + this.mMachine = this.checkMachine(aBaseMetaTileEntity, this.mInventory[1]); + } + if (this.mStartUpCheck < 0) { + if (this.mMachine) { + for (final GT_MetaTileEntity_Hatch_Maintenance tHatch : this.mMaintenanceHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (!DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance) { + if (tHatch.mWrench) { + this.mWrench = true; + } + if (tHatch.mScrewdriver) { + this.mScrewdriver = true; + } + if (tHatch.mSoftHammer) { + this.mSoftHammer = true; + } + if (tHatch.mHardHammer) { + this.mHardHammer = true; + } + if (tHatch.mSolderingTool) { + this.mSolderingTool = true; + } + if (tHatch.mCrowbar) { + this.mCrowbar = true; + } + } else { + this.mWrench = true; + this.mScrewdriver = true; + this.mSoftHammer = true; + this.mHardHammer = true; + this.mSolderingTool = true; + this.mCrowbar = true; + } + + tHatch.mWrench = false; + tHatch.mScrewdriver = false; + tHatch.mSoftHammer = false; + tHatch.mHardHammer = false; + tHatch.mSolderingTool = false; + tHatch.mCrowbar = false; + } + } + if (this.getRepairStatus() > 0) { + if ((this.mMaxProgresstime > 0) && this.doRandomMaintenanceDamage()) { + if (this.onRunningTick(this.mInventory[1])) { + if (!this.polluteEnvironment(this.getPollutionPerTick(this.mInventory[1]))) { + this.stopMachine(); + } + if ((this.mMaxProgresstime > 0) && (++this.mProgresstime >= this.mMaxProgresstime)) { + if (this.mOutputItems != null) { + for (final ItemStack tStack : this.mOutputItems) { + if (tStack != null) { + try { + GT_Mod.achievements.issueAchivementHatch(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack); + } catch (final Exception e) { + } + this.addOutput(tStack); + } + } + } + if ((this.mOutputFluids != null) && (this.mOutputFluids.length == 1)) { + for (final FluidStack tStack : this.mOutputFluids) { + if (tStack != null) { + this.addOutput(tStack); + } + } + } else if ((this.mOutputFluids != null) && (this.mOutputFluids.length > 1)) { + this.addFluidOutputs(this.mOutputFluids); + } + this.mEfficiency = Math.max(0, Math.min(this.mEfficiency + this.mEfficiencyIncrease, this.getMaxEfficiency(this.mInventory[1]) - ((this.getIdealStatus() - this.getRepairStatus()) * 1000))); + this.mOutputItems = null; + this.mProgresstime = 0; + this.mMaxProgresstime = 0; + this.mEfficiencyIncrease = 0; + if (aBaseMetaTileEntity.isAllowedToWork()) { + this.checkRecipe(this.mInventory[1]); + } + if ((this.mOutputFluids != null) && (this.mOutputFluids.length > 0)) { + if (this.mOutputFluids.length > 1) { + GT_Mod.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant"); + } + } + } + } + } else { + if (((aTick % 100) == 0) || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { + + if (aBaseMetaTileEntity.isAllowedToWork()) { + this.checkRecipe(this.mInventory[1]); + } + if (this.mMaxProgresstime <= 0) { + this.mEfficiency = Math.max(0, this.mEfficiency - 1000); + } + } + } + } else { + this.stopMachine(); + } + } else { + this.stopMachine(); + } + } + aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (this.mWrench ? 0 : 1) | (this.mScrewdriver ? 0 : 2) | (this.mSoftHammer ? 0 : 4) | (this.mHardHammer ? 0 : 8) | (this.mSolderingTool ? 0 : 16) | (this.mCrowbar ? 0 : 32) | (this.mMachine ? 0 : 64)); + aBaseMetaTileEntity.setActive(this.mMaxProgresstime > 0); + } + } + + public boolean polluteEnvironment(final int aPollutionLevel) { + this.mPollution += aPollutionLevel; + for (final GT_MetaTileEntity_Hatch_Muffler tHatch : this.mMufflerHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (this.mPollution >= 10000) { + if (tHatch.polluteEnvironment()) { + this.mPollution -= 10000; + } + } else { + break; + } + } + } + return this.mPollution < 10000; + } + + /** + * Called every tick the Machine runs + */ + public boolean onRunningTick(final ItemStack aStack) { + if (this.mEUt > 0) { + this.addEnergyOutput(((long) this.mEUt * this.mEfficiency) / 10000); + return true; + } + if (this.mEUt < 0) { + if (!this.drainEnergyInput(((long) -this.mEUt * 10000) / Math.max(1000, this.mEfficiency))) { + this.stopMachine(); + return false; + } + } + return true; + } + + /** + * Checks if this is a Correct Machine Part for this kind of Machine (Turbine Rotor for example) + */ + public abstract boolean isCorrectMachinePart(ItemStack aStack); + + /** + * Checks the Recipe + */ + public abstract boolean checkRecipe(ItemStack aStack); + + /** + * Checks the Machine. You have to assign the MetaTileEntities for the Hatches here. + */ + public abstract boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack); + + /** + * Gets the maximum Efficiency that spare Part can get (0 - 10000) + */ + public abstract int getMaxEfficiency(ItemStack aStack); + + /** + * Gets the pollution this Device outputs to a Muffler per tick (10000 = one Pullution Block) + */ + public abstract int getPollutionPerTick(ItemStack aStack); + + /** + * Gets the damage to the ItemStack, usually 0 or 1. + */ + public abstract int getDamageToComponent(ItemStack aStack); + + /** + * Gets the Amount of possibly outputted Items for loading the Output Stack Array from NBT. + * This should be the largest Amount that can ever happen legitimately. + */ + public abstract int getAmountOfOutputs(); + + /** + * If it explodes when the Component has to be replaced. + */ + public abstract boolean explodesOnComponentBreak(ItemStack aStack); + + public void stopMachine() { + this.mOutputItems = null; + this.mEUt = 0; + this.mEfficiency = 0; + this.mProgresstime = 0; + this.mMaxProgresstime = 0; + this.mEfficiencyIncrease = 0; + this.getBaseMetaTileEntity().disableWorking(); + } + + public int getRepairStatus() { + return (this.mWrench ? 1 : 0) + (this.mScrewdriver ? 1 : 0) + (this.mSoftHammer ? 1 : 0) + (this.mHardHammer ? 1 : 0) + (this.mSolderingTool ? 1 : 0) + (this.mCrowbar ? 1 : 0); + } + + public int getIdealStatus() { + return 6; + } + + public boolean doRandomMaintenanceDamage() { + if (!this.isCorrectMachinePart(this.mInventory[1]) || (this.getRepairStatus() == 0)) { + this.stopMachine(); + return false; + } + if (this.mRuntime++ > 1000) { + this.mRuntime = 0; + if (this.getBaseMetaTileEntity().getRandomNumber(6000) == 0) { + switch (this.getBaseMetaTileEntity().getRandomNumber(6)) { + case 0: + this.mWrench = false; + break; + case 1: + this.mScrewdriver = false; + break; + case 2: + this.mSoftHammer = false; + break; + case 3: + this.mHardHammer = false; + break; + case 4: + this.mSolderingTool = false; + break; + case 5: + this.mCrowbar = false; + break; + } + } + if ((this.mInventory[1] != null) && (this.getBaseMetaTileEntity().getRandomNumber(2) == 0) && !this.mInventory[1].getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.")) { + if (this.mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { + final NBTTagCompound tNBT = this.mInventory[1].getTagCompound(); + if (tNBT != null) { + NBTTagCompound tNBT2 = tNBT.getCompoundTag("GT.CraftingComponents"); + if (!tNBT.getBoolean("mDis")) { + tNBT2 = new NBTTagCompound(); + final Materials tMaterial = GT_MetaGenerated_Tool.getPrimaryMaterial(this.mInventory[1]); + final ItemStack tTurbine = GT_OreDictUnificator.get(OrePrefixes.turbineBlade, tMaterial, 1); + final int i = this.mInventory[1].getItemDamage(); + if (i == 170) { + ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); + tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); + tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Magnalium, 1); + tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); + } else if (i == 172) { + ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); + tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.7", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.8", tStack.writeToNBT(new NBTTagCompound())); + tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Titanium, 1); + tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); + } else if (i == 174) { + ItemStack tStack = GT_Utility.copyAmount(2, tTurbine); + tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); + tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.TungstenSteel, 1); + tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); + } else if (i == 176) { + ItemStack tStack = GT_Utility.copyAmount(2, tTurbine); + tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.5", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.6", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.7", tStack.writeToNBT(new NBTTagCompound())); + tNBT2.setTag("Ingredient.8", tStack.writeToNBT(new NBTTagCompound())); + tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Americium, 1); + tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); + } + tNBT.setTag("GT.CraftingComponents", tNBT2); + tNBT.setBoolean("mDis", true); + this.mInventory[1].setTagCompound(tNBT); + + } + } + + ((GT_MetaGenerated_Tool) this.mInventory[1].getItem()).doDamage(this.mInventory[1], (long) Math.min(this.mEUt / 5, Math.pow(this.mEUt, 0.7))); + if (this.mInventory[1].stackSize == 0) { + this.mInventory[1] = null; + } + } + } + } + return true; + } + + public void explodeMultiblock() { + this.mInventory[1] = null; + for (final MetaTileEntity tTileEntity : this.mInputBusses) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mOutputBusses) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mInputHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mOutputHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mDynamoHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mMufflerHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mEnergyHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + for (final MetaTileEntity tTileEntity : this.mMaintenanceHatches) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); + } + this.getBaseMetaTileEntity().doExplosion(V[8]); + } + + public boolean addEnergyOutput(final long aEU) { + if (aEU <= 0) { + return true; + } + for (final GT_MetaTileEntity_Hatch_Dynamo tHatch : this.mDynamoHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(aEU, false)) { + return true; + } + } + } + return false; + } + + public long getMaxInputVoltage() { + long rVoltage = 0; + for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) { + if (isValidMetaTileEntity(tHatch)) { + rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage(); + } + } + return rVoltage; + } + + public boolean drainEnergyInput(final long aEU) { + if (aEU <= 0) { + return true; + } + for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) { + return true; + } + } + } + return false; + } + + public boolean addOutput(final FluidStack aLiquid) { + if (aLiquid == null) { + return false; + } + final FluidStack tLiquid = aLiquid.copy(); + for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { + if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) { + final int tAmount = tHatch.fill(tLiquid, false); + if (tAmount >= tLiquid.amount) { + return tHatch.fill(tLiquid, true) >= tLiquid.amount; + } else if (tAmount > 0) { + tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true); + } + } + } + return false; + } + + private void addFluidOutputs(final FluidStack[] mOutputFluids2) { + for (int i = 0; i < mOutputFluids2.length; i++) { + if ((this.mOutputHatches.size() > i) && (this.mOutputHatches.get(i) != null) && (mOutputFluids2[i] != null) && isValidMetaTileEntity(this.mOutputHatches.get(i))) { + this.mOutputHatches.get(i).fill(mOutputFluids2[i], true); + } + } + + } + + public boolean depleteInput(final FluidStack aLiquid) { + if (aLiquid == null) { + return false; + } + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + FluidStack tLiquid = tHatch.getFluid(); + if ((tLiquid != null) && tLiquid.isFluidEqual(aLiquid)) { + tLiquid = tHatch.drain(aLiquid.amount, false); + if ((tLiquid != null) && (tLiquid.amount >= aLiquid.amount)) { + tLiquid = tHatch.drain(aLiquid.amount, true); + return (tLiquid != null) && (tLiquid.amount >= aLiquid.amount); + } + } + } + } + return false; + } + + public boolean addOutput(ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) { + return false; + } + aStack = GT_Utility.copy(aStack); + // FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); + // if (aLiquid == null) { + for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) { + if (isValidMetaTileEntity(tHatch)) { + for (int i = tHatch.getSizeInventory() - 1; i >= 0; i--) { + if (tHatch.getBaseMetaTileEntity().addStackToSlot(i, aStack)) { + return true; + } + } + } + } + for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { + if (isValidMetaTileEntity(tHatch) && tHatch.outputsItems()) { + if (tHatch.getBaseMetaTileEntity().addStackToSlot(1, aStack)) { + return true; + } + } + } + // }else { + // for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { + // if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid)?tHatch.outputsSteam():tHatch.outputsLiquids()) { + // int tAmount = tHatch.fill(aLiquid, false); + // if (tAmount >= aLiquid.amount) { + // return tHatch.fill(aLiquid, true) >= aLiquid.amount; + // } + // } + // } + // } + return false; + } + + public boolean depleteInput(final ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) { + return false; + } + final FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); + if (aLiquid != null) { + return this.depleteInput(aLiquid); + } + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) { + if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { + tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); + return true; + } + } + } + } + for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) { + if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { + tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); + return true; + } + } + } + } + } + return false; + } + + public ArrayList<ItemStack> getStoredOutputs() { + final ArrayList<ItemStack> rList = new ArrayList<>(); + for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { + if (isValidMetaTileEntity(tHatch)) { + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1)); + } + } + for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) { + if (isValidMetaTileEntity(tHatch)) { + for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + } + return rList; + } + + public ArrayList<FluidStack> getStoredFluids() { + final ArrayList<FluidStack> rList = new ArrayList<>(); + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch) && (tHatch.getFillableStack() != null)) { + rList.add(tHatch.getFillableStack()); + } + } + return rList; + } + + public ArrayList<ItemStack> getStoredInputs() { + final ArrayList<ItemStack> rList = new ArrayList<>(); + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch) && (tHatch.getBaseMetaTileEntity().getStackInSlot(0) != null)) { + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(0)); + } + } + for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null) { + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + } + } + return rList; + } + + public GT_Recipe_Map getRecipeMap() { + return null; + } + + public void updateSlots() { + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + if (isValidMetaTileEntity(tHatch)) { + tHatch.updateSlots(); + } + } + for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) { + if (isValidMetaTileEntity(tHatch)) { + tHatch.updateSlots(); + } + } + } + + public boolean addToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { + return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { + return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { + return this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { + return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { + return this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); + } + return false; + } + + public boolean addMaintenanceToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + } + return false; + } + + public boolean addEnergyInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mEnergyHatches.add((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); + } + return false; + } + + public boolean addDynamoToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity); + } + return false; + } + + public boolean addMufflerToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity); + } + return false; + } + + public boolean addInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = this.getRecipeMap(); + return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = this.getRecipeMap(); + return this.mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + } + return false; + } + + public boolean addOutputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity); + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex; + return this.mOutputBusses.add((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity); + } + return false; + } + + @Override + public String[] getInfoData() { + return new String[]{"Progress:", (this.mProgresstime / 20) + "secs", (this.mMaxProgresstime / 20) + "secs", "Efficiency:", (this.mEfficiency / 100.0F) + "%", "Problems:", "" + (this.getIdealStatus() - this.getRepairStatus())}; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + return false; + } } diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java index 07b2872c7c..8c1336374c 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java @@ -1,10 +1,10 @@ package gtPlusPlus.core.util.debug; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.*; import net.minecraft.item.Item; import net.minecraftforge.client.event.RenderGameOverlayEvent; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class DEBUG_ScreenOverlay extends Gui { @@ -12,19 +12,19 @@ public class DEBUG_ScreenOverlay extends Gui { Minecraft mc = Minecraft.getMinecraft(); @SubscribeEvent - public void eventHandler(RenderGameOverlayEvent.Text event) + public void eventHandler(final RenderGameOverlayEvent.Text event) { //if (mc.thePlayer.getHeldItem().equals(ModItems.itemStaballoyPickaxe)){ - ScaledResolution res = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); - FontRenderer fontRender = mc.fontRenderer; + final ScaledResolution res = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); + final FontRenderer fontRender = this.mc.fontRenderer; this.width = res.getScaledWidth(); this.height = res.getScaledHeight(); Minecraft.getMinecraft().entityRenderer.setupOverlayRendering(); - String str = "Words"; + final String str = "Words"; Item heldItem = null; - try{heldItem = mc.thePlayer.getHeldItem().getItem(); + try{heldItem = this.mc.thePlayer.getHeldItem().getItem(); if (heldItem != null){ /*if (heldItem instanceof StaballoyPickaxe){ @@ -37,7 +37,7 @@ public class DEBUG_ScreenOverlay extends Gui { drawString(fontRender, str, (this.width - fontRender.getStringWidth(str)) / 2, this.height / 10, 0xFFAA00); }*/ } - }catch(NullPointerException e){} + }catch(final NullPointerException e){} } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java index 1eb69eb11b..a0690c9440 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java @@ -1,9 +1,8 @@ package gtPlusPlus.core.util.debug; -import gtPlusPlus.core.util.Utils; - import java.util.concurrent.TimeUnit; +import gtPlusPlus.core.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -12,51 +11,51 @@ import net.minecraftforge.common.util.ForgeDirection; public class DEBUG_TimerThread implements Runnable { - private World world; - private EntityPlayer player; - + private final World world; + private final EntityPlayer player; + - public DEBUG_TimerThread(World WORLD, EntityPlayer PLAYER) { - world = WORLD; - player = PLAYER; + public DEBUG_TimerThread(final World WORLD, final EntityPlayer PLAYER) { + this.world = WORLD; + this.player = PLAYER; } @Override public void run(){ - int xDir = ForgeDirection.getOrientation(player.getPlayerCoordinates().posX).offsetX; - int zDir = ForgeDirection.getOrientation(player.getPlayerCoordinates().posZ).offsetZ; - - int stepX = Minecraft.getMinecraft().objectMouseOver.blockX; - int stepY = Minecraft.getMinecraft().objectMouseOver.blockY; - int stepZ = Minecraft.getMinecraft().objectMouseOver.blockZ; + int xDir = ForgeDirection.getOrientation(this.player.getPlayerCoordinates().posX).offsetX; + int zDir = ForgeDirection.getOrientation(this.player.getPlayerCoordinates().posZ).offsetZ; + + final int stepX = Minecraft.getMinecraft().objectMouseOver.blockX; + final int stepY = Minecraft.getMinecraft().objectMouseOver.blockY; + final int stepZ = Minecraft.getMinecraft().objectMouseOver.blockZ; Utils.LOG_INFO("Clicked on a Block @ "+"[X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"+" with xDir:"+xDir+" zDir:"+zDir); - world.setBlock(stepX, stepY, stepZ, Blocks.bedrock,0,3); + this.world.setBlock(stepX, stepY, stepZ, Blocks.bedrock,0,3); Utils.LOG_INFO("Makng it Bedrock for future investment."); //for (int i = -1; i <= 1; i++) { //stepX = stepX+i; - for (int i = stepX-1; i <= stepX+1; i++){ - for (int j = stepZ-1; j <= stepZ+1; j++){ - for (int h = stepY-1; h <= stepY+1; h++){ - - xDir = ForgeDirection.getOrientation(player.getPlayerCoordinates().posX).offsetX; - zDir = ForgeDirection.getOrientation(player.getPlayerCoordinates().posZ).offsetZ; - - //for (int j = -1; j <= 1; j++) { - //stepZ = stepZ+j; - //for (int h = -1; h <= 1; h++) { + for (int i = stepX-1; i <= (stepX+1); i++){ + for (int j = stepZ-1; j <= (stepZ+1); j++){ + for (int h = stepY-1; h <= (stepY+1); h++){ + + xDir = ForgeDirection.getOrientation(this.player.getPlayerCoordinates().posX).offsetX; + zDir = ForgeDirection.getOrientation(this.player.getPlayerCoordinates().posZ).offsetZ; + + //for (int j = -1; j <= 1; j++) { + //stepZ = stepZ+j; + //for (int h = -1; h <= 1; h++) { //stepY = stepY+h; - Utils.LOG_INFO("Placing Block @ "+"[X:"+i+"][Y:"+h+"][Z:"+j+"]"+" with xDir:"+xDir+" zDir:"+zDir); - if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { - world.setBlock(i, h, j, Blocks.stone,0,3); + Utils.LOG_INFO("Placing Block @ "+"[X:"+i+"][Y:"+h+"][Z:"+j+"]"+" with xDir:"+xDir+" zDir:"+zDir); + if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { + this.world.setBlock(i, h, j, Blocks.stone,0,3); } else { Utils.LOG_INFO("Not even sure what this is for, but I got here."); } try { TimeUnit.MILLISECONDS.sleep(500); - } catch (InterruptedException e1) { + } catch (final InterruptedException e1) { e1.printStackTrace(); - } + } } } } diff --git a/src/Java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java b/src/Java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java index 59c652d73b..7cb1054d53 100644 --- a/src/Java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java +++ b/src/Java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java @@ -12,332 +12,332 @@ import org.lwjgl.opengl.GL11; */ public class UtilityGL11Debug { - public class GLproperty - { - public GLproperty(int init_gLconstant, String init_name, String init_description, String init_category, String init_fetchCommand) { - gLconstant = init_gLconstant; - name = init_name; - description = init_description; - category = init_category; - fetchCommand = init_fetchCommand; - } + public class GLproperty + { + public GLproperty(final int init_gLconstant, final String init_name, final String init_description, final String init_category, final String init_fetchCommand) { + this.gLconstant = init_gLconstant; + this.name = init_name; + this.description = init_description; + this.category = init_category; + this.fetchCommand = init_fetchCommand; + } - public int gLconstant; - public String name; - public String description; - public String category; - public String fetchCommand; - } + public int gLconstant; + public String name; + public String description; + public String category; + public String fetchCommand; + } - public static UtilityGL11Debug instance = new UtilityGL11Debug(); + public static UtilityGL11Debug instance = new UtilityGL11Debug(); - public GLproperty[] propertyList = + public GLproperty[] propertyList = - { - new GLproperty(GL11.GL_CURRENT_COLOR, "GL_CURRENT_COLOR", "Current color", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_INDEX, "GL_CURRENT_INDEX", "Current color index", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_TEXTURE_COORDS, "GL_CURRENT_TEXTURE_COORDS", "Current texture coordinates", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_NORMAL, "GL_CURRENT_NORMAL", "Current normal", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_POSITION, "GL_CURRENT_RASTER_POSITION", "Current raster position", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_DISTANCE, "GL_CURRENT_RASTER_DISTANCE", "Current raster distance", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_COLOR, "GL_CURRENT_RASTER_COLOR", "Color associated with raster position", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_INDEX, "GL_CURRENT_RASTER_INDEX", "Color index associated with raster position", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_TEXTURE_COORDS, "GL_CURRENT_RASTER_TEXTURE_COORDS", "Texture coordinates associated with raster position", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_RASTER_POSITION_VALID, "GL_CURRENT_RASTER_POSITION_VALID", "Raster position valid bit", "current", "glGetBooleanv()"), - new GLproperty(GL11.GL_EDGE_FLAG, "GL_EDGE_FLAG", "Edge flag", "current", "glGetBooleanv()"), - new GLproperty(GL11.GL_VERTEX_ARRAY, "GL_VERTEX_ARRAY", "Vertex array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_VERTEX_ARRAY_SIZE, "GL_VERTEX_ARRAY_SIZE", "Coordinates per vertex", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_VERTEX_ARRAY_TYPE, "GL_VERTEX_ARRAY_TYPE", "Type of vertex coordinates", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_VERTEX_ARRAY_STRIDE, "GL_VERTEX_ARRAY_STRIDE", "Stride between vertices", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_VERTEX_ARRAY_POINTER, "GL_VERTEX_ARRAY_POINTER", "Pointer to the vertex array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_NORMAL_ARRAY, "GL_NORMAL_ARRAY", "Normal array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_NORMAL_ARRAY_TYPE, "GL_NORMAL_ARRAY_TYPE", "Type of normal coordinates", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_NORMAL_ARRAY_STRIDE, "GL_NORMAL_ARRAY_STRIDE", "Stride between normals", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_NORMAL_ARRAY_POINTER, "GL_NORMAL_ARRAY_POINTER", "Pointer to the normal array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_COLOR_ARRAY, "GL_COLOR_ARRAY", "RGBA color array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_ARRAY_SIZE, "GL_COLOR_ARRAY_SIZE", "Colors per vertex", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_ARRAY_TYPE, "GL_COLOR_ARRAY_TYPE", "Type of color components", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_ARRAY_STRIDE, "GL_COLOR_ARRAY_STRIDE", "Stride between colors", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_ARRAY_POINTER, "GL_COLOR_ARRAY_POINTER", "Pointer to the color array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_INDEX_ARRAY, "GL_INDEX_ARRAY", "Color-index array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_INDEX_ARRAY_TYPE, "GL_INDEX_ARRAY_TYPE", "Type of color indices", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_ARRAY_STRIDE, "GL_INDEX_ARRAY_STRIDE", "Stride between color indices", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_ARRAY_POINTER, "GL_INDEX_ARRAY_POINTER", "Pointer to the index array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY, "GL_TEXTURE_COORD_ARRAY", "Texture coordinate array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_SIZE, "GL_TEXTURE_COORD_ARRAY_SIZE", "Texture coordinates per element", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_TYPE, "GL_TEXTURE_COORD_ARRAY_TYPE", "Type of texture coordinates", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_STRIDE, "GL_TEXTURE_COORD_ARRAY_STRIDE", "Stride between texture coordinates", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_POINTER, "GL_TEXTURE_COORD_ARRAY_POINTER", "Pointer to the texture coordinate array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_EDGE_FLAG_ARRAY, "GL_EDGE_FLAG_ARRAY", "Edge flag array enable", "vertex-array", "glIsEnabled()"), - new GLproperty(GL11.GL_EDGE_FLAG_ARRAY_STRIDE, "GL_EDGE_FLAG_ARRAY_STRIDE", "Stride between edge flags", "vertex-array", "glGetIntegerv()"), - new GLproperty(GL11.GL_EDGE_FLAG_ARRAY_POINTER, "GL_EDGE_FLAG_ARRAY_POINTER", "Pointer to the edge flag array", "vertex-array", "glGetPointerv()"), - new GLproperty(GL11.GL_MODELVIEW_MATRIX, "GL_MODELVIEW_MATRIX", "Modelview matrix stack", "matrix", "glGetFloatv()"), - new GLproperty(GL11.GL_PROJECTION_MATRIX, "GL_PROJECTION_MATRIX", "Projection matrix stack", "matrix", "glGetFloatv()"), - new GLproperty(GL11.GL_TEXTURE_MATRIX, "GL_TEXTURE_MATRIX", "Texture matrix stack", "matrix", "glGetFloatv()"), - new GLproperty(GL11.GL_VIEWPORT, "GL_VIEWPORT", "Viewport origin and extent", "viewport", "glGetIntegerv()"), - new GLproperty(GL11.GL_DEPTH_RANGE, "GL_DEPTH_RANGE", "Depth range near and far", "viewport", "glGetFloatv()"), - new GLproperty(GL11.GL_MODELVIEW_STACK_DEPTH, "GL_MODELVIEW_STACK_DEPTH", "Modelview matrix stack pointer", "matrix", "glGetIntegerv()"), - new GLproperty(GL11.GL_PROJECTION_STACK_DEPTH, "GL_PROJECTION_STACK_DEPTH", "Projection matrix stack pointer", "matrix", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_STACK_DEPTH, "GL_TEXTURE_STACK_DEPTH", "Texture matrix stack pointer", "matrix", "glGetIntegerv()"), - new GLproperty(GL11.GL_MATRIX_MODE, "GL_MATRIX_MODE", "Current matrix mode", "transform", "glGetIntegerv()"), - new GLproperty(GL11.GL_NORMALIZE, "GL_NORMALIZE", "Current normal normalization on/off", "transform/ enable", "glIsEnabled()"), - new GLproperty(GL11.GL_FOG_COLOR, "GL_FOG_COLOR", "Fog color", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_INDEX, "GL_FOG_INDEX", "Fog index", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_DENSITY, "GL_FOG_DENSITY", "Exponential fog density", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_START, "GL_FOG_START", "Linear fog start", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_END, "GL_FOG_END", "Linear fog end", "fog", "glGetFloatv()"), - new GLproperty(GL11.GL_FOG_MODE, "GL_FOG_MODE", "Fog mode", "fog", "glGetIntegerv()"), - new GLproperty(GL11.GL_FOG, "GL_FOG", "True if fog enabled", "fog/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_SHADE_MODEL, "GL_SHADE_MODEL", "glShadeModel() setting", "lighting", "glGetIntegerv()"), - new GLproperty(GL11.GL_LIGHTING, "GL_LIGHTING", "True if lighting is enabled", "lighting/e nable", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_MATERIAL, "GL_COLOR_MATERIAL", "True if color tracking is enabled", "lighting", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_MATERIAL_PARAMETER, "GL_COLOR_MATERIAL_PARAMETER", "Material properties tracking current color", "lighting", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_MATERIAL_FACE, "GL_COLOR_MATERIAL_FACE", "Face(s) affected by color tracking", "lighting", "glGetIntegerv()"), - new GLproperty(GL11.GL_AMBIENT, "GL_AMBIENT", "Ambient material color", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_DIFFUSE, "GL_DIFFUSE", "Diffuse material color", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_SPECULAR, "GL_SPECULAR", "Specular material color", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_EMISSION, "GL_EMISSION", "Emissive material color", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_SHININESS, "GL_SHININESS", "Specular exponent of material", "lighting", "glGetMaterialfv()"), - new GLproperty(GL11.GL_LIGHT_MODEL_AMBIENT, "GL_LIGHT_MODEL_AMBIENT", "Ambient scene color", "lighting", "glGetFloatv()"), - new GLproperty(GL11.GL_LIGHT_MODEL_LOCAL_VIEWER, "GL_LIGHT_MODEL_LOCAL_VIEWER", "Viewer is local", "lighting", "glGetBooleanv()"), - new GLproperty(GL11.GL_LIGHT_MODEL_TWO_SIDE, "GL_LIGHT_MODEL_TWO_SIDE", "Use two-sided lighting", "lighting", "glGetBooleanv()"), - new GLproperty(GL11.GL_AMBIENT, "GL_AMBIENT", "Ambient intensity of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_DIFFUSE, "GL_DIFFUSE", "Diffuse intensity of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_SPECULAR, "GL_SPECULAR", "Specular intensity of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_POSITION, "GL_POSITION", "Position of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_CONSTANT_ATTENUATION, "GL_CONSTANT_ATTENUATION", "Constant attenuation factor", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_LINEAR_ATTENUATION, "GL_LINEAR_ATTENUATION", "Linear attenuation factor", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_QUADRATIC_ATTENUATION, "GL_QUADRATIC_ATTENUATION", "Quadratic attenuation factor", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_SPOT_DIRECTION, "GL_SPOT_DIRECTION", "Spotlight direction of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_SPOT_EXPONENT, "GL_SPOT_EXPONENT", "Spotlight exponent of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_SPOT_CUTOFF, "GL_SPOT_CUTOFF", "Spotlight angle of light i", "lighting", "glGetLightfv()"), - new GLproperty(GL11.GL_LIGHT0, "GL_LIGHT0", "True if light 0 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT1, "GL_LIGHT1", "True if light 1 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT2, "GL_LIGHT2", "True if light 2 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT3, "GL_LIGHT3", "True if light 3 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT4, "GL_LIGHT4", "True if light 4 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT5, "GL_LIGHT5", "True if light 5 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT6, "GL_LIGHT6", "True if light 6 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LIGHT7, "GL_LIGHT7", "True if light 7 enabled", "lighting/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_INDEXES, "GL_COLOR_INDEXES", "ca, cd, and cs for color-index lighting", "lighting/e nable", "glGetMaterialfv()"), - new GLproperty(GL11.GL_POINT_SIZE, "GL_POINT_SIZE", "Point size", "point", "glGetFloatv()"), - new GLproperty(GL11.GL_POINT_SMOOTH, "GL_POINT_SMOOTH", "Point antialiasing on", "point/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LINE_WIDTH, "GL_LINE_WIDTH", "Line width", "line", "glGetFloatv()"), - new GLproperty(GL11.GL_LINE_SMOOTH, "GL_LINE_SMOOTH", "Line antialiasing on", "line/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LINE_STIPPLE_PATTERN, "GL_LINE_STIPPLE_PATTERN", "Line stipple", "line", "glGetIntegerv()"), - new GLproperty(GL11.GL_LINE_STIPPLE_REPEAT, "GL_LINE_STIPPLE_REPEAT", "Line stipple repeat", "line", "glGetIntegerv()"), - new GLproperty(GL11.GL_LINE_STIPPLE, "GL_LINE_STIPPLE", "Line stipple enable", "line/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_CULL_FACE, "GL_CULL_FACE", "Polygon culling enabled", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_CULL_FACE_MODE, "GL_CULL_FACE_MODE", "Cull front-/back-facing polygons", "polygon", "glGetIntegerv()"), - new GLproperty(GL11.GL_FRONT_FACE, "GL_FRONT_FACE", "Polygon front-face CW/CCW indicator", "polygon", "glGetIntegerv()"), - new GLproperty(GL11.GL_POLYGON_SMOOTH, "GL_POLYGON_SMOOTH", "Polygon antialiasing on", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_POLYGON_MODE, "GL_POLYGON_MODE", "Polygon rasterization mode (front and back)", "polygon", "glGetIntegerv()"), - new GLproperty(GL11.GL_POLYGON_OFFSET_FACTOR, "GL_POLYGON_OFFSET_FACTOR", "Polygon offset factor", "polygon", "glGetFloatv()"), - new GLproperty(GL11.GL_POLYGON_OFFSET_POINT, "GL_POLYGON_OFFSET_POINT", "Polygon offset enable for GL_POINT mode rasterization", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_POLYGON_OFFSET_LINE, "GL_POLYGON_OFFSET_LINE", "Polygon offset enable for GL_LINE mode rasterization", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_POLYGON_OFFSET_FILL, "GL_POLYGON_OFFSET_FILL", "Polygon offset enable for GL_FILL mode rasterization", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_POLYGON_STIPPLE, "GL_POLYGON_STIPPLE", "Polygon stipple enable", "polygon/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_1D, "GL_TEXTURE_1D", "True if 1-D texturing enabled ", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_2D, "GL_TEXTURE_2D", "True if 2-D texturing enabled ", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_BINDING_1D, "GL_TEXTURE_BINDING_1D", "Texture object bound to GL_TEXTURE_1D", "texture", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE_BINDING_2D, "GL_TEXTURE_BINDING_2D", "Texture object bound to GL_TEXTURE_2D", "texture", "glGetIntegerv()"), - new GLproperty(GL11.GL_TEXTURE, "GL_TEXTURE", "x-D texture image at level of detail i", "UNUSED", "glGetTexImage()"), - new GLproperty(GL11.GL_TEXTURE_WIDTH, "GL_TEXTURE_WIDTH", "x-D texture image i's width", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_HEIGHT, "GL_TEXTURE_HEIGHT", "x-D texture image i's height", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_BORDER, "GL_TEXTURE_BORDER", "x-D texture image i's border width", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_RED_SIZE, "GL_TEXTURE_RED_SIZE", "x-D texture image i's red resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_GREEN_SIZE, "GL_TEXTURE_GREEN_SIZE", "x-D texture image i's green resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_BLUE_SIZE, "GL_TEXTURE_BLUE_SIZE", "x-D texture image i's blue resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_ALPHA_SIZE, "GL_TEXTURE_ALPHA_SIZE", "x-D texture image i's alpha resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_LUMINANCE_SIZE, "GL_TEXTURE_LUMINANCE_SIZE", "x-D texture image i's luminance resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_INTENSITY_SIZE, "GL_TEXTURE_INTENSITY_SIZE", "x-D texture image i's intensity resolution", "UNUSED", "glGetTexLevelParameter*()"), - new GLproperty(GL11.GL_TEXTURE_BORDER_COLOR, "GL_TEXTURE_BORDER_COLOR", "Texture border color", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_MIN_FILTER, "GL_TEXTURE_MIN_FILTER", "Texture minification function", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_MAG_FILTER, "GL_TEXTURE_MAG_FILTER", "Texture magnification function", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_WRAP_S, "GL_TEXTURE_WRAP_S", "Texture wrap mode (x is S or T)", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_WRAP_T, "GL_TEXTURE_WRAP_T", "Texture wrap mode (x is S or T)", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_PRIORITY, "GL_TEXTURE_PRIORITY", "Texture object priority", "texture", "glGetTexParameter*()"), - new GLproperty(GL11.GL_TEXTURE_ENV_MODE, "GL_TEXTURE_ENV_MODE", "Texture application function", "texture", "glGetTexEnviv()"), - new GLproperty(GL11.GL_TEXTURE_ENV_COLOR, "GL_TEXTURE_ENV_COLOR", "Texture environment color", "texture", "glGetTexEnvfv()"), - new GLproperty(GL11.GL_TEXTURE_GEN_S, "GL_TEXTURE_GEN_S", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_GEN_T, "GL_TEXTURE_GEN_T", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_GEN_R, "GL_TEXTURE_GEN_R", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_TEXTURE_GEN_Q, "GL_TEXTURE_GEN_Q", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_EYE_PLANE, "GL_EYE_PLANE", "Texgen plane equation coefficients", "texture", "glGetTexGenfv()"), - new GLproperty(GL11.GL_OBJECT_PLANE, "GL_OBJECT_PLANE", "Texgen object linear coefficients", "texture", "glGetTexGenfv()"), - new GLproperty(GL11.GL_TEXTURE_GEN_MODE, "GL_TEXTURE_GEN_MODE", "Function used for texgen", "texture", "glGetTexGeniv()"), - new GLproperty(GL11.GL_SCISSOR_TEST, "GL_SCISSOR_TEST", "Scissoring enabled", "scissor/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_SCISSOR_BOX, "GL_SCISSOR_BOX", "Scissor box", "scissor", "glGetIntegerv()"), - new GLproperty(GL11.GL_ALPHA_TEST, "GL_ALPHA_TEST", "Alpha test enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_ALPHA_TEST_FUNC, "GL_ALPHA_TEST_FUNC", "Alpha test function", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_ALPHA_TEST_REF, "GL_ALPHA_TEST_REF", "Alpha test reference value", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_TEST, "GL_STENCIL_TEST", "Stenciling enabled", "stencil-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_STENCIL_FUNC, "GL_STENCIL_FUNC", "Stencil function", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_VALUE_MASK, "GL_STENCIL_VALUE_MASK", "Stencil mask", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_REF, "GL_STENCIL_REF", "Stencil reference value", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_FAIL, "GL_STENCIL_FAIL", "Stencil fail action", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_PASS_DEPTH_FAIL, "GL_STENCIL_PASS_DEPTH_FAIL", "Stencil depth buffer fail action", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_PASS_DEPTH_PASS, "GL_STENCIL_PASS_DEPTH_PASS", "Stencil depth buffer pass action", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_DEPTH_TEST, "GL_DEPTH_TEST", "Depth buffer enabled", "depth-buffer/ena ble", "glIsEnabled()"), - new GLproperty(GL11.GL_DEPTH_FUNC, "GL_DEPTH_FUNC", "Depth buffer test function", "depth-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_BLEND, "GL_BLEND", "Blending enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_BLEND_SRC, "GL_BLEND_SRC", "Blending source function", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_BLEND_DST, "GL_BLEND_DST", "Blending destination function", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_DITHER, "GL_DITHER", "Dithering enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_INDEX_LOGIC_OP, "GL_INDEX_LOGIC_OP", "Color index logical operation enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_COLOR_LOGIC_OP, "GL_COLOR_LOGIC_OP", "RGBA color logical operation enabled", "color-buffer/enable", "glIsEnabled()"), - new GLproperty(GL11.GL_LOGIC_OP_MODE, "GL_LOGIC_OP_MODE", "Logical operation function", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_DRAW_BUFFER, "GL_DRAW_BUFFER", "Buffers selected for drawing", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_WRITEMASK, "GL_INDEX_WRITEMASK", "Color-index writemask", "color-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_WRITEMASK, "GL_COLOR_WRITEMASK", "Color write enables; R, G, B, or A", "color-buffer", "glGetBooleanv()"), - new GLproperty(GL11.GL_DEPTH_WRITEMASK, "GL_DEPTH_WRITEMASK", "Depth buffer enabled for writing", "depth-buffer", "glGetBooleanv()"), - new GLproperty(GL11.GL_STENCIL_WRITEMASK, "GL_STENCIL_WRITEMASK", "Stencil-buffer writemask", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_COLOR_CLEAR_VALUE, "GL_COLOR_CLEAR_VALUE", "Color-buffer clear value (RGBA mode)", "color-buffer", "glGetFloatv()"), - new GLproperty(GL11.GL_INDEX_CLEAR_VALUE, "GL_INDEX_CLEAR_VALUE", "Color-buffer clear value (color-index mode)", "color-buffer", "glGetFloatv()"), - new GLproperty(GL11.GL_DEPTH_CLEAR_VALUE, "GL_DEPTH_CLEAR_VALUE", "Depth-buffer clear value", "depth-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_CLEAR_VALUE, "GL_STENCIL_CLEAR_VALUE", "Stencil-buffer clear value", "stencil-buffer", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_CLEAR_VALUE, "GL_ACCUM_CLEAR_VALUE", "Accumulation-buffer clear value", "accum-buffer", "glGetFloatv()"), - new GLproperty(GL11.GL_UNPACK_SWAP_BYTES, "GL_UNPACK_SWAP_BYTES", "Value of GL_UNPACK_SWAP_BYTES", "pixel-store", "glGetBooleanv()"), - new GLproperty(GL11.GL_UNPACK_LSB_FIRST, "GL_UNPACK_LSB_FIRST", "Value of GL_UNPACK_LSB_FIRST", "pixel-store", "glGetBooleanv()"), - new GLproperty(GL11.GL_UNPACK_ROW_LENGTH, "GL_UNPACK_ROW_LENGTH", "Value of GL_UNPACK_ROW_LENGTH", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_UNPACK_SKIP_ROWS, "GL_UNPACK_SKIP_ROWS", "Value of GL_UNPACK_SKIP_ROWS", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_UNPACK_SKIP_PIXELS, "GL_UNPACK_SKIP_PIXELS", "Value of GL_UNPACK_SKIP_PIXELS", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_UNPACK_ALIGNMENT, "GL_UNPACK_ALIGNMENT", "Value of GL_UNPACK_ALIGNMENT", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_PACK_SWAP_BYTES, "GL_PACK_SWAP_BYTES", "Value of GL_PACK_SWAP_BYTES", "pixel-store", "glGetBooleanv()"), - new GLproperty(GL11.GL_PACK_LSB_FIRST, "GL_PACK_LSB_FIRST", "Value of GL_PACK_LSB_FIRST", "pixel-store", "glGetBooleanv()"), - new GLproperty(GL11.GL_PACK_ROW_LENGTH, "GL_PACK_ROW_LENGTH", "Value of GL_PACK_ROW_LENGTH", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_PACK_SKIP_ROWS, "GL_PACK_SKIP_ROWS", "Value of GL_PACK_SKIP_ROWS", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_PACK_SKIP_PIXELS, "GL_PACK_SKIP_PIXELS", "Value of GL_PACK_SKIP_PIXELS", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_PACK_ALIGNMENT, "GL_PACK_ALIGNMENT", "Value of GL_PACK_ALIGNMENT", "pixel-store", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAP_COLOR, "GL_MAP_COLOR", "True if colors are mapped", "pixel", "glGetBooleanv()"), - new GLproperty(GL11.GL_MAP_STENCIL, "GL_MAP_STENCIL", "True if stencil values are mapped", "pixel", "glGetBooleanv()"), - new GLproperty(GL11.GL_INDEX_SHIFT, "GL_INDEX_SHIFT", "Value of GL_INDEX_SHIFT", "pixel", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_OFFSET, "GL_INDEX_OFFSET", "Value of GL_INDEX_OFFSET", "pixel", "glGetIntegerv()"), - new GLproperty(GL11.GL_ZOOM_X, "GL_ZOOM_X", "x zoom factor", "pixel", "glGetFloatv()"), - new GLproperty(GL11.GL_ZOOM_Y, "GL_ZOOM_Y", "y zoom factor", "pixel", "glGetFloatv()"), - new GLproperty(GL11.GL_READ_BUFFER, "GL_READ_BUFFER", "Read source buffer", "pixel", "glGetIntegerv()"), - new GLproperty(GL11.GL_ORDER, "GL_ORDER", "1D map order", "capability", "glGetMapiv()"), - new GLproperty(GL11.GL_ORDER, "GL_ORDER", "2D map orders", "capability", "glGetMapiv()"), - new GLproperty(GL11.GL_COEFF, "GL_COEFF", "1D control points", "capability", "glGetMapfv()"), - new GLproperty(GL11.GL_COEFF, "GL_COEFF", "2D control points", "capability", "glGetMapfv()"), - new GLproperty(GL11.GL_DOMAIN, "GL_DOMAIN", "1D domain endpoints", "capability", "glGetMapfv()"), - new GLproperty(GL11.GL_DOMAIN, "GL_DOMAIN", "2D domain endpoints", "capability", "glGetMapfv()"), - new GLproperty(GL11.GL_MAP1_GRID_DOMAIN, "GL_MAP1_GRID_DOMAIN", "1D grid endpoints", "eval", "glGetFloatv()"), - new GLproperty(GL11.GL_MAP2_GRID_DOMAIN, "GL_MAP2_GRID_DOMAIN", "2D grid endpoints", "eval", "glGetFloatv()"), - new GLproperty(GL11.GL_MAP1_GRID_SEGMENTS, "GL_MAP1_GRID_SEGMENTS", "1D grid divisions", "eval", "glGetFloatv()"), - new GLproperty(GL11.GL_MAP2_GRID_SEGMENTS, "GL_MAP2_GRID_SEGMENTS", "2D grid divisions", "eval", "glGetFloatv()"), - new GLproperty(GL11.GL_AUTO_NORMAL, "GL_AUTO_NORMAL", "True if automatic normal generation enabled", "eval", "glIsEnabled()"), - new GLproperty(GL11.GL_PERSPECTIVE_CORRECTION_HINT, "GL_PERSPECTIVE_CORRECTION_HINT", "Perspective correction hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_POINT_SMOOTH_HINT, "GL_POINT_SMOOTH_HINT", "Point smooth hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_LINE_SMOOTH_HINT, "GL_LINE_SMOOTH_HINT", "Line smooth hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_POLYGON_SMOOTH_HINT, "GL_POLYGON_SMOOTH_HINT", "Polygon smooth hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_FOG_HINT, "GL_FOG_HINT", "Fog hint", "hint", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_LIGHTS, "GL_MAX_LIGHTS", "Maximum number of lights", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_CLIP_PLANES, "GL_MAX_CLIP_PLANES", "Maximum number of user clipping planes", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_MODELVIEW_STACK_DEPTH, "GL_MAX_MODELVIEW_STACK_DEPTH", "Maximum modelview-matrix stack depth", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_PROJECTION_STACK_DEPTH, "GL_MAX_PROJECTION_STACK_DEPTH", "Maximum projection-matrix stack depth", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_TEXTURE_STACK_DEPTH, "GL_MAX_TEXTURE_STACK_DEPTH", "Maximum depth of texture matrix stack", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_SUBPIXEL_BITS, "GL_SUBPIXEL_BITS", "Number of bits of subpixel precision in x and y", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_TEXTURE_SIZE, "GL_MAX_TEXTURE_SIZE", "See discussion in Texture Proxy in Chapter 9", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_PIXEL_MAP_TABLE, "GL_MAX_PIXEL_MAP_TABLE", "Maximum size of a glPixelMap() translation table", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_NAME_STACK_DEPTH, "GL_MAX_NAME_STACK_DEPTH", "Maximum selection-name stack depth", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_LIST_NESTING, "GL_MAX_LIST_NESTING", "Maximum display-list call nesting", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_EVAL_ORDER, "GL_MAX_EVAL_ORDER", "Maximum evaluator polynomial order", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_VIEWPORT_DIMS, "GL_MAX_VIEWPORT_DIMS", "Maximum viewport dimensions", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_ATTRIB_STACK_DEPTH, "GL_MAX_ATTRIB_STACK_DEPTH", "Maximum depth of the attribute stack", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", "Maximum depth of the client attribute stack", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_AUX_BUFFERS, "GL_AUX_BUFFERS", "Number of auxiliary buffers", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_RGBA_MODE, "GL_RGBA_MODE", "True if color buffers store RGBA", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_INDEX_MODE, "GL_INDEX_MODE", "True if color buffers store indices", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_DOUBLEBUFFER, "GL_DOUBLEBUFFER", "True if front and back buffers exist", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_STEREO, "GL_STEREO", "True if left and right buffers exist", "capability", "glGetBooleanv()"), - new GLproperty(GL11.GL_POINT_SIZE_RANGE, "GL_POINT_SIZE_RANGE", "Range (low to high) of antialiased point sizes", "capability", "glGetFloatv()"), - new GLproperty(GL11.GL_POINT_SIZE_GRANULARITY, "GL_POINT_SIZE_GRANULARITY", "Antialiased point-size granularity", "capability", "glGetFloatv()"), - new GLproperty(GL11.GL_LINE_WIDTH_RANGE, "GL_LINE_WIDTH_RANGE", "Range (low to high) of antialiased line widths", "capability", "glGetFloatv()"), - new GLproperty(GL11.GL_LINE_WIDTH_GRANULARITY, "GL_LINE_WIDTH_GRANULARITY", "Antialiased line-width granularity", "capability", "glGetFloatv()"), - new GLproperty(GL11.GL_RED_BITS, "GL_RED_BITS", "Number of bits per red component in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_GREEN_BITS, "GL_GREEN_BITS", "Number of bits per green component in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_BLUE_BITS, "GL_BLUE_BITS", "Number of bits per blue component in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ALPHA_BITS, "GL_ALPHA_BITS", "Number of bits per alpha component in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_INDEX_BITS, "GL_INDEX_BITS", "Number of bits per index in color buffers", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_DEPTH_BITS, "GL_DEPTH_BITS", "Number of depth-buffer bitplanes", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_STENCIL_BITS, "GL_STENCIL_BITS", "Number of stencil bitplanes", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_RED_BITS, "GL_ACCUM_RED_BITS", "Number of bits per red component in the accumulation buffer", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_GREEN_BITS, "GL_ACCUM_GREEN_BITS", "Number of bits per green component in the accumulation buffer", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_BLUE_BITS, "GL_ACCUM_BLUE_BITS", "Number of bits per blue component in the accumulation buffer", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_ACCUM_ALPHA_BITS, "GL_ACCUM_ALPHA_BITS", "Number of bits per alpha component in the accumulation buffer", "capability", "glGetIntegerv()"), - new GLproperty(GL11.GL_LIST_BASE, "GL_LIST_BASE", "Setting of glListBase()", "list", "glGetIntegerv()"), - new GLproperty(GL11.GL_LIST_INDEX, "GL_LIST_INDEX", "Number of display list under construction; 0 if none", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_LIST_MODE, "GL_LIST_MODE", "Mode of display list under construction; undefined if none", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_ATTRIB_STACK_DEPTH, "GL_ATTRIB_STACK_DEPTH", "Attribute stack pointer", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_CLIENT_ATTRIB_STACK_DEPTH, "GL_CLIENT_ATTRIB_STACK_DEPTH", "Client attribute stack pointer", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_NAME_STACK_DEPTH, "GL_NAME_STACK_DEPTH", "Name stack depth", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_RENDER_MODE, "GL_RENDER_MODE", "glRenderMode() setting", "current", "glGetIntegerv()"), - new GLproperty(GL11.GL_SELECTION_BUFFER_POINTER, "GL_SELECTION_BUFFER_POINTER", "Pointer to selection buffer", "select", "glGetPointerv()"), - new GLproperty(GL11.GL_SELECTION_BUFFER_SIZE, "GL_SELECTION_BUFFER_SIZE", "Size of selection buffer", "select", "glGetIntegerv()"), - new GLproperty(GL11.GL_FEEDBACK_BUFFER_POINTER, "GL_FEEDBACK_BUFFER_POINTER", "Pointer to feedback buffer", "feedback", "glGetPointerv()"), - new GLproperty(GL11.GL_FEEDBACK_BUFFER_SIZE, "GL_FEEDBACK_BUFFER_SIZE", "Size of feedback buffer", "feedback", "glGetIntegerv()"), - new GLproperty(GL11.GL_FEEDBACK_BUFFER_TYPE, "GL_FEEDBACK_BUFFER_TYPE", "Type of feedback buffer", "feedback", "glGetIntegerv()"), - }; + { + new GLproperty(GL11.GL_CURRENT_COLOR, "GL_CURRENT_COLOR", "Current color", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_INDEX, "GL_CURRENT_INDEX", "Current color index", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_TEXTURE_COORDS, "GL_CURRENT_TEXTURE_COORDS", "Current texture coordinates", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_NORMAL, "GL_CURRENT_NORMAL", "Current normal", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_RASTER_POSITION, "GL_CURRENT_RASTER_POSITION", "Current raster position", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_RASTER_DISTANCE, "GL_CURRENT_RASTER_DISTANCE", "Current raster distance", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_RASTER_COLOR, "GL_CURRENT_RASTER_COLOR", "Color associated with raster position", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_RASTER_INDEX, "GL_CURRENT_RASTER_INDEX", "Color index associated with raster position", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_RASTER_TEXTURE_COORDS, "GL_CURRENT_RASTER_TEXTURE_COORDS", "Texture coordinates associated with raster position", "current", "glGetFloatv()"), + new GLproperty(GL11.GL_CURRENT_RASTER_POSITION_VALID, "GL_CURRENT_RASTER_POSITION_VALID", "Raster position valid bit", "current", "glGetBooleanv()"), + new GLproperty(GL11.GL_EDGE_FLAG, "GL_EDGE_FLAG", "Edge flag", "current", "glGetBooleanv()"), + new GLproperty(GL11.GL_VERTEX_ARRAY, "GL_VERTEX_ARRAY", "Vertex array enable", "vertex-array", "glIsEnabled()"), + new GLproperty(GL11.GL_VERTEX_ARRAY_SIZE, "GL_VERTEX_ARRAY_SIZE", "Coordinates per vertex", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_VERTEX_ARRAY_TYPE, "GL_VERTEX_ARRAY_TYPE", "Type of vertex coordinates", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_VERTEX_ARRAY_STRIDE, "GL_VERTEX_ARRAY_STRIDE", "Stride between vertices", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_VERTEX_ARRAY_POINTER, "GL_VERTEX_ARRAY_POINTER", "Pointer to the vertex array", "vertex-array", "glGetPointerv()"), + new GLproperty(GL11.GL_NORMAL_ARRAY, "GL_NORMAL_ARRAY", "Normal array enable", "vertex-array", "glIsEnabled()"), + new GLproperty(GL11.GL_NORMAL_ARRAY_TYPE, "GL_NORMAL_ARRAY_TYPE", "Type of normal coordinates", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_NORMAL_ARRAY_STRIDE, "GL_NORMAL_ARRAY_STRIDE", "Stride between normals", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_NORMAL_ARRAY_POINTER, "GL_NORMAL_ARRAY_POINTER", "Pointer to the normal array", "vertex-array", "glGetPointerv()"), + new GLproperty(GL11.GL_COLOR_ARRAY, "GL_COLOR_ARRAY", "RGBA color array enable", "vertex-array", "glIsEnabled()"), + new GLproperty(GL11.GL_COLOR_ARRAY_SIZE, "GL_COLOR_ARRAY_SIZE", "Colors per vertex", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_COLOR_ARRAY_TYPE, "GL_COLOR_ARRAY_TYPE", "Type of color components", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_COLOR_ARRAY_STRIDE, "GL_COLOR_ARRAY_STRIDE", "Stride between colors", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_COLOR_ARRAY_POINTER, "GL_COLOR_ARRAY_POINTER", "Pointer to the color array", "vertex-array", "glGetPointerv()"), + new GLproperty(GL11.GL_INDEX_ARRAY, "GL_INDEX_ARRAY", "Color-index array enable", "vertex-array", "glIsEnabled()"), + new GLproperty(GL11.GL_INDEX_ARRAY_TYPE, "GL_INDEX_ARRAY_TYPE", "Type of color indices", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_INDEX_ARRAY_STRIDE, "GL_INDEX_ARRAY_STRIDE", "Stride between color indices", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_INDEX_ARRAY_POINTER, "GL_INDEX_ARRAY_POINTER", "Pointer to the index array", "vertex-array", "glGetPointerv()"), + new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY, "GL_TEXTURE_COORD_ARRAY", "Texture coordinate array enable", "vertex-array", "glIsEnabled()"), + new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_SIZE, "GL_TEXTURE_COORD_ARRAY_SIZE", "Texture coordinates per element", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_TYPE, "GL_TEXTURE_COORD_ARRAY_TYPE", "Type of texture coordinates", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_STRIDE, "GL_TEXTURE_COORD_ARRAY_STRIDE", "Stride between texture coordinates", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_TEXTURE_COORD_ARRAY_POINTER, "GL_TEXTURE_COORD_ARRAY_POINTER", "Pointer to the texture coordinate array", "vertex-array", "glGetPointerv()"), + new GLproperty(GL11.GL_EDGE_FLAG_ARRAY, "GL_EDGE_FLAG_ARRAY", "Edge flag array enable", "vertex-array", "glIsEnabled()"), + new GLproperty(GL11.GL_EDGE_FLAG_ARRAY_STRIDE, "GL_EDGE_FLAG_ARRAY_STRIDE", "Stride between edge flags", "vertex-array", "glGetIntegerv()"), + new GLproperty(GL11.GL_EDGE_FLAG_ARRAY_POINTER, "GL_EDGE_FLAG_ARRAY_POINTER", "Pointer to the edge flag array", "vertex-array", "glGetPointerv()"), + new GLproperty(GL11.GL_MODELVIEW_MATRIX, "GL_MODELVIEW_MATRIX", "Modelview matrix stack", "matrix", "glGetFloatv()"), + new GLproperty(GL11.GL_PROJECTION_MATRIX, "GL_PROJECTION_MATRIX", "Projection matrix stack", "matrix", "glGetFloatv()"), + new GLproperty(GL11.GL_TEXTURE_MATRIX, "GL_TEXTURE_MATRIX", "Texture matrix stack", "matrix", "glGetFloatv()"), + new GLproperty(GL11.GL_VIEWPORT, "GL_VIEWPORT", "Viewport origin and extent", "viewport", "glGetIntegerv()"), + new GLproperty(GL11.GL_DEPTH_RANGE, "GL_DEPTH_RANGE", "Depth range near and far", "viewport", "glGetFloatv()"), + new GLproperty(GL11.GL_MODELVIEW_STACK_DEPTH, "GL_MODELVIEW_STACK_DEPTH", "Modelview matrix stack pointer", "matrix", "glGetIntegerv()"), + new GLproperty(GL11.GL_PROJECTION_STACK_DEPTH, "GL_PROJECTION_STACK_DEPTH", "Projection matrix stack pointer", "matrix", "glGetIntegerv()"), + new GLproperty(GL11.GL_TEXTURE_STACK_DEPTH, "GL_TEXTURE_STACK_DEPTH", "Texture matrix stack pointer", "matrix", "glGetIntegerv()"), + new GLproperty(GL11.GL_MATRIX_MODE, "GL_MATRIX_MODE", "Current matrix mode", "transform", "glGetIntegerv()"), + new GLproperty(GL11.GL_NORMALIZE, "GL_NORMALIZE", "Current normal normalization on/off", "transform/ enable", "glIsEnabled()"), + new GLproperty(GL11.GL_FOG_COLOR, "GL_FOG_COLOR", "Fog color", "fog", "glGetFloatv()"), + new GLproperty(GL11.GL_FOG_INDEX, "GL_FOG_INDEX", "Fog index", "fog", "glGetFloatv()"), + new GLproperty(GL11.GL_FOG_DENSITY, "GL_FOG_DENSITY", "Exponential fog density", "fog", "glGetFloatv()"), + new GLproperty(GL11.GL_FOG_START, "GL_FOG_START", "Linear fog start", "fog", "glGetFloatv()"), + new GLproperty(GL11.GL_FOG_END, "GL_FOG_END", "Linear fog end", "fog", "glGetFloatv()"), + new GLproperty(GL11.GL_FOG_MODE, "GL_FOG_MODE", "Fog mode", "fog", "glGetIntegerv()"), + new GLproperty(GL11.GL_FOG, "GL_FOG", "True if fog enabled", "fog/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_SHADE_MODEL, "GL_SHADE_MODEL", "glShadeModel() setting", "lighting", "glGetIntegerv()"), + new GLproperty(GL11.GL_LIGHTING, "GL_LIGHTING", "True if lighting is enabled", "lighting/e nable", "glIsEnabled()"), + new GLproperty(GL11.GL_COLOR_MATERIAL, "GL_COLOR_MATERIAL", "True if color tracking is enabled", "lighting", "glIsEnabled()"), + new GLproperty(GL11.GL_COLOR_MATERIAL_PARAMETER, "GL_COLOR_MATERIAL_PARAMETER", "Material properties tracking current color", "lighting", "glGetIntegerv()"), + new GLproperty(GL11.GL_COLOR_MATERIAL_FACE, "GL_COLOR_MATERIAL_FACE", "Face(s) affected by color tracking", "lighting", "glGetIntegerv()"), + new GLproperty(GL11.GL_AMBIENT, "GL_AMBIENT", "Ambient material color", "lighting", "glGetMaterialfv()"), + new GLproperty(GL11.GL_DIFFUSE, "GL_DIFFUSE", "Diffuse material color", "lighting", "glGetMaterialfv()"), + new GLproperty(GL11.GL_SPECULAR, "GL_SPECULAR", "Specular material color", "lighting", "glGetMaterialfv()"), + new GLproperty(GL11.GL_EMISSION, "GL_EMISSION", "Emissive material color", "lighting", "glGetMaterialfv()"), + new GLproperty(GL11.GL_SHININESS, "GL_SHININESS", "Specular exponent of material", "lighting", "glGetMaterialfv()"), + new GLproperty(GL11.GL_LIGHT_MODEL_AMBIENT, "GL_LIGHT_MODEL_AMBIENT", "Ambient scene color", "lighting", "glGetFloatv()"), + new GLproperty(GL11.GL_LIGHT_MODEL_LOCAL_VIEWER, "GL_LIGHT_MODEL_LOCAL_VIEWER", "Viewer is local", "lighting", "glGetBooleanv()"), + new GLproperty(GL11.GL_LIGHT_MODEL_TWO_SIDE, "GL_LIGHT_MODEL_TWO_SIDE", "Use two-sided lighting", "lighting", "glGetBooleanv()"), + new GLproperty(GL11.GL_AMBIENT, "GL_AMBIENT", "Ambient intensity of light i", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_DIFFUSE, "GL_DIFFUSE", "Diffuse intensity of light i", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_SPECULAR, "GL_SPECULAR", "Specular intensity of light i", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_POSITION, "GL_POSITION", "Position of light i", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_CONSTANT_ATTENUATION, "GL_CONSTANT_ATTENUATION", "Constant attenuation factor", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_LINEAR_ATTENUATION, "GL_LINEAR_ATTENUATION", "Linear attenuation factor", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_QUADRATIC_ATTENUATION, "GL_QUADRATIC_ATTENUATION", "Quadratic attenuation factor", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_SPOT_DIRECTION, "GL_SPOT_DIRECTION", "Spotlight direction of light i", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_SPOT_EXPONENT, "GL_SPOT_EXPONENT", "Spotlight exponent of light i", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_SPOT_CUTOFF, "GL_SPOT_CUTOFF", "Spotlight angle of light i", "lighting", "glGetLightfv()"), + new GLproperty(GL11.GL_LIGHT0, "GL_LIGHT0", "True if light 0 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LIGHT1, "GL_LIGHT1", "True if light 1 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LIGHT2, "GL_LIGHT2", "True if light 2 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LIGHT3, "GL_LIGHT3", "True if light 3 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LIGHT4, "GL_LIGHT4", "True if light 4 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LIGHT5, "GL_LIGHT5", "True if light 5 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LIGHT6, "GL_LIGHT6", "True if light 6 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LIGHT7, "GL_LIGHT7", "True if light 7 enabled", "lighting/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_COLOR_INDEXES, "GL_COLOR_INDEXES", "ca, cd, and cs for color-index lighting", "lighting/e nable", "glGetMaterialfv()"), + new GLproperty(GL11.GL_POINT_SIZE, "GL_POINT_SIZE", "Point size", "point", "glGetFloatv()"), + new GLproperty(GL11.GL_POINT_SMOOTH, "GL_POINT_SMOOTH", "Point antialiasing on", "point/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LINE_WIDTH, "GL_LINE_WIDTH", "Line width", "line", "glGetFloatv()"), + new GLproperty(GL11.GL_LINE_SMOOTH, "GL_LINE_SMOOTH", "Line antialiasing on", "line/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LINE_STIPPLE_PATTERN, "GL_LINE_STIPPLE_PATTERN", "Line stipple", "line", "glGetIntegerv()"), + new GLproperty(GL11.GL_LINE_STIPPLE_REPEAT, "GL_LINE_STIPPLE_REPEAT", "Line stipple repeat", "line", "glGetIntegerv()"), + new GLproperty(GL11.GL_LINE_STIPPLE, "GL_LINE_STIPPLE", "Line stipple enable", "line/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_CULL_FACE, "GL_CULL_FACE", "Polygon culling enabled", "polygon/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_CULL_FACE_MODE, "GL_CULL_FACE_MODE", "Cull front-/back-facing polygons", "polygon", "glGetIntegerv()"), + new GLproperty(GL11.GL_FRONT_FACE, "GL_FRONT_FACE", "Polygon front-face CW/CCW indicator", "polygon", "glGetIntegerv()"), + new GLproperty(GL11.GL_POLYGON_SMOOTH, "GL_POLYGON_SMOOTH", "Polygon antialiasing on", "polygon/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_POLYGON_MODE, "GL_POLYGON_MODE", "Polygon rasterization mode (front and back)", "polygon", "glGetIntegerv()"), + new GLproperty(GL11.GL_POLYGON_OFFSET_FACTOR, "GL_POLYGON_OFFSET_FACTOR", "Polygon offset factor", "polygon", "glGetFloatv()"), + new GLproperty(GL11.GL_POLYGON_OFFSET_POINT, "GL_POLYGON_OFFSET_POINT", "Polygon offset enable for GL_POINT mode rasterization", "polygon/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_POLYGON_OFFSET_LINE, "GL_POLYGON_OFFSET_LINE", "Polygon offset enable for GL_LINE mode rasterization", "polygon/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_POLYGON_OFFSET_FILL, "GL_POLYGON_OFFSET_FILL", "Polygon offset enable for GL_FILL mode rasterization", "polygon/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_POLYGON_STIPPLE, "GL_POLYGON_STIPPLE", "Polygon stipple enable", "polygon/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_TEXTURE_1D, "GL_TEXTURE_1D", "True if 1-D texturing enabled ", "texture/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_TEXTURE_2D, "GL_TEXTURE_2D", "True if 2-D texturing enabled ", "texture/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_TEXTURE_BINDING_1D, "GL_TEXTURE_BINDING_1D", "Texture object bound to GL_TEXTURE_1D", "texture", "glGetIntegerv()"), + new GLproperty(GL11.GL_TEXTURE_BINDING_2D, "GL_TEXTURE_BINDING_2D", "Texture object bound to GL_TEXTURE_2D", "texture", "glGetIntegerv()"), + new GLproperty(GL11.GL_TEXTURE, "GL_TEXTURE", "x-D texture image at level of detail i", "UNUSED", "glGetTexImage()"), + new GLproperty(GL11.GL_TEXTURE_WIDTH, "GL_TEXTURE_WIDTH", "x-D texture image i's width", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_HEIGHT, "GL_TEXTURE_HEIGHT", "x-D texture image i's height", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_BORDER, "GL_TEXTURE_BORDER", "x-D texture image i's border width", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_RED_SIZE, "GL_TEXTURE_RED_SIZE", "x-D texture image i's red resolution", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_GREEN_SIZE, "GL_TEXTURE_GREEN_SIZE", "x-D texture image i's green resolution", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_BLUE_SIZE, "GL_TEXTURE_BLUE_SIZE", "x-D texture image i's blue resolution", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_ALPHA_SIZE, "GL_TEXTURE_ALPHA_SIZE", "x-D texture image i's alpha resolution", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_LUMINANCE_SIZE, "GL_TEXTURE_LUMINANCE_SIZE", "x-D texture image i's luminance resolution", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_INTENSITY_SIZE, "GL_TEXTURE_INTENSITY_SIZE", "x-D texture image i's intensity resolution", "UNUSED", "glGetTexLevelParameter*()"), + new GLproperty(GL11.GL_TEXTURE_BORDER_COLOR, "GL_TEXTURE_BORDER_COLOR", "Texture border color", "texture", "glGetTexParameter*()"), + new GLproperty(GL11.GL_TEXTURE_MIN_FILTER, "GL_TEXTURE_MIN_FILTER", "Texture minification function", "texture", "glGetTexParameter*()"), + new GLproperty(GL11.GL_TEXTURE_MAG_FILTER, "GL_TEXTURE_MAG_FILTER", "Texture magnification function", "texture", "glGetTexParameter*()"), + new GLproperty(GL11.GL_TEXTURE_WRAP_S, "GL_TEXTURE_WRAP_S", "Texture wrap mode (x is S or T)", "texture", "glGetTexParameter*()"), + new GLproperty(GL11.GL_TEXTURE_WRAP_T, "GL_TEXTURE_WRAP_T", "Texture wrap mode (x is S or T)", "texture", "glGetTexParameter*()"), + new GLproperty(GL11.GL_TEXTURE_PRIORITY, "GL_TEXTURE_PRIORITY", "Texture object priority", "texture", "glGetTexParameter*()"), + new GLproperty(GL11.GL_TEXTURE_ENV_MODE, "GL_TEXTURE_ENV_MODE", "Texture application function", "texture", "glGetTexEnviv()"), + new GLproperty(GL11.GL_TEXTURE_ENV_COLOR, "GL_TEXTURE_ENV_COLOR", "Texture environment color", "texture", "glGetTexEnvfv()"), + new GLproperty(GL11.GL_TEXTURE_GEN_S, "GL_TEXTURE_GEN_S", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_TEXTURE_GEN_T, "GL_TEXTURE_GEN_T", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_TEXTURE_GEN_R, "GL_TEXTURE_GEN_R", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_TEXTURE_GEN_Q, "GL_TEXTURE_GEN_Q", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_EYE_PLANE, "GL_EYE_PLANE", "Texgen plane equation coefficients", "texture", "glGetTexGenfv()"), + new GLproperty(GL11.GL_OBJECT_PLANE, "GL_OBJECT_PLANE", "Texgen object linear coefficients", "texture", "glGetTexGenfv()"), + new GLproperty(GL11.GL_TEXTURE_GEN_MODE, "GL_TEXTURE_GEN_MODE", "Function used for texgen", "texture", "glGetTexGeniv()"), + new GLproperty(GL11.GL_SCISSOR_TEST, "GL_SCISSOR_TEST", "Scissoring enabled", "scissor/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_SCISSOR_BOX, "GL_SCISSOR_BOX", "Scissor box", "scissor", "glGetIntegerv()"), + new GLproperty(GL11.GL_ALPHA_TEST, "GL_ALPHA_TEST", "Alpha test enabled", "color-buffer/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_ALPHA_TEST_FUNC, "GL_ALPHA_TEST_FUNC", "Alpha test function", "color-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_ALPHA_TEST_REF, "GL_ALPHA_TEST_REF", "Alpha test reference value", "color-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_TEST, "GL_STENCIL_TEST", "Stenciling enabled", "stencil-buffer/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_STENCIL_FUNC, "GL_STENCIL_FUNC", "Stencil function", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_VALUE_MASK, "GL_STENCIL_VALUE_MASK", "Stencil mask", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_REF, "GL_STENCIL_REF", "Stencil reference value", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_FAIL, "GL_STENCIL_FAIL", "Stencil fail action", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_PASS_DEPTH_FAIL, "GL_STENCIL_PASS_DEPTH_FAIL", "Stencil depth buffer fail action", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_PASS_DEPTH_PASS, "GL_STENCIL_PASS_DEPTH_PASS", "Stencil depth buffer pass action", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_DEPTH_TEST, "GL_DEPTH_TEST", "Depth buffer enabled", "depth-buffer/ena ble", "glIsEnabled()"), + new GLproperty(GL11.GL_DEPTH_FUNC, "GL_DEPTH_FUNC", "Depth buffer test function", "depth-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_BLEND, "GL_BLEND", "Blending enabled", "color-buffer/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_BLEND_SRC, "GL_BLEND_SRC", "Blending source function", "color-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_BLEND_DST, "GL_BLEND_DST", "Blending destination function", "color-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_DITHER, "GL_DITHER", "Dithering enabled", "color-buffer/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_INDEX_LOGIC_OP, "GL_INDEX_LOGIC_OP", "Color index logical operation enabled", "color-buffer/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_COLOR_LOGIC_OP, "GL_COLOR_LOGIC_OP", "RGBA color logical operation enabled", "color-buffer/enable", "glIsEnabled()"), + new GLproperty(GL11.GL_LOGIC_OP_MODE, "GL_LOGIC_OP_MODE", "Logical operation function", "color-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_DRAW_BUFFER, "GL_DRAW_BUFFER", "Buffers selected for drawing", "color-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_INDEX_WRITEMASK, "GL_INDEX_WRITEMASK", "Color-index writemask", "color-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_COLOR_WRITEMASK, "GL_COLOR_WRITEMASK", "Color write enables; R, G, B, or A", "color-buffer", "glGetBooleanv()"), + new GLproperty(GL11.GL_DEPTH_WRITEMASK, "GL_DEPTH_WRITEMASK", "Depth buffer enabled for writing", "depth-buffer", "glGetBooleanv()"), + new GLproperty(GL11.GL_STENCIL_WRITEMASK, "GL_STENCIL_WRITEMASK", "Stencil-buffer writemask", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_COLOR_CLEAR_VALUE, "GL_COLOR_CLEAR_VALUE", "Color-buffer clear value (RGBA mode)", "color-buffer", "glGetFloatv()"), + new GLproperty(GL11.GL_INDEX_CLEAR_VALUE, "GL_INDEX_CLEAR_VALUE", "Color-buffer clear value (color-index mode)", "color-buffer", "glGetFloatv()"), + new GLproperty(GL11.GL_DEPTH_CLEAR_VALUE, "GL_DEPTH_CLEAR_VALUE", "Depth-buffer clear value", "depth-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_CLEAR_VALUE, "GL_STENCIL_CLEAR_VALUE", "Stencil-buffer clear value", "stencil-buffer", "glGetIntegerv()"), + new GLproperty(GL11.GL_ACCUM_CLEAR_VALUE, "GL_ACCUM_CLEAR_VALUE", "Accumulation-buffer clear value", "accum-buffer", "glGetFloatv()"), + new GLproperty(GL11.GL_UNPACK_SWAP_BYTES, "GL_UNPACK_SWAP_BYTES", "Value of GL_UNPACK_SWAP_BYTES", "pixel-store", "glGetBooleanv()"), + new GLproperty(GL11.GL_UNPACK_LSB_FIRST, "GL_UNPACK_LSB_FIRST", "Value of GL_UNPACK_LSB_FIRST", "pixel-store", "glGetBooleanv()"), + new GLproperty(GL11.GL_UNPACK_ROW_LENGTH, "GL_UNPACK_ROW_LENGTH", "Value of GL_UNPACK_ROW_LENGTH", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_UNPACK_SKIP_ROWS, "GL_UNPACK_SKIP_ROWS", "Value of GL_UNPACK_SKIP_ROWS", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_UNPACK_SKIP_PIXELS, "GL_UNPACK_SKIP_PIXELS", "Value of GL_UNPACK_SKIP_PIXELS", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_UNPACK_ALIGNMENT, "GL_UNPACK_ALIGNMENT", "Value of GL_UNPACK_ALIGNMENT", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_PACK_SWAP_BYTES, "GL_PACK_SWAP_BYTES", "Value of GL_PACK_SWAP_BYTES", "pixel-store", "glGetBooleanv()"), + new GLproperty(GL11.GL_PACK_LSB_FIRST, "GL_PACK_LSB_FIRST", "Value of GL_PACK_LSB_FIRST", "pixel-store", "glGetBooleanv()"), + new GLproperty(GL11.GL_PACK_ROW_LENGTH, "GL_PACK_ROW_LENGTH", "Value of GL_PACK_ROW_LENGTH", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_PACK_SKIP_ROWS, "GL_PACK_SKIP_ROWS", "Value of GL_PACK_SKIP_ROWS", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_PACK_SKIP_PIXELS, "GL_PACK_SKIP_PIXELS", "Value of GL_PACK_SKIP_PIXELS", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_PACK_ALIGNMENT, "GL_PACK_ALIGNMENT", "Value of GL_PACK_ALIGNMENT", "pixel-store", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAP_COLOR, "GL_MAP_COLOR", "True if colors are mapped", "pixel", "glGetBooleanv()"), + new GLproperty(GL11.GL_MAP_STENCIL, "GL_MAP_STENCIL", "True if stencil values are mapped", "pixel", "glGetBooleanv()"), + new GLproperty(GL11.GL_INDEX_SHIFT, "GL_INDEX_SHIFT", "Value of GL_INDEX_SHIFT", "pixel", "glGetIntegerv()"), + new GLproperty(GL11.GL_INDEX_OFFSET, "GL_INDEX_OFFSET", "Value of GL_INDEX_OFFSET", "pixel", "glGetIntegerv()"), + new GLproperty(GL11.GL_ZOOM_X, "GL_ZOOM_X", "x zoom factor", "pixel", "glGetFloatv()"), + new GLproperty(GL11.GL_ZOOM_Y, "GL_ZOOM_Y", "y zoom factor", "pixel", "glGetFloatv()"), + new GLproperty(GL11.GL_READ_BUFFER, "GL_READ_BUFFER", "Read source buffer", "pixel", "glGetIntegerv()"), + new GLproperty(GL11.GL_ORDER, "GL_ORDER", "1D map order", "capability", "glGetMapiv()"), + new GLproperty(GL11.GL_ORDER, "GL_ORDER", "2D map orders", "capability", "glGetMapiv()"), + new GLproperty(GL11.GL_COEFF, "GL_COEFF", "1D control points", "capability", "glGetMapfv()"), + new GLproperty(GL11.GL_COEFF, "GL_COEFF", "2D control points", "capability", "glGetMapfv()"), + new GLproperty(GL11.GL_DOMAIN, "GL_DOMAIN", "1D domain endpoints", "capability", "glGetMapfv()"), + new GLproperty(GL11.GL_DOMAIN, "GL_DOMAIN", "2D domain endpoints", "capability", "glGetMapfv()"), + new GLproperty(GL11.GL_MAP1_GRID_DOMAIN, "GL_MAP1_GRID_DOMAIN", "1D grid endpoints", "eval", "glGetFloatv()"), + new GLproperty(GL11.GL_MAP2_GRID_DOMAIN, "GL_MAP2_GRID_DOMAIN", "2D grid endpoints", "eval", "glGetFloatv()"), + new GLproperty(GL11.GL_MAP1_GRID_SEGMENTS, "GL_MAP1_GRID_SEGMENTS", "1D grid divisions", "eval", "glGetFloatv()"), + new GLproperty(GL11.GL_MAP2_GRID_SEGMENTS, "GL_MAP2_GRID_SEGMENTS", "2D grid divisions", "eval", "glGetFloatv()"), + new GLproperty(GL11.GL_AUTO_NORMAL, "GL_AUTO_NORMAL", "True if automatic normal generation enabled", "eval", "glIsEnabled()"), + new GLproperty(GL11.GL_PERSPECTIVE_CORRECTION_HINT, "GL_PERSPECTIVE_CORRECTION_HINT", "Perspective correction hint", "hint", "glGetIntegerv()"), + new GLproperty(GL11.GL_POINT_SMOOTH_HINT, "GL_POINT_SMOOTH_HINT", "Point smooth hint", "hint", "glGetIntegerv()"), + new GLproperty(GL11.GL_LINE_SMOOTH_HINT, "GL_LINE_SMOOTH_HINT", "Line smooth hint", "hint", "glGetIntegerv()"), + new GLproperty(GL11.GL_POLYGON_SMOOTH_HINT, "GL_POLYGON_SMOOTH_HINT", "Polygon smooth hint", "hint", "glGetIntegerv()"), + new GLproperty(GL11.GL_FOG_HINT, "GL_FOG_HINT", "Fog hint", "hint", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_LIGHTS, "GL_MAX_LIGHTS", "Maximum number of lights", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_CLIP_PLANES, "GL_MAX_CLIP_PLANES", "Maximum number of user clipping planes", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_MODELVIEW_STACK_DEPTH, "GL_MAX_MODELVIEW_STACK_DEPTH", "Maximum modelview-matrix stack depth", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_PROJECTION_STACK_DEPTH, "GL_MAX_PROJECTION_STACK_DEPTH", "Maximum projection-matrix stack depth", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_TEXTURE_STACK_DEPTH, "GL_MAX_TEXTURE_STACK_DEPTH", "Maximum depth of texture matrix stack", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_SUBPIXEL_BITS, "GL_SUBPIXEL_BITS", "Number of bits of subpixel precision in x and y", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_TEXTURE_SIZE, "GL_MAX_TEXTURE_SIZE", "See discussion in Texture Proxy in Chapter 9", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_PIXEL_MAP_TABLE, "GL_MAX_PIXEL_MAP_TABLE", "Maximum size of a glPixelMap() translation table", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_NAME_STACK_DEPTH, "GL_MAX_NAME_STACK_DEPTH", "Maximum selection-name stack depth", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_LIST_NESTING, "GL_MAX_LIST_NESTING", "Maximum display-list call nesting", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_EVAL_ORDER, "GL_MAX_EVAL_ORDER", "Maximum evaluator polynomial order", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_VIEWPORT_DIMS, "GL_MAX_VIEWPORT_DIMS", "Maximum viewport dimensions", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_ATTRIB_STACK_DEPTH, "GL_MAX_ATTRIB_STACK_DEPTH", "Maximum depth of the attribute stack", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", "Maximum depth of the client attribute stack", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_AUX_BUFFERS, "GL_AUX_BUFFERS", "Number of auxiliary buffers", "capability", "glGetBooleanv()"), + new GLproperty(GL11.GL_RGBA_MODE, "GL_RGBA_MODE", "True if color buffers store RGBA", "capability", "glGetBooleanv()"), + new GLproperty(GL11.GL_INDEX_MODE, "GL_INDEX_MODE", "True if color buffers store indices", "capability", "glGetBooleanv()"), + new GLproperty(GL11.GL_DOUBLEBUFFER, "GL_DOUBLEBUFFER", "True if front and back buffers exist", "capability", "glGetBooleanv()"), + new GLproperty(GL11.GL_STEREO, "GL_STEREO", "True if left and right buffers exist", "capability", "glGetBooleanv()"), + new GLproperty(GL11.GL_POINT_SIZE_RANGE, "GL_POINT_SIZE_RANGE", "Range (low to high) of antialiased point sizes", "capability", "glGetFloatv()"), + new GLproperty(GL11.GL_POINT_SIZE_GRANULARITY, "GL_POINT_SIZE_GRANULARITY", "Antialiased point-size granularity", "capability", "glGetFloatv()"), + new GLproperty(GL11.GL_LINE_WIDTH_RANGE, "GL_LINE_WIDTH_RANGE", "Range (low to high) of antialiased line widths", "capability", "glGetFloatv()"), + new GLproperty(GL11.GL_LINE_WIDTH_GRANULARITY, "GL_LINE_WIDTH_GRANULARITY", "Antialiased line-width granularity", "capability", "glGetFloatv()"), + new GLproperty(GL11.GL_RED_BITS, "GL_RED_BITS", "Number of bits per red component in color buffers", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_GREEN_BITS, "GL_GREEN_BITS", "Number of bits per green component in color buffers", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_BLUE_BITS, "GL_BLUE_BITS", "Number of bits per blue component in color buffers", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_ALPHA_BITS, "GL_ALPHA_BITS", "Number of bits per alpha component in color buffers", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_INDEX_BITS, "GL_INDEX_BITS", "Number of bits per index in color buffers", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_DEPTH_BITS, "GL_DEPTH_BITS", "Number of depth-buffer bitplanes", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_STENCIL_BITS, "GL_STENCIL_BITS", "Number of stencil bitplanes", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_ACCUM_RED_BITS, "GL_ACCUM_RED_BITS", "Number of bits per red component in the accumulation buffer", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_ACCUM_GREEN_BITS, "GL_ACCUM_GREEN_BITS", "Number of bits per green component in the accumulation buffer", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_ACCUM_BLUE_BITS, "GL_ACCUM_BLUE_BITS", "Number of bits per blue component in the accumulation buffer", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_ACCUM_ALPHA_BITS, "GL_ACCUM_ALPHA_BITS", "Number of bits per alpha component in the accumulation buffer", "capability", "glGetIntegerv()"), + new GLproperty(GL11.GL_LIST_BASE, "GL_LIST_BASE", "Setting of glListBase()", "list", "glGetIntegerv()"), + new GLproperty(GL11.GL_LIST_INDEX, "GL_LIST_INDEX", "Number of display list under construction; 0 if none", "current", "glGetIntegerv()"), + new GLproperty(GL11.GL_LIST_MODE, "GL_LIST_MODE", "Mode of display list under construction; undefined if none", "current", "glGetIntegerv()"), + new GLproperty(GL11.GL_ATTRIB_STACK_DEPTH, "GL_ATTRIB_STACK_DEPTH", "Attribute stack pointer", "current", "glGetIntegerv()"), + new GLproperty(GL11.GL_CLIENT_ATTRIB_STACK_DEPTH, "GL_CLIENT_ATTRIB_STACK_DEPTH", "Client attribute stack pointer", "current", "glGetIntegerv()"), + new GLproperty(GL11.GL_NAME_STACK_DEPTH, "GL_NAME_STACK_DEPTH", "Name stack depth", "current", "glGetIntegerv()"), + new GLproperty(GL11.GL_RENDER_MODE, "GL_RENDER_MODE", "glRenderMode() setting", "current", "glGetIntegerv()"), + new GLproperty(GL11.GL_SELECTION_BUFFER_POINTER, "GL_SELECTION_BUFFER_POINTER", "Pointer to selection buffer", "select", "glGetPointerv()"), + new GLproperty(GL11.GL_SELECTION_BUFFER_SIZE, "GL_SELECTION_BUFFER_SIZE", "Size of selection buffer", "select", "glGetIntegerv()"), + new GLproperty(GL11.GL_FEEDBACK_BUFFER_POINTER, "GL_FEEDBACK_BUFFER_POINTER", "Pointer to feedback buffer", "feedback", "glGetPointerv()"), + new GLproperty(GL11.GL_FEEDBACK_BUFFER_SIZE, "GL_FEEDBACK_BUFFER_SIZE", "Size of feedback buffer", "feedback", "glGetIntegerv()"), + new GLproperty(GL11.GL_FEEDBACK_BUFFER_TYPE, "GL_FEEDBACK_BUFFER_TYPE", "Type of feedback buffer", "feedback", "glGetIntegerv()"), + }; - public static void dumpOpenGLstate() - { - } + public static void dumpOpenGLstate() + { + } - public static void dumpAllIsEnabled() //Call This - { - for (int i = 0; i < instance.propertyList.length; ++i) + public static void dumpAllIsEnabled() //Call This + { + for (int i = 0; i < instance.propertyList.length; ++i) - { - if (instance.propertyList[i].fetchCommand == "glIsEnabled()") + { + if (instance.propertyList[i].fetchCommand == "glIsEnabled()") - { - System.out.print(instance.propertyList[i].name + ":"); - System.out.print(GL11.glIsEnabled(instance.propertyList[i].gLconstant)); - System.out.println(" (" + instance.propertyList[i].description + ")"); - } - } - } + { + System.out.print(instance.propertyList[i].name + ":"); + System.out.print(GL11.glIsEnabled(instance.propertyList[i].gLconstant)); + System.out.println(" (" + instance.propertyList[i].description + ")"); + } + } + } - public static void dumpAllType(String type) + public static void dumpAllType(final String type) - { - for (int i = 0; i < instance.propertyList.length; ++i) + { + for (int i = 0; i < instance.propertyList.length; ++i) - { - if (instance.propertyList[i].category.equals(type)) + { + if (instance.propertyList[i].category.equals(type)) - { - System.out.print(instance.propertyList[i].name + ":"); - System.out.println(getPropertyAsString(i)); - System.out.println(" (" + instance.propertyList[i].description + ")"); - } - } - } + { + System.out.print(instance.propertyList[i].name + ":"); + System.out.println(getPropertyAsString(i)); + System.out.println(" (" + instance.propertyList[i].description + ")"); + } + } + } - private static String getPropertyAsString(int propertyListIndex) - { - int gLconstant = instance.propertyList[propertyListIndex].gLconstant; - if (instance.propertyList[propertyListIndex].fetchCommand.equals("glIsEnabled()")) { - return "" + GL11.glIsEnabled(gLconstant); - } + private static String getPropertyAsString(final int propertyListIndex) + { + final int gLconstant = instance.propertyList[propertyListIndex].gLconstant; + if (instance.propertyList[propertyListIndex].fetchCommand.equals("glIsEnabled()")) { + return "" + GL11.glIsEnabled(gLconstant); + } - if (instance.propertyList[propertyListIndex].fetchCommand == "glGetBooleanv()") + if (instance.propertyList[propertyListIndex].fetchCommand == "glGetBooleanv()") - { - ByteBuffer params = BufferUtils.createByteBuffer(16); + { + final ByteBuffer params = BufferUtils.createByteBuffer(16); - GL11.glGetBoolean(gLconstant, params); - String out = ""; - for (int i = 0; i < params.capacity(); ++i) + GL11.glGetBoolean(gLconstant, params); + String out = ""; + for (int i = 0; i < params.capacity(); ++i) - { - out += (i == 0 ? "" : ", ") + params.get(i); - } - return out; - } + { + out += (i == 0 ? "" : ", ") + params.get(i); + } + return out; + } - return ""; - } + return ""; + } } diff --git a/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java b/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java index 4749a103d1..e5c52939ac 100644 --- a/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java +++ b/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.util.entity; +import cpw.mods.fml.common.registry.EntityRegistry; import ic2.core.IC2Potion; import ic2.core.item.armor.ItemArmorHazmat; import net.minecraft.block.Block; @@ -7,43 +8,42 @@ import net.minecraft.entity.*; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; -import cpw.mods.fml.common.registry.EntityRegistry; public class EntityUtils { - public static void setEntityOnFire(Entity entity, int length){ + public static void setEntityOnFire(final Entity entity, final int length){ entity.setFire(length); } - public static int getFacingDirection(Entity entity){ - int d = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360) + 0.50) & 3; + public static int getFacingDirection(final Entity entity){ + final int d = MathHelper.floor_double((entity.rotationYaw * 4.0F) / 360 + 0.50) & 3; return d; } @Deprecated - public static Block findBlockUnderEntityNonBoundingBox(Entity parEntity){ - int blockX = MathHelper.floor_double(parEntity.posX); - int blockY = MathHelper.floor_double(parEntity.posY-0.2D - (double)parEntity.yOffset); - int blockZ = MathHelper.floor_double(parEntity.posZ); + public static Block findBlockUnderEntityNonBoundingBox(final Entity parEntity){ + final int blockX = MathHelper.floor_double(parEntity.posX); + final int blockY = MathHelper.floor_double(parEntity.posY-0.2D - parEntity.yOffset); + final int blockZ = MathHelper.floor_double(parEntity.posZ); return parEntity.worldObj.getBlock(blockX, blockY, blockZ); } - public static Block findBlockUnderEntity(Entity parEntity){ - int blockX = MathHelper.floor_double(parEntity.posX); - int blockY = MathHelper.floor_double(parEntity.boundingBox.minY)-1; - int blockZ = MathHelper.floor_double(parEntity.posZ); + public static Block findBlockUnderEntity(final Entity parEntity){ + final int blockX = MathHelper.floor_double(parEntity.posX); + final int blockY = MathHelper.floor_double(parEntity.boundingBox.minY)-1; + final int blockZ = MathHelper.floor_double(parEntity.posZ); return parEntity.worldObj.getBlock(blockX, blockY, blockZ); } //TODO - public static void registerEntityToBiomeSpawns(Class<EntityLiving> classy, EnumCreatureType EntityType, BiomeGenBase baseBiomeGen){ - EntityRegistry.addSpawn(classy, 6, 1, 5, EntityType, baseBiomeGen); //change the values to vary the spawn rarity, biome, etc. + public static void registerEntityToBiomeSpawns(final Class<EntityLiving> classy, final EnumCreatureType EntityType, final BiomeGenBase baseBiomeGen){ + EntityRegistry.addSpawn(classy, 6, 1, 5, EntityType, baseBiomeGen); //change the values to vary the spawn rarity, biome, etc. } - public static boolean applyRadiationDamageToEntity(int damage, World world, Entity entityHolding){ - if (!world.isRemote){ - if (damage > 0 && (entityHolding instanceof EntityLivingBase)) { - EntityLivingBase entityLiving = (EntityLivingBase) entityHolding; + public static boolean applyRadiationDamageToEntity(final int damage, final World world, final Entity entityHolding){ + if (!world.isRemote){ + if ((damage > 0) && (entityHolding instanceof EntityLivingBase)) { + final EntityLivingBase entityLiving = (EntityLivingBase) entityHolding; if (!ItemArmorHazmat.hasCompleteHazmat(entityLiving)) { int duration; if (entityLiving.getActivePotionEffect(IC2Potion.radiation) != null){ @@ -53,13 +53,13 @@ public class EntityUtils { else { //Utils.LOG_INFO("f"); duration = damage*30; - } + } IC2Potion.radiation.applyTo(entityLiving, duration, damage * 15); } } return true; } - return false; + return false; } } diff --git a/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java b/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java index 5674082c4a..b09c9dd795 100644 --- a/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java +++ b/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java @@ -6,25 +6,25 @@ import net.minecraftforge.fluids.Fluid; public class FluidGT6 extends Fluid implements Runnable { - private final short[] mRGBa; - public final String mTextureName; - - public FluidGT6(final String aName, final String aTextureName, final short[] aRGBa) { - super(aName); - this.mRGBa = aRGBa; - this.mTextureName = aTextureName; - if (GregTech_API.sGTBlockIconload != null) { - GregTech_API.sGTBlockIconload.add(this); - } - } - - @Override + private final short[] mRGBa; + public final String mTextureName; + + public FluidGT6(final String aName, final String aTextureName, final short[] aRGBa) { + super(aName); + this.mRGBa = aRGBa; + this.mTextureName = aTextureName; + if (GregTech_API.sGTBlockIconload != null) { + GregTech_API.sGTBlockIconload.add(this); + } + } + + @Override public int getColor() { - return Math.max(0, Math.min(255, this.mRGBa[0])) << 16 | Math.max(0, Math.min(255, this.mRGBa[1])) << 8 | Math.max(0, Math.min(255, this.mRGBa[2])); - } - - @Override + return (Math.max(0, Math.min(255, this.mRGBa[0])) << 16) | (Math.max(0, Math.min(255, this.mRGBa[1])) << 8) | Math.max(0, Math.min(255, this.mRGBa[2])); + } + + @Override public void run() { - this.setIcons(GregTech_API.sBlockIcons.registerIcon(CORE.MODID+ ":" + "fluids/fluid." + mTextureName)); - } + this.setIcons(GregTech_API.sBlockIcons.registerIcon(CORE.MODID+ ":" + "fluids/fluid." + this.mTextureName)); + } } diff --git a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java index 8163648c41..882f3f1eb4 100644 --- a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java +++ b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java @@ -17,56 +17,56 @@ import net.minecraftforge.fluids.*; public class FluidUtils { - public static FluidStack getFluidStack(String fluidName, int amount){ + public static FluidStack getFluidStack(final String fluidName, final int amount){ Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName); try { return FluidRegistry.getFluidStack(fluidName, amount).copy(); - } - catch (Throwable e){ + } + catch (final Throwable e){ return null; } } - public static FluidStack getFluidStack(FluidStack vmoltenFluid, int fluidAmount) { + public static FluidStack getFluidStack(final FluidStack vmoltenFluid, final int fluidAmount) { Utils.LOG_WARNING("Trying to get a fluid stack of "+vmoltenFluid.getFluid().getName()); try { return FluidRegistry.getFluidStack(vmoltenFluid.getFluid().getName(), fluidAmount).copy(); - } - catch (Throwable e){ + } + catch (final Throwable e){ return null; } } - public static FluidStack getFluidStack(Fluid vFluid, int fluidAmount) { + public static FluidStack getFluidStack(final Fluid vFluid, final int fluidAmount) { Utils.LOG_WARNING("Trying to get a fluid stack of "+vFluid.getName()); try { return FluidRegistry.getFluidStack(vFluid.getName(), fluidAmount).copy(); - } - catch (Throwable e){ + } + catch (final Throwable e){ return null; } } - public static FluidStack[] getFluidStackArray(String fluidName, int amount){ + public static FluidStack[] getFluidStackArray(final String fluidName, final int amount){ Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName); try { - FluidStack[] singleFluid = {FluidRegistry.getFluidStack(fluidName, amount)}; + final FluidStack[] singleFluid = {FluidRegistry.getFluidStack(fluidName, amount)}; return singleFluid; - } - catch (Throwable e){ + } + catch (final Throwable e){ return null; } } - public static FluidStack[] getFluidStackArray(FluidStack fluidName, int amount){ + public static FluidStack[] getFluidStackArray(final FluidStack fluidName, final int amount){ Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName); try { - FluidStack[] singleFluid = {FluidRegistry.getFluidStack(fluidName.getLocalizedName(), amount)}; + final FluidStack[] singleFluid = {FluidRegistry.getFluidStack(fluidName.getLocalizedName(), amount)}; return singleFluid; - } - catch (Throwable e){ + } + catch (final Throwable e){ return null; } @@ -80,10 +80,10 @@ public class FluidUtils { * @param short[] rgba * @param byte state * States: 0 (Solid), 1 (Fluid), 2(Gas), 3(Plasma) 4(Fuel I think? Don't use.) - * + * * @return short[] */ - public static Fluid generateFluid(String displayName, String fluidName, int tempK, short[] rgba ,int aState){ + public static Fluid generateFluid(final String displayName, final String fluidName, final int tempK, final short[] rgba ,final int aState){ Fluid generatedFluid = null; switch (aState) { case 0: { @@ -108,17 +108,17 @@ public class FluidUtils { return generatedFluid; } /** - * + * * @param String fluidName * @param int meltingPointC Temp * @param short[] rgba * @param byte state * States: 0 (Solid), 1 (Fluid), 2(Gas), 3(Plasma) 4(Fuel I think? Don't use.) - * + * * @return short[] */ - public static Fluid generateFluid(Material material ,int aState){ - int tempK = material.getMeltingPointC(); + public static Fluid generateFluid(final Material material ,final int aState){ + final int tempK = material.getMeltingPointC(); Fluid generatedFluid = null; switch (aState) { case 0: { @@ -144,9 +144,9 @@ public class FluidUtils { } - public static Fluid addAutogeneratedMoltenFluid(String materialNameFormatted, short[] rgba, int MeltingPoint) { + public static Fluid addAutogeneratedMoltenFluid(final String materialNameFormatted, final short[] rgba, final int MeltingPoint) { return addFluid("molten." + materialNameFormatted.toLowerCase(), "molten.autogenerated", "Molten " + materialNameFormatted, null, rgba, 1, (MeltingPoint <= 0L) ? 1000L : MeltingPoint, null, null, 0); - } + } public static Fluid addAutogeneratedMoltenFluid(final GT_Materials aMaterial) { return addFluid("molten." + aMaterial.name().toLowerCase(), "molten.autogenerated", "Molten " + aMaterial.name(), aMaterial, aMaterial.mMoltenRGBa, 1, (aMaterial.mMeltingPoint <= 0L) ? 1000L : aMaterial.mMeltingPoint, null, null, 0); @@ -195,7 +195,7 @@ public class FluidUtils { else { rFluid = FluidRegistry.getFluid(aName); } - if (rFluid.getTemperature() == new Fluid("test").getTemperature() || rFluid.getTemperature() <= 0) { + if ((rFluid.getTemperature() == new Fluid("test").getTemperature()) || (rFluid.getTemperature() <= 0)) { rFluid.setTemperature((int) (aTemperatureK)); } if (aMaterial != null) { @@ -214,7 +214,7 @@ public class FluidUtils { } } } - if (aFullContainer != null && aEmptyContainer != null && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { + if ((aFullContainer != null) && (aEmptyContainer != null) && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { GT_Values.RA.addFluidCannerRecipe(aFullContainer, container(aFullContainer, false), null, new FluidStack(rFluid, aFluidAmount)); } return rFluid; @@ -223,48 +223,48 @@ public class FluidUtils { public static Fluid addGTFluid(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { return addGTFluid("molten."+aName, "molten.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount); } - + public static Fluid addGTFluidNonMolten(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { return addGTFluid("fluid."+aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount); } - - public static Fluid addGTPlasma(Material aMaterial) { - if (aMaterial.getLocalizedName().toLowerCase().contains("clay")){ - return null; - } - Utils.LOG_INFO("Generating a "+aMaterial.getLocalizedName()+" Plasma Cell"); - if (aMaterial.vComponentCount != 1){ - Utils.LOG_INFO("Compound made from: "); - for (MaterialStack x : aMaterial.getComposites()){ - Utils.LOG_INFO(x.getStackMaterial().getLocalizedName()); - } - Utils.LOG_INFO("Material is a composite, not generating plasma."); - return null; - } - - ItemStack temp = null; - //Generate a Cell if we need to - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+aMaterial.getUnlocalizedName(), 1) == null){ - Item temp2 = new BaseItemPlasmaCell(aMaterial); - temp = aMaterial.getPlasmaCell(1); - } - else { - temp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+aMaterial.getUnlocalizedName(), 1); - } - if (temp != null){ - return addGTFluid( - "plasma." + Utils.sanitizeString(aMaterial.getLocalizedName().toLowerCase()), - "plasma.autogenerated", - aMaterial.getLocalizedName() + " Plasma", - aMaterial.getRGBA(), - 3, - 10000, - temp, - ItemList.Cell_Empty.get(1L, new Object[0]), - 1000); + + public static Fluid addGTPlasma(final Material aMaterial) { + if (aMaterial.getLocalizedName().toLowerCase().contains("clay")){ + return null; + } + Utils.LOG_INFO("Generating a "+aMaterial.getLocalizedName()+" Plasma Cell"); + if (aMaterial.vComponentCount != 1){ + Utils.LOG_INFO("Compound made from: "); + for (final MaterialStack x : aMaterial.getComposites()){ + Utils.LOG_INFO(x.getStackMaterial().getLocalizedName()); } + Utils.LOG_INFO("Material is a composite, not generating plasma."); return null; - } + } + + ItemStack temp = null; + //Generate a Cell if we need to + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+aMaterial.getUnlocalizedName(), 1) == null){ + final Item temp2 = new BaseItemPlasmaCell(aMaterial); + temp = aMaterial.getPlasmaCell(1); + } + else { + temp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+aMaterial.getUnlocalizedName(), 1); + } + if (temp != null){ + return addGTFluid( + "plasma." + Utils.sanitizeString(aMaterial.getLocalizedName().toLowerCase()), + "plasma.autogenerated", + aMaterial.getLocalizedName() + " Plasma", + aMaterial.getRGBA(), + 3, + 10000, + temp, + ItemList.Cell_Empty.get(1L, new Object[0]), + 1000); + } + return null; + } public static Fluid addGTFluid(String aName, final String aTexture, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { aName = Utils.sanitizeString(aName.toLowerCase()); @@ -301,21 +301,21 @@ public class FluidUtils { else { rFluid = FluidRegistry.getFluid(aName); } - if (rFluid.getTemperature() == new Fluid("test").getTemperature() || rFluid.getTemperature() <= 0) { + if ((rFluid.getTemperature() == new Fluid("test").getTemperature()) || (rFluid.getTemperature() <= 0)) { rFluid.setTemperature((int) (aTemperatureK)); - } - if (aFullContainer != null && aEmptyContainer != null && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { + } + if ((aFullContainer != null) && (aEmptyContainer != null) && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { GT_Values.RA.addFluidCannerRecipe(aFullContainer, container(aFullContainer, false), null, new FluidStack(rFluid, aFluidAmount)); } return rFluid; } public static boolean valid(final Object aStack) { - return aStack != null && aStack instanceof ItemStack && ((ItemStack)aStack).getItem() != null && ((ItemStack)aStack).stackSize >= 0; + return (aStack != null) && (aStack instanceof ItemStack) && (((ItemStack)aStack).getItem() != null) && (((ItemStack)aStack).stackSize >= 0); } public static boolean invalid(final Object aStack) { - return aStack == null || !(aStack instanceof ItemStack) || ((ItemStack)aStack).getItem() == null || ((ItemStack)aStack).stackSize < 0; + return (aStack == null) || !(aStack instanceof ItemStack) || (((ItemStack)aStack).getItem() == null) || (((ItemStack)aStack).stackSize < 0); } public static boolean equal(final ItemStack aStack1, final ItemStack aStack2) { @@ -323,11 +323,11 @@ public class FluidUtils { } public static boolean equal(final ItemStack aStack1, final ItemStack aStack2, final boolean aIgnoreNBT) { - return aStack1 != null && aStack2 != null && equal_(aStack1, aStack2, aIgnoreNBT); + return (aStack1 != null) && (aStack2 != null) && equal_(aStack1, aStack2, aIgnoreNBT); } public static boolean equal_(final ItemStack aStack1, final ItemStack aStack2, final boolean aIgnoreNBT) { - return aStack1.getItem() == aStack2.getItem() && (aIgnoreNBT || (aStack1.getTagCompound() == null == (aStack2.getTagCompound() == null) && (aStack1.getTagCompound() == null || aStack1.getTagCompound().equals((Object)aStack2.getTagCompound())))) && (meta(aStack1) == meta(aStack2) || meta(aStack1) == 32767 || meta(aStack2) == 32767); + return (aStack1.getItem() == aStack2.getItem()) && (aIgnoreNBT || ((aStack1.getTagCompound() == null == (aStack2.getTagCompound() == null)) && ((aStack1.getTagCompound() == null) || aStack1.getTagCompound().equals(aStack2.getTagCompound())))) && ((meta(aStack1) == meta(aStack2)) || (meta(aStack1) == 32767) || (meta(aStack2) == 32767)); } public static ItemStack copy(final Object... aStacks) { @@ -352,7 +352,7 @@ public class FluidUtils { } public static ItemStack meta(final ItemStack aStack, final long aMeta) { - Items.feather.setDamage(aStack, (int)(short)aMeta); + Items.feather.setDamage(aStack, (short)aMeta); return aStack; } @@ -375,7 +375,7 @@ public class FluidUtils { if (equal(aStack, ItemList.Cell_Empty.get(1), true)) { return null; } - if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem)aStack.getItem()).getCapacity(aStack) > 0) { + if (aCheckIFluidContainerItems && (aStack.getItem() instanceof IFluidContainerItem) && (((IFluidContainerItem)aStack.getItem()).getCapacity(aStack) > 0)) { final ItemStack tStack = amount(1L, aStack); ((IFluidContainerItem)aStack.getItem()).drain(tStack, Integer.MAX_VALUE, true); if (!equal(aStack, tStack)) { @@ -391,21 +391,22 @@ public class FluidUtils { public static ItemStack container(final ItemStack aStack, final boolean aCheckIFluidContainerItems, final int aStacksize) { return amount(aStacksize, container(aStack, aCheckIFluidContainerItems)); - } + } - public final static Fluid generateFluid(String unlocalizedName, String localizedName, int MeltingPoint, short[] RGBA){ - if (FluidUtils.getFluidStack("molten"+"."+unlocalizedName.toLowerCase(), 1) == null && ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+Utils.sanitizeString(localizedName), 1) != null){ + public final static Fluid generateFluid(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA){ + if ((FluidUtils.getFluidStack("molten"+"."+unlocalizedName.toLowerCase(), 1) == null) && (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+Utils.sanitizeString(localizedName), 1) != null)){ Utils.LOG_WARNING("Generating our own fluid."); //Generate a Cell if we need to if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ @SuppressWarnings("unused") + final Item temp = new BaseItemComponent(unlocalizedName, localizedName, RGBA); } - Fluid gtFluid = FluidUtils.addGTFluid( + final Fluid gtFluid = FluidUtils.addGTFluid( unlocalizedName, - "Molten "+localizedName, + "Molten "+localizedName, RGBA, 4, MeltingPoint, @@ -427,22 +428,23 @@ public class FluidUtils { return null; } - public final static Fluid generateFluidNonMolten(String unlocalizedName, String localizedName, int MeltingPoint, short[] RGBA, ItemStack dustStack, ItemStack dustStack2){ + public final static Fluid generateFluidNonMolten(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA, ItemStack dustStack, final ItemStack dustStack2){ if (dustStack == null){ dustStack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+Utils.sanitizeString(localizedName), 1); - } - if (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null && (dustStack != null || dustStack2 != null)){ + } + if ((FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null) && ((dustStack != null) || (dustStack2 != null))){ Utils.LOG_WARNING("Generating our own fluid."); //Generate a Cell if we need to if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ @SuppressWarnings("unused") + final Item temp = new BaseItemComponent(unlocalizedName, localizedName, RGBA); } - Fluid gtFluid = FluidUtils.addGTFluidNonMolten( + final Fluid gtFluid = FluidUtils.addGTFluidNonMolten( unlocalizedName, - localizedName, + localizedName, RGBA, 4, MeltingPoint, diff --git a/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java b/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java index b10e643831..0c98751398 100644 --- a/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java +++ b/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java @@ -1,11 +1,10 @@ package gtPlusPlus.core.util.gregtech.recipehandlers; +import java.lang.reflect.Method; + import gregtech.api.util.GT_ModHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; - -import java.lang.reflect.Method; - import net.minecraft.item.ItemStack; public final class GregtechRecipe { @@ -15,21 +14,21 @@ public final class GregtechRecipe { Utils.LOG_INFO("Initializing a recipe handler for different versions of Gregtech 5."); try { if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - this.ourProxy = new LibProxy1(); - Utils.LOG_INFO("Selecting GT 5.7/5.8 Recipe Set"); + this.ourProxy = new LibProxy1(); + Utils.LOG_INFO("Selecting GT 5.7/5.8 Recipe Set"); } if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - this.ourProxy = new LibProxy2(); - Utils.LOG_INFO("Selecting GT 5.9 Recipe Set"); + this.ourProxy = new LibProxy2(); + Utils.LOG_INFO("Selecting GT 5.9 Recipe Set"); } - } catch (NoSuchMethodException e) { + } catch (final NoSuchMethodException e) { this.ourProxy = null; } } - public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aInput, ItemStack aOutput) { + public boolean addSmeltingAndAlloySmeltingRecipe(final ItemStack aInput, final ItemStack aOutput) { Utils.LOG_WARNING("Adding a GT Furnace/Alloy Smelter Recipe"+"| Input:"+aInput.getDisplayName()+" | Output:"+aOutput.getDisplayName()+" |"); - return ourProxy.addSmeltingAndAlloySmeltingRecipe(aInput, aOutput); + return this.ourProxy.addSmeltingAndAlloySmeltingRecipe(aInput, aOutput); } } @@ -42,15 +41,15 @@ class LibProxy1 extends LibraryProxy { final Method m1; public LibProxy1() throws NoSuchMethodException { - m1 = GT_ModHandler.class.getDeclaredMethod("addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class); + this.m1 = GT_ModHandler.class.getDeclaredMethod("addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class); } @Override - public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aInput, ItemStack aOutput) { + public boolean addSmeltingAndAlloySmeltingRecipe(final ItemStack aInput, final ItemStack aOutput) { try { Utils.LOG_INFO("Trying with Gt 5.7/5.8 Method."); - return (boolean) m1.invoke(null, aInput, aOutput); - } catch (Exception e) { + return (boolean) this.m1.invoke(null, aInput, aOutput); + } catch (final Exception e) { throw new RuntimeException(e); } } @@ -60,15 +59,15 @@ class LibProxy2 extends LibraryProxy { final Method m2; public LibProxy2() throws NoSuchMethodException { - m2 = GT_ModHandler.class.getDeclaredMethod("addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class, boolean.class); + this.m2 = GT_ModHandler.class.getDeclaredMethod("addSmeltingAndAlloySmeltingRecipe", ItemStack.class, ItemStack.class, boolean.class); } @Override - public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aInput, ItemStack aOutput) { + public boolean addSmeltingAndAlloySmeltingRecipe(final ItemStack aInput, final ItemStack aOutput) { try { Utils.LOG_INFO("Trying with Gt 5.9 Method."); - return (boolean) m2.invoke(null, aInput, aOutput, true); - } catch (Exception e) { + return (boolean) this.m2.invoke(null, aInput, aOutput, true); + } catch (final Exception e) { throw new RuntimeException(e); } } diff --git a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java index 83a8fff751..8fe80ff184 100644 --- a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java @@ -1,5 +1,9 @@ package gtPlusPlus.core.util.item; +import java.util.ArrayList; +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; @@ -10,6 +14,7 @@ import gtPlusPlus.core.item.base.dusts.BaseItemDust; import gtPlusPlus.core.item.base.dusts.BaseItemDustUnique; import gtPlusPlus.core.item.base.dusts.decimal.BaseItemCentidust; import gtPlusPlus.core.item.base.dusts.decimal.BaseItemDecidust; +import gtPlusPlus.core.item.base.plates.BaseItemPlate_OLD; import gtPlusPlus.core.item.tool.staballoy.MultiPickaxeBase; import gtPlusPlus.core.item.tool.staballoy.MultiSpadeBase; import gtPlusPlus.core.lib.CORE; @@ -20,179 +25,175 @@ import gtPlusPlus.core.util.array.Pair; import gtPlusPlus.core.util.materials.MaterialUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.core.util.wrapper.var; - -import java.util.ArrayList; -import java.util.List; - import net.minecraft.block.Block; -import net.minecraft.item.*; +import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; -import cpw.mods.fml.common.registry.GameRegistry; public class ItemUtils { - public static ItemStack getSimpleStack(Item x){ + public static ItemStack getSimpleStack(final Item x){ return getSimpleStack(x, 1); } - public static ItemStack getSimpleStack(Block x){ + public static ItemStack getSimpleStack(final Block x){ return getSimpleStack(Item.getItemFromBlock(x), 1); } - public static ItemStack getSimpleStack(Item x, int i){ + public static ItemStack getSimpleStack(final Item x, final int i){ try { - ItemStack r = new ItemStack(x, i); + final ItemStack r = new ItemStack(x, i); return r; - } catch(Throwable e){ + } catch(final Throwable e){ return null; } } - public static ItemStack getSimpleStack(ItemStack x, int i){ + public static ItemStack getSimpleStack(final ItemStack x, final int i){ try { - ItemStack r = x.copy(); + final ItemStack r = x.copy(); r.stackSize = i; return r; - } catch(Throwable e){ + } catch(final Throwable e){ return null; } } - public static ItemStack getIC2Cell(String S){ - ItemStack moreTemp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+S, 1); + public static ItemStack getIC2Cell(final String S){ + final ItemStack moreTemp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+S, 1); if (moreTemp == null){ - int cellID = 0; - ItemStack temp =GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, cellID); + final int cellID = 0; + final ItemStack temp =GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, cellID); return temp != null ? temp : null; } return moreTemp; } - public static ItemStack getIC2Cell(int meta){ - ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, meta); + public static ItemStack getIC2Cell(final int meta){ + final ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, meta); return temp != null ? temp : null; } - public static void getItemForOreDict(String FQRN, String oreDictName, String itemName, int meta){ + public static void getItemForOreDict(final String FQRN, final String oreDictName, final String itemName, final int meta){ try { - Item em = null; - Item em1 = getItem(FQRN); + Item em = null; + final Item em1 = getItem(FQRN); //Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); if (em1 != null){ em = em1; } if (em != null){ - ItemStack metaStack = new ItemStack(em,1,meta); + final ItemStack metaStack = new ItemStack(em,1,meta); GT_OreDictUnificator.registerOre(oreDictName, metaStack); /*ItemStack itemStackWithMeta = new ItemStack(em,1,meta); GT_OreDictUnificator.registerOre(oreDictName, new ItemStack(itemStackWithMeta.getItem()));*/ } - } catch (NullPointerException e) { + } catch (final NullPointerException e) { Utils.LOG_ERROR(itemName+" not found. [NULL]"); } } - public static void addItemToOreDictionary(ItemStack stack, String oreDictName){ + public static void addItemToOreDictionary(final ItemStack stack, final String oreDictName){ try { GT_OreDictUnificator.registerOre(oreDictName, stack); - } catch (NullPointerException e) { + } catch (final NullPointerException e) { Utils.LOG_ERROR(stack.getDisplayName()+" not registered. [NULL]"); } } - public static ItemStack getItemStackWithMeta(boolean MOD, String FQRN, String itemName, int meta, int itemstackSize){ + public static ItemStack getItemStackWithMeta(final boolean MOD, final String FQRN, final String itemName, final int meta, final int itemstackSize){ if (MOD){ try { - Item em = null; - Item em1 = getItem(FQRN); + Item em = null; + final Item em1 = getItem(FQRN); //Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); if (em1 != null){ if (null == em){ em = em1; } if (em != null){ - ItemStack metaStack = new ItemStack(em,itemstackSize,meta); + final ItemStack metaStack = new ItemStack(em,itemstackSize,meta); return metaStack; } } return null; - } catch (NullPointerException e) { + } catch (final NullPointerException e) { Utils.LOG_ERROR(itemName+" not found. [NULL]"); return null; - } + } } return null; } - public static ItemStack simpleMetaStack(String FQRN, int meta, int itemstackSize){ + public static ItemStack simpleMetaStack(final String FQRN, final int meta, final int itemstackSize){ try { - Item em = null; - Item em1 = getItem(FQRN); + Item em = null; + final Item em1 = getItem(FQRN); //Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); if (em1 != null){ if (null == em){ em = em1; } if (em != null){ - ItemStack metaStack = new ItemStack(em,itemstackSize,meta); + final ItemStack metaStack = new ItemStack(em,itemstackSize,meta); return metaStack; } } return null; - } catch (NullPointerException e) { + } catch (final NullPointerException e) { Utils.LOG_ERROR(FQRN+" not found. [NULL]"); return null; - } + } } @SuppressWarnings("unused") - public static ItemStack simpleMetaStack(Item item, int meta, int itemstackSize){ + public static ItemStack simpleMetaStack(final Item item, final int meta, final int itemstackSize){ try { if (item == null){ return null; - } - Item em = item; - Item em1 = item; + } + Item em = item; + final Item em1 = item; Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); if (em1 != null){ if (null == em){ em = em1; } if (em != null){ - ItemStack metaStack = new ItemStack(em,itemstackSize,meta); + final ItemStack metaStack = new ItemStack(em,itemstackSize,meta); return metaStack; } } return null; - } catch (NullPointerException e) { + } catch (final NullPointerException e) { //Utils.LOG_ERROR(item.getUnlocalizedName()+" not found. [NULL]"); return null; - } + } } - public static ItemStack getCorrectStacktype(String fqrn, int stackSize){ - String oreDict = "ore:"; + public static ItemStack getCorrectStacktype(final String fqrn, final int stackSize){ + final String oreDict = "ore:"; ItemStack temp; if (fqrn.toLowerCase().contains(oreDict.toLowerCase())){ - String sanitizedName = fqrn.replace(oreDict, ""); + final String sanitizedName = fqrn.replace(oreDict, ""); temp = ItemUtils.getItemStack(sanitizedName, stackSize); return temp; } - String[] fqrnSplit = fqrn.split(":"); + final String[] fqrnSplit = fqrn.split(":"); String temp1; String temp2; temp1 = fqrnSplit[1]; if (fqrnSplit.length < 3){temp2 = "0";} else {temp2 = fqrnSplit[2];} temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, temp1, Integer.parseInt(temp2), stackSize); - return temp; - } + return temp; + } - public static ItemStack getCorrectStacktype(Object item_Input, int stackSize) { + public static ItemStack getCorrectStacktype(final Object item_Input, final int stackSize) { if (item_Input instanceof String){ return getItemStackOfAmountFromOreDictNoBroken((String) item_Input, stackSize); } @@ -205,91 +206,95 @@ public class ItemUtils { return null; } - public static Item getItem(String fqrn) // fqrn = fully qualified resource name + public static Item getItem(final String fqrn) // fqrn = fully qualified resource name { - String[] fqrnSplit = fqrn.split(":"); + final String[] fqrnSplit = fqrn.split(":"); return GameRegistry.findItem(fqrnSplit[0], fqrnSplit[1]); } - public static ItemStack getItemStack(String fqrn, int Size) // fqrn = fully qualified resource name + public static ItemStack getItemStack(final String fqrn, final int Size) // fqrn = fully qualified resource name { - String[] fqrnSplit = fqrn.split(":"); + final String[] fqrnSplit = fqrn.split(":"); return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size); } - public static void generateSpawnEgg(String entityModID, String parSpawnName, int colourEgg, int colourOverlay){ - Item itemSpawnEgg = new BasicSpawnEgg(entityModID, parSpawnName, colourEgg, colourOverlay).setUnlocalizedName("spawn_egg_"+parSpawnName.toLowerCase()).setTextureName(CORE.MODID+":spawn_egg"); + public static void generateSpawnEgg(final String entityModID, final String parSpawnName, final int colourEgg, final int colourOverlay){ + final Item itemSpawnEgg = new BasicSpawnEgg(entityModID, parSpawnName, colourEgg, colourOverlay).setUnlocalizedName("spawn_egg_"+parSpawnName.toLowerCase()).setTextureName(CORE.MODID+":spawn_egg"); GameRegistry.registerItem(itemSpawnEgg, "spawnEgg"+parSpawnName); } - public static ItemStack[] validItemsForOreDict(String oredictName){ - List<?> validNames = MaterialUtils.oreDictValuesForEntry(oredictName); - ItemStack[] inputs = new ItemStack[validNames.size()]; + public static ItemStack[] validItemsForOreDict(final String oredictName){ + final List<?> validNames = MaterialUtils.oreDictValuesForEntry(oredictName); + final ItemStack[] inputs = new ItemStack[validNames.size()]; for (int i=0; i<validNames.size();i++){ inputs[i] = (ItemStack) validNames.get(i); } - return inputs; + return inputs; } - public static ItemStack getItemStackOfAmountFromOreDict(String oredictName, int amount){ - ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); + public static ItemStack getItemStackOfAmountFromOreDict(final String oredictName, final int amount){ + final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); if (!oreDictList.isEmpty()){ - ItemStack returnValue = oreDictList.get(0).copy(); + final ItemStack returnValue = oreDictList.get(0).copy(); returnValue.stackSize = amount; return returnValue; } return getSimpleStack(ModItems.AAA_Broken, amount); } - public static ItemStack getItemStackOfAmountFromOreDictNoBroken(String oredictName, int amount){ + public static ItemStack getItemStackOfAmountFromOreDictNoBroken(final String oredictName, final int amount){ if (CORE.DEBUG){ Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(1)); Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(2)); Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(3)); Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(4)); - Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(5)); + Utils.LOG_INFO("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(5)); } - ItemStack returnValue = getItemStackOfAmountFromOreDict(oredictName, amount); - if (returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass() || returnValue.getItem() != ModItems.AAA_Broken){ - return returnValue; + final ItemStack returnValue = getItemStackOfAmountFromOreDict(oredictName, amount); + if ((returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass()) || (returnValue.getItem() != ModItems.AAA_Broken)){ + return returnValue.copy(); } - Utils.LOG_INFO(oredictName+" was not valid."); + Utils.LOG_INFO(oredictName+" was not valid."); return null; } - public static ItemStack getGregtechDust(Materials material, int amount){ - ItemStack returnValue = GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L); + public static ItemStack getGregtechDust(final Materials material, final int amount){ + final ItemStack returnValue = GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L); if (returnValue != null){ - if (returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass() || returnValue.getItem() != ModItems.AAA_Broken){ - return returnValue; + if ((returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass()) || (returnValue.getItem() != ModItems.AAA_Broken)){ + return returnValue.copy(); } } - Utils.LOG_INFO(material+" was not valid."); + Utils.LOG_INFO(material+" was not valid."); return null; } - public static Item[] generateDusts(String unlocalizedName, String materialName, int materialTier, Material matInfo, int Colour){ - int radioactive = getRadioactivityLevel(materialName); - Item[] output = { + public static Item[] generateDusts(final String unlocalizedName, final String materialName, final int materialTier, final Material matInfo, final int Colour){ + final int radioactive = getRadioactivityLevel(materialName); + final Item[] output = { new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, radioactive), new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, radioactive), new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, radioactive)}; return output; } - public static Item[] generateSpecialUseDusts(String unlocalizedName, String materialName, int Colour){ - Item[] output = { + public static Item[] generateSpecialUseDusts(final String unlocalizedName, final String materialName, final int Colour){ + final Item[] output = { new BaseItemDustUnique("itemDust"+unlocalizedName, materialName, Colour, "Dust"), new BaseItemDustUnique("itemDustSmall"+unlocalizedName, materialName, Colour, "Small"), new BaseItemDustUnique("itemDustTiny"+unlocalizedName, materialName, Colour, "Tiny")}; return output; } + + public static Item generateSpecialUsePlate(String internalName, String displayName, short[] rgb, int radioactivity){ + return new BaseItemPlate_OLD(internalName, displayName, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), radioactivity); + } - public static Item[] generateSpecialUseDusts(Material material, boolean onlyLargeDust){ - String materialName = material.getLocalizedName(); - String unlocalizedName = Utils.sanitizeString(materialName); - int Colour = material.getRgbAsHex(); + public static Item[] generateSpecialUseDusts(final Material material, final boolean onlyLargeDust){ + final String materialName = material.getLocalizedName(); + final String unlocalizedName = Utils.sanitizeString(materialName); + final int Colour = material.getRgbAsHex(); Item[] output = null; if (onlyLargeDust == false){ output = new Item[]{ @@ -304,20 +309,20 @@ public class ItemUtils { return output; } - public static MultiPickaxeBase generateMultiPick(boolean GT_Durability, Materials material){ - ToolMaterial customMaterial = Utils.generateToolMaterialFromGT(material); - Object enchant = new Pair(material.mEnchantmentTools, material.mEnchantmentToolsLevel); + public static MultiPickaxeBase generateMultiPick(final boolean GT_Durability, final Materials material){ + final ToolMaterial customMaterial = Utils.generateToolMaterialFromGT(material); + final Object enchant = new Pair(material.mEnchantmentTools, material.mEnchantmentToolsLevel); return generateMultiPick(GT_Durability, customMaterial, material.mDefaultLocalName, material.mDurability, material.mRGBa, enchant); } - public static MultiPickaxeBase generateMultiPick(Material material){ - ToolMaterial customMaterial = Utils.generateToolMaterial(material); + public static MultiPickaxeBase generateMultiPick(final Material material){ + final ToolMaterial customMaterial = Utils.generateToolMaterial(material); return generateMultiPick(true, customMaterial, material.getLocalizedName(), (int) material.vDurability, material.getRGBA(), null); } - public static MultiPickaxeBase generateMultiPick(boolean GT_Durability, ToolMaterial customMaterial, String name, int durability, short[] rgba, Object enchantment){ + public static MultiPickaxeBase generateMultiPick(final boolean GT_Durability, final ToolMaterial customMaterial, final String name, final int durability, final short[] rgba, final Object enchantment){ Utils.LOG_INFO("Generating a Multi-Pick out of "+name); - short[] rgb = rgba; + final short[] rgb = rgba; int dur = customMaterial.getMaxUses(); Utils.LOG_WARNING("Determined durability for "+name+" is "+dur); if (GT_Durability){ @@ -342,8 +347,8 @@ public class ItemUtils { else { enchant = null; } - - MultiPickaxeBase MP_Redstone = new MultiPickaxeBase( + + final MultiPickaxeBase MP_Redstone = new MultiPickaxeBase( name+" Multipick", (customMaterial), dur, @@ -352,7 +357,7 @@ public class ItemUtils { if (MP_Redstone.isValid){ return MP_Redstone; - } + } Utils.LOG_INFO("Pickaxe was not valid."); return null; } @@ -362,19 +367,19 @@ public class ItemUtils { - public static MultiSpadeBase generateMultiShovel(boolean GT_Durability, Materials material){ - ToolMaterial customMaterial = Utils.generateToolMaterialFromGT(material); + public static MultiSpadeBase generateMultiShovel(final boolean GT_Durability, final Materials material){ + final ToolMaterial customMaterial = Utils.generateToolMaterialFromGT(material); return generateMultiShovel(GT_Durability, customMaterial, material.mDefaultLocalName, material.mDurability, material.mRGBa); } - public static MultiSpadeBase generateMultiShovel(Material material){ - ToolMaterial customMaterial = Utils.generateToolMaterial(material); + public static MultiSpadeBase generateMultiShovel(final Material material){ + final ToolMaterial customMaterial = Utils.generateToolMaterial(material); return generateMultiShovel(true, customMaterial, material.getLocalizedName(), (int) material.vDurability, material.getRGBA()); } - public static MultiSpadeBase generateMultiShovel(boolean GT_Durability, ToolMaterial customMaterial, String name, int durability, short[] rgba){ + public static MultiSpadeBase generateMultiShovel(final boolean GT_Durability, final ToolMaterial customMaterial, final String name, final int durability, final short[] rgba){ Utils.LOG_WARNING("Generating a Multi-Spade out of "+name); - short[] rgb = rgba; + final short[] rgb = rgba; int dur = customMaterial.getMaxUses(); Utils.LOG_WARNING("Determined durability for "+name+" is "+dur); if (GT_Durability){ @@ -389,7 +394,7 @@ public class ItemUtils { Utils.LOG_WARNING("Still too low, "+name+" will now go unused."); return null; } - MultiSpadeBase MP_Redstone = new MultiSpadeBase( + final MultiSpadeBase MP_Redstone = new MultiSpadeBase( name+" Multispade", (customMaterial), dur, @@ -398,7 +403,7 @@ public class ItemUtils { if (MP_Redstone.isValid){ return MP_Redstone; - } + } return null; } @@ -413,44 +418,44 @@ public class ItemUtils { - public static BaseItemDecidust generateDecidust(Materials material){ + public static BaseItemDecidust generateDecidust(final Materials material){ if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null){ - Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); + final Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); if (placeholder != null) { generateDecidust(placeholder); - } - } + } + } return null; } - public static BaseItemDecidust generateDecidust(Material material){ - if (material.getDust(1) != null && MaterialUtils.hasValidRGBA(material.getRGBA())){ - BaseItemDecidust Decidust = new BaseItemDecidust(material); - return Decidust; + public static BaseItemDecidust generateDecidust(final Material material){ + if ((material.getDust(1) != null) && MaterialUtils.hasValidRGBA(material.getRGBA())){ + final BaseItemDecidust Decidust = new BaseItemDecidust(material); + return Decidust; } return null; } - public static BaseItemCentidust generateCentidust(Materials material){ + public static BaseItemCentidust generateCentidust(final Materials material){ if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null){ - Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); + final Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); if (placeholder != null) { generateCentidust(placeholder); - } - } + } + } return null; } - public static BaseItemCentidust generateCentidust(Material material){ - if (material.getDust(1) != null && MaterialUtils.hasValidRGBA(material.getRGBA())){ - BaseItemCentidust Centidust = new BaseItemCentidust(material); - return Centidust; + public static BaseItemCentidust generateCentidust(final Material material){ + if ((material.getDust(1) != null) && MaterialUtils.hasValidRGBA(material.getRGBA())){ + final BaseItemCentidust Centidust = new BaseItemCentidust(material); + return Centidust; } return null; } - public static boolean isRadioactive(String materialName){ - int sRadiation = 0; + public static boolean isRadioactive(final String materialName){ + int sRadiation = 0; if (materialName.toLowerCase().contains("uranium")){ sRadiation = 2; } @@ -466,8 +471,8 @@ public class ItemUtils { return false; } - public static int getRadioactivityLevel(String materialName){ - int sRadiation = 0; + public static int getRadioactivityLevel(final String materialName){ + int sRadiation = 0; if (materialName.toLowerCase().contains("uranium")){ sRadiation = 2; } @@ -480,16 +485,16 @@ public class ItemUtils { return sRadiation; } - public static String getArrayStackNames(ItemStack[] aStack){ + public static String getArrayStackNames(final ItemStack[] aStack){ String itemNames = "Item Array: "; - for (ItemStack alph : aStack){ + for (final ItemStack alph : aStack){ if (alph != null){ - String temp = itemNames; - itemNames = temp + ", " + alph.getDisplayName() + " x" + alph.stackSize; + final String temp = itemNames; + itemNames = temp + ", " + alph.getDisplayName() + " x" + alph.stackSize; } else { - String temp = itemNames; + final String temp = itemNames; itemNames = temp + ", " + "null" + " x" + "0"; } } @@ -497,10 +502,10 @@ public class ItemUtils { } - public static String[] getArrayStackNamesAsArray(ItemStack[] aStack){ - String[] itemNames = {}; + public static String[] getArrayStackNamesAsArray(final ItemStack[] aStack){ + final String[] itemNames = {}; int arpos = 0; - for (ItemStack alph : aStack){ + for (final ItemStack alph : aStack){ itemNames[arpos] = alph.getDisplayName(); arpos++; } @@ -508,29 +513,29 @@ public class ItemUtils { } - public static String getFluidArrayStackNames(FluidStack[] aStack){ + public static String getFluidArrayStackNames(final FluidStack[] aStack){ String itemNames = "Fluid Array: "; - for (FluidStack alph : aStack){ - String temp = itemNames; + for (final FluidStack alph : aStack){ + final String temp = itemNames; itemNames = temp + ", " + alph.getFluid().getName() + " x" + alph.amount; } return itemNames; } - public static ItemStack getGregtechCircuit(int Meta){ + public static ItemStack getGregtechCircuit(final int Meta){ return ItemUtils.getItemStackWithMeta(LoadedMods.Gregtech, "gregtech:gt.integrated_circuit", "Gregtech Circuit", Meta, 0); } - public static ItemStack[] getBlockDrops(ArrayList<ItemStack> blockDrops) { + public static ItemStack[] getBlockDrops(final ArrayList<ItemStack> blockDrops) { if (blockDrops == null){ return null; } if (blockDrops.isEmpty()){ return null; } - ItemStack[] outputs = new ItemStack[blockDrops.size()]; - short forCounter = 0; - for (ItemStack I : blockDrops){ + final ItemStack[] outputs = new ItemStack[blockDrops.size()]; + final short forCounter = 0; + for (final ItemStack I : blockDrops){ outputs[forCounter] = I; } return outputs; diff --git a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java index 680ce004b9..da68bfaaae 100644 --- a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java @@ -1,15 +1,14 @@ package gtPlusPlus.core.util.materials; +import java.util.ArrayList; +import java.util.List; + import gregtech.api.enums.*; import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.objects.MaterialStack; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; - -import java.util.ArrayList; -import java.util.List; - import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.oredict.OreDictionary; @@ -25,7 +24,7 @@ public class MaterialUtils { boolean.class, int.class, int.class, int.class, Dyes.class, int.class, List.class , List.class}}; - public static Materials addGtMaterial(String enumNameForMaterial, TextureSet aIconSet, float aToolSpeed, int aToolDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, int aExtraData, List<MaterialStack> aMaterialList, List<TC_AspectStack> aAspects) + public static Materials addGtMaterial(final String enumNameForMaterial, final TextureSet aIconSet, final float aToolSpeed, final int aToolDurability, final int aToolQuality, final int aTypes, final int aR, final int aG, final int aB, final int aA, final String aLocalName, final int aFuelType, final int aFuelPower, final int aMeltingPoint, final int aBlastFurnaceTemp, final boolean aBlastFurnaceRequired, final boolean aTransparent, final int aOreValue, final int aDensityMultiplier, final int aDensityDivider, final Dyes aColor, final int aExtraData, final List<MaterialStack> aMaterialList, final List<TC_AspectStack> aAspects) { Utils.LOG_INFO("Attempting to add GT material: "+enumNameForMaterial); return EnumHelper.addEnum(Materials.class, enumNameForMaterial, commonTypes, firstID++, aIconSet, aToolSpeed, aToolDurability, aToolQuality, aTypes, aR, aG, aB, aA, aLocalName, @@ -33,32 +32,32 @@ public class MaterialUtils { aColor, aExtraData, aMaterialList, aAspects); } - public static List<?> oreDictValuesForEntry(String oredictName){ + public static List<?> oreDictValuesForEntry(final String oredictName){ List<?> oredictItemNames; if(OreDictionary.doesOreNameExist(oredictName)){ - ArrayList<ItemStack> oredictItems = OreDictionary.getOres(oredictName); + final ArrayList<ItemStack> oredictItems = OreDictionary.getOres(oredictName); oredictItemNames = Utils.convertArrayListToList(oredictItems); return oredictItemNames; - } + } return null; } - public static Material generateMaterialFromGtENUM(Materials material){ + public static Material generateMaterialFromGtENUM(final Materials material){ String name = material.name(); - short[] rgba = material.mRGBa; - int melting = material.mMeltingPoint; - int boiling = material.mBlastFurnaceTemp; - long protons = material.getProtons(); - long neutrons = material.getNeutrons(); - boolean blastFurnace = material.mBlastFurnaceRequired; - int durability = material.mDurability; + final short[] rgba = material.mRGBa; + final int melting = material.mMeltingPoint; + final int boiling = material.mBlastFurnaceTemp; + final long protons = material.getProtons(); + final long neutrons = material.getNeutrons(); + final boolean blastFurnace = material.mBlastFurnaceRequired; + final int durability = material.mDurability; MaterialState materialState; - String chemicalFormula = MaterialUtils.subscript(Utils.sanitizeString(material.mChemicalFormula)); - Element element = material.mElement; + final String chemicalFormula = MaterialUtils.subscript(Utils.sanitizeString(material.mChemicalFormula)); + final Element element = material.mElement; int radioactivity = 0; if (material.isRadioactive()){ radioactivity = 1; - } + } //Determine default state if (material.getMolten(1) != null){ @@ -79,10 +78,10 @@ public class MaterialUtils { if (name.toLowerCase().contains("infused")){ - String tempname = name.substring(7, name.length()); + final String tempname = name.substring(7, name.length()); name = "Infused " + tempname; } - if (hasValidRGBA(rgba) || element == Element.H || (material == Materials.InfusedAir || material == Materials.InfusedFire || material == Materials.InfusedEarth || material == Materials.InfusedWater)){ + if (hasValidRGBA(rgba) || (element == Element.H) || ((material == Materials.InfusedAir) || (material == Materials.InfusedFire) || (material == Materials.InfusedEarth) || (material == Materials.InfusedWater))){ //ModItems.itemBaseDecidust = UtilsItems.generateDecidust(material); //ModItems.itemBaseCentidust = UtilsItems.generateCentidust(material); return new Material(name, materialState, durability, rgba, melting, boiling, protons, neutrons, blastFurnace, chemicalFormula, radioactivity); @@ -91,8 +90,8 @@ public class MaterialUtils { } - public static Material generateQuickMaterial(String materialName, MaterialState defaultState, short[] colour, int sRadioactivity) { - Material temp = new Material( + public static Material generateQuickMaterial(final String materialName, final MaterialState defaultState, final short[] colour, final int sRadioactivity) { + final Material temp = new Material( materialName, defaultState, 0, //Durability @@ -107,23 +106,23 @@ public class MaterialUtils { return temp; } - public static boolean hasValidRGBA(short[] rgba){ + public static boolean hasValidRGBA(final short[] rgba){ boolean test1 = false; boolean test2 = false; - boolean test3 = false; + boolean test3 = false; for (int r=0;r<rgba.length;r++){ if (rgba[r] == 0){ if (r == 0){ test1 = true; } else if (r == 1){ - test2 = true; + test2 = true; } else if (r == 2){ - test3 = true; + test3 = true; } } - } + } if ((test1 && test2) || (test1 && test3) || (test3 && test2)){ return false; } @@ -140,7 +139,7 @@ public class MaterialUtils { str = str.replaceAll("6", "\u2076"); str = str.replaceAll("7", "\u2077"); str = str.replaceAll("8", "\u2078"); - str = str.replaceAll("9", "\u2079"); + str = str.replaceAll("9", "\u2079"); return str; } @@ -158,35 +157,35 @@ public class MaterialUtils { return str; } - public static int getTierOfMaterial(int M){ - if (M >= 0 && M <= 750){ + public static int getTierOfMaterial(final int M){ + if ((M >= 0) && (M <= 750)){ return 1; } - else if(M >= 751 && M <= 1250){ + else if((M >= 751) && (M <= 1250)){ return 2; } - else if(M >= 1251 && M <= 1750){ + else if((M >= 1251) && (M <= 1750)){ return 3; } - else if(M >= 1751 && M <= 2250){ + else if((M >= 1751) && (M <= 2250)){ return 4; } - else if(M >= 2251 && M <= 2750){ + else if((M >= 2251) && (M <= 2750)){ return 5; } - else if(M >= 2751 && M <= 3250){ + else if((M >= 2751) && (M <= 3250)){ return 6; } - else if(M >= 3251 && M <= 3750){ + else if((M >= 3251) && (M <= 3750)){ return 7; } - else if(M >= 3751 && M <= 4250){ + else if((M >= 3751) && (M <= 4250)){ return 8; } - else if(M >= 4251 && M <= 4750){ + else if((M >= 4251) && (M <= 4750)){ return 9; } - else if(M >= 4751 && M <= 9999){ + else if((M >= 4751) && (M <= 9999)){ return 10; } else { @@ -197,11 +196,11 @@ public class MaterialUtils { /* * That's shown, many times, in the EnumHelper code, all the add functions just wrap the addEnum function. - You need the target enum class, and 2 arrays, 1 holding the types for the constructor arguments, + You need the target enum class, and 2 arrays, 1 holding the types for the constructor arguments, and the other holding the constructor argument values (the things being passed to the constructor) - The 'decompiled' Boolean should be set to true if the class you're adding to has been decompiled/recompiled again. - (it adds a 2nd enum arguments that need to be accounted for, but isn't actually useful to you) + The 'decompiled' Boolean should be set to true if the class you're adding to has been decompiled/recompiled again. + (it adds a 2nd enum arguments that need to be accounted for, but isn't actually useful to you) * *new Class[{int.class, TextureSet.class, float.class, int.class, diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index 96231fb29c..3c04266f38 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -1,10 +1,10 @@ package gtPlusPlus.core.util.math; -import gtPlusPlus.core.util.Utils; - import java.util.Map; import java.util.Random; +import gtPlusPlus.core.util.Utils; + public class MathUtils { /** @@ -17,24 +17,24 @@ public class MathUtils { * @return Integer between min and max, inclusive. * @see java.util.Random#nextInt(int) */ - public static int randInt(int min, int max) { + public static int randInt(final int min, final int max) { // Usually this can be a field rather than a method variable - Random rand = new Random(); + final Random rand = new Random(); // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive - int randomNum = rand.nextInt((max - min) + 1) + min; + final int randomNum = rand.nextInt((max - min) + 1) + min; return randomNum; } - - public static double getChanceOfXOverYRuns(double x, double y){ - double z = (1-Math.pow((1-x), y)); - return z; + + public static double getChanceOfXOverYRuns(final double x, final double y){ + final double z = (1-Math.pow((1-x), y)); + return z; } - - + + /** * Returns a psuedo-random number between min and max, inclusive. * The difference between min and max can be at most @@ -45,27 +45,27 @@ public class MathUtils { * @return Long between min and max, inclusive. * @see java.util.Random#nextLong(long) */ - public static long randLong(long min, long max) { + public static long randLong(final long min, final long max) { // Usually this can be a field rather than a method variable - Random rand = new Random(); + final Random rand = new Random(); // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive - long randomNum = MathUtils.nextLong(rand,(max - min) + 1) + min; + final long randomNum = MathUtils.nextLong(rand,(max - min) + 1) + min; return randomNum; } - private static long nextLong(Random rng, long n) { + private static long nextLong(final Random rng, final long n) { // error checking and 2^x checking removed for simplicity. long bits, val; do { bits = (rng.nextLong() << 1) >>> 1; val = bits % n; - } while (bits-val+(n-1) < 0L); + } while (((bits-val)+(n-1)) < 0L); return val; } - - + + /** * Returns a psuedo-random number between min and max, inclusive. * The difference between min and max can be at most @@ -76,26 +76,26 @@ public class MathUtils { * @return Double between min and max, inclusive. * @see java.util.Random#nextDouble(double) */ - public static double randDouble(double min, double max) { + public static double randDouble(final double min, final double max) { // Usually this can be a field rather than a method variable - Random rand = new Random(); + final Random rand = new Random(); // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive - double randomNum = MathUtils.nextDouble(rand,(max - min) + 1) + min; + final double randomNum = MathUtils.nextDouble(rand,(max - min) + 1) + min; return randomNum; } - - private static double nextDouble(Random rng, double n) { + + private static double nextDouble(final Random rng, final double n) { // error checking and 2^x checking removed for simplicity. double bits, val; do { bits = (rng.nextLong() << 1) >>> 1; val = bits % n; - } while (bits-val+(n-1) < 0L); + } while (((bits-val)+(n-1)) < 0L); return val; } - + /** * Returns a percentage. @@ -104,14 +104,14 @@ public class MathUtils { * * @param current Current value. * @param max Maximim value. Must be greater than min. - * @return double between min and max, inclusive. + * @return double between min and max, inclusive. */ - public static double findPercentage(double current, double max){ - double c = ((double) current / max) * 100; - double roundOff = Math.round(c * 100.00) / 100.00; + public static double findPercentage(final double current, final double max){ + final double c = (current / max) * 100; + final double roundOff = Math.round(c * 100.00) / 100.00; return roundOff; } - + //Smooth Rounding Function /** @@ -120,12 +120,12 @@ public class MathUtils { * Supports Doubles. * * @param current Current value. - * @return double Rounded value. + * @return double Rounded value. */ - public static double decimalRounding(double d) { + public static double decimalRounding(final double d) { return Math.round(d * 2) / 2.0; } - + //Smooth Rounding Function (Nearest 5) /** @@ -134,39 +134,39 @@ public class MathUtils { * Supports Doubles. * * @param current Current value. - * @return double Rounded value. + * @return double Rounded value. */ - public static double decimalRoundingToWholes(double d) { + public static double decimalRoundingToWholes(final double d) { return 5*(Math.round(d/5)); } - + //Smooth Rounding Function - /** - * Returns a integer. - * The returned number is d rounded to the nearest flat integer. - * Supports Doubles as input. - * - * @param current Current value. - * @return integer Rounded value. - */ - public static int roundToClosestInt(double d) { - return (int) (Math.round(d * 2) / 2.0); + /** + * Returns a integer. + * The returned number is d rounded to the nearest flat integer. + * Supports Doubles as input. + * + * @param current Current value. + * @return integer Rounded value. + */ + public static int roundToClosestInt(final double d) { + return (int) (Math.round(d * 2) / 2.0); + } + + public static int roundToClosestMultiple(final double number, final int multiple) { + int result = multiple; + if ((number % multiple) == 0) { + return (int) number; + } + // If not already multiple of given number + if ((number % multiple) != 0) { + final int division = (int) ((number / multiple) + 1); + result = division * multiple; } - - public static int roundToClosestMultiple(double number, int multiple) { - int result = multiple; - if (number % multiple == 0) { - return (int) number; - } - // If not already multiple of given number - if (number % multiple != 0) { - int division = (int) ((number / multiple) + 1); - result = division * multiple; - } - return result; - } - - + return result; + } + + /** * Returns a boolean. * The returned boolean is wether or not X evenly fits in to Y. @@ -174,9 +174,9 @@ public class MathUtils { * * @param x Value A. * @param y Value B. Must be greater than min. - * @return boolean Whether or not it divides evenly. + * @return boolean Whether or not it divides evenly. */ - public static boolean divideXintoY(int x, int y){ + public static boolean divideXintoY(final int x, final int y){ if ((x % y) == 0) { return true; @@ -184,16 +184,16 @@ public class MathUtils { return false; } - + /** * Returns a boolean. * The returned boolean is based on the odd/eveness of the input. * Supports ints. * * @param x Value A. - * @return boolean Whether or not it divides evenly. + * @return boolean Whether or not it divides evenly. */ - public static boolean isNumberEven(int x){ + public static boolean isNumberEven(final int x){ if ((x % 2) == 0) { return true; @@ -201,7 +201,7 @@ public class MathUtils { return false; } - + /** * Returns an int. @@ -209,13 +209,13 @@ public class MathUtils { * Supports ints. * * @param i Temp in Celcius. - * @return int The celcius temp returned as Kelvin, rounded to the readest whole. + * @return int The celcius temp returned as Kelvin, rounded to the readest whole. */ - public static float celsiusToKelvin(int i){ - double f = i + 273.15F; + public static float celsiusToKelvin(final int i){ + final double f = i + 273.15F; return (int)decimalRoundingToWholes(f); } - + /** * Returns a hexInteger. @@ -223,14 +223,14 @@ public class MathUtils { * Supports ints. * * @param input Current value. - * @return hexInteger. + * @return hexInteger. */ - public static int getHexNumberFromInt(int input){ - String result = Integer.toHexString(input); - int resultINT = Integer.getInteger(result); + public static int getHexNumberFromInt(final int input){ + final String result = Integer.toHexString(input); + final int resultINT = Integer.getInteger(result); return resultINT; } - + /** * Returns a hexInteger. @@ -239,80 +239,84 @@ public class MathUtils { * * @param min Minimum value. * @param max Maximium value. Must be greater than min. - * @return hexInteger between min and max, inclusive. + * @return hexInteger between min and max, inclusive. */ - public static int generateRandomHexValue(int min, int max){ - int result = getHexNumberFromInt(randInt(min, max)); + public static int generateRandomHexValue(final int min, final int max){ + final int result = getHexNumberFromInt(randInt(min, max)); return result; } - + /** * Returns a random hex value. * The returned value is between 000000-ffffff. * - * @return hexInteger between min and max, inclusive. + * @return hexInteger between min and max, inclusive. */ public static int generateSingularRandomHexValue(){ String temp; - int randomInt = randInt(1, 5); + final int randomInt = randInt(1, 5); final Map<Integer, String> colours = Utils.hexColourGeneratorRandom(5); - if (colours.get(randomInt) != null && colours.size() > 0){ - temp = colours.get(randomInt); + if ((colours.get(randomInt) != null) && (colours.size() > 0)){ + temp = colours.get(randomInt); } else { - temp = "0F0F0F"; + temp = "0F0F0F"; } - Utils.LOG_WARNING("Operating with "+temp); + Utils.LOG_WARNING("Operating with "+temp); temp = Utils.appenedHexNotationToString(String.valueOf(temp)); Utils.LOG_WARNING("Made "+temp+" - Hopefully it's not a mess."); Utils.LOG_WARNING("It will decode into "+Integer.decode(temp)+"."); return Integer.decode(temp); } - - public static long[] simplifyNumbersToSmallestForm(long[] inputArray){ - long GCD = gcd(inputArray); - long[] outputArray = new long[inputArray.length]; + + public static long[] simplifyNumbersToSmallestForm(final long[] inputArray){ + final long GCD = gcd(inputArray); + final long[] outputArray = new long[inputArray.length]; for (int i=0;i<inputArray.length;i++){ - if (GCD != 0) - outputArray[i] = (inputArray[i]/GCD); - else + if (GCD != 0) { + outputArray[i] = (inputArray[i]/GCD); + } else { outputArray[i] = inputArray[i]; + } + } + if (outputArray.length > 0) { + return outputArray; } - if (outputArray.length > 0) - return outputArray; return null; } - + private static long gcd(long a, long b){ - while (b > 0) - { - long temp = b; - b = a % b; // % is remainder - a = temp; - } - return a; + while (b > 0) + { + final long temp = b; + b = a % b; // % is remainder + a = temp; + } + return a; } - - private static long gcd(long[] input){ - long result = input[0]; - for(int i = 1; i < input.length; i++) result = gcd(result, input[i]); - return result; + + private static long gcd(final long[] input){ + long result = input[0]; + for(int i = 1; i < input.length; i++) { + result = gcd(result, input[i]); + } + return result; } - - final public static int getRgbAsHex(short[] RGBA){ - int returnValue = Utils.rgbtoHexValue(RGBA[0], RGBA[1], RGBA[2]); + final public static int getRgbAsHex(final short[] RGBA){ + + final int returnValue = Utils.rgbtoHexValue(RGBA[0], RGBA[1], RGBA[2]); if (returnValue == 0){ - return (int) 0; - } + return 0; + } return Utils.rgbtoHexValue(RGBA[0], RGBA[1], RGBA[2]); } - - - public final static int returnLargestNumber(int a, int b){ + + + public final static int returnLargestNumber(final int a, final int b){ if (a > b){ return a; } diff --git a/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java b/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java index aa0f24f559..b02b50bbfd 100644 --- a/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java +++ b/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java @@ -6,7 +6,7 @@ import java.util.Enumeration; public class NetworkUtils { - public static String getContentFromURL(String args) { + public static String getContentFromURL(final String args) { try { if (hasValidNetworkInterface()){ if (netIsAvailableGithub() || netIsAvailableOther() || netIsAvailableBaidu() || netIsAvailableGoogle()){ @@ -14,9 +14,9 @@ public class NetworkUtils { URL url; // get URL content url = new URL(args); - URLConnection conn = url.openConnection(); + final URLConnection conn = url.openConnection(); // open the stream and put it into BufferedReader - BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())); + final BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())); String inputLine; String tempLine = null; while ((inputLine = br.readLine()) != null) { @@ -24,75 +24,77 @@ public class NetworkUtils { } br.close(); return tempLine; - } - catch (MalformedURLException e) {} - catch (IOException e) {} - } + } + catch (final MalformedURLException e) {} + catch (final IOException e) {} + } } - } catch (SocketException e) {} + } catch (final SocketException e) {} return "offline"; } - private static boolean netIsAvailableGoogle() { - try { - final URL url = new URL("http://www.google.com"); - final URLConnection conn = url.openConnection(); - conn.connect(); - return true; - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } catch (IOException e) { - return false; - } - } + private static boolean netIsAvailableGoogle() { + try { + final URL url = new URL("http://www.google.com"); + final URLConnection conn = url.openConnection(); + conn.connect(); + return true; + } catch (final MalformedURLException e) { + throw new RuntimeException(e); + } catch (final IOException e) { + return false; + } + } - private static boolean netIsAvailableBaidu() { - try { - final URL url = new URL("http://www.baidu.com"); - final URLConnection conn = url.openConnection(); - conn.connect(); - return true; - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } catch (IOException e) { - return false; - } + private static boolean netIsAvailableBaidu() { + try { + final URL url = new URL("http://www.baidu.com"); + final URLConnection conn = url.openConnection(); + conn.connect(); + return true; + } catch (final MalformedURLException e) { + throw new RuntimeException(e); + } catch (final IOException e) { + return false; + } } - private static boolean netIsAvailableGithub() { - try { - final URL url = new URL("https://github.com/draknyte1/GTplusplus"); - final URLConnection conn = url.openConnection(); - conn.connect(); - return true; - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } catch (IOException e) { - return false; - } - } + private static boolean netIsAvailableGithub() { + try { + final URL url = new URL("https://github.com/draknyte1/GTplusplus"); + final URLConnection conn = url.openConnection(); + conn.connect(); + return true; + } catch (final MalformedURLException e) { + throw new RuntimeException(e); + } catch (final IOException e) { + return false; + } + } - private static boolean netIsAvailableOther() { - try { - int timeout = 2000; - InetAddress[] addresses = InetAddress.getAllByName("www.yahoo.com"); - for (InetAddress address : addresses) { - if (address.isReachable(timeout)) - return true; + private static boolean netIsAvailableOther() { + try { + final int timeout = 2000; + final InetAddress[] addresses = InetAddress.getAllByName("www.yahoo.com"); + for (final InetAddress address : addresses) { + if (address.isReachable(timeout)) { + return true; + } + return false; + } + } catch (final Exception e) { return false; - } - } catch (Exception e) { - return false; - } - return false; + } + return false; } private static boolean hasValidNetworkInterface() throws SocketException{ - Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); + final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { - NetworkInterface interf = interfaces.nextElement(); - if (interf.isUp() && !interf.isLoopback()) + final NetworkInterface interf = interfaces.nextElement(); + if (interf.isUp() && !interf.isLoopback()) { return true; + } } return false; } diff --git a/src/Java/gtPlusPlus/core/util/particles/BlockBreakParticles.java b/src/Java/gtPlusPlus/core/util/particles/BlockBreakParticles.java index df0910da99..a1a46b39f4 100644 --- a/src/Java/gtPlusPlus/core/util/particles/BlockBreakParticles.java +++ b/src/Java/gtPlusPlus/core/util/particles/BlockBreakParticles.java @@ -6,12 +6,12 @@ import net.minecraft.world.World; public class BlockBreakParticles { - public BlockBreakParticles(World world, int x, int y, int z, Block block){ + public BlockBreakParticles(final World world, final int x, final int y, final int z, final Block block){ try { HANDLER_FR.createBlockBreakParticles(world, x, y, z, block); - } catch (Throwable T){ - + } catch (final Throwable T){ + } } - + } diff --git a/src/Java/gtPlusPlus/core/util/particles/EntityParticleFXMysterious.java b/src/Java/gtPlusPlus/core/util/particles/EntityParticleFXMysterious.java index 2c704e48a6..97103b636b 100644 --- a/src/Java/gtPlusPlus/core/util/particles/EntityParticleFXMysterious.java +++ b/src/Java/gtPlusPlus/core/util/particles/EntityParticleFXMysterious.java @@ -5,13 +5,13 @@ import net.minecraft.world.World; public class EntityParticleFXMysterious extends EntityAuraFX { - public EntityParticleFXMysterious(World parWorld, - double parX, double parY, double parZ, - double parMotionX, double parMotionY, double parMotionZ) - { - super(parWorld, parX, parY, parZ, parMotionX, parMotionY, parMotionZ); - setParticleTextureIndex(82); // same as happy villager - particleScale = 2.0F; - setRBGColorF(0x88, 0x00, 0x88); - } + public EntityParticleFXMysterious(final World parWorld, + final double parX, final double parY, final double parZ, + final double parMotionX, final double parMotionY, final double parMotionZ) + { + super(parWorld, parX, parY, parZ, parMotionX, parMotionY, parMotionZ); + this.setParticleTextureIndex(82); // same as happy villager + this.particleScale = 2.0F; + this.setRBGColorF(0x88, 0x00, 0x88); + } } diff --git a/src/Java/gtPlusPlus/core/util/player/PlayerCache.java b/src/Java/gtPlusPlus/core/util/player/PlayerCache.java index 85bba2470a..99635d8fe9 100644 --- a/src/Java/gtPlusPlus/core/util/player/PlayerCache.java +++ b/src/Java/gtPlusPlus/core/util/player/PlayerCache.java @@ -1,11 +1,10 @@ package gtPlusPlus.core.util.player; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; - import java.io.*; import java.util.*; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; @@ -19,11 +18,11 @@ public class PlayerCache { if (cache != null){ CORE.PlayerCache = PlayerCache.readPropertiesFileAsMap(); - Utils.LOG_INFO("Loaded PlayerCache.dat"); + Utils.LOG_INFO("Loaded PlayerCache.dat"); } - } catch (Exception e) { + } catch (final Exception e) { Utils.LOG_INFO("Failed to initialise PlayerCache.dat"); PlayerCache.createPropertiesFile("PLAYER_", "DATA"); //e.printStackTrace(); @@ -31,21 +30,21 @@ public class PlayerCache { } } - public static void createPropertiesFile(String playerName, String playerUUIDasString) { + public static void createPropertiesFile(final String playerName, final String playerUUIDasString) { try { - Properties props = new Properties(); + final Properties props = new Properties(); props.setProperty(playerName+" ", playerUUIDasString); - OutputStream out = new FileOutputStream(cache); + final OutputStream out = new FileOutputStream(cache); props.store(out, "Player Cache."); Utils.LOG_INFO("PlayerCache.dat created for future use."); } - catch (Exception e ) { + catch (final Exception e ) { e.printStackTrace(); } } - public static void appendParamChanges(String playerName, String playerUUIDasString) { - HashMap<String, UUID> playerInfo = new HashMap<String, UUID>(); + public static void appendParamChanges(final String playerName, final String playerUUIDasString) { + final HashMap<String, UUID> playerInfo = new HashMap<>(); playerInfo.put(playerName, UUID.fromString(playerUUIDasString)); /*try { @@ -66,49 +65,54 @@ public class PlayerCache { try { - FileOutputStream fos = new FileOutputStream("PlayerCache.dat"); - ObjectOutputStream oos = new ObjectOutputStream(fos); + final FileOutputStream fos = new FileOutputStream("PlayerCache.dat"); + final ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(playerInfo); oos.close(); fos.close(); Utils.LOG_INFO("Serialized Player data saved in PlayerCache.dat"); } - catch (IOException e) { + catch (final IOException e) { Utils.LOG_INFO("No PlayerCache file found, creating one."); createPropertiesFile(playerName, playerUUIDasString); - } + } } /** - * Reads a "properties" file, and returns it as a Map + * Reads a "properties" file, and returns it as a Map * (a collection of key/value pairs). - * + * * Credit due to Alvin Alexander - http://alvinalexander.com/java/java-properties-file-map-example?nocache=1#comment-8215 * Changed slightly as the filename and delimiter are constant in my case. - * + * * @param filename The properties filename to read. - * @param delimiter The string (or character) that separates the key + * @param delimiter The string (or character) that separates the key * from the value in the properties file. * @return The Map that contains the key/value pairs. * @throws Exception */ @Deprecated public static Map<String, String> readPropertiesFileAsMapOld() throws Exception { - String delimiter = "="; + final String delimiter = "="; @SuppressWarnings({ "rawtypes", "unchecked" }) - Map<String, String> map = new HashMap<String, String>(); - BufferedReader reader = new BufferedReader(new FileReader(cache)); + final + Map<String, String> map = new HashMap<>(); + final BufferedReader reader = new BufferedReader(new FileReader(cache)); String line; while ((line = reader.readLine()) != null) { - if (line.trim().length()==0) continue; - if (line.charAt(0)=='#') continue; + if (line.trim().length()==0) { + continue; + } + if (line.charAt(0)=='#') { + continue; + } // assumption here is that proper lines are like "String : <a href="http://xxx.yyy.zzz/foo/bar"" title="http://xxx.yyy.zzz/foo/bar"">http://xxx.yyy.zzz/foo/bar"</a>, // and the ":" is the delimiter - int delimPosition = line.indexOf(delimiter); - String key = line.substring(0, delimPosition-1).trim(); - String value = line.substring(delimPosition+1).trim(); + final int delimPosition = line.indexOf(delimiter); + final String key = line.substring(0, delimPosition-1).trim(); + final String value = line.substring(delimPosition+1).trim(); map.put(key, value); } reader.close(); @@ -120,16 +124,16 @@ public class PlayerCache { HashMap<String, UUID> map = null; try { - FileInputStream fis = new FileInputStream(cache); - ObjectInputStream ois = new ObjectInputStream(fis); + final FileInputStream fis = new FileInputStream(cache); + final ObjectInputStream ois = new ObjectInputStream(fis); map = (HashMap<String, UUID>) ois.readObject(); ois.close(); fis.close(); - }catch(IOException ioe) + }catch(final IOException ioe) { - ioe.printStackTrace(); + ioe.printStackTrace(); return null; - }catch(ClassNotFoundException c) + }catch(final ClassNotFoundException c) { Utils.LOG_INFO("Class not found"); c.printStackTrace(); @@ -139,15 +143,16 @@ public class PlayerCache { return map; } - public static String lookupPlayerByUUID(UUID UUID){ - if (UUID == null) + public static String lookupPlayerByUUID(final UUID UUID){ + if (UUID == null) { return null; - List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList; - for (EntityPlayerMP player : allPlayers) { + } + final List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList; + for (final EntityPlayerMP player : allPlayers) { if (player.getUniqueID().equals(UUID)) { return player.getDisplayName(); } - } + } return "Offline Player."; } } diff --git a/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java b/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java index f81ad561da..6a2253ab54 100644 --- a/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java +++ b/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java @@ -2,6 +2,8 @@ package gtPlusPlus.core.util.player; import java.util.*; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -9,41 +11,39 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class PlayerUtils { - public static void messagePlayer(EntityPlayer P, String S){ + public static void messagePlayer(final EntityPlayer P, final String S){ gregtech.api.util.GT_Utility.sendChatToPlayer(P, S); } - public static EntityPlayer getPlayer(String name){ - List<EntityPlayer> i = new ArrayList<EntityPlayer>(); - Iterator<EntityPlayer> crunchifyIterator = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator(); + public static EntityPlayer getPlayer(final String name){ + final List<EntityPlayer> i = new ArrayList<>(); + final Iterator<EntityPlayer> crunchifyIterator = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator(); while (crunchifyIterator.hasNext()) { i.add((crunchifyIterator.next())); - } + } try{ - for (EntityPlayer temp : i) { + for (final EntityPlayer temp : i) { if (temp.getDisplayName().toLowerCase().equals(name.toLowerCase())){ return temp; } } } - catch(NullPointerException e){} + catch(final NullPointerException e){} return null; } - - public static EntityPlayer getPlayerOnServerFromUUID(UUID parUUID){ - if (parUUID == null) + + public static EntityPlayer getPlayerOnServerFromUUID(final UUID parUUID){ + if (parUUID == null) { return null; } - List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList; - for (EntityPlayerMP player : allPlayers) + final List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList; + for (final EntityPlayerMP player : allPlayers) { - if (player.getUniqueID().equals(parUUID)) + if (player.getUniqueID().equals(parUUID)) { return player; } @@ -52,21 +52,21 @@ public class PlayerUtils { } //Not Clientside - public static EntityPlayer getPlayerInWorld(World world, String Name){ - List<EntityPlayer> i = world.playerEntities; - Minecraft mc = Minecraft.getMinecraft(); - try{ - for (EntityPlayer temp : i) { - if (temp.getDisplayName().toLowerCase().equals(Name.toLowerCase())){ - return temp; - } + public static EntityPlayer getPlayerInWorld(final World world, final String Name){ + final List<EntityPlayer> i = world.playerEntities; + final Minecraft mc = Minecraft.getMinecraft(); + try{ + for (final EntityPlayer temp : i) { + if (temp.getDisplayName().toLowerCase().equals(Name.toLowerCase())){ + return temp; } } - catch(NullPointerException e){} - return null; } + catch(final NullPointerException e){} + return null; + } - public static boolean isPlayerOP(EntityPlayer player){ + public static boolean isPlayerOP(final EntityPlayer player){ if (player.canCommandSenderUseCommand(2, "")){ return true; } @@ -74,11 +74,11 @@ public class PlayerUtils { } //Not Clientside - public static ItemStack getItemStackInPlayersHand(World world, String Name){ - EntityPlayer thePlayer = getPlayer(Name); + public static ItemStack getItemStackInPlayersHand(final World world, final String Name){ + final EntityPlayer thePlayer = getPlayer(Name); ItemStack heldItem = null; try{heldItem = thePlayer.getHeldItem(); - }catch(NullPointerException e){return null;} + }catch(final NullPointerException e){return null;} if (heldItem != null){ return heldItem; } @@ -87,21 +87,21 @@ public class PlayerUtils { @SideOnly(Side.CLIENT) public static ItemStack getItemStackInPlayersHand(){ - Minecraft mc = Minecraft.getMinecraft(); + final Minecraft mc = Minecraft.getMinecraft(); ItemStack heldItem = null; try{heldItem = mc.thePlayer.getHeldItem(); - }catch(NullPointerException e){return null;} + }catch(final NullPointerException e){return null;} if (heldItem != null){ return heldItem; } return null; } - + @SideOnly(Side.SERVER) - public static ItemStack getItemStackInPlayersHand(EntityPlayer player){ + public static ItemStack getItemStackInPlayersHand(final EntityPlayer player){ ItemStack heldItem = null; try{heldItem = player.getHeldItem(); - }catch(NullPointerException e){return null;} + }catch(final NullPointerException e){return null;} if (heldItem != null){ return heldItem; } @@ -110,16 +110,16 @@ public class PlayerUtils { @SideOnly(Side.CLIENT) public static Item getItemInPlayersHand(){ - Minecraft mc = Minecraft.getMinecraft(); + final Minecraft mc = Minecraft.getMinecraft(); Item heldItem = null; - + try{heldItem = mc.thePlayer.getHeldItem().getItem(); - }catch(NullPointerException e){return null;} - + }catch(final NullPointerException e){return null;} + if (heldItem != null){ return heldItem; } - + return null; } diff --git a/src/Java/gtPlusPlus/core/util/player/UtilsMining.java b/src/Java/gtPlusPlus/core/util/player/UtilsMining.java index 8468c4b3a2..d52dd7ee88 100644 --- a/src/Java/gtPlusPlus/core/util/player/UtilsMining.java +++ b/src/Java/gtPlusPlus/core/util/player/UtilsMining.java @@ -7,38 +7,38 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class UtilsMining { - + private static boolean durabilityDamage = false; private static ItemStack stack; - public static Boolean canPickaxeBlock(Block currentBlock, World currentWorld){ + public static Boolean canPickaxeBlock(final Block currentBlock, final World currentWorld){ String correctTool = ""; - if (!currentWorld.isRemote){ + if (!currentWorld.isRemote){ try { correctTool = currentBlock.getHarvestTool(0); //Utils.LOG_WARNING(correctTool); if (correctTool.equals("pickaxe")){ return true;} - } catch (NullPointerException e){ + } catch (final NullPointerException e){ return false;} } return false; } - - private static void removeBlockAndDropAsItem(World world, int X, int Y, int Z){ + + private static void removeBlockAndDropAsItem(final World world, final int X, final int Y, final int Z){ try { - Block block = world.getBlock(X, Y, Z); - if (canPickaxeBlock(block, world)){ - if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ - block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); - world.setBlockToAir(X, Y, Z); + final Block block = world.getBlock(X, Y, Z); + if (canPickaxeBlock(block, world)){ + if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ + block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); + world.setBlockToAir(X, Y, Z); } else { Utils.LOG_WARNING("Incorrect Tool for mining this block."); } } - } catch (NullPointerException e){ + } catch (final NullPointerException e){ } } @@ -71,7 +71,7 @@ public class UtilsMining { for(int j = -2; j < 3; j++) { for(int k = -2; k < 3; k++) { // float dur = calculateDurabilityLoss(world, X + i, Y + k, Z + j); -// DURABILITY_LOSS = (DURABILITY_LOSS + dur); +// DURABILITY_LOSS = (DURABILITY_LOSS + dur); // Utils.LOG_WARNING("Added Loss: "+dur); removeBlockAndDropAsItem(world, X + i, Y + k, Z + j); } @@ -88,7 +88,7 @@ public class UtilsMining { X = (int) aPlayer.posX + 1;} else { X = (int) aPlayer.posX - 1;} - + DURABILITY_LOSS = 0; for(int i = -1; i < 2; i++) { @@ -108,12 +108,12 @@ public class UtilsMining { //Set Player Facing X = (int) aPlayer.posX; Y = (int) aPlayer.posY; - + if (FACING.equals("facingNorth")){ Z = (int) aPlayer.posZ + 1;} else { Z = (int) aPlayer.posZ - 1;} - + DURABILITY_LOSS = 0; for(int i = -1; i < 2; i++) { for(int j = -1; j < 2; j++) { @@ -137,9 +137,9 @@ public class UtilsMining { DURABILITY_LOSS = 0; } }*/ - - - public static boolean getBlockType(Block block, World world, int[] xyz, int miningLevel){ + + + public static boolean getBlockType(final Block block, final World world, final int[] xyz, final int miningLevel){ final String LIQUID = "liquid"; final String BLOCK = "block"; final String ORE = "ore"; @@ -149,18 +149,34 @@ public class UtilsMining { if (world.isRemote){ return false; } - - if (block == Blocks.end_stone) return true; - if (block == Blocks.stone) return true; - if (block == Blocks.sandstone) return true; - if (block == Blocks.netherrack) return true; - if (block == Blocks.nether_brick) return true; - if (block == Blocks.nether_brick_stairs) return true; - if (block == Blocks.nether_brick_fence) return true; - if (block == Blocks.glowstone) return true; - - - + + if (block == Blocks.end_stone) { + return true; + } + if (block == Blocks.stone) { + return true; + } + if (block == Blocks.sandstone) { + return true; + } + if (block == Blocks.netherrack) { + return true; + } + if (block == Blocks.nether_brick) { + return true; + } + if (block == Blocks.nether_brick_stairs) { + return true; + } + if (block == Blocks.nether_brick_fence) { + return true; + } + if (block == Blocks.glowstone) { + return true; + } + + + try { blockClass = block.getClass().toString().toLowerCase(); Utils.LOG_WARNING(blockClass); @@ -189,10 +205,10 @@ public class UtilsMining { return false; } } - catch(NullPointerException e){ + catch(final NullPointerException e){ return false; } } - - + + } diff --git a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java index c1972f4cfd..f930935f40 100644 --- a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java +++ b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.util.recipe; +import java.util.*; + +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.core.handler.COMPAT_HANDLER; import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler; @@ -8,34 +11,30 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.shapeless.ShapelessUtils; - -import java.util.*; - import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.oredict.*; -import cpw.mods.fml.common.registry.GameRegistry; public class RecipeUtils { - public static boolean recipeBuilder(Object slot_1, Object slot_2, Object slot_3, Object slot_4, Object slot_5, Object slot_6, Object slot_7, Object slot_8, Object slot_9, ItemStack resultItem){ + public static boolean recipeBuilder(final Object slot_1, final Object slot_2, final Object slot_3, final Object slot_4, final Object slot_5, final Object slot_6, final Object slot_7, final Object slot_8, final Object slot_9, final ItemStack resultItem){ - ArrayList<Object> validSlots = new ArrayList<Object>(); + final ArrayList<Object> validSlots = new ArrayList<>(); if (resultItem == null){ Utils.LOG_INFO("Found a recipe with an invalid output, yet had a valid inputs. Skipping."); return false; } - - if (slot_1 == null && slot_2 == null && slot_3 == null && - slot_4 == null && slot_5 == null && slot_6 == null && - slot_7 == null && slot_8 == null && slot_9 == null){ + + if ((slot_1 == null) && (slot_2 == null) && (slot_3 == null) && + (slot_4 == null) && (slot_5 == null) && (slot_6 == null) && + (slot_7 == null) && (slot_8 == null) && (slot_9 == null)){ Utils.LOG_INFO("Found a recipe with 0 inputs, yet had a valid output."); Utils.LOG_INFO("Error found while adding a recipe for: "+resultItem.getDisplayName()+" | Please report this issue on Github."); return false; } - + //Utils.LOG_INFO("Trying to add a recipe for "+resultItem.toString()); String a,b,c,d,e,f,g,h,i; if (slot_1 == null){ a = " ";} else { a = "1";validSlots.add('1');validSlots.add(slot_1);} @@ -59,13 +58,13 @@ public class RecipeUtils { Utils.LOG_ERROR("_______"); - String lineOne = a+b+c; + final String lineOne = a+b+c; Utils.LOG_ERROR("|"+a+"|"+b+"|"+c+"|"); Utils.LOG_ERROR("_______"); - String lineTwo = d+e+f; + final String lineTwo = d+e+f; Utils.LOG_ERROR("|"+d+"|"+e+"|"+f+"|"); Utils.LOG_ERROR("_______"); - String lineThree = g+h+i; + final String lineThree = g+h+i; Utils.LOG_ERROR("|"+g+"|"+h+"|"+i+"|"); Utils.LOG_ERROR("_______"); @@ -75,10 +74,10 @@ public class RecipeUtils { boolean advancedLog = false; if (CORE.DEBUG){ advancedLog = true; - } + } if (advancedLog){ int j = 0; - int l = validSlots.size(); + final int l = validSlots.size(); Utils.LOG_WARNING("l:"+l); while (j <= l) { Utils.LOG_WARNING("j:"+j); @@ -102,14 +101,14 @@ public class RecipeUtils { break; } } - if (validSlots.get(j) instanceof String || validSlots.get(j) instanceof ItemStack){ + if ((validSlots.get(j) instanceof String) || (validSlots.get(j) instanceof ItemStack)){ //Utils.LOG_WARNING("Is Valid: "+validSlots.get(j)); } - } + } } try { - GameRegistry.addRecipe(new ShapedOreRecipe(resultItem.copy(), (Object[]) validSlots.toArray())); + GameRegistry.addRecipe(new ShapedOreRecipe(resultItem.copy(), validSlots.toArray())); //Utils.LOG_INFO("Success! Added a recipe for "+resultItem.getDisplayName()); if (!COMPAT_HANDLER.areInitItemsLoaded){ RegistrationHandler.recipesSuccess++; @@ -130,15 +129,15 @@ public class RecipeUtils { } else { LateRegistrationHandler.recipesFailed++; - } + } return false; } } - public static void shapelessBuilder(ItemStack Output, Object slot_1, Object slot_2, Object slot_3, Object slot_4, Object slot_5, Object slot_6, Object slot_7, Object slot_8, Object slot_9){ + public static void shapelessBuilder(final ItemStack Output, final Object slot_1, final Object slot_2, final Object slot_3, final Object slot_4, final Object slot_5, final Object slot_6, final Object slot_7, final Object slot_8, final Object slot_9){ //Item output_ITEM = Output.getItem(); - ArrayList<Object> validSlots = new ArrayList<Object>(); + final ArrayList<Object> validSlots = new ArrayList<>(); Utils.LOG_INFO("Trying to add a recipe for "+Output.toString()); String a,b,c,d,e,f,g,h,i; @@ -182,12 +181,12 @@ public class RecipeUtils { try { //GameRegistry.addRecipe(new ShapelessOreRecipe(Output, outputAmount), (Object[]) validSlots.toArray()); - GameRegistry.addRecipe(new ShapelessOreRecipe(Output, (Object[]) validSlots.toArray())); + GameRegistry.addRecipe(new ShapelessOreRecipe(Output, validSlots.toArray())); //GameRegistry.addShapelessRecipe(new ItemStack(output_ITEM, 1), new Object[] {slot_1, slot_2}); Utils.LOG_INFO("Success! Added a recipe for "+Output.getDisplayName()); - RegistrationHandler.recipesSuccess++; + RegistrationHandler.recipesSuccess++; } - catch(RuntimeException k){ + catch(final RuntimeException k){ k.getMessage(); k.getClass(); k.printStackTrace(); @@ -200,7 +199,7 @@ public class RecipeUtils { //GameRegistry.addShapelessRecipe(new ItemStack(output_ITEM, 1), new Object[] {slot_1, slot_2}); } - public static void recipeBuilder(Object[] array, ItemStack outPut) { + public static void recipeBuilder(final Object[] array, final ItemStack outPut) { Utils.LOG_SPECIFIC_WARNING("object Array - recipeBuilder", "Attempting to build a recipe using an object array as an input, splitting it, then running the normal recipeBuilder() method.", 396); Object a=null; Object b=null; @@ -251,8 +250,8 @@ public class RecipeUtils { public static boolean removeCraftingRecipe(Object x){ if (null == x){return false;} - if (x instanceof String){ - Item R = ItemUtils.getItem((String) x); + if (x instanceof String){ + final Item R = ItemUtils.getItem((String) x); if (R != null){ x = R; } @@ -260,16 +259,16 @@ public class RecipeUtils { return false; } } - if (x instanceof Item || x instanceof ItemStack){ + if ((x instanceof Item) || (x instanceof ItemStack)){ if (x instanceof Item){ - ItemStack r = new ItemStack((Item) x); + final ItemStack r = new ItemStack((Item) x); Utils.LOG_INFO("Removing Recipe for "+r.getUnlocalizedName()); } else { Utils.LOG_INFO("Removing Recipe for "+((ItemStack) x).getUnlocalizedName()); } if (x instanceof ItemStack){ - Item r = ((ItemStack) x).getItem(); + final Item r = ((ItemStack) x).getItem(); if (null != r){ x = r; } @@ -277,25 +276,25 @@ public class RecipeUtils { Utils.LOG_INFO("Recipe removal failed - Tell Alkalus."); return false; } - } + } if (RecipeUtils.attemptRecipeRemoval((Item) x)){ Utils.LOG_INFO("Recipe removal successful"); return true; } Utils.LOG_INFO("Recipe removal failed - Tell Alkalus."); - return false; + return false; } return false; } - private static boolean attemptRecipeRemoval(Item I){ + private static boolean attemptRecipeRemoval(final Item I){ Utils.LOG_WARNING("Create list of recipes."); - List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList(); - Iterator<IRecipe> items = recipes.iterator(); + final List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList(); + final Iterator<IRecipe> items = recipes.iterator(); Utils.LOG_WARNING("Begin list iteration."); while (items.hasNext()) { - ItemStack is = items.next().getRecipeOutput(); - if (is != null && is.getItem() == I){ + final ItemStack is = items.next().getRecipeOutput(); + if ((is != null) && (is.getItem() == I)){ items.remove(); Utils.LOG_INFO("Remove a recipe with "+I.getUnlocalizedName()+" as output."); continue; @@ -304,10 +303,10 @@ public class RecipeUtils { Utils.LOG_WARNING("All recipes should be gone?"); if (!items.hasNext()){ Utils.LOG_WARNING("We iterated once, let's try again to double check."); - Iterator<IRecipe> items2 = recipes.iterator(); + final Iterator<IRecipe> items2 = recipes.iterator(); while (items2.hasNext()) { - ItemStack is = items2.next().getRecipeOutput(); - if (is != null && is.getItem() == I){ + final ItemStack is = items2.next().getRecipeOutput(); + if ((is != null) && (is.getItem() == I)){ items.remove(); Utils.LOG_WARNING("REMOVING MISSED RECIPE - RECHECK CONSTRUCTORS"); return true; @@ -325,48 +324,48 @@ public class RecipeUtils { - public static boolean addShapedGregtechRecipe( - Object InputItem1, Object InputItem2, Object InputItem3, - Object InputItem4, Object InputItem5, Object InputItem6, - Object InputItem7, Object InputItem8, Object InputItem9, - ItemStack OutputItem){ + public static boolean addShapedGregtechRecipe( + final Object InputItem1, final Object InputItem2, final Object InputItem3, + final Object InputItem4, final Object InputItem5, final Object InputItem6, + final Object InputItem7, final Object InputItem8, final Object InputItem9, + final ItemStack OutputItem){ - if ((!(InputItem1 instanceof ItemStack) && !(InputItem1 instanceof String) && (InputItem1 != null)) || - (!(InputItem2 instanceof ItemStack) && !(InputItem2 instanceof String) && (InputItem2 != null)) || - (!(InputItem3 instanceof ItemStack) && !(InputItem3 instanceof String) && (InputItem3 != null)) || - (!(InputItem4 instanceof ItemStack) && !(InputItem4 instanceof String) && (InputItem4 != null)) || - (!(InputItem5 instanceof ItemStack) && !(InputItem5 instanceof String) && (InputItem5 != null)) || - (!(InputItem6 instanceof ItemStack) && !(InputItem6 instanceof String) && (InputItem6 != null)) || - (!(InputItem7 instanceof ItemStack) && !(InputItem7 instanceof String) && (InputItem7 != null)) || - (!(InputItem8 instanceof ItemStack) && !(InputItem8 instanceof String) && (InputItem8 != null)) || + if ((!(InputItem1 instanceof ItemStack) && !(InputItem1 instanceof String) && (InputItem1 != null)) || + (!(InputItem2 instanceof ItemStack) && !(InputItem2 instanceof String) && (InputItem2 != null)) || + (!(InputItem3 instanceof ItemStack) && !(InputItem3 instanceof String) && (InputItem3 != null)) || + (!(InputItem4 instanceof ItemStack) && !(InputItem4 instanceof String) && (InputItem4 != null)) || + (!(InputItem5 instanceof ItemStack) && !(InputItem5 instanceof String) && (InputItem5 != null)) || + (!(InputItem6 instanceof ItemStack) && !(InputItem6 instanceof String) && (InputItem6 != null)) || + (!(InputItem7 instanceof ItemStack) && !(InputItem7 instanceof String) && (InputItem7 != null)) || + (!(InputItem8 instanceof ItemStack) && !(InputItem8 instanceof String) && (InputItem8 != null)) || (!(InputItem9 instanceof ItemStack) && !(InputItem9 instanceof String) && (InputItem9 != null))){ Utils.LOG_INFO("One Input item was not an ItemStack of an OreDict String."); return false; } - if (GT_ModHandler.addCraftingRecipe(OutputItem, - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | + if (GT_ModHandler.addCraftingRecipe(OutputItem, + GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, - new Object[]{"ABC", "DEF", "GHI", - 'A', InputItem1, - 'B', InputItem2, - 'C', InputItem3, - 'D', InputItem4, - 'E', InputItem5, - 'F', InputItem6, - 'G', InputItem7, - 'H', InputItem8, - 'I', InputItem9})){ + new Object[]{"ABC", "DEF", "GHI", + 'A', InputItem1, + 'B', InputItem2, + 'C', InputItem3, + 'D', InputItem4, + 'E', InputItem5, + 'F', InputItem6, + 'G', InputItem7, + 'H', InputItem8, + 'I', InputItem9})){ Utils.LOG_INFO("Success! Added a recipe for "+OutputItem.getDisplayName()); - RegistrationHandler.recipesSuccess++; + RegistrationHandler.recipesSuccess++; return true; } return false; } - public static void addShapelessGregtechRecipe(ItemStack OutputItem, Object... inputItems){ + public static void addShapelessGregtechRecipe(final ItemStack OutputItem, final Object... inputItems){ - for(Object whatever : inputItems){ + for(final Object whatever : inputItems){ if (!(whatever instanceof ItemStack) && !(whatever instanceof String)){ Utils.LOG_INFO("One Input item was not an ItemStack of an OreDict String."); return; @@ -378,13 +377,13 @@ public class RecipeUtils { new Object[]{inputItems}); } - public static ItemStack getItemStackFromOreDict(String oredictName){ - ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); + public static ItemStack getItemStackFromOreDict(final String oredictName){ + final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); return oreDictList.get(0); } - public static boolean buildShapelessRecipe(ItemStack output, Object[] input){ - return ShapelessUtils.addShapelessRecipe(output, input); + public static boolean buildShapelessRecipe(final ItemStack output, final Object[] input){ + return ShapelessUtils.addShapelessRecipe(output, input); } } diff --git a/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java b/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java index bf9d4960d8..d0ad6d3361 100644 --- a/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java +++ b/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java @@ -1,9 +1,8 @@ package gtPlusPlus.core.util.recipe.shapeless; -import gtPlusPlus.core.util.Utils; - import java.util.ArrayList; +import gtPlusPlus.core.util.Utils; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -13,15 +12,15 @@ import net.minecraft.item.crafting.ShapelessRecipes; public class ShapelessUtils { - public static boolean addShapelessRecipe(ItemStack output, Object ... params) + public static boolean addShapelessRecipe(final ItemStack output, final Object ... params) { - ArrayList<ItemStack> arraylist = new ArrayList<ItemStack>(); - Object[] aobject = params; - int i = params.length; + final ArrayList<ItemStack> arraylist = new ArrayList<>(); + final Object[] aobject = params; + final int i = params.length; for (int j = 0; j < i; ++j) { - Object object1 = aobject[j]; + final Object object1 = aobject[j]; if (object1 instanceof ItemStack) { @@ -35,7 +34,7 @@ public class ShapelessUtils { { if ((object1 == null)) { - Utils.LOG_INFO(("Invalid shapeless input, ignoring!")); + Utils.LOG_INFO(("Invalid shapeless input, ignoring!")); } else if (!(object1 instanceof Block) && (object1 != null)) { diff --git a/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java b/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java index fbbe4ac076..c1d0279f72 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java @@ -6,27 +6,27 @@ import cpw.mods.fml.common.SidedProxy; public class ClientProxyFinder { - public static Object getInstance(Object modInstance) throws ReflectiveOperationException { - for(Field field : modInstance.getClass().getDeclaredFields()) { - if(field.isAnnotationPresent(SidedProxy.class)) { - SidedProxy sidedProxy = field.getAnnotation(SidedProxy.class); - Object fieldValue = field.get(modInstance); - try { - Class clientSideClass = Class.forName(sidedProxy.clientSide()); - if(clientSideClass.isAssignableFrom(fieldValue.getClass())) { - Object clientProxy = clientSideClass.cast(fieldValue); - //do what you want with client proxy instance - return clientProxy; - } + public static Object getInstance(final Object modInstance) throws ReflectiveOperationException { + for(final Field field : modInstance.getClass().getDeclaredFields()) { + if(field.isAnnotationPresent(SidedProxy.class)) { + final SidedProxy sidedProxy = field.getAnnotation(SidedProxy.class); + final Object fieldValue = field.get(modInstance); + try { + final Class clientSideClass = Class.forName(sidedProxy.clientSide()); + if(clientSideClass.isAssignableFrom(fieldValue.getClass())) { + final Object clientProxy = clientSideClass.cast(fieldValue); + //do what you want with client proxy instance + return clientProxy; + } - } catch (NoClassDefFoundError err) { - //its server side - return null; - } - break; - } - } - return null; - } + } catch (final NoClassDefFoundError err) { + //its server side + return null; + } + break; + } + } + return null; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 78e6b8ad47..5c02ccc3e7 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -1,8 +1,5 @@ package gtPlusPlus.core.util.reflect; -import gregtech.GT_Mod; -import gtPlusPlus.core.util.Utils; - import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.net.URL; @@ -11,13 +8,16 @@ import java.util.Scanner; import org.apache.commons.lang3.reflect.FieldUtils; +import gregtech.GT_Mod; +import gtPlusPlus.core.util.Utils; + public class ReflectionUtils { - public static Field getField(Class<?> clazz, String fieldName) throws NoSuchFieldException { + public static Field getField(final Class<?> clazz, final String fieldName) throws NoSuchFieldException { try { return clazz.getDeclaredField(fieldName); - } catch (NoSuchFieldException e) { - Class<?> superClass = clazz.getSuperclass(); + } catch (final NoSuchFieldException e) { + final Class<?> superClass = clazz.getSuperclass(); if (superClass == null) { throw e; } @@ -25,7 +25,7 @@ public class ReflectionUtils { } } - public static void makeAccessible(Field field) { + public static void makeAccessible(final Field field) { if (!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers())) { @@ -35,33 +35,33 @@ public class ReflectionUtils { //Some Reflection utils - http://stackoverflow.com/questions/14374878/using-reflection-to-set-an-object-property @SuppressWarnings("unchecked") - public static <V> V getField(Object object, String fieldName) { + public static <V> V getField(final Object object, final String fieldName) { Class<?> clazz = object.getClass(); while (clazz != null) { try { - Field field = clazz.getDeclaredField(fieldName); + final Field field = clazz.getDeclaredField(fieldName); field.setAccessible(true); return (V) field.get(object); - } catch (NoSuchFieldException e) { + } catch (final NoSuchFieldException e) { clazz = clazz.getSuperclass(); - } catch (Exception e) { + } catch (final Exception e) { throw new IllegalStateException(e); } } return null; } - public static boolean setField(Object object, String fieldName, Object fieldValue) { + public static boolean setField(final Object object, final String fieldName, final Object fieldValue) { Class<?> clazz = object.getClass(); while (clazz != null) { try { - Field field = clazz.getDeclaredField(fieldName); + final Field field = clazz.getDeclaredField(fieldName); makeAccessible(field); field.set(object, fieldValue); return true; - } catch (NoSuchFieldException e) { + } catch (final NoSuchFieldException e) { clazz = clazz.getSuperclass(); - } catch (Exception e) { + } catch (final Exception e) { throw new IllegalStateException(e); } } @@ -69,17 +69,17 @@ public class ReflectionUtils { } public static boolean becauseIWorkHard(){ - /* TODO: fix this stuff \u002a\u002f\u0048\u0061\u0073\u0068\u0053\u0065\u0074<String>\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074<String>\u0028\u0029\u003b\u000a\u0009\u0009\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u003b\u0009\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0009\u0009\u0009\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u0020\u003d\u0020\u0043\u006c\u0069\u0065\u006e\u0074\u0050\u0072\u006f\u0078\u0079\u0046\u0069\u006e\u0064\u0065\u0072\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0047\u0054\u005f\u004d\u006f\u0064\u002e\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0029\u003b\u0009\u0009\u0009\u0009\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0052\u0065\u0066\u006c\u0065\u0063\u0074\u0069\u0076\u0065\u004f\u0070\u0065\u0072\u0061\u0074\u0069\u006f\u006e\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0031\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u0020\u003d\u0020\u006e\u0075\u006c\u006c\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u006f\u0062\u0074\u0061\u0069\u006e\u0065\u0064\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0020\u006f\u0066\u0020\u0061\u0020\u0063\u006c\u0069\u0065\u006e\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u000a\u0009\u0009\u007d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0020\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0028\u006e\u0065\u0077\u0020\u0055\u0052\u004c\u0028\u0022\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0067\u0072\u0065\u0067\u0074\u0065\u0063\u0068\u002e\u006f\u0076\u0065\u0072\u006d\u0069\u006e\u0064\u0064\u006c\u0031\u002e\u0063\u006f\u006d\u002f\u0063\u006f\u006d\u002f\u0067\u0072\u0065\u0067\u006f\u0072\u0069\u0075\u0073\u0074\u002f\u0067\u0072\u0065\u0067\u0074\u0065\u0063\u0068\u002f\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0072\u006c\u0069\u0073\u0074\u002e\u0074\u0078\u0074\u0022\u0029\u002e\u006f\u0070\u0065\u006e\u0053\u0074\u0072\u0065\u0061\u006d\u0028\u0029\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0054\u0072\u0079\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0062\u0075\u0069\u006c\u0064\u0020\u0061\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0077\u0068\u0069\u006c\u0065\u0020\u0028\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u0068\u0061\u0073\u004e\u0065\u0078\u0074\u004c\u0069\u006e\u0065\u0028\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0074\u004e\u0061\u006d\u0065\u0020\u003d\u0020\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u006e\u0065\u0078\u0074\u004c\u0069\u006e\u0065\u0028\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0074\u004e\u0061\u006d\u0065\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0074\u004e\u0061\u006d\u0065\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0022\u0064\u0072\u0061\u006b\u006e\u0079\u0074\u0065\u0031\u0022\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0076\u0061\u006c\u0075\u0065\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0022\u0064\u0072\u0061\u006b\u006e\u0079\u0074\u0065\u0031\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0065\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0074\u0068\u0065\u0020\u0077\u0065\u0062\u0020\u006c\u0069\u0073\u0074\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u0020\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0009\u0009\u0009\u0046\u0069\u0065\u006c\u0064\u0055\u0074\u0069\u006c\u0073\u002e\u0077\u0072\u0069\u0074\u0065\u0046\u0069\u0065\u006c\u0064\u0028\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u002c\u0020\u0022\u006d\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u0022\u002c\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002c\u0020\u0074\u0072\u0075\u0065\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u006f\u0064\u0069\u0066\u0069\u0065\u0064\u0020\u0068\u0061\u0073\u0068\u0073\u0065\u0074\u0020\u0062\u0061\u0063\u006b\u0020\u0069\u006e\u0074\u006f\u0020\u0074\u0068\u0065\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u002e\u0022\u0029\u003b\u0020\u0020\u0009\u0009\u0009\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0074\u0072\u0075\u0065\u003b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0065\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0052\u0065\u0066\u006c\u0065\u0063\u0074\u0069\u006f\u006e\u0020\u0069\u006e\u0074\u006f\u0020\u0061\u0063\u0074\u0069\u0076\u0065\u0020\u0063\u006c\u0069\u0065\u006e\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u0020\u0020\u0020\u0020\u0020\u0020\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u0020\u0020\u0009\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u002f\u002a */ + /* TODO: fix this stuff \u002a\u002ffinal \u0048\u0061\u0073\u0068\u0053\u0065\u0074<String>\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074<>\u0028\u0029\u003b\u000a\u0009\u0009\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u003b\u0009\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0009\u0009\u0009\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u0020\u003d\u0020\u0043\u006c\u0069\u0065\u006e\u0074\u0050\u0072\u006f\u0078\u0079\u0046\u0069\u006e\u0064\u0065\u0072\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0047\u0054\u005f\u004d\u006f\u0064\u002e\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0029\u003b\u0009\u0009\u0009\u0009\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028final \u0052\u0065\u0066\u006c\u0065\u0063\u0074\u0069\u0076\u0065\u004f\u0070\u0065\u0072\u0061\u0074\u0069\u006f\u006e\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0031\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u0020\u003d\u0020\u006e\u0075\u006c\u006c\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u006f\u0062\u0074\u0061\u0069\u006e\u0065\u0064\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0020\u006f\u0066\u0020\u0061\u0020\u0063\u006c\u0069\u0065\u006e\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u000a\u0009\u0009\u007d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020final \u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0020\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0028\u006e\u0065\u0077\u0020\u0055\u0052\u004c\u0028\u0022\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0067\u0072\u0065\u0067\u0074\u0065\u0063\u0068\u002e\u006f\u0076\u0065\u0072\u006d\u0069\u006e\u0064\u0064\u006c\u0031\u002e\u0063\u006f\u006d\u002f\u0063\u006f\u006d\u002f\u0067\u0072\u0065\u0067\u006f\u0072\u0069\u0075\u0073\u0074\u002f\u0067\u0072\u0065\u0067\u0074\u0065\u0063\u0068\u002f\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0072\u006c\u0069\u0073\u0074\u002e\u0074\u0078\u0074\u0022\u0029\u002e\u006f\u0070\u0065\u006e\u0053\u0074\u0072\u0065\u0061\u006d\u0028\u0029\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0054\u0072\u0079\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0062\u0075\u0069\u006c\u0064\u0020\u0061\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0077\u0068\u0069\u006c\u0065\u0020\u0028\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u0068\u0061\u0073\u004e\u0065\u0078\u0074\u004c\u0069\u006e\u0065\u0028\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020final \u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0074\u004e\u0061\u006d\u0065\u0020\u003d\u0020\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u006e\u0065\u0078\u0074\u004c\u0069\u006e\u0065\u0028\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0074\u004e\u0061\u006d\u0065\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0074\u004e\u0061\u006d\u0065\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0022\u0064\u0072\u0061\u006b\u006e\u0079\u0074\u0065\u0031\u0022\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0076\u0061\u006c\u0075\u0065\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0022\u0064\u0072\u0061\u006b\u006e\u0079\u0074\u0065\u0031\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028final \u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0065\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0074\u0068\u0065\u0020\u0077\u0065\u0062\u0020\u006c\u0069\u0073\u0074\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u0020\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0009\u0009\u0009\u0046\u0069\u0065\u006c\u0064\u0055\u0074\u0069\u006c\u0073\u002e\u0077\u0072\u0069\u0074\u0065\u0046\u0069\u0065\u006c\u0064\u0028\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u002c\u0020\u0022\u006d\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u0022\u002c\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002c\u0020\u0074\u0072\u0075\u0065\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u006f\u0064\u0069\u0066\u0069\u0065\u0064\u0020\u0068\u0061\u0073\u0068\u0073\u0065\u0074\u0020\u0062\u0061\u0063\u006b\u0020\u0069\u006e\u0074\u006f\u0020\u0074\u0068\u0065\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u002e\u0022\u0029\u003b\u0020\u0020\u0009\u0009\u0009\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0074\u0072\u0075\u0065\u003b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028final \u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0065\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0052\u0065\u0066\u006c\u0065\u0063\u0074\u0069\u006f\u006e\u0020\u0069\u006e\u0074\u006f\u0020\u0061\u0063\u0074\u0069\u0076\u0065\u0020\u0063\u006c\u0069\u0065\u006e\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u0020\u0020\u0020\u0020\u0020\u0020\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u0020\u0020\u0009\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u002f\u002a */ } - public static boolean doesClassExist(String classname) { + public static boolean doesClassExist(final String classname) { boolean exists = true; try { // Load any class that should be present if driver's available Class.forName(classname); - } catch (ClassNotFoundException e) { + } catch (final ClassNotFoundException e) { // Driver is not available - exists = false; + exists = false; } return exists; } diff --git a/src/Java/gtPlusPlus/core/util/wrapper/var.java b/src/Java/gtPlusPlus/core/util/wrapper/var.java index 3e7413ed85..1b73d035bc 100644 --- a/src/Java/gtPlusPlus/core/util/wrapper/var.java +++ b/src/Java/gtPlusPlus/core/util/wrapper/var.java @@ -6,62 +6,62 @@ import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; public class var{ - - private ItemStack temp = null; - private String sanitizedName; - private String fqrn; - - public var(String o){ - String t = sanitize('<', o); - String t2 = sanitize('>', t); - sanitizedName = t2; - o = sanitize('"', t2); - fqrn = o; - } - - private String sanitize(char token, String input){ - for (int i=0;i<input.length();i++) { - if (input.charAt(i) == token) { - input = input.replace(input.charAt(i), ' '); - Utils.LOG_WARNING("MATCH FOUND"); - } - input = input.replaceAll(" ", ""); - } - String output = input; - return output; - } - - public String getFQRN(){ - String s = fqrn; - return s; - } - - public String getsanitizedName(){ - String s = sanitizedName; - return s; + + private ItemStack temp = null; + private final String sanitizedName; + private final String fqrn; + + public var(String o){ + final String t = this.sanitize('<', o); + final String t2 = this.sanitize('>', t); + this.sanitizedName = t2; + o = this.sanitize('"', t2); + this.fqrn = o; + } + + private String sanitize(final char token, String input){ + for (int i=0;i<input.length();i++) { + if (input.charAt(i) == token) { + input = input.replace(input.charAt(i), ' '); + Utils.LOG_WARNING("MATCH FOUND"); + } + input = input.replaceAll(" ", ""); } - - private ItemStack getOreDictStack(int stackSize){ - ItemStack v = ItemUtils.getItemStack(sanitizedName, stackSize); + final String output = input; + return output; + } + + public String getFQRN(){ + final String s = this.fqrn; + return s; + } + + public String getsanitizedName(){ + final String s = this.sanitizedName; + return s; + } + + private ItemStack getOreDictStack(final int stackSize){ + final ItemStack v = ItemUtils.getItemStack(this.sanitizedName, stackSize); + return v; + } + + public ItemStack getStack(final int stackSize){ + final String oreDict = "ore:"; + if (this.fqrn.toLowerCase().contains(oreDict.toLowerCase())){ + final ItemStack v = this.getOreDictStack(stackSize); return v; } - - public ItemStack getStack(int stackSize){ - String oreDict = "ore:"; - if (fqrn.toLowerCase().contains(oreDict.toLowerCase())){ - ItemStack v = getOreDictStack(stackSize); - return v; - } - String[] fqrnSplit = fqrn.split(":"); - String meta = "0"; - try { + final String[] fqrnSplit = this.fqrn.split(":"); + String meta = "0"; + try { if(fqrnSplit[2] != null){meta = fqrnSplit[2];} - temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(meta), stackSize); - } - catch (ArrayIndexOutOfBoundsException a){ - temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(meta), stackSize); - } - return temp; - } - - }
\ No newline at end of file + this.temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, this.fqrn, fqrnSplit[1], Integer.parseInt(meta), stackSize); + } + catch (final ArrayIndexOutOfBoundsException a){ + this.temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, this.fqrn, fqrnSplit[1], Integer.parseInt(meta), stackSize); + } + return this.temp; + } + +}
\ No newline at end of file |