aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/util')
-rw-r--r--src/Java/gtPlusPlus/core/util/BaseHandler.java8
-rw-r--r--src/Java/gtPlusPlus/core/util/ClassUtils.java79
-rw-r--r--src/Java/gtPlusPlus/core/util/Log.java41
-rw-r--r--src/Java/gtPlusPlus/core/util/LoggingUtils.java55
-rw-r--r--src/Java/gtPlusPlus/core/util/Quality.java87
-rw-r--r--src/Java/gtPlusPlus/core/util/Utils.java711
-rw-r--r--src/Java/gtPlusPlus/core/util/UtilsChatFormatting.java266
-rw-r--r--src/Java/gtPlusPlus/core/util/UtilsRarity.java29
-rw-r--r--src/Java/gtPlusPlus/core/util/UtilsText.java24
-rw-r--r--src/Java/gtPlusPlus/core/util/array/ArrayUtils.java16
-rw-r--r--src/Java/gtPlusPlus/core/util/array/Pair.java28
-rw-r--r--src/Java/gtPlusPlus/core/util/array/Triplet.java38
-rw-r--r--src/Java/gtPlusPlus/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java145
-rw-r--r--src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java27
-rw-r--r--src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java43
-rw-r--r--src/Java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java1700
-rw-r--r--src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java54
-rw-r--r--src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java68
-rw-r--r--src/Java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java853
-rw-r--r--src/Java/gtPlusPlus/core/util/entity/EntityUtils.java85
-rw-r--r--src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java42
-rw-r--r--src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java529
-rw-r--r--src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java69
-rw-r--r--src/Java/gtPlusPlus/core/util/item/ItemUtils.java672
-rw-r--r--src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java331
-rw-r--r--src/Java/gtPlusPlus/core/util/math/MathUtils.java372
-rw-r--r--src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java42
-rw-r--r--src/Java/gtPlusPlus/core/util/particles/EntityParticleFXMysterious.java19
-rw-r--r--src/Java/gtPlusPlus/core/util/player/PlayerCache.java261
-rw-r--r--src/Java/gtPlusPlus/core/util/player/PlayerUtils.java170
-rw-r--r--src/Java/gtPlusPlus/core/util/player/UtilsMining.java204
-rw-r--r--src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java635
-rw-r--r--src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java43
-rw-r--r--src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java43
-rw-r--r--src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java75
-rw-r--r--src/Java/gtPlusPlus/core/util/wrapper/var.java116
36 files changed, 4301 insertions, 3679 deletions
diff --git a/src/Java/gtPlusPlus/core/util/BaseHandler.java b/src/Java/gtPlusPlus/core/util/BaseHandler.java
index 63f22f3763..e8fb919ab0 100644
--- a/src/Java/gtPlusPlus/core/util/BaseHandler.java
+++ b/src/Java/gtPlusPlus/core/util/BaseHandler.java
@@ -2,10 +2,10 @@ package gtPlusPlus.core.util;
public abstract class BaseHandler {
- public abstract void preInit();
-
public abstract void init();
-
+
public abstract void postInit();
-
+
+ public abstract void preInit();
+
}
diff --git a/src/Java/gtPlusPlus/core/util/ClassUtils.java b/src/Java/gtPlusPlus/core/util/ClassUtils.java
index dfd8ec898b..e58c2f2785 100644
--- a/src/Java/gtPlusPlus/core/util/ClassUtils.java
+++ b/src/Java/gtPlusPlus/core/util/ClassUtils.java
@@ -4,65 +4,53 @@ import java.lang.reflect.*;
public class ClassUtils {
-
- /*@ if (isPresent("com.optionaldependency.DependencyClass")) {
- // This block will never execute when the dependency is not present
- // There is therefore no more risk of code throwing NoClassDefFoundException.
- executeCodeLinkingToDependency();
- }*/
- public static boolean isPresent(String className) {
- try {
- Class.forName(className);
- return true;
- } catch (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
- if (invoke){
+ 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();
}
- //full package name --------^^^^^^^^^^
- //or simpler without Class.forName:
- //Class<package1.A> c = package1.A.class;
+ // full package name --------^^^^^^^^^^
+ // or simpler without Class.forName:
+ // Class<package1.A> c = package1.A.class;
- if (null != c){
- //In our case we need to use
+ if (null != c) {
+ // In our case we need to use
Constructor<?> constructor = null;
try {
constructor = c.getDeclaredConstructor();
- } catch (NoSuchMethodException | SecurityException e) {
+ }
+ catch (NoSuchMethodException | SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- //note: getConstructor() can return only public constructors
- //so we needed to search for any Declared constructor
+ // note: getConstructor() can return only public constructors
+ // so we needed to search for any Declared constructor
- //now we need to make this constructor accessible
- if (null != constructor){
- constructor.setAccessible(true);//ABRACADABRA!
+ // now we need to make this constructor accessible
+ if (null != constructor) {
+ constructor.setAccessible(true);// ABRACADABRA!
try {
- Object o = constructor.newInstance();
+ final Object o = constructor.newInstance();
return (Class) o;
- } catch (InstantiationException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {
+ }
+ catch (InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
@@ -71,6 +59,21 @@ public class ClassUtils {
return null;
}
-
+ /*
+ * @ if (isPresent("com.optionaldependency.DependencyClass")) { // This
+ * block will never execute when the dependency is not present // There is
+ * therefore no more risk of code throwing NoClassDefFoundException.
+ * executeCodeLinkingToDependency(); }
+ */
+ public static boolean isPresent(final String className) {
+ try {
+ Class.forName(className);
+ return true;
+ }
+ catch (final Throwable ex) {
+ // Class or one of its dependencies is not present...
+ return false;
+ }
+ }
}
diff --git a/src/Java/gtPlusPlus/core/util/Log.java b/src/Java/gtPlusPlus/core/util/Log.java
index ea7076e453..460f8598dc 100644
--- a/src/Java/gtPlusPlus/core/util/Log.java
+++ b/src/Java/gtPlusPlus/core/util/Log.java
@@ -3,27 +3,22 @@ package gtPlusPlus.core.util;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public final class Log
-{
- public static final Logger LOGGER = LogManager.getLogger("MiscUtils");
-
- public static void warn(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 final class Log {
+ public static final Logger LOGGER = LogManager.getLogger("MiscUtils");
+
+ public static void debug(final String msg) {
+ Log.LOGGER.debug(msg);
+ }
+
+ public static void error(final String msg) {
+ Log.LOGGER.error(msg);
+ }
+
+ public static void info(final String msg) {
+ Log.LOGGER.info(msg);
+ }
+
+ public static void warn(final String msg) {
+ Log.LOGGER.warn(msg);
+ }
}
diff --git a/src/Java/gtPlusPlus/core/util/LoggingUtils.java b/src/Java/gtPlusPlus/core/util/LoggingUtils.java
index 607771bc8e..ffae71c40d 100644
--- a/src/Java/gtPlusPlus/core/util/LoggingUtils.java
+++ b/src/Java/gtPlusPlus/core/util/LoggingUtils.java
@@ -5,47 +5,48 @@ import java.util.Date;
public class LoggingUtils {
- public static void profileLog(Object o){
- try {
+ public static boolean logCurrentSystemTime(final String message) {
+ final Date date = new Date(System.currentTimeMillis());
+ try {
+ LoggingUtils.profileLog(message + " | " + date.toString());
+ return true;
+ }
+ catch (final Throwable r) {
+ return false;
+ }
+
+ }
+
+ 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){
+ }
+ 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;
- }
-
}
-
+
}
diff --git a/src/Java/gtPlusPlus/core/util/Quality.java b/src/Java/gtPlusPlus/core/util/Quality.java
index 1ce29c7a58..50d1b9fc90 100644
--- a/src/Java/gtPlusPlus/core/util/Quality.java
+++ b/src/Java/gtPlusPlus/core/util/Quality.java
@@ -4,56 +4,65 @@ 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),
- MAGIC("Magic", EnumChatFormatting.BLUE),
- RARE("Rare", EnumChatFormatting.YELLOW),
- UNIQUE("Unique", EnumChatFormatting.GOLD),
- ARTIFACT("Artifact", EnumChatFormatting.AQUA),
- SET("Set Piece", EnumChatFormatting.GREEN),
- TRADEOFF("Trade-off", EnumChatFormatting.DARK_RED),
- EPIC("Epic", EnumChatFormatting.LIGHT_PURPLE);
-
- private String LOOT;
- private EnumChatFormatting COLOUR;
- private Quality (final String lootTier, final EnumChatFormatting tooltipColour)
- {
+
+ POOR("Poor", EnumChatFormatting.GRAY), COMMON("Common", EnumChatFormatting.WHITE), UNCOMMON("Uncommon",
+ EnumChatFormatting.DARK_GREEN), MAGIC("Magic", EnumChatFormatting.BLUE), RARE("Rare",
+ EnumChatFormatting.YELLOW), UNIQUE("Unique", EnumChatFormatting.GOLD), ARTIFACT("Artifact",
+ EnumChatFormatting.AQUA), SET("Set Piece", EnumChatFormatting.GREEN), TRADEOFF("Trade-off",
+ EnumChatFormatting.DARK_RED), EPIC("Epic", EnumChatFormatting.LIGHT_PURPLE);
+
+ public static Quality getRandomQuality() {
+ 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;
+ }
+ }
+ private String LOOT;
+
+ private EnumChatFormatting COLOUR;
+
+ private Quality(final String lootTier, final EnumChatFormatting tooltipColour) {
this.LOOT = lootTier;
this.COLOUR = tooltipColour;
}
- public String getQuality() {
- return LOOT;
+ public String formatted() {
+ return this.COLOUR + this.LOOT;
}
-
- protected EnumChatFormatting getColour(){
- return COLOUR;
- }
-
- public String formatted(){
- return this.COLOUR+this.LOOT;
+
+ protected EnumChatFormatting getColour() {
+ return this.COLOUR;
}
-
- public static Quality getRandomQuality(){
- 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;
+
+ public String getQuality() {
+ return this.LOOT;
}
}
-
-
diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java
index 03d3d68044..e65e0f2ea9 100644
--- a/src/Java/gtPlusPlus/core/util/Utils.java
+++ b/src/Java/gtPlusPlus/core/util/Utils.java
@@ -31,207 +31,274 @@ import net.minecraftforge.oredict.OreDictionary;
public class Utils {
- public static final int WILDCARD_VALUE = Short.MAX_VALUE;
-
- public static final boolean isServer(){
- return FMLCommonHandler.instance().getEffectiveSide().isServer();
- }
-
static class ShortTimerTask extends TimerTask {
@Override
public void run() {
Utils.LOG_WARNING("Timer expired.");
}
}
-
- public static boolean isModUpToDate(){
-
- if (CORE.MASTER_VERSION.equals(CORE.VERSION.toLowerCase())){
- return true;
- }
+
+ public static final int WILDCARD_VALUE = Short.MAX_VALUE;
+
+ private static short cellID = 15;
+
+ public static Integer appenedHexNotationToInteger(final int hexAsStringOrInt) {
+ final String hexChar = "0x";
+ String result;
+ Utils.LOG_INFO(String.valueOf(hexAsStringOrInt));
+ result = hexChar + String.valueOf(hexAsStringOrInt);
+ return Integer.getInteger(result);
+ }
+
+ public static String appenedHexNotationToString(final Object hexAsStringOrInt) {
+ final String hexChar = "0x";
+ String result;
+ if (hexAsStringOrInt.getClass() == String.class) {
+
+ if (((String) hexAsStringOrInt).length() != 6) {
+ final String temp = Utils.leftPadWithZeroes((String) hexAsStringOrInt, 6);
+ result = temp;
+ }
+ result = hexChar + hexAsStringOrInt;
+ return result;
+ }
+ else if (hexAsStringOrInt.getClass() == Integer.class) {
+ ;
+ if (((String) hexAsStringOrInt).length() != 6) {
+ final String temp = Utils.leftPadWithZeroes((String) hexAsStringOrInt, 6);
+ result = temp;
+ }
+ result = hexChar + String.valueOf(hexAsStringOrInt);
+ return result;
+ }
+ else {
+ return null;
+ }
+ }
+
+ public static String byteToHex(final byte b) {
+ final int i = b & 0xFF;
+ return Integer.toHexString(i);
+ }
+
+ public static String checkCorrectMiningToolForBlock(final Block currentBlock, final World currentWorld) {
+ String correctTool = "";
+ if (!currentWorld.isRemote) {
+ try {
+ correctTool = currentBlock.getHarvestTool(0);
+ Utils.LOG_WARNING(correctTool);
+
+ }
+ catch (final NullPointerException e) {
+
+ }
+ }
+
+ return correctTool;
+ }
+
+ public static boolean containsMatch(final boolean strict, final ItemStack[] inputs, final ItemStack... targets) {
+ for (final ItemStack input : inputs) {
+ for (final ItemStack target : targets) {
+ if (Utils.itemMatches(target, input, strict)) {
+ return true;
+ }
+ }
+ }
return false;
}
-
- public static TC_AspectStack getTcAspectStack (TC_Aspects aspect, long size){
- return getTcAspectStack(aspect.name(), (int) size);
+
+ public static List<Object> convertArrayListToList(final ArrayList sourceArray) {
+ final List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray));
+ return targetList;
+ }
+
+ public static List<Object> convertArrayToFixedSizeList(final Object[] sourceArray) {
+ final List<Object> targetList = Arrays.asList(sourceArray);
+ return targetList;
+ }
+
+ public static List<Object> convertArrayToList(final Object[] sourceArray) {
+ final List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray));
+ return targetList;
+ }
+
+ public static Object[] convertListToArray(final List<Object> sourceList) {
+ final Object[] targetArray = sourceList.toArray(new Object[sourceList.size()]);
+ return targetArray;
+ }
+
+ public static ItemStack createInternalNameAndFluidCell(final String s) {
+ Utils.LOG_WARNING("1");
+ final InternalName yourName = EnumHelper.addEnum(InternalName.class, s, new Class[0], new Object[0]);
+ Utils.LOG_WARNING("2 " + yourName.name());
+ final ItemCell item = (ItemCell) Ic2Items.cell.getItem();
+ Utils.LOG_WARNING("3 " + item.getUnlocalizedName());
+ try {
+ Utils.LOG_WARNING("4");
+ final Class<? extends ItemCell> clz = item.getClass();
+ Utils.LOG_WARNING("5 " + clz.getSimpleName());
+ 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());
+ final ItemStack temp = (ItemStack) methode.invoke(item, Utils.cellID++, yourName, new Block[0]);
+ Utils.LOG_INFO("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 (final Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static boolean doesEntryExistAlreadyInOreDictionary(final String OreDictName) {
+ if (OreDictionary.getOres(OreDictName).size() != 0) {
+ return true;
+ }
+ return false;
}
-
- public static TC_AspectStack getTcAspectStack (String aspect, long size){
- return getTcAspectStack(aspect, (int) size);
+
+ public static ToolMaterial generateMaterialFromGT(final Materials gtMaterial) {
+ final String name = gtMaterial.name();
+ 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 TC_AspectStack getTcAspectStack (TC_Aspects aspect, int size){
- return getTcAspectStack(aspect.name(), size);
+ /**
+ * Returns a Liquid Stack with given amount of IC2Steam.
+ */
+ public static FluidStack getIC2Steam(final long aAmount) {
+ return FluidRegistry.getFluidStack("ic2steam", (int) aAmount);
}
-
- public static TC_AspectStack getTcAspectStack (String aspect, int size){
+
+ public static TC_AspectStack getTcAspectStack(final String aspect, final int size) {
TC_AspectStack returnValue = null;
- if (aspect.toUpperCase() == "COGNITIO"){
- //Adds in Compat for older GT Versions which Misspell aspects.
+ if (aspect.toUpperCase() == "COGNITIO") {
+ // Adds in Compat for older GT Versions which Misspell aspects.
try {
- if (EnumUtils.isValidEnum(TC_Aspects.class, "COGNITIO")){
- Utils.LOG_WARNING("TC Aspect found - "+aspect);
+ if (EnumUtils.isValidEnum(TC_Aspects.class, "COGNITIO")) {
+ Utils.LOG_WARNING("TC Aspect found - " + aspect);
returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITIO"), size);
}
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");
+ 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() == "EXANIMUS"){
- //Adds in Compat for older GT Versions which Misspell aspects.
+ else if (aspect.toUpperCase() == "EXANIMUS") {
+ // 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);
+ if (EnumUtils.isValidEnum(TC_Aspects.class, "EXANIMUS")) {
+ Utils.LOG_WARNING("TC Aspect found - " + aspect);
returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXANIMUS"), size);
}
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");
+ 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() == "PRAECANTATIO"){
- //Adds in Compat for older GT Versions which Misspell aspects.
+ else if (aspect.toUpperCase() == "PRAECANTATIO") {
+ // 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);
+ if (EnumUtils.isValidEnum(TC_Aspects.class, "PRAECANTATIO")) {
+ Utils.LOG_WARNING("TC Aspect found - " + aspect);
returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTATIO"), size);
}
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");
+ 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);
+ Utils.LOG_WARNING("TC Aspect found - " + aspect);
returnValue = new TC_AspectStack(TC_Aspects.valueOf(aspect), size);
}
return returnValue;
}
- public static boolean containsMatch(boolean strict, ItemStack[] inputs, ItemStack... targets)
- {
- for (ItemStack input : inputs)
- {
- for (ItemStack target : targets)
- {
- if (itemMatches(target, input, strict))
- {
- return true;
- }
- }
- }
- return false;
- }
-
- public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict)
- {
- if (input == null || target == null)
- {
- return false;
- }
- return (target.getItem() == input.getItem() && ((target.getItemDamage() == WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage()));
- }
-
- //Non-Dev Comments
- public static void LOG_INFO(String s){
- //if (CORE.DEBUG){
- FMLLog.info("GT++: "+s);
- //}
- }
-
- //Developer Comments
- public static void LOG_WARNING(String s){
- if (CORE.DEBUG){
- FMLLog.warning("GT++: "+s);
- }
- }
+ /*
+ * public static void recipeBuilderBlock(ItemStack slot_1, ItemStack slot_2,
+ * ItemStack slot_3, ItemStack slot_4, ItemStack slot_5, ItemStack slot_6,
+ * ItemStack slot_7, ItemStack slot_8, ItemStack slot_9, Block resultBlock){
+ * GameRegistry.addRecipe(new ItemStack(resultBlock), new Object[] {"ABC",
+ * "DEF", "GHI", 'A',slot_1,'B',slot_2,'C',slot_3,
+ * 'D',slot_4,'E',slot_5,'F',slot_6, 'G',slot_7,'H',slot_8,'I',slot_9 }); }
+ */
- //Errors
- public static void LOG_ERROR(String s){
- if (CORE.DEBUG){
- FMLLog.severe("GT++: "+s);
- }
+ public static TC_AspectStack getTcAspectStack(final String aspect, final long size) {
+ return Utils.getTcAspectStack(aspect, (int) size);
}
- //Developer Logger
- public static void LOG_SPECIFIC_WARNING(String whatToLog, String msg, int line){
- if (CORE.DEBUG){
- FMLLog.warning("GT++ |"+line+"| "+whatToLog+" | "+msg);
- }
+ public static TC_AspectStack getTcAspectStack(final TC_Aspects aspect, final int size) {
+ return Utils.getTcAspectStack(aspect.name(), size);
}
- public static void paintBox(Graphics g, int MinA, int MinB, int MaxA, int MaxB){
- g.drawRect (MinA, MinB, MaxA, MaxB);
+ public static TC_AspectStack getTcAspectStack(final TC_Aspects aspect, final long size) {
+ return Utils.getTcAspectStack(aspect.name(), (int) size);
}
/**
- * Returns if that Liquid is IC2Steam.
+ *
+ * @param colourInt
+ * e.g. 0XFFFFFF
+ * @return Colour
*/
- public static boolean isIC2Steam(FluidStack aFluid) {
- if (aFluid == null) return false;
- return aFluid.isFluidEqual(getIC2Steam(1));
+ public static Color hex2Rgb(final int colourInt) {
+ return Color.decode(String.valueOf(colourInt));
}
/**
- * Returns a Liquid Stack with given amount of IC2Steam.
+ *
+ * @param colourStr
+ * e.g. "#FFFFFF"
+ * @return
*/
- public static FluidStack getIC2Steam(long aAmount) {
- return FluidRegistry.getFluidStack("ic2steam", (int)aAmount);
- }
-
-
-
- /*public static void recipeBuilderBlock(ItemStack slot_1, ItemStack slot_2, ItemStack slot_3, ItemStack slot_4, ItemStack slot_5, ItemStack slot_6, ItemStack slot_7, ItemStack slot_8, ItemStack slot_9, Block resultBlock){
- GameRegistry.addRecipe(new ItemStack(resultBlock),
- new Object[] {"ABC", "DEF", "GHI",
- 'A',slot_1,'B',slot_2,'C',slot_3,
- 'D',slot_4,'E',slot_5,'F',slot_6,
- 'G',slot_7,'H',slot_8,'I',slot_9
- });
- }*/
-
- public static String checkCorrectMiningToolForBlock(Block currentBlock, World currentWorld){
- String correctTool = "";
- if (!currentWorld.isRemote){
- try {
- correctTool = currentBlock.getHarvestTool(0);
- Utils.LOG_WARNING(correctTool);
-
- } catch (NullPointerException e){
-
- }
- }
-
- return correctTool;
+ public static Color hex2Rgb(final String colorStr) {
+ return new Color(Integer.valueOf(colorStr.substring(1, 3), 16), Integer.valueOf(colorStr.substring(3, 5), 16),
+ Integer.valueOf(colorStr.substring(5, 7), 16));
}
/**
- *
- * @param colourStr e.g. "#FFFFFF"
+ *
+ * @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),
- Integer.valueOf(hexString.substring(5, 7), 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(",");
@@ -241,256 +308,162 @@ public class Utils {
sb.append(")");
return sb.toString();
}
-
- /**
- *
- * @param colourStr e.g. "#FFFFFF"
- * @return
- */
- public static Color hex2Rgb(String colorStr) {
- return new Color(
- Integer.valueOf( colorStr.substring( 1, 3 ), 16 ),
- Integer.valueOf( colorStr.substring( 3, 5 ), 16 ),
- Integer.valueOf( colorStr.substring( 5, 7 ), 16 ) );
- }
-
- /**
- *
- * @param colourInt e.g. 0XFFFFFF
- * @return Colour
- */
- public static Color hex2Rgb(int colourInt) {
- return Color.decode(String.valueOf(colourInt));
- }
-
+
/**
- *
- * @param colourInt e.g. 0XFFFFFF
+ *
+ * @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) {
- Timer timer;
- timer = new Timer();
- timer.schedule(new ShortTimerTask(), seconds * 1000);
- return timer;
- }
-
- public static String byteToHex(byte b) {
- int i = b & 0xFF;
- return Integer.toHexString(i);
+ /*
+ * Original Code by Chandana Napagoda -
+ * https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator.
+ * html
+ */
+ public static Map<Integer, String> hexColourGenerator(final int colorCount) {
+ final int maxColorValue = 16777215;
+ // this is decimal value of the "FFFFFF"
+ final int devidedvalue = maxColorValue / colorCount;
+ int countValue = 0;
+ final HashMap<Integer, String> hexColorMap = new HashMap<Integer, String>();
+ for (int a = 0; a < colorCount && maxColorValue >= countValue; a++) {
+ if (a != 0) {
+ countValue += devidedvalue;
+ hexColorMap.put(a, Integer.toHexString(0x10000 | countValue).substring(1).toUpperCase());
+ }
+ else {
+ hexColorMap.put(a, Integer.toHexString(0x10000 | countValue).substring(1).toUpperCase());
+ }
+ }
+ return hexColorMap;
}
- public static Object[] convertListToArray(List<Object> sourceList) {
- Object[] targetArray = sourceList.toArray(new Object[sourceList.size()]);
- return targetArray;
+ /*
+ * Original Code by Chandana Napagoda -
+ * https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator.
+ * html
+ */
+ public static Map<Integer, String> hexColourGeneratorRandom(final int colorCount) {
+ final HashMap<Integer, String> hexColorMap = new HashMap<Integer, String>();
+ for (int a = 0; a < colorCount; a++) {
+ String code = "" + (int) (Math.random() * 256);
+ code = code + code + code;
+ final int i = Integer.parseInt(code);
+ hexColorMap.put(a, Integer.toHexString(0x1000000 | i).substring(1).toUpperCase());
+ Utils.LOG_INFO("" + Integer.toHexString(0x1000000 | i).substring(1).toUpperCase());
+ }
+ return hexColorMap;
}
- public static List<Object> convertArrayToFixedSizeList(Object[] sourceArray) {
- List<Object> targetList = Arrays.asList(sourceArray);
- return targetList;
+ public static boolean invertBoolean(final boolean booleans) {
+ if (booleans == true) {
+ return false;
+ }
+ return true;
}
- public static List<Object> convertArrayToList(Object[] sourceArray) {
- List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray));
- return targetList;
- }
-
- public static List<Object> convertArrayListToList(ArrayList sourceArray) {
- List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray));
- return targetList;
+ /**
+ * Returns if that Liquid is IC2Steam.
+ */
+ public static boolean isIC2Steam(final FluidStack aFluid) {
+ if (aFluid == null) {
+ return false;
+ }
+ return aFluid.isFluidEqual(Utils.getIC2Steam(1));
}
- public static void spawnCustomParticle(Entity entity){
- GTplusplus.proxy.generateMysteriousParticles(entity);
- }
+ public static boolean isModUpToDate() {
- public static void spawnFX(World world, int x, int y, int z, String particleName, Object particleName2){
- if (!world.isRemote){
- 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;
-
- if (l == 1)
- {
- world.spawnParticle(particleName, d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
- }
- else if (l == 2)
- {
- world.spawnParticle((String) particleName2, d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
- }
- else if (l == 3)
- {
- world.spawnParticle(particleName, d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
- }
- else if (l == 4)
- {
- world.spawnParticle((String) particleName2, d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
- }
- else
- {
- world.spawnParticle(particleName, d0, d1, d2, 0.0D, 0.0D, 0.0D);
- if (particleName2 != null){
- world.spawnParticle((String) particleName2, d0, d1, d2, 0.0D, 0.0D, 0.0D);
- }
- }
+ if (CORE.MASTER_VERSION.equals(CORE.VERSION.toLowerCase())) {
+ return true;
}
+ return false;
}
- public static int rgbtoHexValue(int r, int g, 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();
+ public static final boolean isServer() {
+ return FMLCommonHandler.instance().getEffectiveSide().isServer();
+ }
- //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)+".");
- return Integer.decode(temp);
+ public static boolean itemMatches(final ItemStack target, final ItemStack input, final boolean strict) {
+ if (input == null || target == null) {
+ return false;
+ }
+ return target.getItem() == input.getItem() && (target.getItemDamage() == Utils.WILDCARD_VALUE && !strict
+ || target.getItemDamage() == input.getItemDamage());
}
/*
* http://javadevnotes.com/java-left-pad-string-with-zeros-examples
*/
- public static String leftPadWithZeroes(String originalString, int length) {
- StringBuilder sb = new StringBuilder();
+ 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;
- // this is decimal value of the "FFFFFF"
- int devidedvalue = maxColorValue/colorCount;
- int countValue = 0;
- HashMap<Integer, String> hexColorMap = new HashMap<Integer, String>();
- for(int a=0; a < colorCount && maxColorValue >= countValue ; a++){
- if(a != 0){
- countValue+=devidedvalue;
- hexColorMap.put(a,Integer.toHexString( 0x10000 | countValue).substring(1).toUpperCase());
- }
- else {
- hexColorMap.put(a,Integer.toHexString( 0x10000 | countValue).substring(1).toUpperCase());
- }
+ // Errors
+ public static void LOG_ERROR(final String s) {
+ if (CORE.DEBUG) {
+ FMLLog.severe("GT++: " + s);
}
- return hexColorMap;
}
- /*
- * 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>();
- for(int a=0;a < colorCount; a++){
- String code = ""+(int)(Math.random()*256);
- code = code+code+code;
- int i = Integer.parseInt(code);
- hexColorMap.put(a,Integer.toHexString( 0x1000000 | i).substring(1).toUpperCase());
- Utils.LOG_INFO(""+Integer.toHexString( 0x1000000 | i).substring(1).toUpperCase());
- }
- return hexColorMap;
+ // Non-Dev Comments
+ public static void LOG_INFO(final String s) {
+ // if (CORE.DEBUG){
+ FMLLog.info("GT++: " + s);
+ // }
}
- public static String appenedHexNotationToString(Object hexAsStringOrInt){
- String hexChar = "0x";
- String result;
- if (hexAsStringOrInt.getClass() == String.class){
-
- if (((String) hexAsStringOrInt).length() != 6){
- String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6);
- result = temp;
- }
- result = hexChar+hexAsStringOrInt;
- return result;
+ // Developer Logger
+ public static void LOG_SPECIFIC_WARNING(final String whatToLog, final String msg, final int line) {
+ if (CORE.DEBUG) {
+ FMLLog.warning("GT++ |" + line + "| " + whatToLog + " | " + msg);
}
- else if (hexAsStringOrInt.getClass() == Integer.class){
- ;
- if (((String) hexAsStringOrInt).length() != 6){
- String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6);
- result = temp;
- }
- result = hexChar+String.valueOf(hexAsStringOrInt);
- return result;
- }
- else {
- return null;
- }
- }
-
- public static Integer appenedHexNotationToInteger(int hexAsStringOrInt){
- String hexChar = "0x";
- String result;
- Utils.LOG_INFO(String.valueOf(hexAsStringOrInt));
- result = hexChar+String.valueOf(hexAsStringOrInt);
- return Integer.getInteger(result);
}
- public static boolean doesEntryExistAlreadyInOreDictionary(String OreDictName){
- if (OreDictionary.getOres(OreDictName).size() != 0) {
- return true;
+ // Developer Comments
+ public static void LOG_WARNING(final String s) {
+ if (CORE.DEBUG) {
+ FMLLog.warning("GT++: " + s);
}
- return false;
}
- public static boolean invertBoolean(boolean booleans){
- if (booleans == true){
- return false;
- }
- return true;
+ 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);
}
- private static short cellID = 15;
- public static ItemStack createInternalNameAndFluidCell(String s){
- Utils.LOG_WARNING("1");
- 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();
- Utils.LOG_WARNING("3 "+item.getUnlocalizedName());
- try
- {
- Utils.LOG_WARNING("4");
- Class<? extends ItemCell> clz = item.getClass();
- Utils.LOG_WARNING("5 "+clz.getSimpleName());
- 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]);
- Utils.LOG_INFO("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){
- e.printStackTrace();
+ 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;
}
- return null;
+ 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);
+ 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 String sanitizeString(String input){
+
+ public static String sanitizeString(final String input) {
String temp;
String output;
-
+
temp = input.replace(" ", "");
temp = temp.replace("-", "");
temp = temp.replace("_", "");
@@ -505,24 +478,54 @@ public class Utils {
temp = temp.replace("[", "");
temp = temp.replace("]", "");
temp = temp.replace(" ", "");
- output = temp;
+ output = temp;
return output;
-
- }
-
- public static ToolMaterial generateMaterialFromGT(Materials gtMaterial){
- String name = gtMaterial.name();
- 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);
- return temp;
-
+
}
+ public static Timer ShortTimer(final int seconds) {
+ Timer timer;
+ timer = new Timer();
+ timer.schedule(new ShortTimerTask(), seconds * 1000);
+ return timer;
+ }
-}
+ public static void spawnCustomParticle(final Entity entity) {
+ GTplusplus.proxy.generateMysteriousParticles(entity);
+ }
+ public static void spawnFX(final World world, final int x, final int y, final int z, final String particleName,
+ Object particleName2) {
+ if (!world.isRemote) {
+ if (particleName2 == null || particleName2.equals("")) {
+ particleName2 = particleName;
+ }
+ 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) {
+ world.spawnParticle(particleName, d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
+ }
+ else if (l == 2) {
+ world.spawnParticle((String) particleName2, d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
+ }
+ else if (l == 3) {
+ world.spawnParticle(particleName, d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
+ }
+ else if (l == 4) {
+ world.spawnParticle((String) particleName2, d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
+ }
+ else {
+ world.spawnParticle(particleName, d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ if (particleName2 != null) {
+ world.spawnParticle((String) particleName2, d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ }
+ }
+ }
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/util/UtilsChatFormatting.java b/src/Java/gtPlusPlus/core/util/UtilsChatFormatting.java
index 51589a1f5d..38fa9eeca9 100644
--- a/src/Java/gtPlusPlus/core/util/UtilsChatFormatting.java
+++ b/src/Java/gtPlusPlus/core/util/UtilsChatFormatting.java
@@ -6,148 +6,126 @@ import java.util.regex.Pattern;
import cpw.mods.fml.relauncher.Side;
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
- 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);
- }
- }
+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]");
+ static {
+ final UtilsChatFormatting[] var0 = UtilsChatFormatting.values();
+ final int var1 = var0.length;
+
+ for (int var2 = 0; var2 < var1; ++var2) {
+ final UtilsChatFormatting var3 = var0[var2];
+ UtilsChatFormatting.formattingCodeMapping.put(Character.valueOf(var3.getFormattingCode()), var3);
+ UtilsChatFormatting.nameMapping.put(var3.getFriendlyName(), var3);
+ }
+ }
+ /**
+ * 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
+ : UtilsChatFormatting.formattingCodePattern.matcher(p_110646_0_).replaceAll("");
+ }
+ /**
+ * 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<String>();
+ final UtilsChatFormatting[] aenumchatformatting = UtilsChatFormatting.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;
+ }
+
+ /**
+ * 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) UtilsChatFormatting.nameMapping.get(p_96300_0_.toLowerCase());
+ }
+
+ /** 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;
+ }
+
+ /**
+ * Gets the friendly name of this value.
+ */
+ public String getFriendlyName() {
+ return this.name().toLowerCase();
+ }
+
+ /**
+ * Checks if typo is a color.
+ */
+ public boolean isColor() {
+ return !this.fancyStyling && this != RESET;
+ }
+
+ /**
+ * False if this is just changing the color or resetting; true otherwise.
+ */
+ public boolean isFancyStyling() {
+ return this.fancyStyling;
+ }
+
+ @Override
+ public String toString() {
+ return this.controlString;
+ }
} \ 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..1eed211613 100644
--- a/src/Java/gtPlusPlus/core/util/UtilsRarity.java
+++ b/src/Java/gtPlusPlus/core/util/UtilsRarity.java
@@ -2,22 +2,17 @@ package gtPlusPlus.core.util;
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;
+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");
- 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..0db7dd35a2 100644
--- a/src/Java/gtPlusPlus/core/util/UtilsText.java
+++ b/src/Java/gtPlusPlus/core/util/UtilsText.java
@@ -2,31 +2,17 @@ package gtPlusPlus.core.util;
public enum UtilsText {
- blue('1'),
- green('2'),
- teal('3'),
- maroon('4'),
- purple('5'),
- orange('6'),
- lightGray('7'),
- darkGray('8'),
- lightBlue('9'),
- black('0'),
- lime('a'),
- aqua('b'),
- red('c'),
- pink('d'),
- yellow('e'),
- white('f');
+ blue('1'), green('2'), teal('3'), maroon('4'), purple('5'), orange('6'), lightGray('7'), darkGray('8'), lightBlue(
+ '9'), black('0'), lime('a'), aqua('b'), red('c'), pink('d'), yellow('e'), 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..0d78c76681 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) {
- Object[] series = someArray;
- series = addElement(series, newValueToAdd);
+ private static Object[] addElement(Object[] series, final Object newValueToAdd) {
+ series = Arrays.copyOf(series, series.length + 1);
+ series[series.length - 1] = newValueToAdd;
+ return series;
}
- private static Object[] addElement(Object[] series, Object newValueToAdd) {
- series = Arrays.copyOf(series, series.length + 1);
- series[series.length - 1] = newValueToAdd;
- return series;
+ public static void expandArray(final Object[] someArray, final Object newValueToAdd) {
+ Object[] series = someArray;
+ series = ArrayUtils.addElement(series, newValueToAdd);
}
-
+
}
diff --git a/src/Java/gtPlusPlus/core/util/array/Pair.java b/src/Java/gtPlusPlus/core/util/array/Pair.java
index 94437e6779..45c6aacc23 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 Pair(final K key, 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;
- }
-
- final public V getValue(){
- return value;
- }
+
+ final public K getKey() {
+ return this.key;
+ }
+
+ final public V getValue() {
+ 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..7882c2f13a 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;
- private final C count;
-
- public Triplet(final K key, final V value, final C value2){
+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;
- }
-
- final public V getValue(){
- return value;
- }
-
- final public C getSecondValue(){
- return count;
- }
+
+ final public K getKey() {
+ return this.key;
+ }
+
+ final public C getSecondValue() {
+ return this.count;
+ }
+
+ final public V getValue() {
+ return this.value;
+ }
} \ 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..1f90697e52 100644
--- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java
+++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java
@@ -11,95 +11,67 @@ 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) {
- return new DEBUG_BLOCK_ShapeSpawner(this.mName);
- }
-
-
- public String[] getDescription() {
- return new String[]{
- "Controller Block for the Testing",
- "Create the shapes for Multiblocks.",};
- }
-
-
- @Override
- public ITexture[] getTexture(IGregTechTileEntity arg0, byte arg1,
- byte arg2, byte arg3, boolean arg4, boolean arg5) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean isCorrectMachinePart(ItemStack aStack) {
- // TODO Auto-generated method stub
- return false;
- }
+ public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
- @Override
- public boolean checkRecipe(ItemStack aStack) {
- // TODO Auto-generated method stub
- return false;
- }
+ final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- @Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
-
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
-
if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) {
return false;
}
-
+
int 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+"]");
- break;
-
- case 1:
- stepX--;
- 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 + "]");
+ break;
+
+ case 1:
+ stepX--;
+ 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+"]");
- break;
-
- case 1:
- 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 + "]");
+ break;
+
+ case 1:
+ 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("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,33 +79,64 @@ public class DEBUG_BLOCK_ShapeSpawner extends DEBUG_MULTIBLOCK_ShapeSpawner {
}
@Override
- public int getMaxEfficiency(ItemStack aStack) {
+ public boolean checkRecipe(final ItemStack aStack) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
// TODO Auto-generated method stub
return 0;
}
@Override
- public int getPollutionPerTick(ItemStack aStack) {
+ public int getDamageToComponent(final ItemStack aStack) {
// TODO Auto-generated method stub
return 0;
}
@Override
- public int getDamageToComponent(ItemStack aStack) {
+ public String[] getDescription() {
+ return new String[] {
+ "Controller Block for the Testing", "Create the shapes for Multiblocks.",
+ };
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
// TODO Auto-generated method stub
return 0;
}
@Override
- public int getAmountOfOutputs() {
+ public int getPollutionPerTick(final ItemStack aStack) {
// TODO Auto-generated method stub
return 0;
}
@Override
- public boolean explodesOnComponentBreak(ItemStack aStack) {
+ 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(final ItemStack aStack) {
// TODO Auto-generated method stub
return false;
}
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new DEBUG_BLOCK_ShapeSpawner(this.mName);
+ }
+
}
diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java
index 8f120eb481..048b9cc8e8 100644
--- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java
+++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java
@@ -10,34 +10,33 @@ import net.minecraftforge.common.MinecraftForge;
public class DEBUG_INIT {
- public static void registerBlocks(){
- //Debug Loading
- if (CORE.DEBUG){
+ public static void registerBlocks() {
+ // Debug Loading
+ if (CORE.DEBUG) {
}
}
- public static void registerItems(){
- ModItems.itemDebugShapeSpawner = new DEBUG_ITEM_ShapeSpawner("itemDebugShapeSpawner", AddToCreativeTab.tabMisc, 1, 500);
+ public static void registerHandlers() {
+ MinecraftForge.EVENT_BUS.register(new DEBUG_ScreenOverlay());
+ }
+
+ public static void registerItems() {
+ ModItems.itemDebugShapeSpawner = new DEBUG_ITEM_ShapeSpawner("itemDebugShapeSpawner", AddToCreativeTab.tabMisc,
+ 1, 500);
GameRegistry.registerItem(ModItems.itemDebugShapeSpawner, "itemDebugShapeSpawner");
ModItems.itemBedLocator_Base = new BedLocator_Base("itemBedLocator_Base");
- GameRegistry.registerItem(ModItems.itemBedLocator_Base, "itemBedLocator_Base");
+ GameRegistry.registerItem(ModItems.itemBedLocator_Base, "itemBedLocator_Base");
ModItems.itemBaseItemWithCharge = new BaseItemWithCharge("itemBaseItemWithCharge", 0, 1000);
GameRegistry.registerItem(ModItems.itemBaseItemWithCharge, "itemBaseItemWithCharge");
}
- public static void registerTEs(){
+ public static void registerMisc() {
}
- public static void registerMisc(){
-
-
-
- }
+ public static void registerTEs() {
- public static void registerHandlers(){
- 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 d5073d274e..7257986e99 100644
--- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java
+++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java
@@ -15,7 +15,7 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
-public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric{
+public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric {
public DEBUG_ITEM_ShapeSpawner(String s, CreativeTabs c, int stackSize, int maxDmg) {
super(s, c, stackSize, maxDmg);
@@ -25,31 +25,32 @@ public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric{
maxDmg = 500;
}
+ @SuppressWarnings({
+ "unchecked", "rawtypes"
+ })
@Override
- public ItemStack onItemRightClick(ItemStack stack, World world, 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();
+ 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);
+ }
+
+ @Override
+ 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");
+ 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)
- {
- if (event.isCanceled() || event.world.isRemote || event.action != RIGHT_CLICK_BLOCK) return;
+ public void playerInteractEventHandler(final PlayerInteractEvent event) {
+ 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) {
- 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 1deec8b441..fc61878ffe 100644
--- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java
+++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java
@@ -1,7 +1,5 @@
package gtPlusPlus.core.util.debug;
-import static gregtech.api.enums.GT_Values.V;
-
import java.util.ArrayList;
import gregtech.GT_Mod;
@@ -26,768 +24,938 @@ 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 static boolean isValidMetaTileEntity(final MetaTileEntity aMetaTileEntity) {
+ return aMetaTileEntity.getBaseMetaTileEntity() != null
+ && aMetaTileEntity.getBaseMetaTileEntity().getMetaTileEntity() == aMetaTileEntity
+ && !aMetaTileEntity.getBaseMetaTileEntity().isDead();
+ }
+ 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(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 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 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 addEnergyOutput(final long aEU) {
+ if (aEU <= 0) {
+ return true;
+ }
+ for (final GT_MetaTileEntity_Hatch_Dynamo tHatch : this.mDynamoHatches) {
+ if (DEBUG_MULTIBLOCK_ShapeSpawner.isValidMetaTileEntity(tHatch)) {
+ if (tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(aEU, false)) {
+ return 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
+ && DEBUG_MULTIBLOCK_ShapeSpawner.isValidMetaTileEntity(this.mOutputHatches.get(i))) {
+ this.mOutputHatches.get(i).fill(mOutputFluids2[i], true);
+ }
+ }
+
+ }
+
+ 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 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 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 addOutput(final FluidStack aLiquid) {
+ if (aLiquid == null) {
+ return false;
+ }
+ final FluidStack tLiquid = aLiquid.copy();
+ for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) {
+ if (DEBUG_MULTIBLOCK_ShapeSpawner.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;
+ }
+
+ 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 (DEBUG_MULTIBLOCK_ShapeSpawner.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 (DEBUG_MULTIBLOCK_ShapeSpawner.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 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;
+ }
+
+ 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;
+ }
+
+ @Override
+ public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aCoverID) {
+ return aSide != this.getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @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;
+ }
+
+ /**
+ * Checks the Machine. You have to assign the MetaTileEntities for the
+ * Hatches here.
+ */
+ public abstract boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack);
+
+ /**
+ * Checks the Recipe
+ */
+ public abstract boolean checkRecipe(ItemStack aStack);
+
+ 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 (DEBUG_MULTIBLOCK_ShapeSpawner.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 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 (DEBUG_MULTIBLOCK_ShapeSpawner.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 (DEBUG_MULTIBLOCK_ShapeSpawner.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 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 boolean drainEnergyInput(final long aEU) {
+ if (aEU <= 0) {
+ return true;
+ }
+ for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) {
+ if (DEBUG_MULTIBLOCK_ShapeSpawner.isValidMetaTileEntity(tHatch)) {
+ if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public void explodeMultiblock() {
+ this.mInventory[1] = null;
+ for (final MetaTileEntity tTileEntity : this.mInputBusses) {
+ tTileEntity.getBaseMetaTileEntity().doExplosion(GT_Values.V[8]);
+ }
+ for (final MetaTileEntity tTileEntity : this.mOutputBusses) {
+ tTileEntity.getBaseMetaTileEntity().doExplosion(GT_Values.V[8]);
+ }
+ for (final MetaTileEntity tTileEntity : this.mInputHatches) {
+ tTileEntity.getBaseMetaTileEntity().doExplosion(GT_Values.V[8]);
+ }
+ for (final MetaTileEntity tTileEntity : this.mOutputHatches) {
+ tTileEntity.getBaseMetaTileEntity().doExplosion(GT_Values.V[8]);
+ }
+ for (final MetaTileEntity tTileEntity : this.mDynamoHatches) {
+ tTileEntity.getBaseMetaTileEntity().doExplosion(GT_Values.V[8]);
+ }
+ for (final MetaTileEntity tTileEntity : this.mMufflerHatches) {
+ tTileEntity.getBaseMetaTileEntity().doExplosion(GT_Values.V[8]);
+ }
+ for (final MetaTileEntity tTileEntity : this.mEnergyHatches) {
+ tTileEntity.getBaseMetaTileEntity().doExplosion(GT_Values.V[8]);
+ }
+ for (final MetaTileEntity tTileEntity : this.mMaintenanceHatches) {
+ tTileEntity.getBaseMetaTileEntity().doExplosion(GT_Values.V[8]);
+ }
+ this.getBaseMetaTileEntity().doExplosion(GT_Values.V[8]);
+ }
+
+ /**
+ * If it explodes when the Component has to be replaced.
+ */
+ public abstract boolean explodesOnComponentBreak(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();
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(),
+ "MultiblockDisplay.png");
+ }
+
+ /**
+ * Gets the damage to the ItemStack, usually 0 or 1.
+ */
+ public abstract int getDamageToComponent(ItemStack aStack);
+
+ public int getIdealStatus() {
+ return 6;
+ }
+
+ @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())
+ };
+ }
+
+ /**
+ * Gets the maximum Efficiency that spare Part can get (0 - 10000)
+ */
+ public abstract int getMaxEfficiency(ItemStack aStack);
+
+ public long getMaxInputVoltage() {
+ long rVoltage = 0;
+ for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) {
+ if (DEBUG_MULTIBLOCK_ShapeSpawner.isValidMetaTileEntity(tHatch)) {
+ rVoltage += tHatch.getBaseMetaTileEntity().getInputVoltage();
+ }
+ }
+ return rVoltage;
+ }
+
+ /**
+ * Gets the pollution this Device outputs to a Muffler per tick (10000 = one
+ * Pullution Block)
+ */
+ public abstract int getPollutionPerTick(ItemStack aStack);
+
+ @Override
+ public int getProgresstime() {
+ return this.mProgresstime;
+ }
+
+ public GT_Recipe_Map getRecipeMap() {
+ return null;
+ }
+
+ 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);
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public ArrayList<FluidStack> getStoredFluids() {
+ final ArrayList<FluidStack> rList = new ArrayList<FluidStack>();
+ for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) {
+ tHatch.mRecipeMap = this.getRecipeMap();
+ if (DEBUG_MULTIBLOCK_ShapeSpawner.isValidMetaTileEntity(tHatch) && tHatch.getFillableStack() != null) {
+ rList.add(tHatch.getFillableStack());
+ }
+ }
+ return rList;
+ }
+
+ public ArrayList<ItemStack> getStoredInputs() {
+ final ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) {
+ tHatch.mRecipeMap = this.getRecipeMap();
+ if (DEBUG_MULTIBLOCK_ShapeSpawner.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 (DEBUG_MULTIBLOCK_ShapeSpawner.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 ArrayList<ItemStack> getStoredOutputs() {
+ final ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) {
+ if (DEBUG_MULTIBLOCK_ShapeSpawner.isValidMetaTileEntity(tHatch)) {
+ rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1));
+ }
+ }
+ for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) {
+ if (DEBUG_MULTIBLOCK_ShapeSpawner.isValidMetaTileEntity(tHatch)) {
+ for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ }
+ return rList;
+ }
+
+ @Override
+ public byte getTileEntityBaseType() {
+ return 2;
+ }
+
+ @Override
+ public int increaseProgress(final int aProgress) {
+ return aProgress;
+ }
+
+ @Override
+ public boolean isAccessAllowed(final EntityPlayer aPlayer) {
+ 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);
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public boolean isValidSlot(final int aIndex) {
+ return aIndex > 0;
+ }
+
+ @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 int maxProgresstime() {
+ return this.mMaxProgresstime;
+ }
+
+ @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 (DEBUG_MULTIBLOCK_ShapeSpawner.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);
+ }
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ }
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ /**
+ * 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;
+ }
+
+ public boolean polluteEnvironment(final int aPollutionLevel) {
+ this.mPollution += aPollutionLevel;
+ for (final GT_MetaTileEntity_Hatch_Muffler tHatch : this.mMufflerHatches) {
+ if (DEBUG_MULTIBLOCK_ShapeSpawner.isValidMetaTileEntity(tHatch)) {
+ if (this.mPollution >= 10000) {
+ if (tHatch.polluteEnvironment()) {
+ this.mPollution -= 10000;
+ }
+ }
+ else {
+ break;
+ }
+ }
+ }
+ return this.mPollution < 10000;
+ }
+
+ @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);
+ }
+
+ 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 void updateSlots() {
+ for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) {
+ if (DEBUG_MULTIBLOCK_ShapeSpawner.isValidMetaTileEntity(tHatch)) {
+ tHatch.updateSlots();
+ }
+ }
+ for (final GT_MetaTileEntity_Hatch_InputBus tHatch : this.mInputBusses) {
+ if (DEBUG_MULTIBLOCK_ShapeSpawner.isValidMetaTileEntity(tHatch)) {
+ tHatch.updateSlots();
+ }
+ }
+ }
}
diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java
index 134da6d827..4040c07d1b 100644
--- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java
+++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java
@@ -8,36 +8,48 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
public class DEBUG_ScreenOverlay extends Gui {
- int width, height;
- Minecraft mc = Minecraft.getMinecraft();
+ int width, height;
+ 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;
+ // if
+ // (mc.thePlayer.getHeldItem().equals(ModItems.itemStaballoyPickaxe)){
+ 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();
-
- if (heldItem != null){
- /*if (heldItem instanceof StaballoyPickaxe){
-
- int dmg =((StaballoyPickaxe) heldItem).getDamage(((StaballoyPickaxe) heldItem).thisPickaxe);
-
- ((StaballoyPickaxe) heldItem).checkFacing(((StaballoyPickaxe) heldItem).localWorld);
- str = "DAMAGE: "+ dmg +" | FACING: "+((StaballoyPickaxe) heldItem).FACING+" | FACING_HORIZONTAL: "+((StaballoyPickaxe) heldItem).FACING_HORIZONTAL+" | LOOKING DIRECTION: "+((StaballoyPickaxe) heldItem).lookingDirection;
-
- drawString(fontRender, str, (this.width - fontRender.getStringWidth(str)) / 2, this.height / 10, 0xFFAA00);
- }*/
+ try {
+ heldItem = this.mc.thePlayer.getHeldItem().getItem();
+
+ if (heldItem != null) {
+ /*
+ * if (heldItem instanceof StaballoyPickaxe){
+ *
+ * int dmg =((StaballoyPickaxe)
+ * heldItem).getDamage(((StaballoyPickaxe)
+ * heldItem).thisPickaxe);
+ *
+ * ((StaballoyPickaxe) heldItem).checkFacing(((StaballoyPickaxe)
+ * heldItem).localWorld); str = "DAMAGE: "+ dmg +" | FACING: "
+ * +((StaballoyPickaxe) heldItem).FACING+
+ * " | FACING_HORIZONTAL: "+((StaballoyPickaxe)
+ * heldItem).FACING_HORIZONTAL+" | LOOKING DIRECTION: "
+ * +((StaballoyPickaxe) heldItem).lookingDirection;
+ *
+ * drawString(fontRender, str, (this.width -
+ * fontRender.getStringWidth(str)) / 2, this.height / 10,
+ * 0xFFAA00); }
+ */
+ }
+ }
+ catch (final NullPointerException e) {
}
- }catch(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 88995ac23b..9c1e931bb2 100644
--- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java
+++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java
@@ -11,51 +11,53 @@ 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;
- 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);
+ public void run() {
+ 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);
+ 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++) {
- //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);
+ // 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(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)) {
+ 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..b289b9152a 100644
--- a/src/Java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java
+++ b/src/Java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java
@@ -5,339 +5,562 @@ import java.nio.ByteBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
-
/**
- * User: The Grey Ghost
- * Date: 9/02/14
+ * User: The Grey Ghost Date: 9/02/14
*/
-public class UtilityGL11Debug
-{
- public class GLproperty
- {
- public GLproperty(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 UtilityGL11Debug {
+ public class GLproperty {
+ public int gLconstant;
- public int gLconstant;
- public String name;
- public String description;
- public String category;
- public String fetchCommand;
- }
+ public String name;
+ public String description;
+ public String category;
+ public String fetchCommand;
+ public GLproperty(final int init_gLconstant, final String init_name, final String init_description,
+ final String init_category, final String init_fetchCommand) {
+ this.gLconstant = init_gLconstant;
+ this.name = init_name;
+ this.description = init_description;
+ this.category = init_category;
+ this.fetchCommand = init_fetchCommand;
+ }
+ }
- public static UtilityGL11Debug instance = new UtilityGL11Debug();
+ public static UtilityGL11Debug instance = new UtilityGL11Debug();
- public GLproperty[] propertyList =
+ public static void dumpAllIsEnabled() // Call This
+ {
+ for (int i = 0; i < UtilityGL11Debug.instance.propertyList.length; ++i)
- {
- 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()"),
- };
+ {
+ if (UtilityGL11Debug.instance.propertyList[i].fetchCommand == "glIsEnabled()")
- public static void dumpOpenGLstate()
- {
- }
+ {
+ System.out.print(UtilityGL11Debug.instance.propertyList[i].name + ":");
+ System.out.print(GL11.glIsEnabled(UtilityGL11Debug.instance.propertyList[i].gLconstant));
+ System.out.println(" (" + UtilityGL11Debug.instance.propertyList[i].description + ")");
+ }
+ }
+ }
- public static void dumpAllIsEnabled() //Call This
- {
- for (int i = 0; i < instance.propertyList.length; ++i)
+ public static void dumpAllType(final String type)
- {
- if (instance.propertyList[i].fetchCommand == "glIsEnabled()")
+ {
+ for (int i = 0; i < UtilityGL11Debug.instance.propertyList.length; ++i)
- {
- System.out.print(instance.propertyList[i].name + ":");
- System.out.print(GL11.glIsEnabled(instance.propertyList[i].gLconstant));
- System.out.println(" (" + instance.propertyList[i].description + ")");
- }
- }
- }
+ {
+ if (UtilityGL11Debug.instance.propertyList[i].category.equals(type))
- public static void dumpAllType(String type)
+ {
+ System.out.print(UtilityGL11Debug.instance.propertyList[i].name + ":");
+ System.out.println(UtilityGL11Debug.getPropertyAsString(i));
+ System.out.println(" (" + UtilityGL11Debug.instance.propertyList[i].description + ")");
+ }
+ }
+ }
- {
- for (int i = 0; i < instance.propertyList.length; ++i)
+ public static void dumpOpenGLstate() {
+ }
- {
- if (instance.propertyList[i].category.equals(type))
+ private static String getPropertyAsString(final int propertyListIndex) {
+ final int gLconstant = UtilityGL11Debug.instance.propertyList[propertyListIndex].gLconstant;
+ if (UtilityGL11Debug.instance.propertyList[propertyListIndex].fetchCommand.equals("glIsEnabled()")) {
+ return "" + GL11.glIsEnabled(gLconstant);
+ }
- {
- System.out.print(instance.propertyList[i].name + ":");
- System.out.println(getPropertyAsString(i));
- System.out.println(" (" + instance.propertyList[i].description + ")");
- }
- }
- }
+ if (UtilityGL11Debug.instance.propertyList[propertyListIndex].fetchCommand == "glGetBooleanv()")
- private static String getPropertyAsString(int propertyListIndex)
- {
- int gLconstant = instance.propertyList[propertyListIndex].gLconstant;
- if (instance.propertyList[propertyListIndex].fetchCommand.equals("glIsEnabled()")) {
- return "" + GL11.glIsEnabled(gLconstant);
- }
+ {
+ final ByteBuffer params = BufferUtils.createByteBuffer(16);
- if (instance.propertyList[propertyListIndex].fetchCommand == "glGetBooleanv()")
+ GL11.glGetBoolean(gLconstant, params);
+ String out = "";
+ for (int i = 0; i < params.capacity(); ++i)
- {
- ByteBuffer params = BufferUtils.createByteBuffer(16);
+ {
+ out += (i == 0 ? "" : ", ") + params.get(i);
+ }
+ return out;
+ }
- GL11.glGetBoolean(gLconstant, params);
- String out = "";
- for (int i = 0; i < params.capacity(); ++i)
+ return "";
+ }
- {
- out += (i == 0 ? "" : ", ") + params.get(i);
- }
- return out;
- }
+ public GLproperty[] propertyList =
- return "";
- }
+ {
+ 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()"),
+ };
}
-
diff --git a/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java b/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java
index be41e765d1..a571f1d76d 100644
--- a/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java
+++ b/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java
@@ -11,55 +11,66 @@ import net.minecraft.world.biome.BiomeGenBase;
public class EntityUtils {
- public static void setEntityOnFire(Entity entity, int length){
- entity.setFire(length);
+ 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) {
+ // Utils.LOG_INFO("t");
+ duration = damage * 5 + entityLiving.getActivePotionEffect(IC2Potion.radiation).getDuration();
+ }
+ else {
+ // Utils.LOG_INFO("f");
+ duration = damage * 30;
+ }
+ IC2Potion.radiation.applyTo(entityLiving, duration, damage * 15);
+ }
+ }
+ return true;
+ }
+ return false;
}
- public static int getFacingDirection(Entity entity){
- int d = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360) + 0.50) & 3;
- return d;
+ 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);
}
@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);
- return parEntity.worldObj.getBlock(blockX, blockY, blockZ);
+ public static int getFacingDirection(final Entity entity) {
+ final int d = MathHelper.floor_double(entity.rotationYaw * 4.0F / 360 + 0.50) & 3;
+ return d;
}
- //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.
+ // TODO
+ 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;
- if (!ItemArmorHazmat.hasCompleteHazmat(entityLiving)) {
- int duration;
- if (entityLiving.getActivePotionEffect(IC2Potion.radiation) != null){
- //Utils.LOG_INFO("t");
- duration = (damage*5)+entityLiving.getActivePotionEffect(IC2Potion.radiation).getDuration();
- }
- else {
- //Utils.LOG_INFO("f");
- duration = damage*30;
- }
- IC2Potion.radiation.applyTo(entityLiving, duration, damage * 15);
- }
- }
- return true;
- }
- return false;
+ public static void setEntityOnFire(final Entity entity, final int length) {
+ entity.setFire(length);
}
}
diff --git a/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java b/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java
index 5674082c4a..dd1cdfe6ea 100644
--- a/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java
+++ b/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java
@@ -4,27 +4,27 @@ import gregtech.api.GregTech_API;
import gtPlusPlus.core.lib.CORE;
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
+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
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 26a8770d44..d104195082 100644
--- a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java
+++ b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java
@@ -12,328 +12,371 @@ import net.minecraftforge.fluids.*;
public class FluidUtils {
- public static FluidStack getFluidStack(String fluidName, int amount){
- Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName);
- try {
- return FluidRegistry.getFluidStack(fluidName, amount).copy();
- }
- catch (Throwable e){
- return null;
- }
-
+ public static Fluid addAutogeneratedMoltenFluid(final GT_Materials aMaterial) {
+ return FluidUtils.addFluid("molten." + aMaterial.name().toLowerCase(), "molten.autogenerated",
+ "Molten " + aMaterial.name(), aMaterial, aMaterial.mMoltenRGBa, 1,
+ aMaterial.mMeltingPoint <= 0L ? 1000L : aMaterial.mMeltingPoint, null, null, 0);
}
-
- public static FluidStack getFluidStack(FluidStack vmoltenFluid, 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){
- return null;
- }
+
+ public static Fluid addAutogeneratedMoltenFluid(final String materialNameFormatted, final short[] rgba,
+ final int MeltingPoint) {
+ return FluidUtils.addFluid("molten." + materialNameFormatted.toLowerCase(), "molten.autogenerated",
+ "Molten " + materialNameFormatted, null, rgba, 1, MeltingPoint <= 0L ? 1000L : MeltingPoint, null, null,
+ 0);
}
- public static FluidStack[] getFluidStackArray(String fluidName, int amount){
- Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName);
- try {
- FluidStack[] singleFluid = {FluidRegistry.getFluidStack(fluidName, amount)};
- return singleFluid;
- }
- catch (Throwable e){
- return null;
- }
+ public static Fluid addFluid(final String aName, final String aLocalized, final GT_Materials aMaterial,
+ final int aState, final long aTemperatureK) {
+ return FluidUtils.addFluid(aName, aLocalized, aMaterial, aState, aTemperatureK, null, null, 0);
+ }
+ public static Fluid addFluid(final String aName, final String aLocalized, final GT_Materials aMaterial,
+ final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer,
+ final int aFluidAmount) {
+ return FluidUtils.addFluid(aName, aName.toLowerCase(), aLocalized, aMaterial, null, aState, aTemperatureK,
+ aFullContainer, aEmptyContainer, aFluidAmount);
}
- public static FluidStack[] getFluidStackArray(FluidStack fluidName, int amount){
- Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName);
- try {
- FluidStack[] singleFluid = {FluidRegistry.getFluidStack(fluidName.getLocalizedName(), amount)};
- return singleFluid;
- }
- catch (Throwable e){
- return null;
+ public static Fluid addFluid(String aName, final String aTexture, final String aLocalized,
+ final GT_Materials aMaterial, final short[] aRGBa, final int aState, final long aTemperatureK,
+ final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) {
+ aName = Utils.sanitizeString(aName.toLowerCase());
+ Fluid rFluid = new FluidGT6(aName, aTexture, aRGBa != null ? aRGBa : Dyes._NULL.getRGBA());
+ GT_LanguageManager.addStringLocalization(rFluid.getUnlocalizedName(), aLocalized == null ? aName : aLocalized);
+ if (FluidRegistry.registerFluid(rFluid)) {
+ switch (aState) {
+ case 0: {
+ rFluid.setGaseous(false);
+ rFluid.setViscosity(10000);
+ break;
+ }
+ case 1:
+ case 4: {
+ rFluid.setGaseous(false);
+ rFluid.setViscosity(1000);
+ break;
+ }
+ case 2: {
+ rFluid.setGaseous(true);
+ rFluid.setDensity(-100);
+ rFluid.setViscosity(200);
+ break;
+ }
+ case 3: {
+ rFluid.setGaseous(true);
+ rFluid.setDensity(-10000);
+ rFluid.setViscosity(10);
+ rFluid.setLuminosity(15);
+ break;
+ }
+ }
}
+ else {
+ rFluid = FluidRegistry.getFluid(aName);
+ }
+ if (rFluid.getTemperature() == new Fluid("test").getTemperature() || rFluid.getTemperature() <= 0) {
+ rFluid.setTemperature((int) aTemperatureK);
+ }
+ if (aMaterial != null) {
+ switch (aState) {
+ case 1: {
+ aMaterial.mFluid = rFluid;
+ break;
+ }
+ case 2: {
+ aMaterial.mGas = rFluid;
+ break;
+ }
+ case 3: {
+ aMaterial.mPlasma = rFluid;
+ break;
+ }
+ }
+ }
+ if (aFullContainer != null && aEmptyContainer != null && !FluidContainerRegistry
+ .registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) {
+ GT_Values.RA.addFluidCannerRecipe(aFullContainer, FluidUtils.container(aFullContainer, false), null,
+ new FluidStack(rFluid, aFluidAmount));
+ }
+ return rFluid;
+ }
+ 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 FluidUtils.addGTFluid("molten." + aName, "molten.autogenerated", aLocalized, aRGBa, aState,
+ aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount);
}
-
-
- /**
- * @param String displayName
- * @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(String displayName, String fluidName, int tempK, short[] rgba ,int aState){
- Fluid generatedFluid = null;
- switch (aState) {
- case 0: {
- generatedFluid = new GenericFluid(displayName, fluidName, 0, 100, tempK, 10000, false, rgba);
- break;
+
+ 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());
+ Fluid rFluid = new FluidGT6(aName, aTexture, aRGBa != null ? aRGBa : Dyes._NULL.getRGBA());
+ GT_LanguageManager.addStringLocalization(rFluid.getUnlocalizedName(), aLocalized == null ? aName : aLocalized);
+ if (FluidRegistry.registerFluid(rFluid)) {
+ switch (aState) {
+ case 0: {
+ rFluid.setGaseous(false);
+ rFluid.setViscosity(10000);
+ break;
+ }
+ case 1:
+ case 4: {
+ rFluid.setGaseous(false);
+ rFluid.setViscosity(1000);
+ break;
+ }
+ case 2: {
+ rFluid.setGaseous(true);
+ rFluid.setDensity(-100);
+ rFluid.setViscosity(200);
+ break;
+ }
+ case 3: {
+ rFluid.setGaseous(true);
+ rFluid.setDensity(-10000);
+ rFluid.setViscosity(10);
+ rFluid.setLuminosity(15);
+ break;
+ }
+ }
}
- default:
- case 1:
- case 4: {
- generatedFluid = new GenericFluid(displayName, fluidName, 0, 100, tempK, 1000, false, rgba);
- break;
+ else {
+ rFluid = FluidRegistry.getFluid(aName);
}
- case 2: {
- generatedFluid = new GenericFluid(displayName, fluidName, 0, -100, tempK, 200, true, rgba);
- break;
+ if (rFluid.getTemperature() == new Fluid("test").getTemperature() || rFluid.getTemperature() <= 0) {
+ rFluid.setTemperature((int) aTemperatureK);
}
- case 3: {
- generatedFluid = new GenericFluid(displayName, fluidName, 15, -10000, tempK, 10, true, rgba);
- break;
+ if (aFullContainer != null && aEmptyContainer != null && !FluidContainerRegistry
+ .registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) {
+ GT_Values.RA.addFluidCannerRecipe(aFullContainer, FluidUtils.container(aFullContainer, false), null,
+ new FluidStack(rFluid, aFluidAmount));
}
+ return rFluid;
+ }
+
+ public static ItemStack amount(final long aAmount, final Object... aStacks) {
+ final ItemStack rStack = FluidUtils.copy(aStacks);
+ if (FluidUtils.invalid(rStack)) {
+ return null;
}
- return generatedFluid;
+ rStack.stackSize = (int) aAmount;
+ return rStack;
}
- /**
- *
- * @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();
- Fluid generatedFluid = null;
- switch (aState) {
- case 0: {
- generatedFluid = new GenericFluid(material, 0, 100, tempK, 10000, false);
- break;
+
+ public static ItemStack container(final ItemStack aStack, final boolean aCheckIFluidContainerItems) {
+ if (FluidUtils.invalid(aStack)) {
+ return null;
}
- default:
- case 1:
- case 4: {
- generatedFluid = new GenericFluid(material, 0, 100, tempK, 1000, false);
- break;
+ if (aStack.getItem().hasContainerItem(aStack)) {
+ return aStack.getItem().getContainerItem(aStack);
}
- case 2: {
- generatedFluid = new GenericFluid(material, 0, -100, tempK, 200, true);
- break;
+ if (FluidUtils.equal(aStack, ItemList.Cell_Empty.get(1), true)) {
+ return null;
}
- case 3: {
- generatedFluid = new GenericFluid(material, 15, -10000, tempK, 10, true);
- break;
+ if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem
+ && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) {
+ final ItemStack tStack = FluidUtils.amount(1L, aStack);
+ ((IFluidContainerItem) aStack.getItem()).drain(tStack, Integer.MAX_VALUE, true);
+ if (!FluidUtils.equal(aStack, tStack)) {
+ return tStack;
+ }
+ return null;
}
+ if (FluidUtils.equal(aStack, ItemList.IC2_ForgeHammer.get(1))
+ || FluidUtils.equal(aStack, ItemList.IC2_WireCutter.get(1))) {
+ return FluidUtils.copyMeta(FluidUtils.meta(aStack) + 1, aStack);
}
- return generatedFluid;
+ return null;
}
-
- public static Fluid addAutogeneratedMoltenFluid(String materialNameFormatted, short[] rgba, 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);
+ public static ItemStack container(final ItemStack aStack, final boolean aCheckIFluidContainerItems,
+ final int aStacksize) {
+ return FluidUtils.amount(aStacksize, FluidUtils.container(aStack, aCheckIFluidContainerItems));
+ }
+
+ public static ItemStack copy(final Object... aStacks) {
+ for (final Object tStack : aStacks) {
+ if (FluidUtils.valid(tStack)) {
+ return ((ItemStack) tStack).copy();
+ }
+ }
+ return null;
}
- public static Fluid addFluid(final String aName, final String aLocalized, final GT_Materials aMaterial, final int aState, final long aTemperatureK) {
- return addFluid(aName, aLocalized, aMaterial, aState, aTemperatureK, null, null, 0);
+ public static ItemStack copyMeta(final long aMetaData, final Object... aStacks) {
+ final ItemStack rStack = FluidUtils.copy(aStacks);
+ if (FluidUtils.invalid(rStack)) {
+ return null;
+ }
+ return FluidUtils.meta(rStack, aMetaData);
}
- public static Fluid addFluid(final String aName, final String aLocalized, final GT_Materials aMaterial, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) {
- return addFluid(aName, aName.toLowerCase(), aLocalized, aMaterial, null, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount);
+ public static boolean equal(final ItemStack aStack1, final ItemStack aStack2) {
+ return FluidUtils.equal(aStack1, aStack2, false);
}
- public static Fluid addFluid(String aName, final String aTexture, final String aLocalized, final GT_Materials aMaterial, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) {
- aName = Utils.sanitizeString(aName.toLowerCase());
- Fluid rFluid = new FluidGT6(aName, aTexture, (aRGBa != null) ? aRGBa : Dyes._NULL.getRGBA());
- GT_LanguageManager.addStringLocalization(rFluid.getUnlocalizedName(), (aLocalized == null) ? aName : aLocalized);
- if (FluidRegistry.registerFluid(rFluid)) {
- switch (aState) {
+ public static boolean equal(final ItemStack aStack1, final ItemStack aStack2, final boolean aIgnoreNBT) {
+ return aStack1 != null && aStack2 != null && FluidUtils.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(aStack2.getTagCompound())))
+ && (FluidUtils.meta(aStack1) == FluidUtils.meta(aStack2) || FluidUtils.meta(aStack1) == 32767
+ || FluidUtils.meta(aStack2) == 32767);
+ }
+
+ /**
+ *
+ * @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(final Material material, final int aState) {
+ final int tempK = material.getMeltingPointC();
+ Fluid generatedFluid = null;
+ switch (aState) {
case 0: {
- rFluid.setGaseous(false);
- rFluid.setViscosity(10000);
+ generatedFluid = new GenericFluid(material, 0, 100, tempK, 10000, false);
break;
}
+ default:
case 1:
case 4: {
- rFluid.setGaseous(false);
- rFluid.setViscosity(1000);
+ generatedFluid = new GenericFluid(material, 0, 100, tempK, 1000, false);
break;
}
case 2: {
- rFluid.setGaseous(true);
- rFluid.setDensity(-100);
- rFluid.setViscosity(200);
+ generatedFluid = new GenericFluid(material, 0, -100, tempK, 200, true);
break;
}
case 3: {
- rFluid.setGaseous(true);
- rFluid.setDensity(-10000);
- rFluid.setViscosity(10);
- rFluid.setLuminosity(15);
+ generatedFluid = new GenericFluid(material, 15, -10000, tempK, 10, true);
break;
}
- }
- }
- else {
- rFluid = FluidRegistry.getFluid(aName);
- }
- if (rFluid.getTemperature() == new Fluid("test").getTemperature() || rFluid.getTemperature() <= 0) {
- rFluid.setTemperature((int) (aTemperatureK));
- }
- if (aMaterial != null) {
- switch (aState) {
- case 1: {
- aMaterial.mFluid = (rFluid);
- break;
- }
- case 2: {
- aMaterial.mGas = (rFluid);
- break;
- }
- case 3: {
- aMaterial.mPlasma = (rFluid);
- break;
- }
- }
}
- 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 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);
+ return generatedFluid;
}
-
- 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());
- Fluid rFluid = new FluidGT6(aName, aTexture, (aRGBa != null) ? aRGBa : Dyes._NULL.getRGBA());
- GT_LanguageManager.addStringLocalization(rFluid.getUnlocalizedName(), (aLocalized == null) ? aName : aLocalized);
- if (FluidRegistry.registerFluid(rFluid)) {
- switch (aState) {
+
+ /**
+ * @param String
+ * displayName
+ * @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(final String displayName, final String fluidName, final int tempK,
+ final short[] rgba, final int aState) {
+ Fluid generatedFluid = null;
+ switch (aState) {
case 0: {
- rFluid.setGaseous(false);
- rFluid.setViscosity(10000);
+ generatedFluid = new GenericFluid(displayName, fluidName, 0, 100, tempK, 10000, false, rgba);
break;
}
+ default:
case 1:
case 4: {
- rFluid.setGaseous(false);
- rFluid.setViscosity(1000);
+ generatedFluid = new GenericFluid(displayName, fluidName, 0, 100, tempK, 1000, false, rgba);
break;
}
case 2: {
- rFluid.setGaseous(true);
- rFluid.setDensity(-100);
- rFluid.setViscosity(200);
+ generatedFluid = new GenericFluid(displayName, fluidName, 0, -100, tempK, 200, true, rgba);
break;
}
case 3: {
- rFluid.setGaseous(true);
- rFluid.setDensity(-10000);
- rFluid.setViscosity(10);
- rFluid.setLuminosity(15);
+ generatedFluid = new GenericFluid(displayName, fluidName, 15, -10000, tempK, 10, true, rgba);
break;
}
- }
- }
- else {
- rFluid = FluidRegistry.getFluid(aName);
- }
- 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)) {
- GT_Values.RA.addFluidCannerRecipe(aFullContainer, container(aFullContainer, false), null, new FluidStack(rFluid, aFluidAmount));
}
- return rFluid;
+ return generatedFluid;
}
- public static boolean valid(final Object aStack) {
- return aStack != null && aStack instanceof ItemStack && ((ItemStack)aStack).getItem() != null && ((ItemStack)aStack).stackSize >= 0;
+ 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 (final Throwable e) {
+ return null;
+ }
}
- public static boolean invalid(final Object aStack) {
- return aStack == null || !(aStack instanceof ItemStack) || ((ItemStack)aStack).getItem() == null || ((ItemStack)aStack).stackSize < 0;
- }
+ 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 (final Throwable e) {
+ return null;
+ }
- public static boolean equal(final ItemStack aStack1, final ItemStack aStack2) {
- return equal(aStack1, aStack2, false);
}
- public static boolean equal(final ItemStack aStack1, final ItemStack aStack2, final boolean aIgnoreNBT) {
- return aStack1 != null && aStack2 != null && equal_(aStack1, aStack2, aIgnoreNBT);
- }
+ public static FluidStack[] getFluidStackArray(final FluidStack fluidName, final int amount) {
+ Utils.LOG_WARNING("Trying to get a fluid stack of " + fluidName);
+ try {
+ final FluidStack[] singleFluid = {
+ FluidRegistry.getFluidStack(fluidName.getLocalizedName(), amount)
+ };
+ return singleFluid;
+ }
+ catch (final Throwable e) {
+ return null;
+ }
- 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);
}
- public static ItemStack copy(final Object... aStacks) {
- for (final Object tStack : aStacks) {
- if (valid(tStack)) {
- return ((ItemStack)tStack).copy();
- }
+ public static FluidStack[] getFluidStackArray(final String fluidName, final int amount) {
+ Utils.LOG_WARNING("Trying to get a fluid stack of " + fluidName);
+ try {
+ final FluidStack[] singleFluid = {
+ FluidRegistry.getFluidStack(fluidName, amount)
+ };
+ return singleFluid;
}
- return null;
- }
-
- public static ItemStack copyMeta(final long aMetaData, final Object... aStacks) {
- final ItemStack rStack = copy(aStacks);
- if (invalid(rStack)) {
+ catch (final Throwable e) {
return null;
}
- return meta(rStack, aMetaData);
+
+ }
+
+ public static boolean invalid(final Object aStack) {
+ return aStack == null || !(aStack instanceof ItemStack) || ((ItemStack) aStack).getItem() == null
+ || ((ItemStack) aStack).stackSize < 0;
}
public static short meta(final ItemStack aStack) {
- return (short)Items.feather.getDamage(aStack);
+ return (short) Items.feather.getDamage(aStack);
}
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;
}
- public static ItemStack amount(final long aAmount, final Object... aStacks) {
- final ItemStack rStack = copy(aStacks);
- if (invalid(rStack)) {
- return null;
- }
- rStack.stackSize = (int)aAmount;
- return rStack;
- }
-
- public static ItemStack container(final ItemStack aStack, final boolean aCheckIFluidContainerItems) {
- if (invalid(aStack)) {
- return null;
- }
- if (aStack.getItem().hasContainerItem(aStack)) {
- return aStack.getItem().getContainerItem(aStack);
- }
- if (equal(aStack, ItemList.Cell_Empty.get(1), true)) {
- return null;
- }
- 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)) {
- return tStack;
- }
- return null;
- }
- if (equal(aStack, ItemList.IC2_ForgeHammer.get(1)) || equal(aStack, ItemList.IC2_WireCutter.get(1))) {
- return copyMeta(meta(aStack) + 1, aStack);
- }
- return null;
+ public static boolean valid(final Object aStack) {
+ return aStack != null && aStack instanceof ItemStack && ((ItemStack) aStack).getItem() != null
+ && ((ItemStack) aStack).stackSize >= 0;
}
- public static ItemStack container(final ItemStack aStack, final boolean aCheckIFluidContainerItems, final int aStacksize) {
- return amount(aStacksize, container(aStack, aCheckIFluidContainerItems));
- }
-
}
diff --git a/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java b/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java
index 4511f2a396..025b535e14 100644
--- a/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java
+++ b/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java
@@ -10,46 +10,47 @@ import net.minecraft.item.ItemStack;
public final class GregtechRecipe {
public LibraryProxy ourProxy;
- public GregtechRecipe(){
+
+ public 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");
+ if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
+ 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");
+ if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
+ 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) {
- Utils.LOG_WARNING("Adding a GT Furnace/Alloy Smelter Recipe"+"| Input:"+aInput.getDisplayName()+" | Output:"+aOutput.getDisplayName()+" |");
- return ourProxy.addSmeltingAndAlloySmeltingRecipe(aInput, 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 this.ourProxy.addSmeltingAndAlloySmeltingRecipe(aInput, aOutput);
}
}
-abstract class LibraryProxy { // can also be interface unless you want to have common code here
- abstract public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aInput, ItemStack aOutput);
-}
-
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);
}
}
@@ -59,28 +60,32 @@ 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);
}
}
}
-/*class Lib { // v1
- public static void addRecipe(ItemStack aInput, ItemStack aOutput) {
- System.out.println("shit totally happened v1");
- }
+abstract class LibraryProxy { // can also be interface unless you want to have
+ // common code here
+ abstract public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aInput, ItemStack aOutput);
}
-class Lib2 { // v2
- public static void addRecipe(ItemStack aInput, ItemStack aOutput, boolean hidden) {
- System.out.println("shit totally happened v2");
- }
-}*/ \ No newline at end of file
+/*
+ * class Lib { // v1 public static void addRecipe(ItemStack aInput, ItemStack
+ * aOutput) { System.out.println("shit totally happened v1"); } }
+ *
+ * class Lib2 { // v2 public static void addRecipe(ItemStack aInput, ItemStack
+ * aOutput, boolean hidden) { System.out.println("shit totally happened v2"); }
+ * }
+ */ \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java
index e6e36caf25..c8b9848c9f 100644
--- a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java
+++ b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java
@@ -30,243 +30,329 @@ import net.minecraftforge.oredict.OreDictionary;
public class ItemUtils {
- public static ItemStack getSimpleStack(Item x){
- return getSimpleStack(x, 1);
- }
- public static ItemStack getSimpleStack(Item x, int i){
+ public static void addItemToOreDictionary(final ItemStack stack, final String oreDictName) {
try {
- ItemStack r = new ItemStack(x, i);
- return r;
- } catch(Throwable e){
- return null;
+ GT_OreDictUnificator.registerOre(oreDictName, stack);
+ }
+ catch (final NullPointerException e) {
+ Utils.LOG_ERROR(stack.getDisplayName() + " not registered. [NULL]");
}
}
- public static ItemStack getSimpleStack(ItemStack x, int i){
- try {
- ItemStack r = x.copy();
- r.stackSize = i;
- return r;
- } catch(Throwable e){
- return null;
+
+ 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 ItemStack getIC2Cell(String S){
- ItemStack moreTemp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+S, 1);
+ public static BaseItemCentidust generateCentidust(final Materials material) {
+ if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null) {
+ final Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material);
+ if (placeholder != null) {
+ ItemUtils.generateCentidust(placeholder);
+ }
+ }
+ return null;
+ }
- if (moreTemp == null){
- int cellID = 0;
- ItemStack temp =GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, cellID);
- return temp != null ? temp : null;
+ 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;
+ }
- return moreTemp;
+ public static BaseItemDecidust generateDecidust(final Materials material) {
+ if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null) {
+ final Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material);
+ if (placeholder != null) {
+ ItemUtils.generateDecidust(placeholder);
+ }
+ }
+ return null;
}
- public static ItemStack getIC2Cell(int meta){
- ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, meta);
- return temp != null ? temp : null;
+ public static Item[] generateDusts(final String unlocalizedName, final String materialName, final int materialTier,
+ final Material matInfo, final int Colour) {
+ final int radioactive = ItemUtils.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 MultiPickaxeBase generateMultiPick(final boolean GT_Durability, final Materials material) {
+ final ToolMaterial customMaterial = Utils.generateMaterialFromGT(material);
+ Utils.LOG_WARNING("Generating a Multi-Pick out of " + material.name());
+ short[] rgb;
+ rgb = material.getRGBA();
+ int dur = customMaterial.getMaxUses();
+ Utils.LOG_WARNING("Determined durability for " + material.name() + " is " + dur);
+ if (GT_Durability) {
+ dur = material.mDurability * 100;
+ Utils.LOG_WARNING("Using gregtech durability value, " + material.name() + " is now " + dur + ".");
+ }
+ else if (dur <= 0) {
+ dur = material.mDurability;
+ Utils.LOG_WARNING("Determined durability too low, " + material.name() + " is now " + dur
+ + " based on the GT material durability.");
+ }
- public static void getItemForOreDict(String FQRN, String oreDictName, String itemName, int meta){
- try {
- Item em = null;
- Item em1 = getItem(FQRN);
- Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta);
- if (em1 != null){
- em = em1;
- }
- if (em != null){
+ if (dur <= 0) {
+ Utils.LOG_WARNING("Still too low, " + material.name() + " will now go unused.");
+ return null;
+ }
- ItemStack metaStack = new ItemStack(em,1,meta);
- GT_OreDictUnificator.registerOre(oreDictName, metaStack);
+ final MultiPickaxeBase MP_Redstone = new MultiPickaxeBase(material.name() + " Multipick", customMaterial, dur,
+ Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]));
- /*ItemStack itemStackWithMeta = new ItemStack(em,1,meta);
- GT_OreDictUnificator.registerOre(oreDictName, new ItemStack(itemStackWithMeta.getItem()));*/
- }
- } catch (NullPointerException e) {
- Utils.LOG_ERROR(itemName+" not found. [NULL]");
+ if (MP_Redstone.isValid) {
+ return MP_Redstone;
}
+ return null;
+
}
- public static void addItemToOreDictionary(ItemStack stack, String oreDictName){
- try {
- GT_OreDictUnificator.registerOre(oreDictName, stack);
- } catch (NullPointerException e) {
- Utils.LOG_ERROR(stack.getDisplayName()+" not registered. [NULL]");
+ public static MultiSpadeBase generateMultiShovel(final boolean GT_Durability, final Materials material) {
+ final ToolMaterial customMaterial = Utils.generateMaterialFromGT(material);
+ Utils.LOG_WARNING("Generating a Multi-Shovel out of " + material.name());
+ short[] rgb;
+ rgb = material.getRGBA();
+ int dur = customMaterial.getMaxUses();
+ Utils.LOG_WARNING("Determined durability for " + material.name() + " is " + dur);
+ if (GT_Durability) {
+ dur = material.mDurability * 100;
+ Utils.LOG_WARNING("Using gregtech durability value, " + material.name() + " is now " + dur + ".");
+ }
+ else if (dur <= 0) {
+ dur = material.mDurability;
+ Utils.LOG_WARNING("Determined durability too low, " + material.name() + " is now " + dur
+ + " based on the GT material durability.");
}
- }
- @SuppressWarnings("unused")
- public static ItemStack getItemStackWithMeta(boolean MOD, String FQRN, String itemName, int meta, int itemstackSize){
- if (MOD){
- try {
- Item em = null;
- 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);
- return metaStack;
- }
- }
- return null;
- } catch (NullPointerException e) {
- Utils.LOG_ERROR(itemName+" not found. [NULL]");
- return null;
- }
+ if (dur <= 0) {
+ Utils.LOG_WARNING("Still too low, " + material.name() + " will now go unused.");
+ return null;
+ }
+
+ final MultiSpadeBase MP_Redstone = new MultiSpadeBase(material.name() + " Multishovel", customMaterial, dur,
+ Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]));
+
+ if (MP_Redstone.isValid) {
+ return MP_Redstone;
}
return null;
+
}
- @SuppressWarnings("unused")
- public static ItemStack simpleMetaStack(String FQRN, int meta, int itemstackSize){
- try {
- Item em = null;
- 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);
- return metaStack;
- }
- }
- return null;
- } catch (NullPointerException e) {
- Utils.LOG_ERROR(FQRN+" not found. [NULL]");
- return null;
- }
+ 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);
}
- @SuppressWarnings("unused")
- public static ItemStack simpleMetaStack(Item item, int meta, int itemstackSize){
- try {
- Item em = item;
- 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);
- return metaStack;
- }
+ 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 String getArrayStackNames(final ItemStack[] aStack) {
+ String itemNames = "Item Array: ";
+ for (final ItemStack alph : aStack) {
+
+ if (alph != null) {
+ final String temp = itemNames;
+ itemNames = temp + ", " + alph.getDisplayName() + " x" + alph.stackSize;
}
- return null;
- } catch (NullPointerException e) {
- Utils.LOG_ERROR(item.getUnlocalizedName()+" not found. [NULL]");
- return null;
- }
+ else {
+ final String temp = itemNames;
+ itemNames = temp + ", " + "null" + " x" + "0";
+ }
+ }
+ return itemNames;
+
}
- public static ItemStack getCorrectStacktype(String fqrn, int stackSize){
- String oreDict = "ore:";
- ItemStack temp;
- if (fqrn.toLowerCase().contains(oreDict.toLowerCase())){
- String sanitizedName = fqrn.replace(oreDict, "");
- temp = ItemUtils.getItemStack(sanitizedName, stackSize);
- return temp;
+ public static String[] getArrayStackNamesAsArray(final ItemStack[] aStack) {
+ final String[] itemNames = {};
+ int arpos = 0;
+ for (final ItemStack alph : aStack) {
+ itemNames[arpos] = alph.getDisplayName();
+ arpos++;
}
- String[] fqrnSplit = fqrn.split(":");
- if(fqrnSplit[2] == null){fqrnSplit[2] = "0";}
- temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(fqrnSplit[2]), stackSize);
- return temp;
- }
+ return itemNames;
+
+ }
- public static ItemStack getCorrectStacktype(Object item_Input, int stackSize) {
- if (item_Input instanceof String){
- return getCorrectStacktype(item_Input, stackSize);
+ public static ItemStack getCorrectStacktype(final Object item_Input, final int stackSize) {
+ if (item_Input instanceof String) {
+ return ItemUtils.getCorrectStacktype(item_Input, stackSize);
}
- else if (item_Input instanceof ItemStack){
+ else if (item_Input instanceof ItemStack) {
return (ItemStack) item_Input;
}
- if (item_Input instanceof var){
+ if (item_Input instanceof var) {
return ((var) item_Input).getStack(stackSize);
}
return null;
}
- public static Item getItem(String fqrn) // fqrn = fully qualified resource name
- {
- String[] fqrnSplit = fqrn.split(":");
- return GameRegistry.findItem(fqrnSplit[0], fqrnSplit[1]);
+ public static ItemStack getCorrectStacktype(final String fqrn, final int stackSize) {
+ final String oreDict = "ore:";
+ ItemStack temp;
+ if (fqrn.toLowerCase().contains(oreDict.toLowerCase())) {
+ final String sanitizedName = fqrn.replace(oreDict, "");
+ temp = ItemUtils.getItemStack(sanitizedName, stackSize);
+ return temp;
+ }
+ final String[] fqrnSplit = fqrn.split(":");
+ if (fqrnSplit[2] == null) {
+ fqrnSplit[2] = "0";
+ }
+ temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(fqrnSplit[2]),
+ stackSize);
+ return temp;
}
- public static ItemStack getItemStack(String fqrn, int Size) // fqrn = fully qualified resource name
- {
- String[] fqrnSplit = fqrn.split(":");
- return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size);
+ // TODO
+ /*
+ * public static FluidStack getFluidStack(Materials m, int Size) // fqrn =
+ * fully qualified resource name { String[] fqrnSplit = fqrn.split(":");
+ *
+ * FluidStack x = (FluidStack) "Materials."+m+".getFluid"(Size);
+ *
+ * return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size); }
+ */
+
+ public static String getFluidArrayStackNames(final FluidStack[] aStack) {
+ String itemNames = "Fluid Array: ";
+ for (final FluidStack alph : aStack) {
+ final String temp = itemNames;
+ itemNames = temp + ", " + alph.getFluid().getName() + " x" + alph.amount;
+ }
+ return itemNames;
+
}
- // TODO
- /*public static FluidStack getFluidStack(Materials m, int Size) // fqrn = fully qualified resource name
- {
- String[] fqrnSplit = fqrn.split(":");
+ public static ItemStack getGregtechCircuit(final int Meta) {
+ return ItemUtils.getItemStackWithMeta(LoadedMods.Gregtech, "gregtech:gt.integrated_circuit", "Gregtech Circuit",
+ Meta, 0);
+ }
- FluidStack x = (FluidStack) "Materials."+m+".getFluid"(Size);
+ public static ItemStack getIC2Cell(final int meta) {
+ final ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, meta);
+ return temp != null ? temp : null;
+ }
- return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size);
- }*/
+ public static ItemStack getIC2Cell(final String S) {
+ final ItemStack moreTemp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell" + S, 1);
+ if (moreTemp == null) {
+ final int cellID = 0;
+ final ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, cellID);
+ return temp != null ? temp : null;
+ }
- 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");
- GameRegistry.registerItem(itemSpawnEgg, "spawnEgg"+parSpawnName);
+ return moreTemp;
}
+ public static Item getItem(final String fqrn) // fqrn = fully qualified
+ // resource name
+ {
+ final String[] fqrnSplit = fqrn.split(":");
+ return GameRegistry.findItem(fqrnSplit[0], fqrnSplit[1]);
+ }
- public static ItemStack[] validItemsForOreDict(String oredictName){
- List<?> validNames = MaterialUtils.oreDictValuesForEntry(oredictName);
- ItemStack[] inputs = null;
- for (int i=0; i<validNames.size();i++){
- inputs[i] = (ItemStack) validNames.get(i);
+ public static void getItemForOreDict(final String FQRN, final String oreDictName, final String itemName,
+ final int meta) {
+ try {
+ Item em = null;
+ final Item em1 = ItemUtils.getItem(FQRN);
+ Utils.LOG_WARNING("Found: " + em1.getUnlocalizedName() + ":" + meta);
+ if (em1 != null) {
+ em = em1;
+ }
+ if (em != null) {
+
+ 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 (final NullPointerException e) {
+ Utils.LOG_ERROR(itemName + " not found. [NULL]");
}
- return inputs;
}
- public static ItemStack getItemStackOfAmountFromOreDict(String oredictName, int amount){
- ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName);
- if (!oreDictList.isEmpty()){
- ItemStack returnValue = oreDictList.get(0).copy();
+ public static ItemStack getItemStack(final String fqrn, final int Size) // fqrn
+ // =
+ // fully
+ // qualified
+ // resource
+ // name
+ {
+ final String[] fqrnSplit = fqrn.split(":");
+ return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size);
+ }
+
+ public static ItemStack getItemStackOfAmountFromOreDict(final String oredictName, final int amount) {
+ final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName);
+ if (!oreDictList.isEmpty()) {
+ final ItemStack returnValue = oreDictList.get(0).copy();
returnValue.stackSize = amount;
return returnValue;
}
- return getSimpleStack(ModItems.AAA_Broken, amount);
+ return ItemUtils.getSimpleStack(ModItems.AAA_Broken, amount);
}
- public static ItemStack getItemStackOfAmountFromOreDictNoBroken(String oredictName, int amount){
- ItemStack returnValue = getItemStackOfAmountFromOreDict(oredictName, amount);
+ public static ItemStack getItemStackOfAmountFromOreDictNoBroken(final String oredictName, final int amount) {
+ final ItemStack returnValue = ItemUtils.getItemStackOfAmountFromOreDict(oredictName, amount);
- if (returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass() || returnValue.getItem() != ModItems.AAA_Broken){
+ if (returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass()
+ || returnValue.getItem() != ModItems.AAA_Broken) {
return returnValue;
}
- Utils.LOG_INFO(oredictName+" was not valid.");
+ Utils.LOG_INFO(oredictName + " was not valid.");
return null;
}
- public static ItemStack getItemStackOfAmountFromOreDictNoBrokenExcluding(String excludeModName, String oredictName, int amount){
- ItemStack returnValue = getItemStackOfAmountFromOreDict(oredictName, amount);
+ public static ItemStack getItemStackOfAmountFromOreDictNoBrokenExcluding(final String excludeModName,
+ final String oredictName, final int amount) {
+ ItemStack returnValue = ItemUtils.getItemStackOfAmountFromOreDict(oredictName, amount);
- if (returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass() || returnValue.getItem() != ModItems.AAA_Broken){
- if (returnValue.getClass().toString().toLowerCase().contains(excludeModName.toLowerCase())){
- ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName);
- if (!oreDictList.isEmpty()){
+ if (returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass()
+ || returnValue.getItem() != ModItems.AAA_Broken) {
+ if (returnValue.getClass().toString().toLowerCase().contains(excludeModName.toLowerCase())) {
+ final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName);
+ if (!oreDictList.isEmpty()) {
returnValue = oreDictList.get(1).copy();
returnValue.stackSize = amount;
return returnValue;
}
- }
+ }
else {
- ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName);
- if (!oreDictList.isEmpty()){
+ final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName);
+ if (!oreDictList.isEmpty()) {
returnValue = oreDictList.get(1).copy();
returnValue.stackSize = amount;
return returnValue;
@@ -274,202 +360,146 @@ public class ItemUtils {
}
return returnValue;
}
- Utils.LOG_INFO(oredictName+" was not valid.");
+ Utils.LOG_INFO(oredictName + " 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 = {
- 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 = {
- 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 MultiPickaxeBase generateMultiPick(boolean GT_Durability, Materials material){
- ToolMaterial customMaterial = Utils.generateMaterialFromGT(material);
- Utils.LOG_WARNING("Generating a Multi-Pick out of "+material.name());
- short[] rgb;
- rgb = material.getRGBA();
- int dur = customMaterial.getMaxUses();
- Utils.LOG_WARNING("Determined durability for "+material.name()+" is "+dur);
- if (GT_Durability){
- dur = material.mDurability*100;
- Utils.LOG_WARNING("Using gregtech durability value, "+material.name()+" is now "+dur+".");
- }
- else if (dur <= 0){
- dur = material.mDurability;
- Utils.LOG_WARNING("Determined durability too low, "+material.name()+" is now "+dur+" based on the GT material durability.");
- }
-
- if (dur <= 0){
- Utils.LOG_WARNING("Still too low, "+material.name()+" will now go unused.");
- return null;
+ @SuppressWarnings("unused")
+ 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;
+ final Item em1 = ItemUtils.getItem(FQRN);
+ Utils.LOG_WARNING("Found: " + em1.getUnlocalizedName() + ":" + meta);
+ if (em1 != null) {
+ if (null == em) {
+ em = em1;
+ }
+ if (em != null) {
+ final ItemStack metaStack = new ItemStack(em, itemstackSize, meta);
+ return metaStack;
+ }
+ }
+ return null;
+ }
+ catch (final NullPointerException e) {
+ Utils.LOG_ERROR(itemName + " not found. [NULL]");
+ return null;
+ }
}
-
- MultiPickaxeBase MP_Redstone = new MultiPickaxeBase(
- material.name()+" Multipick",
- (customMaterial),
- dur,
- Utils.rgbtoHexValue(rgb[0],rgb[1],rgb[2])
- );
-
- if (MP_Redstone.isValid){
- return MP_Redstone;
- }
return null;
-
}
- public static MultiSpadeBase generateMultiShovel(boolean GT_Durability, Materials material){
- ToolMaterial customMaterial = Utils.generateMaterialFromGT(material);
- Utils.LOG_WARNING("Generating a Multi-Shovel out of "+material.name());
- short[] rgb;
- rgb = material.getRGBA();
- int dur = customMaterial.getMaxUses();
- Utils.LOG_WARNING("Determined durability for "+material.name()+" is "+dur);
- if (GT_Durability){
- dur = material.mDurability*100;
- Utils.LOG_WARNING("Using gregtech durability value, "+material.name()+" is now "+dur+".");
+ public static int getRadioactivityLevel(final String materialName) {
+ int sRadiation = 0;
+ if (materialName.toLowerCase().contains("uranium")) {
+ sRadiation = 2;
}
- else if (dur <= 0){
- dur = material.mDurability;
- Utils.LOG_WARNING("Determined durability too low, "+material.name()+" is now "+dur+" based on the GT material durability.");
+ else if (materialName.toLowerCase().contains("plutonium")) {
+ sRadiation = 4;
}
-
- if (dur <= 0){
- Utils.LOG_WARNING("Still too low, "+material.name()+" will now go unused.");
- return null;
+ else if (materialName.toLowerCase().contains("thorium")) {
+ sRadiation = 1;
}
-
- MultiSpadeBase MP_Redstone = new MultiSpadeBase(
- material.name()+" Multishovel",
- (customMaterial),
- dur,
- Utils.rgbtoHexValue(rgb[0],rgb[1],rgb[2])
- );
-
- if (MP_Redstone.isValid){
- return MP_Redstone;
- }
- return null;
-
+ return sRadiation;
}
- public static BaseItemDecidust generateDecidust(Materials material){
- if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null){
- Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material);
- if (placeholder != null)
- generateDecidust(placeholder);
- }
- return null;
+ public static ItemStack getSimpleStack(final Item x) {
+ return ItemUtils.getSimpleStack(x, 1);
}
- public static BaseItemDecidust generateDecidust(Material material){
- if (material.getDust(1) != null && MaterialUtils.hasValidRGBA(material.getRGBA())){
- BaseItemDecidust Decidust = new BaseItemDecidust(material);
- return Decidust;
+ public static ItemStack getSimpleStack(final Item x, final int i) {
+ try {
+ final ItemStack r = new ItemStack(x, i);
+ return r;
+ }
+ catch (final Throwable e) {
+ return null;
}
- return null;
- }
-
- public static BaseItemCentidust generateCentidust(Materials material){
- if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null){
- 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 ItemStack getSimpleStack(final ItemStack x, final int i) {
+ try {
+ final ItemStack r = x.copy();
+ r.stackSize = i;
+ return r;
+ }
+ catch (final Throwable e) {
+ return null;
}
- return null;
}
- public static boolean isRadioactive(String materialName){
- int sRadiation = 0;
- if (materialName.toLowerCase().contains("uranium")){
+ public static boolean isRadioactive(final String materialName) {
+ int sRadiation = 0;
+ if (materialName.toLowerCase().contains("uranium")) {
sRadiation = 2;
}
- else if (materialName.toLowerCase().contains("plutonium")){
+ else if (materialName.toLowerCase().contains("plutonium")) {
sRadiation = 4;
}
- else if (materialName.toLowerCase().contains("thorium")){
+ else if (materialName.toLowerCase().contains("thorium")) {
sRadiation = 1;
}
- if (sRadiation >= 1){
+ if (sRadiation >= 1) {
return true;
}
return false;
}
- public static int getRadioactivityLevel(String materialName){
- int sRadiation = 0;
- if (materialName.toLowerCase().contains("uranium")){
- sRadiation = 2;
- }
- else if (materialName.toLowerCase().contains("plutonium")){
- sRadiation = 4;
+ @SuppressWarnings("unused")
+ public static ItemStack simpleMetaStack(final Item item, final int meta, final int itemstackSize) {
+ try {
+ 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) {
+ final ItemStack metaStack = new ItemStack(em, itemstackSize, meta);
+ return metaStack;
+ }
+ }
+ return null;
}
- else if (materialName.toLowerCase().contains("thorium")){
- sRadiation = 1;
+ catch (final NullPointerException e) {
+ Utils.LOG_ERROR(item.getUnlocalizedName() + " not found. [NULL]");
+ return null;
}
- return sRadiation;
}
- public static String getArrayStackNames(ItemStack[] aStack){
- String itemNames = "Item Array: ";
- for (ItemStack alph : aStack){
-
- if (alph != null){
- String temp = itemNames;
- itemNames = temp + ", " + alph.getDisplayName() + " x" + alph.stackSize;
- }
- else {
- String temp = itemNames;
- itemNames = temp + ", " + "null" + " x" + "0";
+ @SuppressWarnings("unused")
+ public static ItemStack simpleMetaStack(final String FQRN, final int meta, final int itemstackSize) {
+ try {
+ Item em = null;
+ final Item em1 = ItemUtils.getItem(FQRN);
+ Utils.LOG_WARNING("Found: " + em1.getUnlocalizedName() + ":" + meta);
+ if (em1 != null) {
+ if (null == em) {
+ em = em1;
+ }
+ if (em != null) {
+ final ItemStack metaStack = new ItemStack(em, itemstackSize, meta);
+ return metaStack;
+ }
}
+ return null;
}
- return itemNames;
-
- }
-
- public static String[] getArrayStackNamesAsArray(ItemStack[] aStack){
- String[] itemNames = {};
- int arpos = 0;
- for (ItemStack alph : aStack){
- itemNames[arpos] = alph.getDisplayName();
- arpos++;
+ catch (final NullPointerException e) {
+ Utils.LOG_ERROR(FQRN + " not found. [NULL]");
+ return null;
}
- return itemNames;
-
}
- public static String getFluidArrayStackNames(FluidStack[] aStack){
- String itemNames = "Fluid Array: ";
- for (FluidStack alph : aStack){
- String temp = itemNames;
- itemNames = temp + ", " + alph.getFluid().getName() + " x" + alph.amount;
+ public static ItemStack[] validItemsForOreDict(final String oredictName) {
+ final List<?> validNames = MaterialUtils.oreDictValuesForEntry(oredictName);
+ final ItemStack[] inputs = null;
+ for (int i = 0; i < validNames.size(); i++) {
+ inputs[i] = (ItemStack) validNames.get(i);
}
- return itemNames;
-
- }
-
- public static ItemStack getGregtechCircuit(int Meta){
- return ItemUtils.getItemStackWithMeta(LoadedMods.Gregtech, "gregtech:gt.integrated_circuit", "Gregtech Circuit", Meta, 0);
+ return inputs;
}
}
diff --git a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java
index 3f973a56e9..9c93594963 100644
--- a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java
+++ b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java
@@ -13,209 +13,212 @@ import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.oredict.OreDictionary;
public class MaterialUtils {
-
- public static short firstID = 791;
-
- private static Class[][] commonTypes =
- {{Materials.class, int.class, TextureSet.class, float.class, int.class,
- int.class, int.class, int.class, int.class, int.class, int.class,
- String.class, int.class, int.class, int.class, int.class, boolean.class,
- boolean.class, int.class, int.class, int.class, Dyes.class, int.class,
- List.class , List.class}};
-
- public static 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)
- {
- 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,
- aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, aBlastFurnaceRequired, aTransparent, aOreValue, aDensityMultiplier, aDensityDivider,
- aColor, aExtraData, aMaterialList, aAspects);
- }
-
- public static List<?> oreDictValuesForEntry(String oredictName){
- List<?> oredictItemNames;
- if(OreDictionary.doesOreNameExist(oredictName)){
- ArrayList<ItemStack> oredictItems = OreDictionary.getOres(oredictName);
- oredictItemNames = Utils.convertArrayListToList(oredictItems);
- return oredictItemNames;
- }
- return null;
+
+ public static short firstID = 791;
+
+ private static Class[][] commonTypes = {
+ {
+ Materials.class, int.class, TextureSet.class, float.class, int.class, int.class, int.class,
+ int.class, int.class, int.class, int.class, String.class, int.class, int.class, int.class,
+ int.class, boolean.class, boolean.class, int.class, int.class, int.class, Dyes.class, int.class,
+ List.class, List.class
+ }
+ };
+
+ public static 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, MaterialUtils.commonTypes,
+ MaterialUtils.firstID++, aIconSet, aToolSpeed, aToolDurability, aToolQuality, aTypes, aR, aG, aB, aA,
+ aLocalName, aFuelType, aFuelPower, aMeltingPoint, aBlastFurnaceTemp, aBlastFurnaceRequired,
+ aTransparent, aOreValue, aDensityMultiplier, aDensityDivider, aColor, aExtraData, aMaterialList,
+ aAspects);
}
-
- public static Material generateMaterialFromGtENUM(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;
- String chemicalFormula = material.mChemicalFormula;
- Element element = material.mElement;
+
+ public static Material generateMaterialFromGtENUM(final Materials material) {
+ final String name = material.name();
+ 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 String chemicalFormula = material.mChemicalFormula;
+ final Element element = material.mElement;
int radioactivity = 0;
- if (material.isRadioactive()){
+ if (material.isRadioactive()) {
radioactivity = 1;
}
- if (hasValidRGBA(rgba) || element == Element.H){
- //ModItems.itemBaseDecidust = UtilsItems.generateDecidust(material);
- //ModItems.itemBaseCentidust = UtilsItems.generateCentidust(material);
- return new Material(name, rgba, melting, boiling, protons, neutrons, blastFurnace, chemicalFormula, radioactivity);
+ if (MaterialUtils.hasValidRGBA(rgba) || element == Element.H) {
+ // ModItems.itemBaseDecidust =
+ // UtilsItems.generateDecidust(material);
+ // ModItems.itemBaseCentidust =
+ // UtilsItems.generateCentidust(material);
+ return new Material(name, rgba, melting, boiling, protons, neutrons, blastFurnace, chemicalFormula,
+ radioactivity);
}
return null;
-
+
}
-
- public static Material generateQuickMaterial(String materialName, short[] colour, int sRadioactivity) {
- Material temp = new Material(
- materialName,
- colour,
- 1000, //melting
- 3000, //boiling
- 50, //Protons
- 50, //Neutrons
- false,
- "",
- sRadioactivity);
+
+ public static Material generateQuickMaterial(final String materialName, final short[] colour,
+ final int sRadioactivity) {
+ final Material temp = new Material(materialName, colour, 1000, // melting
+ 3000, // boiling
+ 50, // Protons
+ 50, // Neutrons
+ false, "", sRadioactivity);
return temp;
}
-
- public static boolean hasValidRGBA(short[] rgba){
- boolean test1 = false;
- boolean test2 = 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;
- }
- else if (r == 2){
- test3 = true;
- }
- }
- }
- if ((test1 && test2) || (test1 && test3) || (test3 && test2)){
- return false;
- }
- return true;
- }
-
- public static String superscript(String str) {
- str = str.replaceAll("0", "\u2070");
- str = str.replaceAll("1", "\u00B9");
- str = str.replaceAll("2", "\u00B2");
- str = str.replaceAll("3", "\u00B3");
- str = str.replaceAll("4", "\u2074");
- str = str.replaceAll("5", "\u2075");
- str = str.replaceAll("6", "\u2076");
- str = str.replaceAll("7", "\u2077");
- str = str.replaceAll("8", "\u2078");
- str = str.replaceAll("9", "\u2079");
- return str;
- }
- public static String subscript(String str) {
- str = str.replaceAll("0", "\u2080");
- str = str.replaceAll("1", "\u2081");
- str = str.replaceAll("2", "\u2082");
- str = str.replaceAll("3", "\u2083");
- str = str.replaceAll("4", "\u2084");
- str = str.replaceAll("5", "\u2085");
- str = str.replaceAll("6", "\u2086");
- str = str.replaceAll("7", "\u2087");
- str = str.replaceAll("8", "\u2088");
- str = str.replaceAll("9", "\u2089");
- 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 {
return 0;
}
}
-
-
- /*
- * 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,
- 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)
-
- *
- *new Class[{int.class, TextureSet.class, float.class, int.class,
- int.class, int.class, int.class, int.class, int.class, int.class,
- String.class, int.class, int.class, int.class, int.class, boolean.class,
- boolean.class, int.class, int.class, int.class, Dyes.class, int.class,
- List.class , List.class}],
- */
-
-
-
- /*public static Materials GenerateGtMaterialForSingleUse(MaterialInfo s){
-
- Materials yourName = EnumHelper.addEnum(
-
- Materials.class, s.name(),
-
-
-
- new Object[0]
-
- );
- try
- {
-
-
-
- Class<? extends ItemCell> clz = item.getClass();
- Method methode = clz.getDeclaredMethod("addCell", int.class, InternalName.class, Block[].class);
- methode.setAccessible(true);
- ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]);
+ public static boolean hasValidRGBA(final short[] rgba) {
+ boolean test1 = false;
+ boolean test2 = 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;
+ }
+ else if (r == 2) {
+ test3 = true;
+ }
+ }
+ }
+ if (test1 && test2 || test1 && test3 || test3 && test2) {
+ return false;
+ }
+ return true;
+ }
+ public static List<?> oreDictValuesForEntry(final String oredictName) {
+ List<?> oredictItemNames;
+ if (OreDictionary.doesOreNameExist(oredictName)) {
+ final ArrayList<ItemStack> oredictItems = OreDictionary.getOres(oredictName);
+ oredictItemNames = Utils.convertArrayListToList(oredictItems);
+ return oredictItemNames;
+ }
+ return null;
+ }
+ public static String subscript(String str) {
+ str = str.replaceAll("0", "\u2080");
+ str = str.replaceAll("1", "\u2081");
+ str = str.replaceAll("2", "\u2082");
+ str = str.replaceAll("3", "\u2083");
+ str = str.replaceAll("4", "\u2084");
+ str = str.replaceAll("5", "\u2085");
+ str = str.replaceAll("6", "\u2086");
+ str = str.replaceAll("7", "\u2087");
+ str = str.replaceAll("8", "\u2088");
+ str = str.replaceAll("9", "\u2089");
+ return str;
+ }
+ public static String superscript(String str) {
+ str = str.replaceAll("0", "\u2070");
+ str = str.replaceAll("1", "\u00B9");
+ str = str.replaceAll("2", "\u00B2");
+ str = str.replaceAll("3", "\u00B3");
+ str = str.replaceAll("4", "\u2074");
+ str = str.replaceAll("5", "\u2075");
+ str = str.replaceAll("6", "\u2076");
+ str = str.replaceAll("7", "\u2077");
+ str = str.replaceAll("8", "\u2078");
+ str = str.replaceAll("9", "\u2079");
+ return str;
+ }
+ /*
+ * 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, 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)
+ *
+ *
+ * new Class[{int.class, TextureSet.class, float.class, int.class,
+ * int.class, int.class, int.class, int.class, int.class, int.class,
+ * String.class, int.class, int.class, int.class, int.class, boolean.class,
+ * boolean.class, int.class, int.class, int.class, Dyes.class, int.class,
+ * List.class , List.class}],
+ */
- return Materials.Abyssal;
- }
- catch(Exception e){
- e.printStackTrace();
- }
- return null;
- }*/
+ /*
+ * public static Materials GenerateGtMaterialForSingleUse(MaterialInfo s){
+ *
+ * Materials yourName = EnumHelper.addEnum(
+ *
+ * Materials.class, s.name(),
+ *
+ *
+ *
+ * new Object[0]
+ *
+ * ); try {
+ *
+ *
+ *
+ * Class<? extends ItemCell> clz = item.getClass(); Method methode =
+ * clz.getDeclaredMethod("addCell", int.class, InternalName.class,
+ * Block[].class); methode.setAccessible(true); ItemStack temp = (ItemStack)
+ * methode.invoke(item, cellID++, yourName, new Block[0]);
+ *
+ *
+ *
+ *
+ *
+ *
+ * return Materials.Abyssal; } catch(Exception e){ e.printStackTrace(); }
+ * return null; }
+ */
}
diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java
index 86c46969cd..69e4a1a446 100644
--- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java
+++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java
@@ -8,256 +8,252 @@ import gtPlusPlus.core.util.Utils;
public class MathUtils {
/**
- * Returns a psuedo-random number between min and max, inclusive.
- * The difference between min and max can be at most
- * Integer.MAX_VALUE - 1.
+ * Returns an int. The returned number is the value on i + 273.15F. Supports
+ * ints.
*
- * @param min Minimim value
- * @param max Maximim value. Must be greater than min.
- * @return Integer between min and max, inclusive.
- * @see java.util.Random#nextInt(int)
+ * @param i
+ * Temp in Celcius.
+ * @return int The celcius temp returned as Kelvin, rounded to the readest
+ * whole.
*/
- public static int randInt(int min, int max) {
-
- // Usually this can be a field rather than a method variable
- 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;
-
- return randomNum;
- }
-
- public static double getChanceOfXOverYRuns(double x, double y){
- double z = (1-Math.pow((1-x), y));
- return z;
+ public static float celsiusToKelvin(final int i) {
+ final double f = i + 273.15F;
+ return (int) MathUtils.decimalRoundingToWholes(f);
}
-
-
+
+ // Smooth Rounding Function
/**
- * Returns a psuedo-random number between min and max, inclusive.
- * The difference between min and max can be at most
- * Long.MAX_VALUE - 1.
+ * Returns a double. The returned number is d rounded to the nearest d.01.
+ * Supports Doubles.
*
- * @param min Minimim value
- * @param max Maximim value. Must be greater than min.
- * @return Long between min and max, inclusive.
- * @see java.util.Random#nextLong(long)
+ * @param current
+ * Current value.
+ * @return double Rounded value.
*/
- public static long randLong(long min, long max) {
- // Usually this can be a field rather than a method variable
- 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;
-
- return randomNum;
- }
- private static long nextLong(Random rng, 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);
- return val;
+ public static double decimalRounding(final double d) {
+ return Math.round(d * 2) / 2.0;
}
-
+ // Smooth Rounding Function (Nearest 5)
/**
- * Returns a percentage.
- * The returned number is the % of X in Y.
+ * Returns a double. The returned number is d rounded to the nearest d.5.
* Supports Doubles.
*
- * @param current Current value.
- * @param max Maximim value. Must be greater than min.
- * @return double between min and max, inclusive.
+ * @param current
+ * Current value.
+ * @return double Rounded value.
*/
- public static double findPercentage(double current, double max){
- double c = ((double) current / max) * 100;
- double roundOff = Math.round(c * 100.00) / 100.00;
- return roundOff;
+ public static double decimalRoundingToWholes(final double d) {
+ return 5 * Math.round(d / 5);
}
-
- //Smooth Rounding Function
/**
- * Returns a double.
- * The returned number is d rounded to the nearest d.01.
- * Supports Doubles.
+ * Returns a boolean. The returned boolean is wether or not X evenly fits in
+ * to Y. Supports ints.
*
- * @param current Current value.
- * @return double Rounded value.
+ * @param x
+ * Value A.
+ * @param y
+ * Value B. Must be greater than min.
+ * @return boolean Whether or not it divides evenly.
*/
- public static double decimalRounding(double d) {
- return Math.round(d * 2) / 2.0;
+ public static boolean divideXintoY(final int x, final int y) {
+ if (x % y == 0) {
+ return true;
+ }
+ return false;
}
-
- //Smooth Rounding Function (Nearest 5)
/**
- * Returns a double.
- * The returned number is d rounded to the nearest d.5.
- * Supports Doubles.
+ * Returns a percentage. The returned number is the % of X in Y. Supports
+ * Doubles.
*
- * @param current Current value.
- * @return double Rounded value.
+ * @param current
+ * Current value.
+ * @param max
+ * Maximim value. Must be greater than min.
+ * @return double between min and max, inclusive.
*/
- public static double decimalRoundingToWholes(double d) {
- return 5*(Math.round(d/5));
+ 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;
+ }
+
+ private static long gcd(long a, long b) {
+ while (b > 0) {
+ final long temp = b;
+ b = a % b; // % is remainder
+ a = temp;
+ }
+ return a;
+ }
+
+ private static long gcd(final long[] input) {
+ long result = input[0];
+ for (int i = 1; i < input.length; i++) {
+ result = MathUtils.gcd(result, input[i]);
+ }
+ return result;
}
-
- 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;
- }
-
/**
- * Returns a boolean.
- * The returned boolean is wether or not X evenly fits in to Y.
- * Supports ints.
+ * Returns a hexInteger. The returned value is between min and max. Supports
+ * ints.
*
- * @param x Value A.
- * @param y Value B. Must be greater than min.
- * @return boolean Whether or not it divides evenly.
+ * @param min
+ * Minimum value.
+ * @param max
+ * Maximium value. Must be greater than min.
+ * @return hexInteger between min and max, inclusive.
*/
- public static boolean divideXintoY(int x, int y){
- if ((x % y) == 0)
- {
- return true;
- }
- return false;
+ public static int generateRandomHexValue(final int min, final int max) {
+ final int result = MathUtils.getHexNumberFromInt(MathUtils.randInt(min, max));
+ return result;
}
-
/**
- * Returns a boolean.
- * The returned boolean is based on the odd/eveness of the input.
- * Supports ints.
+ * Returns a random hex value. The returned value is between 000000-ffffff.
*
- * @param x Value A.
- * @return boolean Whether or not it divides evenly.
+ * @return hexInteger between min and max, inclusive.
*/
- public static boolean isNumberEven(int x){
- if ((x % 2) == 0)
- {
- return true;
+ public static int generateSingularRandomHexValue() {
+ String temp;
+ final int randomInt = MathUtils.randInt(1, 5);
+ final Map<Integer, String> colours = Utils.hexColourGeneratorRandom(5);
+
+ if (colours.get(randomInt) != null && colours.size() > 0) {
+ temp = colours.get(randomInt);
}
- return false;
+ else {
+ temp = "0F0F0F";
+ }
+
+ 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 double getChanceOfXOverYRuns(final double x, final double y) {
+ final double z = 1 - Math.pow(1 - x, y);
+ return z;
+ }
/**
- * Returns an int.
- * The returned number is the value on i + 273.15F.
+ * Returns a hexInteger. The returned number is the hex value of the input.
* Supports ints.
*
- * @param i Temp in Celcius.
- * @return int The celcius temp returned as Kelvin, rounded to the readest whole.
+ * @param input
+ * Current value.
+ * @return hexInteger.
*/
- public static float celsiusToKelvin(int i){
- double f = i + 273.15F;
- return (int)decimalRoundingToWholes(f);
+ public static int getHexNumberFromInt(final int input) {
+ final String result = Integer.toHexString(input);
+ final int resultINT = Integer.getInteger(result);
+ return resultINT;
}
-
/**
- * Returns a hexInteger.
- * The returned number is the hex value of the input.
- * Supports ints.
+ * Returns a boolean. The returned boolean is based on the odd/eveness of
+ * the input. Supports ints.
*
- * @param input Current value.
- * @return hexInteger.
+ * @param x
+ * Value A.
+ * @return boolean Whether or not it divides evenly.
*/
- public static int getHexNumberFromInt(int input){
- String result = Integer.toHexString(input);
- int resultINT = Integer.getInteger(result);
- return resultINT;
+ public static boolean isNumberEven(final int x) {
+ if (x % 2 == 0) {
+ return true;
+ }
+ return false;
+ }
+
+ 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);
+ return val;
}
-
/**
- * Returns a hexInteger.
- * The returned value is between min and max.
- * Supports ints.
+ * Returns a psuedo-random number between min and max, inclusive. The
+ * difference between min and max can be at most Integer.MAX_VALUE - 1.
*
- * @param min Minimum value.
- * @param max Maximium value. Must be greater than min.
- * @return hexInteger between min and max, inclusive.
+ * @param min
+ * Minimim value
+ * @param max
+ * Maximim value. Must be greater than min.
+ * @return Integer between min and max, inclusive.
+ * @see java.util.Random#nextInt(int)
*/
- public static int generateRandomHexValue(int min, int max){
- int result = getHexNumberFromInt(randInt(min, max));
- return result;
+ public static int randInt(final int min, final int max) {
+
+ // Usually this can be a field rather than a method variable
+ final Random rand = new Random();
+
+ // nextInt is normally exclusive of the top value,
+ // so add 1 to make it inclusive
+ final int randomNum = rand.nextInt(max - min + 1) + min;
+
+ return randomNum;
}
-
/**
- * Returns a random hex value.
- * The returned value is between 000000-ffffff.
+ * Returns a psuedo-random number between min and max, inclusive. The
+ * difference between min and max can be at most Long.MAX_VALUE - 1.
*
- * @return hexInteger between min and max, inclusive.
+ * @param min
+ * Minimim value
+ * @param max
+ * Maximim value. Must be greater than min.
+ * @return Long between min and max, inclusive.
+ * @see java.util.Random#nextLong(long)
*/
- public static int generateSingularRandomHexValue(){
- String temp;
- int randomInt = randInt(1, 5);
- final Map<Integer, String> colours = Utils.hexColourGeneratorRandom(5);
+ public static long randLong(final long min, final long max) {
+ // Usually this can be a field rather than a method variable
+ final Random rand = new Random();
+
+ // nextInt is normally exclusive of the top value,
+ // so add 1 to make it inclusive
+ final long randomNum = MathUtils.nextLong(rand, max - min + 1) + min;
+
+ return randomNum;
+ }
- if (colours.get(randomInt) != null && colours.size() > 0){
- temp = colours.get(randomInt);
+ public static int roundToClosestMultiple(final double number, final int multiple) {
+ int result = multiple;
+ if (number % multiple == 0) {
+ return (int) number;
}
- else {
- temp = "0F0F0F";
+ // If not already multiple of given number
+ if (number % multiple != 0) {
+ final int division = (int) (number / multiple + 1);
+ result = division * multiple;
}
-
- 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);
+ return result;
}
-
- public static long[] simplifyNumbersToSmallestForm(long[] inputArray){
- long GCD = gcd(inputArray);
- long[] outputArray = new long[inputArray.length];
- for (int i=0;i<inputArray.length;i++){
- if (GCD != 0)
- outputArray[i] = (inputArray[i]/GCD);
- else
+
+ public static long[] simplifyNumbersToSmallestForm(final long[] inputArray) {
+ final long GCD = MathUtils.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 {
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;
- }
-
- 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;
- }
-
-
}
diff --git a/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java b/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java
index e2ec1f5d09..2208dd50b7 100644
--- a/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java
+++ b/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java
@@ -5,15 +5,15 @@ import java.net.*;
public class NetworkUtils {
- public static String getContentFromURL(String args) {
- if (netIsAvailable()){
+ public static String getContentFromURL(final String args) {
+ if (NetworkUtils.netIsAvailable()) {
try {
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) {
@@ -21,26 +21,30 @@ public class NetworkUtils {
}
br.close();
return tempLine;
- } catch (MalformedURLException e) {
+ }
+ catch (final MalformedURLException e) {
e.printStackTrace();
- } catch (IOException e) {
+ }
+ catch (final IOException e) {
e.printStackTrace();
}
- }
+ }
return null;
}
- private static boolean netIsAvailable() {
- 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 netIsAvailable() {
+ 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;
+ }
+ }
}
diff --git a/src/Java/gtPlusPlus/core/util/particles/EntityParticleFXMysterious.java b/src/Java/gtPlusPlus/core/util/particles/EntityParticleFXMysterious.java
index 2c704e48a6..54f3936e34 100644
--- a/src/Java/gtPlusPlus/core/util/particles/EntityParticleFXMysterious.java
+++ b/src/Java/gtPlusPlus/core/util/particles/EntityParticleFXMysterious.java
@@ -3,15 +3,12 @@ package gtPlusPlus.core.util.particles;
import net.minecraft.client.particle.EntityAuraFX;
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 class EntityParticleFXMysterious extends EntityAuraFX {
+ public EntityParticleFXMysterious(final World parWorld, final double parX, final double parY, final double parZ,
+ final double parMotionX, final double parMotionY, final double parMotionZ) {
+ 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 a82aaa2b83..ea40993dae 100644
--- a/src/Java/gtPlusPlus/core/util/player/PlayerCache.java
+++ b/src/Java/gtPlusPlus/core/util/player/PlayerCache.java
@@ -13,165 +13,170 @@ public class PlayerCache {
private static final File cache = new File("PlayerCache.dat");
- public static final void initCache() {
- if (CORE.PlayerCache == null || CORE.PlayerCache.equals(null)){
- try {
+ public static void appendParamChanges(final String playerName, final String playerUUIDasString) {
+ final HashMap<String, UUID> playerInfo = new HashMap<String, UUID>();
+ playerInfo.put(playerName, UUID.fromString(playerUUIDasString));
- if (cache != null){
- CORE.PlayerCache = PlayerCache.readPropertiesFileAsMap();
- Utils.LOG_INFO("Loaded PlayerCache.dat");
- }
+ /*
+ * try { Utils.LOG_INFO("Attempting to load "+cache.getName());
+ * properties.load(new FileInputStream(cache)); if (properties == null
+ * || properties.equals(null)){ Utils.LOG_INFO("Please wait."); } else {
+ * Utils.LOG_INFO("Loaded PlayerCache.dat");
+ * properties.setProperty(playerName+"_", playerUUIDasString);
+ * FileOutputStream fr=new FileOutputStream(cache); properties.store(fr,
+ * "Player Cache."); fr.close(); }
+ *
+ * }
+ */
+ try {
+ final FileOutputStream fos = new FileOutputStream("PlayerCache.dat");
+ final ObjectOutputStream oos = new ObjectOutputStream(fos);
+ oos.writeObject(playerInfo);
+ oos.close();
+ fos.close();
+ Utils.LOG_INFO("Serialized Player data saved in PlayerCache.dat");
+ }
- } catch (Exception e) {
- Utils.LOG_INFO("Failed to initialise PlayerCache.dat");
- PlayerCache.createPropertiesFile("PLAYER_", "DATA");
- //e.printStackTrace();
- }
+ catch (final IOException e) {
+ Utils.LOG_INFO("No PlayerCache file found, creating one.");
+ PlayerCache.createPropertiesFile(playerName, playerUUIDasString);
}
}
- public static void createPropertiesFile(String playerName, String playerUUIDasString) {
+ public static void createPropertiesFile(final String playerName, final String playerUUIDasString) {
try {
- Properties props = new Properties();
- props.setProperty(playerName+" ", playerUUIDasString);
- OutputStream out = new FileOutputStream(cache);
+ final Properties props = new Properties();
+ props.setProperty(playerName + " ", playerUUIDasString);
+ final OutputStream out = new FileOutputStream(PlayerCache.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>();
- playerInfo.put(playerName, UUID.fromString(playerUUIDasString));
-
- /*try {
- Utils.LOG_INFO("Attempting to load "+cache.getName());
- properties.load(new FileInputStream(cache));
- if (properties == null || properties.equals(null)){
- Utils.LOG_INFO("Please wait.");
+ public static final void initCache() {
+ if (CORE.PlayerCache == null || CORE.PlayerCache.equals(null)) {
+ try {
+
+ if (PlayerCache.cache != null) {
+ CORE.PlayerCache = PlayerCache.readPropertiesFileAsMap();
+ Utils.LOG_INFO("Loaded PlayerCache.dat");
+ }
+
}
- else {
- Utils.LOG_INFO("Loaded PlayerCache.dat");
- properties.setProperty(playerName+"_", playerUUIDasString);
- FileOutputStream fr=new FileOutputStream(cache);
- properties.store(fr, "Player Cache.");
- fr.close();
+ catch (final Exception e) {
+ Utils.LOG_INFO("Failed to initialise PlayerCache.dat");
+ PlayerCache.createPropertiesFile("PLAYER_", "DATA");
+ // e.printStackTrace();
}
+ }
+ }
- } */
-
- try
- {
- FileOutputStream fos = new FileOutputStream("PlayerCache.dat");
- 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) {
- Utils.LOG_INFO("No PlayerCache file found, creating one.");
- createPropertiesFile(playerName, playerUUIDasString);
- }
+ public static String lookupPlayerByUUID(final UUID UUID) {
+
+ try {
+ final World worldw = Minecraft.getMinecraft().thePlayer.worldObj;
+ // if (!worldw.isRemote){
+
+ try {
+ Map<String, UUID> map = null;
+ try {
+ map = PlayerCache.readPropertiesFileAsMap();
+ }
+ catch (final Exception e) {
+ Utils.LOG_INFO("With " + e.getCause() + " as cause, Caught Exception: " + e.toString());
+ // e.printStackTrace();
+ }
+ for (final Entry<String, UUID> entry : map.entrySet()) {
+ if (Objects.equals(UUID, entry.getValue())) {
+ return entry.getKey();
+ }
+ }
+ return null;
+ }
+ catch (final NullPointerException e) {
+ Utils.LOG_INFO("With " + e.getCause() + " as cause, Caught Exception: " + e.toString());
+ // e.printStackTrace();
+ }
+
+ // }
+
+ }
+ catch (final Throwable r) {
+ Utils.LOG_INFO("With " + r.getCause() + " as cause, Caught Exception: " + r.toString());
+ }
+ return null;
+ }
+
+ public static HashMap<String, UUID> readPropertiesFileAsMap() {
+ HashMap<String, UUID> map = null;
+ try {
+ final FileInputStream fis = new FileInputStream(PlayerCache.cache);
+ final ObjectInputStream ois = new ObjectInputStream(fis);
+ map = (HashMap<String, UUID>) ois.readObject();
+ ois.close();
+ fis.close();
+ }
+ catch (final IOException ioe) {
+ ioe.printStackTrace();
+ return null;
+ }
+ catch (final ClassNotFoundException c) {
+ Utils.LOG_INFO("Class not found");
+ c.printStackTrace();
+ return null;
+ }
+ Utils.LOG_WARNING("Deserialized PlayerCache..");
+ return 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
- * from the value in the properties file.
+ * 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 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 = "=";
- @SuppressWarnings({ "rawtypes", "unchecked" })
- Map<String, String> map = new HashMap<String, String>();
- BufferedReader reader = new BufferedReader(new FileReader(cache));
+ final String delimiter = "=";
+ @SuppressWarnings({
+ "rawtypes", "unchecked"
+ })
+ final Map<String, String> map = new HashMap<String, String>();
+ final BufferedReader reader = new BufferedReader(new FileReader(PlayerCache.cache));
String line;
- while ((line = reader.readLine()) != null)
- {
- 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>,
+ while ((line = reader.readLine()) != null) {
+ 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();
CORE.PlayerCache = map;
return map;
}
-
- public static HashMap<String, UUID> readPropertiesFileAsMap() {
- HashMap<String, UUID> map = null;
- try
- {
- FileInputStream fis = new FileInputStream(cache);
- ObjectInputStream ois = new ObjectInputStream(fis);
- map = (HashMap<String, UUID>) ois.readObject();
- ois.close();
- fis.close();
- }catch(IOException ioe)
- {
- ioe.printStackTrace();
- return null;
- }catch(ClassNotFoundException c)
- {
- Utils.LOG_INFO("Class not found");
- c.printStackTrace();
- return null;
- }
- Utils.LOG_WARNING("Deserialized PlayerCache..");
- return map;
- }
-
- public static String lookupPlayerByUUID(UUID UUID){
-
- try {
- World worldw = Minecraft.getMinecraft().thePlayer.worldObj;
- //if (!worldw.isRemote){
-
-
- try {
- Map<String, UUID> map = null;
- try {
- map = readPropertiesFileAsMap();
- } catch (Exception e) {
- Utils.LOG_INFO("With "+e.getCause()+" as cause, Caught Exception: "+e.toString());
- //e.printStackTrace();
- }
- for (Entry<String, UUID> entry : map.entrySet()) {
- if (Objects.equals(UUID, entry.getValue())) {
- return entry.getKey();
- }
- }
- return null;
- } catch (NullPointerException e) {
- Utils.LOG_INFO("With "+e.getCause()+" as cause, Caught Exception: "+e.toString());
- //e.printStackTrace();
- }
-
-
- //}
-
-
- } catch (Throwable r){
- Utils.LOG_INFO("With "+r.getCause()+" as cause, Caught Exception: "+r.toString());
- }
- return null;
- }
}
diff --git a/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java b/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java
index 616ecc439e..7d6e2f42e7 100644
--- a/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java
+++ b/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java
@@ -14,113 +14,129 @@ import net.minecraft.world.World;
public class PlayerUtils {
- public static void messagePlayer(EntityPlayer P, String S){
- gregtech.api.util.GT_Utility.sendChatToPlayer(P, S);
- }
+ @SideOnly(Side.CLIENT)
+ public static Item getItemInPlayersHand() {
+ final Minecraft mc = Minecraft.getMinecraft();
+ Item heldItem = null;
- public static EntityPlayer getPlayer(String name){
- List<EntityPlayer> i = new ArrayList<EntityPlayer>();
- Iterator<EntityPlayer> crunchifyIterator = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator();
- while (crunchifyIterator.hasNext()) {
- i.add((crunchifyIterator.next()));
- }
- try{
- for (EntityPlayer temp : i) {
- if (temp.getDisplayName().toLowerCase().equals(name.toLowerCase())){
- return temp;
- }
- }
+ try {
+ heldItem = mc.thePlayer.getHeldItem().getItem();
}
- catch(NullPointerException e){}
- return null;
- }
-
- public static EntityPlayer getPlayerOnServerFromUUID(UUID parUUID){
- if (parUUID == null)
- {
+ catch (final NullPointerException e) {
return null;
}
- List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
- for (EntityPlayerMP player : allPlayers)
- {
- if (player.getUniqueID().equals(parUUID))
- {
- return player;
- }
+
+ if (heldItem != null) {
+ return heldItem;
}
+
return null;
}
- //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;
- }
- }
- }
- catch(NullPointerException e){}
+ @SideOnly(Side.CLIENT)
+ public static ItemStack getItemStackInPlayersHand() {
+ final Minecraft mc = Minecraft.getMinecraft();
+ ItemStack heldItem = null;
+ try {
+ heldItem = mc.thePlayer.getHeldItem();
+ }
+ catch (final NullPointerException e) {
return null;
}
-
- public static boolean isPlayerOP(EntityPlayer player){
- if (player.canCommandSenderUseCommand(2, "")){
- return true;
+ if (heldItem != null) {
+ return heldItem;
}
- return false;
+ return null;
}
- //Not Clientside
- public static ItemStack getItemStackInPlayersHand(World world, String Name){
- EntityPlayer thePlayer = getPlayer(Name);
+ @SideOnly(Side.SERVER)
+ public static ItemStack getItemStackInPlayersHand(final EntityPlayer player) {
ItemStack heldItem = null;
- try{heldItem = thePlayer.getHeldItem();
- }catch(NullPointerException e){return null;}
- if (heldItem != null){
+ try {
+ heldItem = player.getHeldItem();
+ }
+ catch (final NullPointerException e) {
+ return null;
+ }
+ if (heldItem != null) {
return heldItem;
}
return null;
}
- @SideOnly(Side.CLIENT)
- public static ItemStack getItemStackInPlayersHand(){
- Minecraft mc = Minecraft.getMinecraft();
+ // Not Clientside
+ public static ItemStack getItemStackInPlayersHand(final World world, final String Name) {
+ final EntityPlayer thePlayer = PlayerUtils.getPlayer(Name);
ItemStack heldItem = null;
- try{heldItem = mc.thePlayer.getHeldItem();
- }catch(NullPointerException e){return null;}
- if (heldItem != null){
+ try {
+ heldItem = thePlayer.getHeldItem();
+ }
+ catch (final NullPointerException e) {
+ return null;
+ }
+ if (heldItem != null) {
return heldItem;
}
return null;
}
-
- @SideOnly(Side.SERVER)
- public static ItemStack getItemStackInPlayersHand(EntityPlayer player){
- ItemStack heldItem = null;
- try{heldItem = player.getHeldItem();
- }catch(NullPointerException e){return null;}
- if (heldItem != null){
- return heldItem;
+
+ public static EntityPlayer getPlayer(final String name) {
+ final List<EntityPlayer> i = new ArrayList<EntityPlayer>();
+ final Iterator<EntityPlayer> crunchifyIterator = MinecraftServer.getServer()
+ .getConfigurationManager().playerEntityList.iterator();
+ while (crunchifyIterator.hasNext()) {
+ i.add(crunchifyIterator.next());
+ }
+ try {
+ for (final EntityPlayer temp : i) {
+ if (temp.getDisplayName().toLowerCase().equals(name.toLowerCase())) {
+ return temp;
+ }
+ }
+ }
+ catch (final NullPointerException e) {
}
return null;
}
- @SideOnly(Side.CLIENT)
- public static Item getItemInPlayersHand(){
- Minecraft mc = Minecraft.getMinecraft();
- Item heldItem = null;
-
- try{heldItem = mc.thePlayer.getHeldItem().getItem();
- }catch(NullPointerException e){return null;}
-
- if (heldItem != null){
- return heldItem;
+ // Not Clientside
+ 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 (final NullPointerException e) {
}
-
return null;
}
+ public static EntityPlayer getPlayerOnServerFromUUID(final UUID parUUID) {
+ if (parUUID == null) {
+ return null;
+ }
+ final List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
+ for (final EntityPlayerMP player : allPlayers) {
+ if (player.getUniqueID().equals(parUUID)) {
+ return player;
+ }
+ }
+ return null;
+ }
+
+ public static boolean isPlayerOP(final EntityPlayer player) {
+ if (player.canCommandSenderUseCommand(2, "")) {
+ return true;
+ }
+ return false;
+ }
+
+ public static void messagePlayer(final EntityPlayer P, final String S) {
+ gregtech.api.util.GT_Utility.sendChatToPlayer(P, S);
+ }
+
}
diff --git a/src/Java/gtPlusPlus/core/util/player/UtilsMining.java b/src/Java/gtPlusPlus/core/util/player/UtilsMining.java
index 1b6b957b32..e92a5ac41a 100644
--- a/src/Java/gtPlusPlus/core/util/player/UtilsMining.java
+++ b/src/Java/gtPlusPlus/core/util/player/UtilsMining.java
@@ -8,139 +8,133 @@ 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){
+ private static boolean durabilityDamage = false;
+ private static ItemStack stack;
+
+ 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){
- return false;}
- }
- return false;
- }
-
- private static void removeBlockAndDropAsItem(World world, int X, int Y, 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);
-
- }
- else {
- Utils.LOG_WARNING("Incorrect Tool for mining this block.");
+ // Utils.LOG_WARNING(correctTool);
+ if (correctTool.equals("pickaxe")) {
+ return true;
}
}
- } catch (NullPointerException e){
-
+ catch (final NullPointerException e) {
+ return false;
+ }
}
+ return false;
}
- public static void customMine(World world, String FACING, EntityPlayer aPlayer){
+ public static void customMine(final World world, final String FACING, final EntityPlayer aPlayer) {
float DURABILITY_LOSS = 0;
- if (!world.isRemote){
+ if (!world.isRemote) {
int X = 0;
int Y = 0;
int Z = 0;
- if (FACING.equals("below") || FACING.equals("above")){
+ if (FACING.equals("below") || FACING.equals("above")) {
- //Set Player Facing
+ // Set Player Facing
X = (int) aPlayer.posX;
- Utils.LOG_WARNING("Setting Variable X: "+X);
- if (FACING.equals("above")){
+ Utils.LOG_WARNING("Setting Variable X: " + X);
+ if (FACING.equals("above")) {
Z = (int) aPlayer.posY + 1;
- Utils.LOG_WARNING("Setting Variable Y: "+Y);
- }
- else {
- Z = (int) aPlayer.posY - 1;
- Utils.LOG_WARNING("Setting Variable Y: "+Y);}
+ Utils.LOG_WARNING("Setting Variable Y: " + Y);
+ }
+ else {
+ Z = (int) aPlayer.posY - 1;
+ Utils.LOG_WARNING("Setting Variable Y: " + Y);
+ }
Z = (int) aPlayer.posZ;
- Utils.LOG_WARNING("Setting Variable Z: "+Z);
+ Utils.LOG_WARNING("Setting Variable Z: " + Z);
DURABILITY_LOSS = 0;
- for(int i = -2; i < 3; i++) {
- 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);
-// Utils.LOG_WARNING("Added Loss: "+dur);
-*/ removeBlockAndDropAsItem(world, X + i, Y + k, Z + j);
+ for (int i = -2; i < 3; i++) {
+ 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); // Utils.LOG_WARNING(
+ * "Added Loss: "+dur);
+ */ UtilsMining.removeBlockAndDropAsItem(world, X + i, Y + k, Z + j);
}
}
}
}
- else if (FACING.equals("facingEast") || FACING.equals("facingWest")){
+ else if (FACING.equals("facingEast") || FACING.equals("facingWest")) {
- //Set Player Facing
+ // Set Player Facing
Z = (int) aPlayer.posZ;
Y = (int) aPlayer.posY;
- if (FACING.equals("facingEast")){
- X = (int) aPlayer.posX + 1;}
- else {
- X = (int) aPlayer.posX - 1;}
-
+ if (FACING.equals("facingEast")) {
+ X = (int) aPlayer.posX + 1;
+ }
+ else {
+ X = (int) aPlayer.posX - 1;
+ }
DURABILITY_LOSS = 0;
- for(int i = -1; i < 2; i++) {
- for(int j = -1; j < 2; j++) {
- for(int k = -1; k < 2; k++) {
- /*float dur = calculateDurabilityLoss(world, X+k, Y + i, Z + j);
- DURABILITY_LOSS = (DURABILITY_LOSS + dur);
- Utils.LOG_WARNING("Added Loss: "+dur);*/
- removeBlockAndDropAsItem(world, X+k, Y + i, Z + j);
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ for (int k = -1; k < 2; k++) {
+ /*
+ * float dur = calculateDurabilityLoss(world, X+k, Y
+ * + i, Z + j); DURABILITY_LOSS = (DURABILITY_LOSS +
+ * dur); Utils.LOG_WARNING("Added Loss: "+dur);
+ */
+ UtilsMining.removeBlockAndDropAsItem(world, X + k, Y + i, Z + j);
}
}
}
}
- else if (FACING.equals("facingNorth") || FACING.equals("facingSouth")){
+ else if (FACING.equals("facingNorth") || FACING.equals("facingSouth")) {
- //Set Player Facing
+ // Set Player Facing
X = (int) aPlayer.posX;
Y = (int) aPlayer.posY;
-
- if (FACING.equals("facingNorth")){
- Z = (int) aPlayer.posZ + 1;}
+
+ if (FACING.equals("facingNorth")) {
+ Z = (int) aPlayer.posZ + 1;
+ }
else {
- Z = (int) aPlayer.posZ - 1;}
-
+ Z = (int) aPlayer.posZ - 1;
+ }
+
DURABILITY_LOSS = 0;
- for(int i = -1; i < 2; i++) {
- for(int j = -1; j < 2; j++) {
- for(int k = -1; k < 2; k++) {
- /*float dur = calculateDurabilityLoss(world, X + j, Y + i, Z+k);
- DURABILITY_LOSS = (DURABILITY_LOSS + dur);
- Utils.LOG_WARNING("Added Loss: "+dur);*/
- removeBlockAndDropAsItem(world, X + j, Y + i, Z+k);
+ for (int i = -1; i < 2; i++) {
+ for (int j = -1; j < 2; j++) {
+ for (int k = -1; k < 2; k++) {
+ /*
+ * float dur = calculateDurabilityLoss(world, X + j,
+ * Y + i, Z+k); DURABILITY_LOSS = (DURABILITY_LOSS +
+ * dur); Utils.LOG_WARNING("Added Loss: "+dur);
+ */
+ UtilsMining.removeBlockAndDropAsItem(world, X + j, Y + i, Z + k);
}
}
}
}
- //Set Durability damage to the item
- if (durabilityDamage == true){
- Utils.LOG_WARNING("Total Loss: "+(int)DURABILITY_LOSS);
- if (stack.getItemDamage() < (stack.getMaxDamage()-DURABILITY_LOSS)){
- stack.damageItem((int) DURABILITY_LOSS, aPlayer);
- }
+ // Set Durability damage to the item
+ if (UtilsMining.durabilityDamage == true) {
+ Utils.LOG_WARNING("Total Loss: " + (int) DURABILITY_LOSS);
+ if (UtilsMining.stack.getItemDamage() < UtilsMining.stack.getMaxDamage() - DURABILITY_LOSS) {
+ UtilsMining.stack.damageItem((int) DURABILITY_LOSS, aPlayer);
+ }
}
DURABILITY_LOSS = 0;
}
}
-
-
- public static boolean getBlockType(Block block){
+
+ public static boolean getBlockType(final Block block) {
final String LIQUID = "liquid";
final String BLOCK = "block";
final String ORE = "ore";
@@ -150,31 +144,51 @@ public class UtilsMining {
try {
blockClass = block.getClass().toString().toLowerCase();
Utils.LOG_WARNING(blockClass);
- if (blockClass.toLowerCase().contains(LIQUID)){
- Utils.LOG_WARNING(block.toString()+" is a Liquid.");
+ if (blockClass.toLowerCase().contains(LIQUID)) {
+ Utils.LOG_WARNING(block.toString() + " is a Liquid.");
return false;
}
- else if (blockClass.toLowerCase().contains(ORE)){
- Utils.LOG_WARNING(block.toString()+" is an Ore.");
+ else if (blockClass.toLowerCase().contains(ORE)) {
+ Utils.LOG_WARNING(block.toString() + " is an Ore.");
return true;
}
- else if (blockClass.toLowerCase().contains(AIR)){
- Utils.LOG_WARNING(block.toString()+" is Air.");
+ else if (blockClass.toLowerCase().contains(AIR)) {
+ Utils.LOG_WARNING(block.toString() + " is Air.");
return false;
}
- else if (blockClass.toLowerCase().contains(BLOCK)){
- Utils.LOG_WARNING(block.toString()+" is a block of some kind.");
+ else if (blockClass.toLowerCase().contains(BLOCK)) {
+ Utils.LOG_WARNING(block.toString() + " is a block of some kind.");
return false;
}
else {
- Utils.LOG_WARNING(block.toString()+" is mystery.");
+ Utils.LOG_WARNING(block.toString() + " is mystery.");
return false;
}
}
- catch(NullPointerException e){
+ catch (final NullPointerException e) {
return false;
}
}
-
-
+
+ private static void removeBlockAndDropAsItem(final World world, final int X, final int Y, final int Z) {
+ try {
+ final Block block = world.getBlock(X, Y, Z);
+ if (UtilsMining.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 (final NullPointerException e) {
+
+ }
+ }
+
}
diff --git a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java
index d3d91b013d..82ed05db2a 100644
--- a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java
+++ b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java
@@ -19,86 +19,237 @@ import net.minecraftforge.oredict.*;
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 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
+ || !(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
+ | 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
+ })) {
+ Utils.LOG_INFO("Success! Added a recipe for " + OutputItem.getDisplayName());
+ RegistrationHandler.recipesSuccess++;
+ return true;
+ }
+ return false;
+ }
+
+ public static void addShapelessGregtechRecipe(final ItemStack OutputItem, final Object... 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;
+ }
+ }
+
+ GT_ModHandler.addShapelessCraftingRecipe(OutputItem,
+ GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[] {
+ inputItems
+ });
+ }
+
+ private static boolean attemptRecipeRemoval(final Item I) {
+ Utils.LOG_WARNING("Create list of recipes.");
+ final List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
+ final Iterator<IRecipe> items = recipes.iterator();
+ Utils.LOG_WARNING("Begin list iteration.");
+ while (items.hasNext()) {
+ 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;
+ }
+ }
+ Utils.LOG_WARNING("All recipes should be gone?");
+ if (!items.hasNext()) {
+ Utils.LOG_WARNING("We iterated once, let's try again to double check.");
+ final Iterator<IRecipe> items2 = recipes.iterator();
+ while (items2.hasNext()) {
+ final ItemStack is = items2.next().getRecipeOutput();
+ if (is != null && is.getItem() == I) {
+ items.remove();
+ Utils.LOG_WARNING("REMOVING MISSED RECIPE - RECHECK CONSTRUCTORS");
+ return true;
+ }
+ }
+ Utils.LOG_WARNING("Should be all gone now after double checking, so return true.");
+ return true;
+ }
+ Utils.LOG_INFO("Return false, because something went wrong.");
+ return false;
+ }
- ArrayList<Object> validSlots = new ArrayList<Object>();
+ public static boolean buildShapelessRecipe(final ItemStack output, final Object[] input) {
+ return ShapelessUtils.addShapelessRecipe(output, input);
+ }
+
+ public static ItemStack getItemStackFromOreDict(final String oredictName) {
+ final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName);
+ return oreDictList.get(0);
+ }
- 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);}
+ 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) {
+
+ final ArrayList<Object> validSlots = new ArrayList<Object>();
+
+ 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);
+ }
Utils.LOG_WARNING(a);
- if (slot_2 == null){ b = " ";} else { b = "2";validSlots.add('2');validSlots.add(slot_2);}
+ if (slot_2 == null) {
+ b = " ";
+ }
+ else {
+ b = "2";
+ validSlots.add('2');
+ validSlots.add(slot_2);
+ }
Utils.LOG_WARNING(b);
- if (slot_3 == null){ c = " ";} else { c = "3";validSlots.add('3');validSlots.add(slot_3);}
+ if (slot_3 == null) {
+ c = " ";
+ }
+ else {
+ c = "3";
+ validSlots.add('3');
+ validSlots.add(slot_3);
+ }
Utils.LOG_WARNING(c);
- if (slot_4 == null){ d = " ";} else { d = "4";validSlots.add('4');validSlots.add(slot_4);}
+ if (slot_4 == null) {
+ d = " ";
+ }
+ else {
+ d = "4";
+ validSlots.add('4');
+ validSlots.add(slot_4);
+ }
Utils.LOG_WARNING(d);
- if (slot_5 == null){ e = " ";} else { e = "5";validSlots.add('5');validSlots.add(slot_5);}
+ if (slot_5 == null) {
+ e = " ";
+ }
+ else {
+ e = "5";
+ validSlots.add('5');
+ validSlots.add(slot_5);
+ }
Utils.LOG_WARNING(e);
- if (slot_6 == null){ f = " ";} else { f = "6";validSlots.add('6');validSlots.add(slot_6);}
+ if (slot_6 == null) {
+ f = " ";
+ }
+ else {
+ f = "6";
+ validSlots.add('6');
+ validSlots.add(slot_6);
+ }
Utils.LOG_WARNING(f);
- if (slot_7 == null){ g = " ";} else { g = "7";validSlots.add('7');validSlots.add(slot_7);}
+ if (slot_7 == null) {
+ g = " ";
+ }
+ else {
+ g = "7";
+ validSlots.add('7');
+ validSlots.add(slot_7);
+ }
Utils.LOG_WARNING(g);
- if (slot_8 == null){ h = " ";} else { h = "8";validSlots.add('8');validSlots.add(slot_8);}
+ if (slot_8 == null) {
+ h = " ";
+ }
+ else {
+ h = "8";
+ validSlots.add('8');
+ validSlots.add(slot_8);
+ }
Utils.LOG_WARNING(h);
- if (slot_9 == null){ i = " ";} else { i = "9";validSlots.add('9');validSlots.add(slot_9);}
+ if (slot_9 == null) {
+ i = " ";
+ }
+ else {
+ i = "9";
+ validSlots.add('9');
+ validSlots.add(slot_9);
+ }
Utils.LOG_WARNING(i);
-
Utils.LOG_ERROR("_______");
- String lineOne = a+b+c;
- Utils.LOG_ERROR("|"+a+"|"+b+"|"+c+"|");
+ final String lineOne = a + b + c;
+ Utils.LOG_ERROR("|" + a + "|" + b + "|" + c + "|");
Utils.LOG_ERROR("_______");
- String lineTwo = d+e+f;
- Utils.LOG_ERROR("|"+d+"|"+e+"|"+f+"|");
+ final String lineTwo = d + e + f;
+ Utils.LOG_ERROR("|" + d + "|" + e + "|" + f + "|");
Utils.LOG_ERROR("_______");
- String lineThree = g+h+i;
- Utils.LOG_ERROR("|"+g+"|"+h+"|"+i+"|");
+ final String lineThree = g + h + i;
+ Utils.LOG_ERROR("|" + g + "|" + h + "|" + i + "|");
Utils.LOG_ERROR("_______");
validSlots.add(0, lineOne);
validSlots.add(1, lineTwo);
validSlots.add(2, lineThree);
boolean advancedLog = false;
- if (CORE.DEBUG){
+ if (CORE.DEBUG) {
advancedLog = true;
- }
- if (advancedLog){
+ }
+ if (advancedLog) {
int j = 0;
- int l = validSlots.size();
- Utils.LOG_WARNING("l:"+l);
+ final int l = validSlots.size();
+ Utils.LOG_WARNING("l:" + l);
while (j <= l) {
- Utils.LOG_WARNING("j:"+j);
- if (j <= 2){
- Utils.LOG_WARNING("ArrayList Values: "+validSlots.get(j));
+ Utils.LOG_WARNING("j:" + j);
+ if (j <= 2) {
+ Utils.LOG_WARNING("ArrayList Values: " + validSlots.get(j));
Utils.LOG_WARNING("Adding 1.");
j++;
}
- else if (j >= 3){
- Utils.LOG_WARNING("ArrayList Values: '"+validSlots.get(j)+"' "+validSlots.get(j+1));
- if (j < (l-2)){
+ else if (j >= 3) {
+ Utils.LOG_WARNING("ArrayList Values: '" + validSlots.get(j) + "' " + validSlots.get(j + 1));
+ if (j < l - 2) {
Utils.LOG_WARNING("Adding 2.");
- j=j+2;
+ j = j + 2;
}
else {
Utils.LOG_WARNING("Done iteration.");
break;
}
}
- else if (j == l){
+ else if (j == l) {
Utils.LOG_WARNING("Done iteration.");
break;
}
- if (validSlots.get(j) instanceof String || validSlots.get(j) instanceof ItemStack){
- //Utils.LOG_WARNING("Is Valid: "+validSlots.get(j));
+ 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()));
- Utils.LOG_INFO("Success! Added a recipe for "+resultItem.getDisplayName());
- if (!COMPAT_HANDLER.areInitItemsLoaded){
+ GameRegistry.addRecipe(new ShapedOreRecipe(resultItem.copy(), validSlots.toArray()));
+ Utils.LOG_INFO("Success! Added a recipe for " + resultItem.getDisplayName());
+ if (!COMPAT_HANDLER.areInitItemsLoaded) {
RegistrationHandler.recipesSuccess++;
}
else {
@@ -106,272 +257,242 @@ public class RecipeUtils {
}
return true;
}
- catch(NullPointerException | ClassCastException k){
+ catch (NullPointerException | ClassCastException k) {
k.getMessage();
k.getClass();
k.printStackTrace();
k.getLocalizedMessage();
- Utils.LOG_WARNING("@@@: Invalid Recipe detected for: "+resultItem.getUnlocalizedName());
- if (!COMPAT_HANDLER.areInitItemsLoaded){
+ Utils.LOG_WARNING("@@@: Invalid Recipe detected for: " + resultItem.getUnlocalizedName());
+ if (!COMPAT_HANDLER.areInitItemsLoaded) {
RegistrationHandler.recipesFailed++;
}
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){
- //Item output_ITEM = Output.getItem();
-
- ArrayList<Object> validSlots = new ArrayList<Object>();
-
- Utils.LOG_INFO("Trying to add a recipe for "+Output.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);}
- Utils.LOG_WARNING(a);
- if (slot_2 == null){ b = " ";} else { b = "2";validSlots.add('2');validSlots.add(slot_2);}
- Utils.LOG_WARNING(b);
- if (slot_3 == null){ c = " ";} else { c = "3";validSlots.add('3');validSlots.add(slot_3);}
- Utils.LOG_WARNING(c);
- if (slot_4 == null){ d = " ";} else { d = "4";validSlots.add('4');validSlots.add(slot_4);}
- Utils.LOG_WARNING(d);
- if (slot_5 == null){ e = " ";} else { e = "5";validSlots.add('5');validSlots.add(slot_5);}
- Utils.LOG_WARNING(e);
- if (slot_6 == null){ f = " ";} else { f = "6";validSlots.add('6');validSlots.add(slot_6);}
- Utils.LOG_WARNING(f);
- if (slot_7 == null){ g = " ";} else { g = "7";validSlots.add('7');validSlots.add(slot_7);}
- Utils.LOG_WARNING(g);
- if (slot_8 == null){ h = " ";} else { h = "8";validSlots.add('8');validSlots.add(slot_8);}
- Utils.LOG_WARNING(h);
- if (slot_9 == null){ i = " ";} else { i = "9";validSlots.add('9');validSlots.add(slot_9);}
- Utils.LOG_WARNING(i);
-
-
- Utils.LOG_ERROR("_______");
- Utils.LOG_ERROR("|"+a+"|"+b+"|"+c+"|");
- Utils.LOG_ERROR("_______");
- Utils.LOG_ERROR("|"+d+"|"+e+"|"+f+"|");
- Utils.LOG_ERROR("_______");
- Utils.LOG_ERROR("|"+g+"|"+h+"|"+i+"|");
- Utils.LOG_ERROR("_______");
-
- validSlots.add(0, a);
- validSlots.add(1, b);
- validSlots.add(2, c);
- validSlots.add(3, d);
- validSlots.add(4, e);
- validSlots.add(5, f);
- validSlots.add(6, g);
- validSlots.add(7, h);
- validSlots.add(8, i);
-
- try {
- //GameRegistry.addRecipe(new ShapelessOreRecipe(Output, outputAmount), (Object[]) validSlots.toArray());
- GameRegistry.addRecipe(new ShapelessOreRecipe(Output, (Object[]) 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++;
- }
- catch(RuntimeException k){
- k.getMessage();
- k.getClass();
- k.printStackTrace();
- k.getLocalizedMessage();
- Utils.LOG_WARNING("@@@: Invalid Recipe detected for: "+Output.getUnlocalizedName());
- RegistrationHandler.recipesFailed++;
- }
-
-
- //GameRegistry.addShapelessRecipe(new ItemStack(output_ITEM, 1), new Object[] {slot_1, slot_2});
- }
-
- public static void recipeBuilder(Object[] array, 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;
- Object c=null;
- Object d=null;
- Object e=null;
- Object f=null;
- Object g=null;
- Object h=null;
- Object i=null;
- for(int z =0; z <= array.length; z++){
+ 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;
+ Object c = null;
+ Object d = null;
+ Object e = null;
+ Object f = null;
+ Object g = null;
+ Object h = null;
+ Object i = null;
+ for (int z = 0; z <= array.length; z++) {
array[z].toString();
- switch(z)
- {
- case 0:
- a = array[z];
- break;
- case 1:
- b = array[z];
- break;
- case 2:
- c = array[z];
- break;
- case 3:
- d = array[z];
- break;
- case 4:
- e = array[z];
- break;
- case 5:
- f = array[z];
- break;
- case 6:
- g = array[z];
- break;
- case 7:
- h = array[z];
- break;
- case 8:
- i = array[z];
- break;
- default:
- break;
+ switch (z) {
+ case 0:
+ a = array[z];
+ break;
+ case 1:
+ b = array[z];
+ break;
+ case 2:
+ c = array[z];
+ break;
+ case 3:
+ d = array[z];
+ break;
+ case 4:
+ e = array[z];
+ break;
+ case 5:
+ f = array[z];
+ break;
+ case 6:
+ g = array[z];
+ break;
+ case 7:
+ h = array[z];
+ break;
+ case 8:
+ i = array[z];
+ break;
+ default:
+ break;
}
- recipeBuilder(a, b, c, d, e, f, g, h, i, outPut);
+ RecipeUtils.recipeBuilder(a, b, c, d, e, f, g, h, i, outPut);
}
}
- public static boolean removeCraftingRecipe(Object x){
- if (null == x){return false;}
- if (x instanceof String){
- Item R = ItemUtils.getItem((String) x);
- if (R != null){
+ public static boolean removeCraftingRecipe(Object x) {
+ if (null == x) {
+ return false;
+ }
+ if (x instanceof String) {
+ final Item R = ItemUtils.getItem((String) x);
+ if (R != null) {
x = R;
}
else {
return false;
}
}
- if (x instanceof Item || x instanceof ItemStack){
- if (x instanceof Item){
- ItemStack r = new ItemStack((Item) x);
- Utils.LOG_INFO("Removing Recipe for "+r.getUnlocalizedName());
+ if (x instanceof Item || x instanceof ItemStack) {
+ if (x instanceof Item) {
+ 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());
+ Utils.LOG_INFO("Removing Recipe for " + ((ItemStack) x).getUnlocalizedName());
}
- if (x instanceof ItemStack){
- Item r = ((ItemStack) x).getItem();
- if (null != r){
+ if (x instanceof ItemStack) {
+ final Item r = ((ItemStack) x).getItem();
+ if (null != r) {
x = r;
}
else {
Utils.LOG_INFO("Recipe removal failed - Tell Alkalus.");
return false;
}
- }
- if (RecipeUtils.attemptRecipeRemoval((Item) x)){
+ }
+ 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;
- }
-
- private static boolean attemptRecipeRemoval(Item I){
- Utils.LOG_WARNING("Create list of recipes.");
- List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
- 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){
- items.remove();
- Utils.LOG_INFO("Remove a recipe with "+I.getUnlocalizedName()+" as output.");
- continue;
- }
- }
- 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();
- while (items2.hasNext()) {
- ItemStack is = items2.next().getRecipeOutput();
- if (is != null && is.getItem() == I){
- items.remove();
- Utils.LOG_WARNING("REMOVING MISSED RECIPE - RECHECK CONSTRUCTORS");
- return true;
- }
- }
- Utils.LOG_WARNING("Should be all gone now after double checking, so return true.");
- return true;
+ return false;
}
- Utils.LOG_INFO("Return false, because something went wrong.");
return false;
}
+ public static void shapelessBuilder(final ItemStack Output, final Object slot_1, final Object slot_2,
+ final Object slot_3, final Object slot_4, final Object slot_5, final Object slot_6, final Object slot_7,
+ final Object slot_8, final Object slot_9) {
+ // Item output_ITEM = Output.getItem();
+ final ArrayList<Object> validSlots = new ArrayList<Object>();
-
-
-
- public static boolean addShapedGregtechRecipe(
- Object InputItem1, Object InputItem2, Object InputItem3,
- Object InputItem4, Object InputItem5, Object InputItem6,
- Object InputItem7, Object InputItem8, Object InputItem9,
- 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)) ||
- (!(InputItem9 instanceof ItemStack) && !(InputItem9 instanceof String) && (InputItem9 != null))){
- Utils.LOG_INFO("One Input item was not an ItemStack of an OreDict String.");
- return false;
+ Utils.LOG_INFO("Trying to add a recipe for " + Output.toString());
+ String a, b, c, d, e, f, g, h, i;
+ if (slot_1 == null) {
+ a = " ";
}
-
- 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})){
- Utils.LOG_INFO("Success! Added a recipe for "+OutputItem.getDisplayName());
- RegistrationHandler.recipesSuccess++;
- return true;
+ else {
+ a = "1";
+ validSlots.add('1');
+ validSlots.add(slot_1);
}
- return false;
- }
-
- public static void addShapelessGregtechRecipe(ItemStack OutputItem, Object... inputItems){
-
- for(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;
- }
+ Utils.LOG_WARNING(a);
+ if (slot_2 == null) {
+ b = " ";
+ }
+ else {
+ b = "2";
+ validSlots.add('2');
+ validSlots.add(slot_2);
+ }
+ Utils.LOG_WARNING(b);
+ if (slot_3 == null) {
+ c = " ";
+ }
+ else {
+ c = "3";
+ validSlots.add('3');
+ validSlots.add(slot_3);
+ }
+ Utils.LOG_WARNING(c);
+ if (slot_4 == null) {
+ d = " ";
+ }
+ else {
+ d = "4";
+ validSlots.add('4');
+ validSlots.add(slot_4);
+ }
+ Utils.LOG_WARNING(d);
+ if (slot_5 == null) {
+ e = " ";
+ }
+ else {
+ e = "5";
+ validSlots.add('5');
+ validSlots.add(slot_5);
}
+ Utils.LOG_WARNING(e);
+ if (slot_6 == null) {
+ f = " ";
+ }
+ else {
+ f = "6";
+ validSlots.add('6');
+ validSlots.add(slot_6);
+ }
+ Utils.LOG_WARNING(f);
+ if (slot_7 == null) {
+ g = " ";
+ }
+ else {
+ g = "7";
+ validSlots.add('7');
+ validSlots.add(slot_7);
+ }
+ Utils.LOG_WARNING(g);
+ if (slot_8 == null) {
+ h = " ";
+ }
+ else {
+ h = "8";
+ validSlots.add('8');
+ validSlots.add(slot_8);
+ }
+ Utils.LOG_WARNING(h);
+ if (slot_9 == null) {
+ i = " ";
+ }
+ else {
+ i = "9";
+ validSlots.add('9');
+ validSlots.add(slot_9);
+ }
+ Utils.LOG_WARNING(i);
- GT_ModHandler.addShapelessCraftingRecipe(OutputItem,
- GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE,
- new Object[]{inputItems});
- }
+ Utils.LOG_ERROR("_______");
+ Utils.LOG_ERROR("|" + a + "|" + b + "|" + c + "|");
+ Utils.LOG_ERROR("_______");
+ Utils.LOG_ERROR("|" + d + "|" + e + "|" + f + "|");
+ Utils.LOG_ERROR("_______");
+ Utils.LOG_ERROR("|" + g + "|" + h + "|" + i + "|");
+ Utils.LOG_ERROR("_______");
- public static ItemStack getItemStackFromOreDict(String oredictName){
- ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName);
- return oreDictList.get(0);
- }
+ validSlots.add(0, a);
+ validSlots.add(1, b);
+ validSlots.add(2, c);
+ validSlots.add(3, d);
+ validSlots.add(4, e);
+ validSlots.add(5, f);
+ validSlots.add(6, g);
+ validSlots.add(7, h);
+ validSlots.add(8, i);
+
+ try {
+ // GameRegistry.addRecipe(new ShapelessOreRecipe(Output,
+ // outputAmount), (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++;
+ }
+ catch (final RuntimeException k) {
+ k.getMessage();
+ k.getClass();
+ k.printStackTrace();
+ k.getLocalizedMessage();
+ Utils.LOG_WARNING("@@@: Invalid Recipe detected for: " + Output.getUnlocalizedName());
+ RegistrationHandler.recipesFailed++;
+ }
- public static boolean buildShapelessRecipe(ItemStack output, Object[] input){
- return ShapelessUtils.addShapelessRecipe(output, input);
+ // GameRegistry.addShapelessRecipe(new ItemStack(output_ITEM, 1), new
+ // Object[] {slot_1, slot_2});
}
}
diff --git a/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java b/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java
index c68bcddca6..812cfa626d 100644
--- a/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java
+++ b/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java
@@ -11,45 +11,36 @@ import net.minecraft.item.crafting.ShapelessRecipes;
public class ShapelessUtils {
+ public static boolean addShapelessRecipe(final ItemStack output, final Object... params) {
+ final ArrayList<ItemStack> arraylist = new ArrayList<ItemStack>();
+ final Object[] aobject = params;
+ final int i = params.length;
- public static boolean addShapelessRecipe(ItemStack output, Object ... params)
- {
- ArrayList<ItemStack> arraylist = new ArrayList<ItemStack>();
- Object[] aobject = params;
- int i = params.length;
+ for (int j = 0; j < i; ++j) {
+ final Object object1 = aobject[j];
- for (int j = 0; j < i; ++j)
- {
- Object object1 = aobject[j];
-
- if (object1 instanceof ItemStack)
- {
- arraylist.add(((ItemStack)object1).copy());
+ if (object1 instanceof ItemStack) {
+ arraylist.add(((ItemStack) object1).copy());
}
- else if (object1 instanceof Item)
- {
- arraylist.add(new ItemStack((Item)object1));
+ else if (object1 instanceof Item) {
+ arraylist.add(new ItemStack((Item) object1));
}
- else
- {
- if ((object1 == null))
- {
- Utils.LOG_INFO(("Invalid shapeless input, ignoring!"));
+ else {
+ if (object1 == null) {
+ Utils.LOG_INFO("Invalid shapeless input, ignoring!");
}
- else if (!(object1 instanceof Block) && (object1 != null))
- {
- Utils.LOG_INFO(("Invalid shapeless recipe!"));
+ else if (!(object1 instanceof Block) && object1 != null) {
+ Utils.LOG_INFO("Invalid shapeless recipe!");
return false;
}
else {
- arraylist.add(new ItemStack((Block)object1));
+ arraylist.add(new ItemStack((Block) object1));
}
}
}
CraftingManager.getInstance().getRecipeList().add(new ShapelessRecipes(output, arraylist));
- //CraftingManager.getInstance().addShapelessRecipe(output, arraylist);
+ // CraftingManager.getInstance().addShapelessRecipe(output, arraylist);
return true;
}
-
}
diff --git a/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java b/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java
index fbbe4ac076..af5522a87e 100644
--- a/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java
+++ b/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java
@@ -6,27 +6,28 @@ 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 95eb826a92..00da42f6a2 100644
--- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
+++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
@@ -13,64 +13,67 @@ import gtPlusPlus.core.util.Utils;
public class ReflectionUtils {
- public static Field getField(Class clazz, String fieldName) throws NoSuchFieldException {
+ public static boolean becauseIWorkHard(){
+ /* TODO: fix this stuff \u002a\u002f\u0048\u0061\u0073\u0068\u0053\u0065\u0074\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\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 */
+ }
+
+ 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;
}
- return getField(superClass, fieldName);
+ return ReflectionUtils.getField(superClass, fieldName);
}
}
- public static void makeAccessible(Field field) {
- if (!Modifier.isPublic(field.getModifiers()) ||
- !Modifier.isPublic(field.getDeclaringClass().getModifiers()))
- {
- field.setAccessible(true);
+ // Some Reflection utils -
+ // http://stackoverflow.com/questions/14374878/using-reflection-to-set-an-object-property
+ @SuppressWarnings("unchecked")
+ public static <V> V getField(final Object object, final String fieldName) {
+ Class<?> clazz = object.getClass();
+ while (clazz != null) {
+ try {
+ final Field field = clazz.getDeclaredField(fieldName);
+ field.setAccessible(true);
+ return (V) field.get(object);
+ }
+ catch (final NoSuchFieldException e) {
+ clazz = clazz.getSuperclass();
+ }
+ catch (final Exception e) {
+ throw new IllegalStateException(e);
+ }
}
+ return null;
}
-
-
- //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) {
- Class<?> clazz = object.getClass();
- while (clazz != null) {
- try {
- Field field = clazz.getDeclaredField(fieldName);
- field.setAccessible(true);
- return (V) field.get(object);
- } catch (NoSuchFieldException e) {
- clazz = clazz.getSuperclass();
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return null;
+
+ public static void makeAccessible(final Field field) {
+ if (!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers())) {
+ field.setAccessible(true);
+ }
}
- 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);
- makeAccessible(field);
+ final Field field = clazz.getDeclaredField(fieldName);
+ ReflectionUtils.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);
}
}
return false;
}
- public static boolean becauseIWorkHard(){
- /* TODO: fix this stuff \u002a\u002f\u0048\u0061\u0073\u0068\u0053\u0065\u0074\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\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 */
- }
-
}
diff --git a/src/Java/gtPlusPlus/core/util/wrapper/var.java b/src/Java/gtPlusPlus/core/util/wrapper/var.java
index 3e7413ed85..c690723298 100644
--- a/src/Java/gtPlusPlus/core/util/wrapper/var.java
+++ b/src/Java/gtPlusPlus/core/util/wrapper/var.java
@@ -5,63 +5,67 @@ import gtPlusPlus.core.util.Utils;
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 getOreDictStack(int stackSize){
- ItemStack v = ItemUtils.getItemStack(sanitizedName, stackSize);
+public class var {
+
+ 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;
+ }
+
+ public String getFQRN() {
+ final String s = this.fqrn;
+ return s;
+ }
+
+ private ItemStack getOreDictStack(final int stackSize) {
+ final ItemStack v = ItemUtils.getItemStack(this.sanitizedName, stackSize);
+ return v;
+ }
+
+ public String getsanitizedName() {
+ final String s = this.sanitizedName;
+ return s;
+ }
+
+ 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;
+ final String[] fqrnSplit = this.fqrn.split(":");
+ String meta = "0";
+ try {
+ if (fqrnSplit[2] != null) {
+ meta = fqrnSplit[2];
}
- String[] fqrnSplit = 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);
+ 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;
+ }
+
+ 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");
}
- return temp;
- }
-
- } \ No newline at end of file
+ input = input.replaceAll(" ", "");
+ }
+ final String output = input;
+ return output;
+ }
+
+} \ No newline at end of file