diff options
115 files changed, 4634 insertions, 3708 deletions
@@ -3,11 +3,11 @@ GT5-Unofficial ## About -GT5-Unofficial is a decompiled and modified version of GT5.07.07. The goal of the mod is to maintain and extend the end game of GT5. +GT5-Unofficial is a decompiled and modified version of GT5.07.07. The goal of the mod is to maintain and extend the end game of GT5. This version has been heavily modified for use with the GTNH modpack. ## Downloads -Builds can be found on the [IC2 Forums](http://forum.industrial-craft.net/index.php?page=Thread&threadID=11488). +Builds can be found on the [GTNH Jenkins Server](http://jenkins.usrv.eu:8080/job/Gregtech-5-Unofficial/). ## Installation @@ -36,4 +36,4 @@ Please do! However, please take a note of current issues and what is currently b [Beyond Reality](https://www.atlauncher.com/pack/BeyondReality)<br /> [Infitech 2](https://forum.feed-the-beast.com/threads/1-7-10-listed-infitech-2-modpack-v3-2-21-hqm-gregtech-balanced-hard-mode-modpack.50185/)<br /> [GT New Horizons](https://www.technicpack.net/modpack/mcnewhorizons.677387)<br /> -[Идеальная Индустриальная Сборка / Ideal Industrial Assembly](http://sapientmail.wixsite.com/minecraft)<br />
\ No newline at end of file +[Идеальная Индустриальная Сборка / Ideal Industrial Assembly](http://sapientmail.wixsite.com/minecraft)<br /> diff --git a/build.properties b/build.properties index e68b0f155a..a878a9ede6 100644 --- a/build.properties +++ b/build.properties @@ -1,7 +1,6 @@ minecraft.version=1.7.10 forge.version=10.13.4.1614-1.7.10 - -gt.version=5.09.33.22 +gt.version=5.09.33.32 ae2.version=rv2-beta-33 applecore.version=1.7.10-1.2.1+107.59407 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differindex b761216703..99340b4ad1 100644 --- a/gradle/wrapper/gradle-wrapper.jar +++ b/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aae599bbfa..2c2bbe5f9a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Wed Jul 02 15:54:47 CDT 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -6,20 +6,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,31 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -90,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -114,6 +113,7 @@ fi if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/libs/CodeChickenCore-1.7.10-1.0.4.35-dev.jar b/libs/CodeChickenCore-1.7.10-1.0.4.35-dev.jar Binary files differdeleted file mode 100644 index 08c35fc2f8..0000000000 --- a/libs/CodeChickenCore-1.7.10-1.0.4.35-dev.jar +++ /dev/null diff --git a/libs/CodeChickenLib-1.7.10-1.1.1.99-dev.jar b/libs/CodeChickenLib-1.7.10-1.1.1.99-dev.jar Binary files differdeleted file mode 100644 index 249afbce66..0000000000 --- a/libs/CodeChickenLib-1.7.10-1.1.1.99-dev.jar +++ /dev/null diff --git a/libs/NotEnoughItems-1.7.10-1.0.4.95-dev.jar b/libs/NotEnoughItems-1.7.10-1.0.4.95-dev.jar Binary files differdeleted file mode 100644 index 3b92091ddb..0000000000 --- a/libs/NotEnoughItems-1.7.10-1.0.4.95-dev.jar +++ /dev/null diff --git a/libs/forestry_1.7.10-4.2.10.58-api.jar b/libs/forestry_1.7.10-4.2.10.58-api.jar Binary files differdeleted file mode 100644 index e45cbd8ead..0000000000 --- a/libs/forestry_1.7.10-4.2.10.58-api.jar +++ /dev/null diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 68c52c44d1..2d0b7257d0 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -11,7 +11,6 @@ import gregtech.api.enchants.Enchantment_Radioactivity; import gregtech.api.enums.*; import gregtech.api.interfaces.internal.IGT_Mod; import gregtech.api.objects.ItemData; -import gregtech.api.objects.MaterialStack; import gregtech.api.objects.XSTR; import gregtech.api.util.*; import gregtech.common.GT_DummyWorld; @@ -23,7 +22,9 @@ import gregtech.common.entities.GT_Entity_Arrow_Potion; import gregtech.common.items.GT_MetaGenerated_Tool_01; import gregtech.common.items.armor.components.LoadArmorComponents; import gregtech.common.items.behaviors.Behaviour_DataOrb; +import gregtech.common.misc.GT_Command; import gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_Massfabricator; +import gregtech.common.tileentities.storage.GT_MetaTileEntity_DigitalChestBase; import gregtech.loaders.load.GT_CoverBehaviorLoader; import gregtech.loaders.load.GT_FuelLoader; import gregtech.loaders.load.GT_ItemIterator; @@ -61,7 +62,9 @@ import java.io.*; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; +import static gregtech.api.enums.GT_Values.MOD_ID_AE; import static gregtech.api.enums.GT_Values.MOD_ID_FR; @Mod(modid = "gregtech", name = "GregTech", version = "MC1710", useMetadata = false, @@ -101,7 +104,7 @@ import static gregtech.api.enums.GT_Values.MOD_ID_FR; " after:TConstruct;" + " after:Translocator;") public class GT_Mod implements IGT_Mod { - public static final int VERSION = 509, SUBVERSION = 31; + public static final int VERSION = 509, SUBVERSION = 33; public static final int TOTAL_VERSION = calculateTotalGTVersion(VERSION, SUBVERSION); public static final int REQUIRED_IC2 = 624; @Mod.Instance("gregtech") @@ -189,18 +192,18 @@ public class GT_Mod implements IGT_Mod { if (!GT_Log.mLogFile.exists()) { try { GT_Log.mLogFile.createNewFile(); - } catch (Throwable e) { + } catch (Throwable ignored) { } } try { GT_Log.out = GT_Log.err = new PrintStream(GT_Log.mLogFile); - } catch (FileNotFoundException e) { + } catch (FileNotFoundException ignored) { } GT_Log.mOreDictLogFile = new File(aEvent.getModConfigurationDirectory().getParentFile(), "logs/OreDict.log"); if (!GT_Log.mOreDictLogFile.exists()) { try { GT_Log.mOreDictLogFile.createNewFile(); - } catch (Throwable e) { + } catch (Throwable ignored) { } } if (tMainConfig.get(aTextGeneral, "LoggingExplosions", true).getBoolean(true)) { @@ -208,12 +211,12 @@ public class GT_Mod implements IGT_Mod { if (!GT_Log.mExplosionLog.exists()) { try { GT_Log.mExplosionLog.createNewFile(); - } catch (Throwable e) { + } catch (Throwable ignored) { } } try { GT_Log.exp = new PrintStream(GT_Log.mExplosionLog); - } catch (Throwable e) { + } catch (Throwable ignored) { } } @@ -222,12 +225,12 @@ public class GT_Mod implements IGT_Mod { if (!GT_Log.mPlayerActivityLogFile.exists()) { try { GT_Log.mPlayerActivityLogFile.createNewFile(); - } catch (Throwable e) { + } catch (Throwable ignored) { } } try { GT_Log.pal = new PrintStream(GT_Log.mPlayerActivityLogFile); - } catch (Throwable e) { + } catch (Throwable ignored) { } } try { @@ -242,7 +245,7 @@ public class GT_Mod implements IGT_Mod { for (Iterator i$ = tList.iterator(); i$.hasNext(); GT_Log.ore.println(tString)) { tString = (String) i$.next(); } - } catch (Throwable e) { + } catch (Throwable ignored) { } gregtechproxy.onPreLoad(); @@ -265,6 +268,9 @@ public class GT_Mod implements IGT_Mod { //GT_Values.oreveinMaxSize = tMainConfig.get(aTextGeneral, "oreveinMaxSize_64",64).getInt(64); GT_Values.ticksBetweenSounds = tMainConfig.get("machines", "TicksBetweenSounds", 30).getInt(30); GT_Values.cleanroomGlass= (float) tMainConfig.get("machines","ReinforcedGlassPercentageForCleanroom",5D).getDouble(5D); + GT_Values.enableChunkloaders = tMainConfig.get("machines", "enableChunkloaders", true).getBoolean(true); + GT_Values.alwaysReloadChunkloaders = tMainConfig.get("machines", "alwaysReloadChunkloaders", false).getBoolean(false); + GT_Values.debugChunkloaders = tMainConfig.get("machines", "debugChunkloaders", false).getBoolean(false); GregTech_API.TICKS_FOR_LAG_AVERAGING = tMainConfig.get(aTextGeneral, "TicksForLagAveragingWithScanner", 25).getInt(25); GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING = tMainConfig.get(aTextGeneral, "MillisecondsPassedInGTTileEntityUntilLagWarning", 100).getInt(100); @@ -347,6 +353,7 @@ public class GT_Mod implements IGT_Mod { gregtechproxy.mUndergroundOil.getConfig(tMainConfig, "undergroundfluid"); gregtechproxy.mEnableCleanroom = tMainConfig.get("general", "EnableCleanroom", true).getBoolean(true); gregtechproxy.mLowGravProcessing = Loader.isModLoaded(GT_Values.MOD_ID_GC_CORE) && tMainConfig.get("general", "LowGravProcessing", true).getBoolean(true); + gregtechproxy.mUseGreatlyShrukenReplacementList = tMainConfig.get("general", "GTNH Optimised Material Loading", true).getBoolean(true); Calendar now = Calendar.getInstance(); gregtechproxy.mAprilFool = GregTech_API.sSpecialFile.get(ConfigCategories.general, "AprilFool", now.get(Calendar.MONTH) == Calendar.APRIL && now.get(Calendar.DAY_OF_MONTH) == 1); gregtechproxy.mCropNeedBlock = tMainConfig.get("general", "CropNeedBlockBelow", true).getBoolean(true); @@ -375,8 +382,8 @@ public class GT_Mod implements IGT_Mod { GregTech_API.mUseOnlyGoodSolderingMaterials = GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.harderrecipes, "useonlygoodsolderingmaterials", GregTech_API.mUseOnlyGoodSolderingMaterials); gregtechproxy.mChangeHarvestLevels = GregTech_API.sMaterialProperties.get("havestLevel", "activateHarvestLevelChange", false);//TODO CHECK if(gregtechproxy.mChangeHarvestLevels) { - gregtechproxy.mGraniteHavestLevel = (int) GregTech_API.sMaterialProperties.get("havestLevel", "graniteHarvestLevel", 3); - gregtechproxy.mMaxHarvestLevel = (int) Math.min(15, GregTech_API.sMaterialProperties.get("havestLevel", "maxLevel", 7)); + gregtechproxy.mGraniteHavestLevel = GregTech_API.sMaterialProperties.get("havestLevel", "graniteHarvestLevel", 3); + gregtechproxy.mMaxHarvestLevel = Math.min(15, GregTech_API.sMaterialProperties.get("havestLevel", "maxLevel", 7)); for (Materials tMaterial : Materials.values()) { if (tMaterial != null && tMaterial.mToolQuality > 0 && tMaterial.mMetaItemSubID < gregtechproxy.mHarvestLevel.length && tMaterial.mMetaItemSubID >= 0) { gregtechproxy.mHarvestLevel[tMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties.get("materialHavestLevel", tMaterial.mDefaultLocalName, tMaterial.mToolQuality); @@ -422,7 +429,7 @@ public class GT_Mod implements IGT_Mod { GT_Log.out.println("GT_Mod: Removing all original Scrapbox Drops."); try { - GT_Utility.getField("ic2.core.item.ItemScrapbox$Drop", "topChance", true, true).set(null, Integer.valueOf(0)); + GT_Utility.getField("ic2.core.item.ItemScrapbox$Drop", "topChance", true, true).set(null, 0); ((List) GT_Utility.getFieldContent(GT_Utility.getFieldContent("ic2.api.recipe.Recipes", "scrapboxDrops", true, true), "drops", true, true)).clear(); } catch (Throwable e) { if (GT_Values.D1) { @@ -502,43 +509,48 @@ public class GT_Mod implements IGT_Mod { }} GT_FML_LOGGER.info("reenableMetaItems"); - for(String reEnable : mMTTags){ - OrePrefixes tPrefix = OrePrefixes.getOrePrefix(reEnable); - if(tPrefix!=null){ - Materials tName = Materials.get(reEnable.replaceFirst(tPrefix.toString(), "")); - if(tName!=null){ - tPrefix.mDisabledItems.remove(tName); - tPrefix.mGeneratedItems.add(tName); - if(tPrefix == OrePrefixes.screw){ - OrePrefixes.bolt.mDisabledItems.remove(tName); - OrePrefixes.bolt.mGeneratedItems.add(tName); - OrePrefixes.stick.mDisabledItems.remove(tName); - OrePrefixes.stick.mGeneratedItems.add(tName); - } - if(tPrefix == OrePrefixes.round){ - OrePrefixes.nugget.mDisabledItems.remove(tName); - OrePrefixes.nugget.mGeneratedItems.add(tName); - } - if(tPrefix == OrePrefixes.spring){ - OrePrefixes.stickLong.mDisabledItems.remove(tName); - OrePrefixes.stickLong.mGeneratedItems.add(tName); - OrePrefixes.stick.mDisabledItems.remove(tName); - OrePrefixes.stick.mGeneratedItems.add(tName); - } - if(tPrefix == OrePrefixes.springSmall){ - OrePrefixes.stick.mDisabledItems.remove(tName); - OrePrefixes.stick.mGeneratedItems.add(tName); - } - if(tPrefix == OrePrefixes.stickLong){ - OrePrefixes.stick.mDisabledItems.remove(tName); - OrePrefixes.stick.mGeneratedItems.add(tName); - } - if(tPrefix == OrePrefixes.rotor){ - OrePrefixes.ring.mDisabledItems.remove(tName); - OrePrefixes.ring.mGeneratedItems.add(tName); - } - }else{GT_FML_LOGGER.info("noMaterial "+reEnable);} - }else{GT_FML_LOGGER.info("noPrefix "+reEnable);}} + for (String reEnable : mMTTags) { + OrePrefixes tPrefix = OrePrefixes.getOrePrefix(reEnable); + if (tPrefix != null) { + Materials tName = Materials.get(reEnable.replaceFirst(tPrefix.toString(), "")); + if (tName != null) { + tPrefix.mDisabledItems.remove(tName); + tPrefix.mGeneratedItems.add(tName); + if (tPrefix == OrePrefixes.screw) { + OrePrefixes.bolt.mDisabledItems.remove(tName); + OrePrefixes.bolt.mGeneratedItems.add(tName); + OrePrefixes.stick.mDisabledItems.remove(tName); + OrePrefixes.stick.mGeneratedItems.add(tName); + } + if (tPrefix == OrePrefixes.round) { + OrePrefixes.nugget.mDisabledItems.remove(tName); + OrePrefixes.nugget.mGeneratedItems.add(tName); + } + if (tPrefix == OrePrefixes.spring) { + OrePrefixes.stickLong.mDisabledItems.remove(tName); + OrePrefixes.stickLong.mGeneratedItems.add(tName); + OrePrefixes.stick.mDisabledItems.remove(tName); + OrePrefixes.stick.mGeneratedItems.add(tName); + } + if (tPrefix == OrePrefixes.springSmall) { + OrePrefixes.stick.mDisabledItems.remove(tName); + OrePrefixes.stick.mGeneratedItems.add(tName); + } + if (tPrefix == OrePrefixes.stickLong) { + OrePrefixes.stick.mDisabledItems.remove(tName); + OrePrefixes.stick.mGeneratedItems.add(tName); + } + if (tPrefix == OrePrefixes.rotor) { + OrePrefixes.ring.mDisabledItems.remove(tName); + OrePrefixes.ring.mGeneratedItems.add(tName); + } + } else { + GT_FML_LOGGER.info("noMaterial " + reEnable); + } + } else { + GT_FML_LOGGER.info("noPrefix " + reEnable); + } + } new GT_Loader_OreProcessing().run(); new GT_Loader_OreDictionary().run(); @@ -551,17 +563,15 @@ public class GT_Mod implements IGT_Mod { new GT_SonictronLoader().run(); new GT_SpawnEventHandler(); - if (true) { - GT_Values.RA.addCentrifugeRecipe(Materials.Stone.getDust(1), GT_Values.NI, GT_Values.NF, GT_Values.NF, - Materials.Quartzite.getDustSmall(1),Materials.PotassiumFeldspar.getDustSmall(1),Materials.Marble.getDustTiny(2), - Materials.Biotite.getDustTiny(1), Materials.MetalMixture.getDustTiny(1), Materials.Sodalite.getDustTiny(1), - new int[]{10000, 10000, 10000, 10000, 7500, 5000}, 480, 120); - GT_Values.RA.addCentrifugeRecipe(Materials.MetalMixture.getDust(1), GT_Values.NI, GT_Values.NF, GT_Values.NF, - Materials.BandedIron.getDustSmall(1), Materials.Bauxite.getDustSmall(1), Materials.Pyrolusite.getDustTiny(2), - Materials.Barite.getDustTiny(1), Materials.Chromite.getDustTiny(1), Materials.Ilmenite.getDustTiny(1), - new int[]{10000, 10000, 10000, 10000, 7500, 5000}, 1000, 900); - } - /* + GT_Values.RA.addCentrifugeRecipe(Materials.Stone.getDust(1), GT_Values.NI, GT_Values.NF, GT_Values.NF, + Materials.Quartzite.getDustSmall(1), Materials.PotassiumFeldspar.getDustSmall(1), Materials.Marble.getDustTiny(2), + Materials.Biotite.getDustTiny(1), Materials.MetalMixture.getDustTiny(1), Materials.Sodalite.getDustTiny(1), + new int[]{10000, 10000, 10000, 10000, 7500, 5000}, 480, 120); + GT_Values.RA.addCentrifugeRecipe(Materials.MetalMixture.getDust(1), GT_Values.NI, GT_Values.NF, GT_Values.NF, + Materials.BandedIron.getDustSmall(1), Materials.Bauxite.getDustSmall(1), Materials.Pyrolusite.getDustTiny(2), + Materials.Barite.getDustTiny(1), Materials.Chromite.getDustTiny(1), Materials.Ilmenite.getDustTiny(1), + new int[]{10000, 10000, 10000, 10000, 7500, 5000}, 1000, 900); + /* if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.gregtechrecipes, "SolarPanel", true)) { GT_ModHandler.addCraftingRecipe(ItemList.Cover_SolarPanel.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SGS", "CPC", 'C', OrePrefixes.circuit.get(Materials.Basic), 'G', new ItemStack(Blocks.glass_pane, 1), 'P', OrePrefixes.plateAlloy.get(Materials.Carbon), 'S', ItemList.Circuit_Silicon_Wafer}); GT_ModHandler.addCraftingRecipe(ItemList.Cover_SolarPanel_8V.get(1L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SGS", "CPC","R R", 'C', OrePrefixes.circuit.get(Materials.Advanced), 'G', new ItemStack(Blocks.glass_pane, 1), 'P', OrePrefixes.wireGt04.get(Materials.Graphene), 'S', ItemList.Circuit_Silicon_Wafer2,'R', OrePrefixes.plate.get(Materials.GalliumArsenide)}); @@ -627,11 +637,11 @@ public class GT_Mod implements IGT_Mod { GT_Log.out.println("GT_Mod: Sorting GregTech to the end of the Mod List for further processing."); LoadController tLoadController = (LoadController) GT_Utility.getFieldContent(Loader.instance(), "modController", true, true); List<ModContainer> tModList = tLoadController.getActiveModList(); - List<ModContainer> tNewModsList = new ArrayList(); + List<ModContainer> tNewModsList = new ArrayList<>(); ModContainer tGregTech = null; short tModList_sS= (short) tModList.size(); for (short i = 0; i < tModList_sS; i = (short) (i + 1)) { - ModContainer tMod = (ModContainer) tModList.get(i); + ModContainer tMod = tModList.get(i); if (tMod.getModId().equalsIgnoreCase("gregtech")) { tGregTech = tMod; } else { @@ -681,11 +691,6 @@ public class GT_Mod implements IGT_Mod { gregtechproxy.mLowGravProcessing = false; } - //Disable Low Grav regardless of config if Cleanroom is disabled. - if (!gregtechproxy.mEnableCleanroom){ - gregtechproxy.mLowGravProcessing = false; - } - gregtechproxy.onLoad(); if (gregtechproxy.mSortToTheEnd) { new GT_ItemIterator().run(); @@ -733,16 +738,13 @@ public class GT_Mod implements IGT_Mod { new GT_AE2EnergyTunnelLoader().run(); LoadArmorComponents.init(); - GT_RecipeRegistrator.registerUsagesForMaterials(new ItemStack(Blocks.planks, 1), null, false); - GT_RecipeRegistrator.registerUsagesForMaterials(new ItemStack(Blocks.cobblestone, 1), null, false); - GT_RecipeRegistrator.registerUsagesForMaterials(new ItemStack(Blocks.stone, 1), null, false); - GT_RecipeRegistrator.registerUsagesForMaterials(new ItemStack(Items.leather, 1), null, false); + GT_RecipeRegistrator.registerUsagesForMaterials(null, false, new ItemStack(Blocks.planks, 1), new ItemStack(Blocks.cobblestone, 1), new ItemStack(Blocks.stone, 1), new ItemStack(Items.leather, 1)); - GT_OreDictUnificator.addItemData(GT_ModHandler.getRecipeOutput(new ItemStack[]{null, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Tin, 1L), null, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Tin, 1L), null, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Tin, 1L), null, null, null}), new ItemData(Materials.Tin, 10886400L, new MaterialStack[0])); + GT_OreDictUnificator.addItemData(GT_ModHandler.getRecipeOutput(null, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Tin, 1L), null, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Tin, 1L), null, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Tin, 1L), null, null, null), new ItemData(Materials.Tin, 10886400L)); if (!GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.storageblockcrafting, "tile.glowstone", false)) { - GT_ModHandler.removeRecipe(new ItemStack[]{new ItemStack(Items.glowstone_dust, 1), new ItemStack(Items.glowstone_dust, 1), null, new ItemStack(Items.glowstone_dust, 1), new ItemStack(Items.glowstone_dust, 1)}); + GT_ModHandler.removeRecipe(new ItemStack(Items.glowstone_dust, 1), new ItemStack(Items.glowstone_dust, 1), null, new ItemStack(Items.glowstone_dust, 1), new ItemStack(Items.glowstone_dust, 1)); } - GT_ModHandler.removeRecipe(new ItemStack[]{new ItemStack(Blocks.wooden_slab, 1, 0), new ItemStack(Blocks.wooden_slab, 1, 1), new ItemStack(Blocks.wooden_slab, 1, 2)}); + GT_ModHandler.removeRecipe(new ItemStack(Blocks.wooden_slab, 1, 0), new ItemStack(Blocks.wooden_slab, 1, 1), new ItemStack(Blocks.wooden_slab, 1, 2)); GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.wooden_slab, 6, 0), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"WWW", 'W', new ItemStack(Blocks.planks, 1, 0)}); //Save a copy of these list before activateOreDictHandler(), then loop over them. @@ -754,13 +756,31 @@ public class GT_Mod implements IGT_Mod { GT_Log.out.println("GT_Mod: Activating OreDictionary Handler, this can take some time, as it scans the whole OreDictionary"); GT_FML_LOGGER.info("If your Log stops here, you were too impatient. Wait a bit more next time, before killing Minecraft with the Task Manager."); + long ms = System.currentTimeMillis(); gregtechproxy.activateOreDictHandler(); - GT_FML_LOGGER.info("Congratulations, you have been waiting long enough. Have a Cake."); + GT_FML_LOGGER.info("Congratulations, you have been waiting long enough (" + (System.currentTimeMillis() - ms) / 1000 + "s / " + (System.currentTimeMillis() - ms) + "ms). Have a Cake."); GT_Log.out.println("GT_Mod: List of Lists of Tool Recipes: "+GT_ModHandler.sSingleNonBlockDamagableRecipeList_list.toString()); GT_Log.out.println("GT_Mod: Vanilla Recipe List -> Outputs null or stackSize <=0: " + GT_ModHandler.sVanillaRecipeList_warntOutput.toString()); GT_Log.out.println("GT_Mod: Single Non Block Damagable Recipe List -> Outputs null or stackSize <=0: " + GT_ModHandler.sSingleNonBlockDamagableRecipeList_warntOutput.toString()); //GT_Log.out.println("GT_Mod: sRodMaterialList cycles: " + GT_RecipeRegistrator.sRodMaterialList_cycles); - + Set<Materials> replaceVanillaItemsSet = gregtechproxy.mUseGreatlyShrukenReplacementList ? Arrays.stream(Materials.values()).filter(GT_RecipeRegistrator::hasVanillaRecipes).collect(Collectors.toSet()) : new HashSet<>(Arrays.asList(Materials.values())); + GT_FML_LOGGER.info("Replacing Vanilla Materials in recipes, please wait."); + + ProgressManager.ProgressBar progressBar = ProgressManager.push("Register materials", replaceVanillaItemsSet.size()); + for (Materials m : replaceVanillaItemsSet) { + progressBar.step(m.mDefaultLocalName); + //GT_FML_LOGGER.info("Replacing Vanilla Recipes for: " + m.mDefaultLocalName); + String platename = OrePrefixes.plate.get(m).toString(); + boolean noSmash = !m.contains(SubTag.NO_SMASHING); + if ((m.mTypes & 2) != 0) + GT_RecipeRegistrator.registerUsagesForMaterials(platename, noSmash, m.getIngots(1)); + if ((m.mTypes & 4) != 0) + GT_RecipeRegistrator.registerUsagesForMaterials(platename, noSmash, m.getGems(1)); + if (m.getBlocks(1) != null) + GT_RecipeRegistrator.registerUsagesForMaterials(null, noSmash, m.getBlocks(1)); + } + ProgressManager.pop(progressBar); + GT_FML_LOGGER.info("Congratulations, you have been waiting long enough (" + (System.currentTimeMillis() - ms) / 1000 + "s / " + (System.currentTimeMillis() - ms) + "ms). Have a Cake."); //Add default IC2 recipe to GT GT_ModHandler.addIC2RecipesToGT(aMaceratorRecipeList, GT_Recipe.GT_Recipe_Map.sMaceratorRecipes, true, true, true); GT_ModHandler.addIC2RecipesToGT(aCompressorRecipeList, GT_Recipe.GT_Recipe_Map.sCompressorRecipes, true, true, true); @@ -796,7 +816,8 @@ public class GT_Mod implements IGT_Mod { GT_Forestry_Compat.transferCentrifugeRecipes(); GT_Forestry_Compat.transferSqueezerRecipes(); } - + if (Loader.isModLoaded(MOD_ID_AE)) + GT_MetaTileEntity_DigitalChestBase.registerAEIntegration(); String tName = ""; if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, aTextIC2 + (tName = "blastfurnace"), true)) { GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item(tName, 1L)); @@ -1022,7 +1043,7 @@ public class GT_Mod implements IGT_Mod { GT_ModHandler.addIC2RecipesToGT(GT_ModHandler.getOreWashingRecipeList(), GT_Recipe.GT_Recipe_Map.sOreWasherRecipes, false, true, true); GT_ModHandler.addIC2RecipesToGT(GT_ModHandler.getThermalCentrifugeRecipeList(), GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes, true, true, true); GT_Log.out.println("GT_Mod: Unificating outputs of all known Recipe Types."); - ArrayList<ItemStack> tStacks = new ArrayList(10000); + ArrayList<ItemStack> tStacks = new ArrayList<>(10000); GT_Log.out.println("GT_Mod: IC2 Machines"); for (RecipeOutput tRecipe : ic2.api.recipe.Recipes.cannerBottle.getRecipes().values()) { ItemStack tStack; @@ -1158,6 +1179,7 @@ public class GT_Mod implements IGT_Mod { tRunnable.run(); } } catch (Throwable e) {e.printStackTrace(GT_Log.err);} + aEvent.registerServerCommand(new GT_Command()); } @Mod.EventHandler @@ -1170,9 +1192,8 @@ public class GT_Mod implements IGT_Mod { GT_Utility.reInit(); GT_Recipe.reInit(); try { - for (Iterator i$ = GregTech_API.sItemStackMappings.iterator(); i$.hasNext(); ) { - Map tMap = (Map) i$.next(); - GT_Utility.reMap(tMap); + for (Map<gregtech.api.objects.GT_ItemStack, ?> gt_itemStackMap : GregTech_API.sItemStackMappings) { + GT_Utility.reMap((Map) gt_itemStackMap); } } catch (Throwable e) {e.printStackTrace(GT_Log.err);} @@ -1217,7 +1238,7 @@ public class GT_Mod implements IGT_Mod { GT_Log.out.println("*"); GT_Log.out.println("*"); - tList = (String[]) FluidRegistry.getRegisteredFluids().keySet().toArray(new String[FluidRegistry.getRegisteredFluids().keySet().size()]); + tList = FluidRegistry.getRegisteredFluids().keySet().toArray(new String[0]); Arrays.sort(tList); for (String tFluidName : tList) { GT_Log.out.println(tFluidName); diff --git a/src/main/java/gregtech/api/enums/GTNH_ExtraMaterials.java b/src/main/java/gregtech/api/enums/GTNH_ExtraMaterials.java index e686be218d..d8d254ce55 100644 --- a/src/main/java/gregtech/api/enums/GTNH_ExtraMaterials.java +++ b/src/main/java/gregtech/api/enums/GTNH_ExtraMaterials.java @@ -2,8 +2,6 @@ package gregtech.api.enums; import gregtech.api.interfaces.IMaterialHandler; -import java.util.Arrays; - import static gregtech.GT_Mod.GT_FML_LOGGER; public class GTNH_ExtraMaterials implements IMaterialHandler { diff --git a/src/main/java/gregtech/api/enums/GT_Values.java b/src/main/java/gregtech/api/enums/GT_Values.java index c89d447d66..43c93450ab 100644 --- a/src/main/java/gregtech/api/enums/GT_Values.java +++ b/src/main/java/gregtech/api/enums/GT_Values.java @@ -183,9 +183,18 @@ public class GT_Values { * This will prevent NEI from crashing but spams the Log. */ public static boolean allow_broken_recipemap = false; - /** * This will set the percentage how much ReinforcedGlass is Allowed in Cleanroom Walls. */ public static float cleanroomGlass = 5.0f; + /** + * This will let machines such as drills and pumps chunkload their work area. + */ + public static boolean enableChunkloaders = true; + /** + * This will make all chunkloading machines act as World Anchors (true) or Passive Anchors (false) + */ + public static boolean alwaysReloadChunkloaders = false; + + public static boolean debugChunkloaders = false; } diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index ef06709e35..16a8f86721 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -114,7 +114,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials Terbium = new Materials( 72, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 255, 255, 255, 0, "Terbium" , "Terbium" , 0, 0, 1629, 1629, true, false, 4, 1, 1, Dyes._NULL , Element.Tb , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1)));
public static Materials Thorium = new Materials( 96, TextureSet.SET_SHINY , 6.0F, 512, 2, 1|2 |8 |32|64 , 0, 30, 0, 0, "Thorium" , "Thorium" , 0, 0, 2115, 0, false, false, 4, 1, 1, Dyes.dyeBlack , Element.Th , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1)));
public static Materials Thulium = new Materials( 76, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1|2 |8 |32 , 255, 255, 255, 0, "Thulium" , "Thulium" , 0, 0, 1818, 1818, true, false, 4, 1, 1, Dyes._NULL , Element.Tm , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1)));
- public static Materials Tin = new Materials( 57, TextureSet.SET_DULL , 1.0F, 0, 1, 1|2 |8 |32 |128 , 220, 220, 220, 0, "Tin" , "Tin" , 0, 0, 505, 505, false, false, 3, 1, 1, Dyes.dyeWhite , Element.Sn , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 1)));
+ public static Materials Tin = new Materials( 57, TextureSet.SET_DULL , 1.0F, 0, 3, 1|2 |8 |32 |128 , 220, 220, 220, 0, "Tin" , "Tin" , 0, 0, 505, 505, false, false, 3, 1, 1, Dyes.dyeWhite , Element.Sn , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 1)));
public static Materials Titanium = new Materials( 28, TextureSet.SET_METALLIC , 7.0F, 1600, 3, 1|2 |8 |32|64|128 , 220, 160, 240, 0, "Titanium" , "Titanium" , 0, 0, 1941, 1940, true, false, 5, 1, 1, Dyes.dyePurple , Element.Ti , Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.TUTAMEN, 1))).disableAutoGeneratedBlastFurnaceRecipes();
public static Materials Tritanium = new Materials( 329, TextureSet.SET_METALLIC , 20.0F,1435392, 6, 1|2 |64 , 255, 255, 255, 0, "Tritanium" , "Tritanium" , 0, 0, 9900, 9900, true, false, 1, 1, 1, Dyes.dyeWhite , Element.Tn ,Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ORDO, 2)));
public static Materials Tritium = new Materials( 3, TextureSet.SET_METALLIC , 1.0F, 0, 2, 16|32 , 255, 0, 0, 240, "Tritium" , "Tritium" , 0, 0, 14, 0, false, true, 10, 1, 1, Dyes.dyeRed , Element.T , Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 4)));
@@ -429,7 +429,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials Bronze = new Materials( 300, TextureSet.SET_METALLIC , 6.0F, 192, 2, 1|2 |64|128 , 255, 128, 0, 0, "Bronze" , "Bronze" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 2, Arrays.asList(new MaterialStack(Tin, 1), new MaterialStack(Copper, 3)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1)));
public static Materials BrownLimonite = new Materials( 930, TextureSet.SET_METALLIC , 1.0F, 0, 1, 1 |8 , 200, 100, 0, 0, "BrownLimonite" , "Brown Limonite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown , 2, Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Hydrogen, 1), new MaterialStack(Oxygen, 2))); // FeO(OH)
public static Materials Calcite = new Materials( 823, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8 , 250, 230, 220, 0, "Calcite" , "Calcite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 1, Arrays.asList(new MaterialStack(Calcium, 1), new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 3)));
- public static Materials Cassiterite = new Materials( 824, TextureSet.SET_METALLIC , 1.0F, 0, 1, 8 , 220, 220, 220, 0, "Cassiterite" , "Cassiterite" , 0, 0, -1, 0, false, false, 4, 3, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Tin, 1), new MaterialStack(Oxygen, 2)));
+ public static Materials Cassiterite = new Materials( 824, TextureSet.SET_METALLIC , 1.0F, 0, 3, 8 , 220, 220, 220, 0, "Cassiterite" , "Cassiterite" , 0, 0, -1, 0, false, false, 4, 3, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Tin, 1), new MaterialStack(Oxygen, 2)));
public static Materials CassiteriteSand = new Materials( 937, TextureSet.SET_SAND , 1.0F, 0, 1, 8 , 220, 220, 220, 0, "CassiteriteSand" , "Cassiterite Sand" , 0, 0, -1, 0, false, false, 4, 3, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Tin, 1), new MaterialStack(Oxygen, 2)));
public static Materials Chalcopyrite = new Materials( 855, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8 , 160, 120, 40, 0, "Chalcopyrite" , "Chalcopyrite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow , 1, Arrays.asList(new MaterialStack(Copper, 1), new MaterialStack(Iron, 1), new MaterialStack(Sulfur, 2)));
// public static Materials Chalk = new Materials( 856, TextureSet.SET_FINE , 1.0F, 0, 2, 1 , 250, 250, 250, 0, "Chalk" , "Chalk" , 0, 0, -1, 0, false, false, 0, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Calcium, 1), new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 3)));
@@ -445,9 +445,9 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials Cupronickel = new Materials( 310, TextureSet.SET_METALLIC , 6.0F, 64, 1, 1|2 |64 , 227, 150, 128, 0, "Cupronickel" , "Cupronickel" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 2, Arrays.asList(new MaterialStack(Copper, 1), new MaterialStack(Nickel, 1)));
public static Materials DarkAsh = new Materials( 816, TextureSet.SET_DULL , 1.0F, 0, 1, 1 , 50, 50, 50, 0, "DarkAsh" , "Dark Ashes" , 0, 0, -1, 0, false, false, 1, 2, 1, Dyes.dyeGray , 1, Arrays.asList(new MaterialStack(Carbon, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.IGNIS, 1), new TC_AspectStack(TC_Aspects.PERDITIO, 1)));
public static Materials DeepIron = new Materials( 829, TextureSet.SET_METALLIC , 6.0F, 384, 2, 1|2 |8 |64 , 150, 140, 140, 0, "DeepIron" , "Deep Iron" , 0, 0, 7500, 7500, true, false, 3, 1, 1, Dyes.dyePink , 2, Arrays.asList(new MaterialStack(Iron, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1)));
- public static Materials Diamond = new Materials( 500, TextureSet.SET_DIAMOND , 8.0F, 1280, 3, 1 |4|8 |64|128 , 200, 255, 255, 127, "Diamond" , "Diamond" , 0, 0, -1, 0, false, true, 5, 64, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Carbon, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 3), new TC_AspectStack(TC_Aspects.LUCRUM, 4)));
+ public static Materials Diamond = new Materials( 500, TextureSet.SET_DIAMOND , 8.0F, 1280, 4, 1 |4|8 |64|128 , 200, 255, 255, 127, "Diamond" , "Diamond" , 0, 0, -1, 0, false, true, 5, 64, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Carbon, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 3), new TC_AspectStack(TC_Aspects.LUCRUM, 4)));
public static Materials Electrum = new Materials( 303, TextureSet.SET_SHINY , 12.0F, 64, 2, 1|2 |8 |64|128 , 255, 255, 100, 0, "Electrum" , "Electrum" , 0, 0, -1, 0, false, false, 4, 1, 1, Dyes.dyeYellow , 2, Arrays.asList(new MaterialStack(Silver, 1), new MaterialStack(Gold, 1)));
- public static Materials Emerald = new Materials( 501, TextureSet.SET_EMERALD , 7.0F, 256, 2, 1 |4|8 |64 , 80, 255, 80, 127, "Emerald" , "Emerald" , 0, 0, -1, 0, false, true, 5, 1, 1, Dyes.dyeGreen , 1, Arrays.asList(new MaterialStack(Beryllium, 3), new MaterialStack(Aluminium, 2), new MaterialStack(Silicon, 6), new MaterialStack(Oxygen, 18)), Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 3), new TC_AspectStack(TC_Aspects.LUCRUM, 5)));
+ public static Materials Emerald = new Materials( 501, TextureSet.SET_EMERALD , 7.0F, 256, 4, 1 |4|8 |64 , 80, 255, 80, 127, "Emerald" , "Emerald" , 0, 0, -1, 0, false, true, 5, 1, 1, Dyes.dyeGreen , 1, Arrays.asList(new MaterialStack(Beryllium, 3), new MaterialStack(Aluminium, 2), new MaterialStack(Silicon, 6), new MaterialStack(Oxygen, 18)), Arrays.asList(new TC_AspectStack(TC_Aspects.VITREUS, 3), new TC_AspectStack(TC_Aspects.LUCRUM, 5)));
public static Materials FreshWater = new Materials( -1, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 0, 0, 255, 0, "FreshWater" , "Fresh Water" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlue , 0, Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.AQUA, 2)));
public static Materials Galena = new Materials( 830, TextureSet.SET_DULL , 1.0F, 0, 3, 1 |8 , 100, 60, 100, 0, "Galena" , "Galena" , 0, 0, -1, 0, false, false, 4, 1, 1, Dyes.dyePurple , 1, Arrays.asList(new MaterialStack(Lead, 1), new MaterialStack(Sulfur, 1)));
public static Materials Garnierite = new Materials( 906, TextureSet.SET_METALLIC , 1.0F, 0, 3, 1 |8 , 50, 200, 70, 0, "Garnierite" , "Garnierite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightBlue , 1, Arrays.asList(new MaterialStack(Nickel, 1), new MaterialStack(Oxygen, 1)));
@@ -619,7 +619,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials Spessartine = new Materials( 838, TextureSet.SET_DULL , 1.0F, 0, 2, 1 |8 , 255, 100, 100, 0, "Spessartine" , "Spessartine" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed , 1, Arrays.asList(new MaterialStack(Aluminium, 2), new MaterialStack(Manganese, 3), new MaterialStack(Silicon, 3), new MaterialStack(Oxygen, 12)));
public static Materials Sphalerite = new Materials( 839, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8 , 255, 255, 255, 0, "Sphalerite" , "Sphalerite" , 0, 0, -1, 0, false, false, 2, 1, 1, Dyes.dyeYellow , 1, Arrays.asList(new MaterialStack(Zinc, 1), new MaterialStack(Sulfur, 1)));
public static Materials StainlessSteel = new Materials( 306, TextureSet.SET_SHINY , 7.0F, 480, 4, 1|2 |64|128 , 200, 200, 220, 0, "StainlessSteel" , "Stainless Steel" , 0, 0, -1, 1700, true, false, 1, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Iron, 6), new MaterialStack(Chrome, 1), new MaterialStack(Manganese, 1), new MaterialStack(Nickel, 1)));
- public static Materials Steel = new Materials( 305, TextureSet.SET_METALLIC , 6.0F, 512, 2, 1|2 |64|128 , 128, 128, 128, 0, "Steel" , "Steel" , 0, 0, 1811, 1000, true, false, 4, 51, 50, Dyes.dyeGray , 1, Arrays.asList(new MaterialStack(Iron, 50), new MaterialStack(Carbon, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ORDO, 1)));
+ public static Materials Steel = new Materials( 305, TextureSet.SET_METALLIC , 6.0F, 512, 3, 1|2 |64|128 , 128, 128, 128, 0, "Steel" , "Steel" , 0, 0, 1811, 1000, true, false, 4, 51, 50, Dyes.dyeGray , 1, Arrays.asList(new MaterialStack(Iron, 50), new MaterialStack(Carbon, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ORDO, 1)));
public static Materials Stibnite = new Materials( 945, TextureSet.SET_METALLIC , 1.0F, 0, 2, 1 |8 , 70, 70, 70, 0, "Stibnite" , "Stibnite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite , 2, Arrays.asList(new MaterialStack(Antimony, 2), new MaterialStack(Sulfur, 3)));
public static Materials SulfuricAcid = new Materials( 720, TextureSet.SET_FLUID , 1.0F, 0, 2, 16 , 255, 128, 0, 0, "SulfuricAcid" , "Sulfuric Acid" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange , 1, Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Sulfur, 1), new MaterialStack(Oxygen, 4)));
public static Materials Tanzanite = new Materials( 508, TextureSet.SET_GEM_VERTICAL , 7.0F, 256, 2, 1 |4|8 |64 , 64, 0, 200, 127, "Tanzanite" , "Tanzanite" , 0, 0, -1, 0, false, true, 5, 1, 1, Dyes.dyePurple , 1, Arrays.asList(new MaterialStack(Calcium, 2), new MaterialStack(Aluminium, 3), new MaterialStack(Silicon, 3), new MaterialStack(Hydrogen, 1), new MaterialStack(Oxygen, 13)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 5), new TC_AspectStack(TC_Aspects.VITREUS, 3)));
@@ -737,7 +737,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials Soapstone = new Materials( 877, TextureSet.SET_DULL , 1.0F, 0, 1, 1 |8 , 95, 145, 95, 0, "Soapstone" , "Soapstone" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes._NULL , 1, Arrays.asList(new MaterialStack(Magnesium, 3), new MaterialStack(Silicon, 4), new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 12))); // H2Mg3(SiO3)4
public static Materials Concrete = new Materials( 947, TextureSet.SET_ROUGH , 1.0F, 0, 1, 1 , 100, 100, 100, 0, "Concrete" , "Concrete" , 0, 0, 300, 0, false, false, 0, 1, 1, Dyes.dyeGray , 0, Arrays.asList(new MaterialStack(Stone, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.TERRA, 1)));
public static Materials IronMagnetic = new Materials( 354, TextureSet.SET_MAGNETIC , 6.0F, 256, 2, 1|2 |64|128 , 200, 200, 200, 0, "IronMagnetic" , "Magnetic Iron" , 0, 0, -1, 0, false, false, 4, 51, 50, Dyes.dyeGray , 1, Arrays.asList(new MaterialStack(Iron, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.MAGNETO, 1)));
- public static Materials SteelMagnetic = new Materials( 355, TextureSet.SET_MAGNETIC , 6.0F, 512, 2, 1|2 |64|128 , 128, 128, 128, 0, "SteelMagnetic" , "Magnetic Steel" , 0, 0, 1000, 1000, true, false, 4, 51, 50, Dyes.dyeGray , 1, Arrays.asList(new MaterialStack(Steel, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 1), new TC_AspectStack(TC_Aspects.ORDO, 1), new TC_AspectStack(TC_Aspects.MAGNETO, 1)));
+ public static Materials SteelMagnetic = new Materials( 355, TextureSet.SET_MAGNETIC , 6.0F, 512, 3, 1|2 |64|128 , 128, 128, 128, 0, "SteelMagnetic" , "Magnetic Steel" , 0, 0, 1000, 1000, true, false, 4, 51, 50, Dyes.dyeGray , 1, Arrays.asList(new MaterialStack(Steel, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 1), new TC_AspectStack(TC_Aspects.ORDO, 1), new TC_AspectStack(TC_Aspects.MAGNETO, 1)));
public static Materials NeodymiumMagnetic = new Materials( 356, TextureSet.SET_MAGNETIC , 7.0F, 512, 2, 1|2 |64|128 , 100, 100, 100, 0, "NeodymiumMagnetic" , "Magnetic Neodymium" , 0, 0, 1297, 1297, true, false, 4, 51, 50, Dyes.dyeGray , 1, Arrays.asList(new MaterialStack(Neodymium, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 1), new TC_AspectStack(TC_Aspects.MAGNETO, 3)));
public static Materials SamariumMagnetic = new Materials( 399, TextureSet.SET_MAGNETIC , 1.0F, 0, 2, 1|2 |64|128 , 255, 255, 204, 0, "SamariumMagnetic" , "Magnetic Samarium" , 0, 0, 1345, 1345, true, false, 4, 1, 1, Dyes.dyeWhite , 1, Arrays.asList(new MaterialStack(Samarium, 1)),Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.RADIO, 1), new TC_AspectStack(TC_Aspects.MAGNETO,10)));
public static Materials TungstenCarbide = new Materials( 370, TextureSet.SET_METALLIC , 14.0F, 1280, 4, 1|2 |64|128 , 51, 0, 102, 0, "TungstenCarbide" , "Tungstencarbide" , 0, 0, 2460, 2460, true, false, 4, 1, 1, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Tungsten, 1), new MaterialStack(Carbon, 1)));
@@ -788,6 +788,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials PulsatingIron = new Materials( 378, TextureSet.SET_METALLIC , 6.0F, 256, 3, 1|2 |64|128 , 128, 246, 155, 0, "PulsatingIron" , "Pulsating Iron" , 0, 0, -1, 1800, true, false, 4, 1, 1, Dyes.dyeLime , 1, Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(EnderPearl, 1), new MaterialStack(RedstoneAlloy, 1))).disableAutoGeneratedBlastFurnaceRecipes();
public static Materials Enderium = new Materials( 321, TextureSet.SET_DULL , 8.0F, 1500, 3, 1|2 |64|128 , 89, 145, 135, 0, "Enderium" , "Enderium" , 0, 0, 4500, 4500, true, false, 1, 1, 1, Dyes.dyeGreen , 1, Arrays.asList(new MaterialStack(EnderiumBase, 2), new MaterialStack(Thaumium, 1), new MaterialStack(EnderPearl, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.ALIENIS, 1))).disableAutoGeneratedBlastFurnaceRecipes();
public static Materials DarkSteel = new Materials( 364, TextureSet.SET_METALLIC , 8.0F, 512, 3, 1|2 |64|128 , 80, 70, 80, 0, "DarkSteel" , "Dark Steel" , 0, 0, -1, 1800, true, false, 3, 1, 1, Dyes.dyePurple , 1, Arrays.asList(new MaterialStack(ElectricalSteel, 1), new MaterialStack(Coal, 1), new MaterialStack(Obsidian, 1))).disableAutoGeneratedBlastFurnaceRecipes();
+ public static Materials EndSteel = new Materials( 401, TextureSet.SET_METALLIC , 12.0F, 2000, 4, 1|2 |64|128 , 223, 217, 165, 0, "EndSteel" , "End Steel" , 0, 0, 940, 3600, true, false, 3, 1, 1, Dyes.dyeYellow , 1, Arrays.asList(new MaterialStack(DarkSteel, 1), new MaterialStack(Tungsten, 1), new MaterialStack(Endstone, 1))).disableAutoGeneratedBlastFurnaceRecipes();
public static Materials Mithril = new Materials( 331, TextureSet.SET_SHINY , 14.0F, 64, 3, 1|2 |8 |64 , 255, 255, 210, 0, "Mithril" , "Mithril" , 0, 0, -1, 0, false, false, 4, 3, 2, Dyes.dyeLightBlue , 2, Arrays.asList(new MaterialStack(Platinum, 2), new MaterialStack(Thaumium, 1)));
public static Materials BlueAlloy = new Materials( 309, TextureSet.SET_DULL , 1.0F, 0, 0, 1|2 , 100, 180, 255, 0, "BlueAlloy" , "Blue Alloy" , 0, 0, -1, 0, false, false, 3, 5, 1, Dyes.dyeLightBlue , 2, Arrays.asList(new MaterialStack(Silver, 1), new MaterialStack(Electrotine, 4)), Arrays.asList(new TC_AspectStack(TC_Aspects.ELECTRUM, 3)));
public static Materials ShadowIron = new Materials( 336, TextureSet.SET_METALLIC , 6.0F, 384, 3, 1|2 |8 |64 , 120, 120, 120, 0, "ShadowIron" , "Shadowiron" , 0, 0, -1, 0, false, false, 3, 4, 3, Dyes.dyeBlack , 3, Arrays.asList(new MaterialStack(Iron, 1), new MaterialStack(Thaumium, 3)));
@@ -945,31 +946,33 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { static {
initSubTags();
- Iron .mOreReRegistrations.add(AnyIron );
- PigIron .mOreReRegistrations.add(AnyIron );
- WroughtIron .mOreReRegistrations.add(AnyIron );
+ Iron.mOreReRegistrations.add(AnyIron);
+ PigIron.mOreReRegistrations.add(AnyIron);
+ WroughtIron.mOreReRegistrations.add(AnyIron);
- Copper .mOreReRegistrations.add(AnyCopper );
- AnnealedCopper .mOreReRegistrations.add(AnyCopper );
+ Copper.mOreReRegistrations.add(AnyCopper);
+ AnnealedCopper.mOreReRegistrations.add(AnyCopper);
- Bronze .mOreReRegistrations.add(AnyBronze );
+ Bronze.mOreReRegistrations.add(AnyBronze);
- Rubber .mOreReRegistrations.add(AnyRubber);
- StyreneButadieneRubber .mOreReRegistrations.add(AnyRubber);
- Silicone .mOreReRegistrations.add(AnyRubber);
+ Rubber.mOreReRegistrations.add(AnyRubber);
+ StyreneButadieneRubber.mOreReRegistrations.add(AnyRubber);
+ Silicone.mOreReRegistrations.add(AnyRubber);
- StyreneButadieneRubber .mOreReRegistrations.add(AnySyntheticRubber);
- Silicone .mOreReRegistrations.add(AnySyntheticRubber);
+ StyreneButadieneRubber.mOreReRegistrations.add(AnySyntheticRubber);
+ Silicone.mOreReRegistrations.add(AnySyntheticRubber);
- Peanutwood .setMaceratingInto(Wood );
- WoodSealed .setMaceratingInto(Wood );
- NetherBrick .setMaceratingInto(Netherrack );
+ Electrotine.mOreReRegistrations.add(Nikolite);
- SamariumMagnetic .setSmeltingInto(Samarium ).setMaceratingInto(Samarium ).setArcSmeltingInto(Samarium );
- NeodymiumMagnetic .setSmeltingInto(Neodymium ).setMaceratingInto(Neodymium ).setArcSmeltingInto(Neodymium );
- SteelMagnetic .setSmeltingInto(Steel ).setMaceratingInto(Steel ).setArcSmeltingInto(Steel );
- Iron .setSmeltingInto(Iron ).setMaceratingInto(Iron ).setArcSmeltingInto(WroughtIron );
- AnyIron .setSmeltingInto(Iron ).setMaceratingInto(Iron ).setArcSmeltingInto(WroughtIron );
+ Peanutwood.setMaceratingInto(Wood);
+ WoodSealed.setMaceratingInto(Wood);
+ NetherBrick.setMaceratingInto(Netherrack);
+
+ SamariumMagnetic.setSmeltingInto(Samarium).setMaceratingInto(Samarium).setArcSmeltingInto(Samarium);
+ NeodymiumMagnetic.setSmeltingInto(Neodymium).setMaceratingInto(Neodymium).setArcSmeltingInto(Neodymium);
+ SteelMagnetic.setSmeltingInto(Steel).setMaceratingInto(Steel).setArcSmeltingInto(Steel);
+ Iron.setSmeltingInto(Iron).setMaceratingInto(Iron).setArcSmeltingInto(WroughtIron);
+ AnyIron.setSmeltingInto(Iron).setMaceratingInto(Iron).setArcSmeltingInto(WroughtIron);
PigIron .setSmeltingInto(Iron ).setMaceratingInto(Iron ).setArcSmeltingInto(WroughtIron );
WroughtIron .setSmeltingInto(WroughtIron ).setMaceratingInto(WroughtIron ).setArcSmeltingInto(WroughtIron );
IronMagnetic .setSmeltingInto(Iron ).setMaceratingInto(Iron ).setArcSmeltingInto(WroughtIron );
@@ -1599,7 +1602,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { aMaterial.mTransparent = GregTech_API.sMaterialProperties.get(aConfigPath, "Transparent", aMaterial.mTransparent);
String aColor = GregTech_API.sMaterialProperties.get(aConfigPath, "DyeColor", aMaterial.mColor == Dyes._NULL ? "None" : aMaterial.mColor.toString());
aMaterial.mColor = aColor.equals("None") ? Dyes._NULL : Dyes.get(aColor);
- String[] aRGBA = GregTech_API.sMaterialProperties.get(aConfigPath, "MatRGBA", String.valueOf(aMaterial.mRGBa[0] + "," + aMaterial.mRGBa[1] + "," + aMaterial.mRGBa[2] + "," + aMaterial.mRGBa[3] + ",")).split(",");
+ String[] aRGBA = GregTech_API.sMaterialProperties.get(aConfigPath, "MatRGBA", aMaterial.mRGBa[0] + "," + aMaterial.mRGBa[1] + "," + aMaterial.mRGBa[2] + "," + aMaterial.mRGBa[3] + ",").split(",");
aMaterial.mRGBa[0] = Short.parseShort(aRGBA[0]);
aMaterial.mRGBa[1] = Short.parseShort(aRGBA[1]);
aMaterial.mRGBa[2] = Short.parseShort(aRGBA[2]);
diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index 1c1aaa3bd8..f7a0409b8c 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -29,7 +29,7 @@ public class Textures { MACHINE_CASING_TANK_5, MACHINE_CASING_TANK_6, MACHINE_CASING_TANK_7, MACHINE_CASING_TANK_8,
MACHINE_CASING_TANK_9, MACHINE_CASING_TANK_10,MACHINE_CASING_TANK_11,MACHINE_CASING_TANK_12,
MACHINE_CASING_TANK_13,MACHINE_CASING_TANK_14,MACHINE_CASING_TANK_15,MACHINE_CASING_TANK_0,
- BLOCK_STEELEAF, BLOCK_ICHORIUM,
+ BLOCK_STEELEAF, BLOCK_ICHORIUM, BLOCK_FIRESTONE,
OVERLAY_ENERGY_IN_POWER,OVERLAY_ENERGY_OUT_POWER,OVERLAY_AUTOMAINTENANCE,OVERLAY_AUTOMAINTENANCE_IDLE,OVERLAY_TELEPORTER_SIDES,
//
VOID // The Empty Texture
@@ -521,7 +521,8 @@ public class Textures { BLOCK_HSSE,
BLOCK_HSSS,
BLOCK_STEELEAF,
- BLOCK_ICHORIUM
+ BLOCK_ICHORIUM,
+ BLOCK_FIRESTONE
},
STORAGE_BLOCKS9 = new IIconContainer[]{
BLOCK_AERCRYSTAL,
diff --git a/src/main/java/gregtech/api/interfaces/IChunkLoader.java b/src/main/java/gregtech/api/interfaces/IChunkLoader.java new file mode 100644 index 0000000000..adba5e721e --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IChunkLoader.java @@ -0,0 +1,9 @@ +package gregtech.api.interfaces; + +import net.minecraft.world.ChunkCoordIntPair; + +// This interface is implemented by the machines that actively load a working chunk +public interface IChunkLoader { + // return a working chunk coordinates, may be null + ChunkCoordIntPair getActiveChunk(); +} diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java index 5bb3545d8d..40a30ebf8a 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java @@ -614,6 +614,9 @@ public interface IGT_RecipeAdder { public boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); public boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, ItemStack aInput5, ItemStack aInput6, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); + + public boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, ItemStack aInput5, ItemStack aInput6, ItemStack aInput7, ItemStack aInput8, ItemStack aInput9, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); + /** * Adds a Recipe for the Laser Engraver */ diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index 8c9bac5c01..73436e3b2a 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -3,7 +3,6 @@ package gregtech.api.interfaces.tileentity; import cofh.api.energy.IEnergyReceiver; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Pollution; import ic2.api.energy.tile.IEnergySink; diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java index 953e3e5dc4..8bd8c5b678 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java @@ -12,6 +12,7 @@ import net.minecraftforge.fluids.IFluidHandler; import java.util.ArrayList; import java.util.List; +import java.util.UUID; /** * A simple compound Interface for all my TileEntities. @@ -93,6 +94,16 @@ public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTil public String getOwnerName(); /** + * Gets the UniqueID of the Machines Owner. + */ + public UUID getOwnerUuid(); + + /** + * Sets the UniqueID of the Machines Owner. + */ + public void setOwnerUuid(UUID uuid); + + /** * Sets initial Values from NBT * * @param aNBT is the NBTTag of readFromNBT diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 6d9ce47ef2..257cc79adb 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -6,6 +6,7 @@ import static gregtech.api.enums.GT_Values.NW; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.UUID;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
@@ -1176,6 +1177,16 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE }
@Override
+ public UUID getOwnerUuid() {
+ return GT_Utility.defaultUuid;
+ }
+
+ @Override
+ public void setOwnerUuid(UUID uuid) {
+
+ }
+
+ @Override
public byte getComparatorValue(byte aSide) {
return canAccessData() ? mMetaTileEntity.getComparatorValue(aSide) : 0;
}
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 1da2dffca9..58a97f644a 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -39,6 +39,7 @@ import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.UUID; import static gregtech.GT_Mod.GT_FML_LOGGER; import static gregtech.api.enums.GT_Values.NW; @@ -69,6 +70,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE public long mLastSoundTick = 0; private long mLastCheckTick = 0; private String mOwnerName = ""; + private UUID mOwnerUuid = GT_Utility.defaultUuid; private NBTTagCompound mRecipeStuff = new NBTTagCompound(); private static final Field ENTITY_ITEM_HEALTH_FIELD; @@ -116,6 +118,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE aNBT.setByte("mStrongRedstone", mStrongRedstone); aNBT.setShort("mFacing", mFacing); aNBT.setString("mOwnerName", mOwnerName); + aNBT.setString("mOwnerUuid", mOwnerUuid == null ? "" : mOwnerUuid.toString()); aNBT.setBoolean("mLockUpgrade", mLockUpgrade); aNBT.setBoolean("mMuffler", mMuffler); aNBT.setBoolean("mSteamConverter", mSteamConverter); @@ -181,6 +184,11 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE mStrongRedstone = aNBT.getByte("mStrongRedstone"); mFacing = oFacing = (byte) aNBT.getShort("mFacing"); mOwnerName = aNBT.getString("mOwnerName"); + try { + mOwnerUuid = UUID.fromString(aNBT.getString("mOwnerUuid")); + } catch (IllegalArgumentException e){ + mOwnerUuid = null; + } mLockUpgrade = aNBT.getBoolean("mLockUpgrade"); mMuffler = aNBT.getBoolean("mMuffler"); mSteamConverter = aNBT.getBoolean("mSteamConverter"); @@ -541,7 +549,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE oTexturePage = (hasValidMetaTileEntity() && mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) ? ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage() : 0, oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), - oColor = mColor), + oColor = mColor), xCoord, zCoord); mSendClientData = false; } @@ -1191,8 +1199,10 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE public boolean playerOwnsThis(EntityPlayer aPlayer, boolean aCheckPrecicely) { if (!canAccessData()) return false; if (aCheckPrecicely || privateAccess() || (mOwnerName.length() == 0)) - if ((mOwnerName.length() == 0) && isServerSide()) setOwnerName(aPlayer.getDisplayName()); - else if (privateAccess() && !aPlayer.getDisplayName().equals("Player") && !mOwnerName.equals("Player") && !mOwnerName.equals(aPlayer.getDisplayName())) + if ((mOwnerName.length() == 0) && isServerSide()) { + setOwnerName(aPlayer.getDisplayName()); + setOwnerUuid(aPlayer.getUniqueID()); + } else if (privateAccess() && !aPlayer.getDisplayName().equals("Player") && !mOwnerName.equals("Player") && !mOwnerName.equals(aPlayer.getDisplayName())) return false; return true; } @@ -1244,7 +1254,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE mMetaTileEntity.doExplosion(aAmount); } } - + public void dropItems(ItemStack tItem){ if(tItem==null)return; EntityItem tItemEntity = new EntityItem(this.worldObj, this.xCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, this.yCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, this.zCoord + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); @@ -1261,7 +1271,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE ENTITY_ITEM_HEALTH_FIELD.setInt(tItemEntity, 99999999); } catch (Exception ignored) {} this.worldObj.spawnEntityInWorld(tItemEntity); - tItem.stackSize = 0; + tItem.stackSize = 0; } @Override @@ -1365,7 +1375,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE doEnetUpdate(); return true; } - + if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)) { byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); if (mMetaTileEntity.onWireCutterRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { @@ -1421,6 +1431,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE if (isUpgradable() && !mLockUpgrade) { mLockUpgrade = true; setOwnerName(aPlayer.getDisplayName()); + setOwnerUuid(aPlayer.getUniqueID()); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(3), 1.0F, -1, xCoord, yCoord, zCoord); if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--; } @@ -1527,7 +1538,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE public byte getOutputRedstoneSignal(byte aSide) { return getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) ? mSidedRedstone[aSide] : getGeneralRS(aSide); } - + public byte getGeneralRS(byte aSide){ if(mMetaTileEntity==null)return 0; return mMetaTileEntity.allowGeneralRedstoneOutput() ? mSidedRedstone[aSide] : 0; @@ -1727,6 +1738,16 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE } @Override + public UUID getOwnerUuid() { + return mOwnerUuid; + } + + @Override + public void setOwnerUuid(UUID uuid) { + mOwnerUuid = uuid; + } + + @Override public byte getComparatorValue(byte aSide) { return canAccessData() ? mMetaTileEntity.getComparatorValue(aSide) : 0; } diff --git a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java index 5c0cd5ceb6..d35d4583d9 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java @@ -1,6 +1,5 @@ package gregtech.api.metatileentity; -import cpw.mods.fml.common.FMLCommonHandler; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java index 5835a6c9ab..1a81e4d570 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java @@ -240,6 +240,7 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier mChargeableCount++; } } + count++; } @Override @@ -309,11 +310,11 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier @Override public String[] getInfoData() { - count++; - if (mMax == 0 || count % 20 == 0) { + if (mMax == 0 || (count > 20)) { long[] tmp = getStoredEnergy(); mStored = tmp[0]; mMax = tmp[1]; + count = 0; } return new String[]{ diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java index d57aff8fc9..26e816a52c 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java @@ -43,19 +43,30 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - int textureIndex=actualTexture|(mTexturePage<<7);//Shift seven since one page is 128 textures! - int texturePointer=(byte)(actualTexture&0x7F);//just to be sure, from my testing the 8th bit cannot be set clientside - return aSide != aFacing ? - textureIndex > 0 ? - new ITexture[]{Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]} : - new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]} : - textureIndex > 0 ? - aActive ? - getTexturesActive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]) : - getTexturesInactive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]) : - aActive ? - getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]) : - getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]); + int textureIndex = actualTexture | (mTexturePage << 7);//Shift seven since one page is 128 textures! + int texturePointer = (byte) (actualTexture & 0x7F);//just to be sure, from my testing the 8th bit cannot be set clientside + try { + if (aSide != aFacing) { + if (textureIndex > 0) + return new ITexture[]{Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]}; + else + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; + } else { + if (textureIndex > 0) { + if (aActive) + return getTexturesActive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]); + else + return getTexturesInactive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]); + } else { + if (aActive) + return getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]); + else + return getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]); + } + } + } catch (NullPointerException npe) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[0][0]}; + } } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java index 9c74811b23..71eea9bf87 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java @@ -10,9 +10,9 @@ import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidHandler; +import net.minecraftforge.fluids.*; public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { private String lockedFluidName = null; @@ -207,7 +207,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { playerThatLockedfluid = aPlayer; if (mFluid == null) { this.setLockedFluidName(null); - inBrackets = trans("115.3","currently none, will be locked to the next that is put in"); + inBrackets = trans("115.3","currently none, will be locked to the next that is put in (or use fluid cell to lock)"); } else { this.setLockedFluidName(this.getDrainableStack().getUnlocalizedName()); inBrackets = this.getDrainableStack().getLocalizedName(); @@ -218,7 +218,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { playerThatLockedfluid = aPlayer; if (mFluid == null) { this.setLockedFluidName(null); - inBrackets = trans("115.3","currently none, will be locked to the next that is put in"); + inBrackets = trans("115.3","currently none, will be locked to the next that is put in (or use fluid cell to lock)"); } else { this.setLockedFluidName(this.getDrainableStack().getUnlocalizedName()); inBrackets = this.getDrainableStack().getLocalizedName(); @@ -227,7 +227,41 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { break; } } - + private boolean tryToLockHatch(EntityPlayer aPlayer, byte aSide) { + if (!getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).isGUIClickable(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity())) + return false; + if (!isFluidLocked()) + return false; + ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); + if (tCurrentItem == null) + return false; + FluidStack tFluid = FluidContainerRegistry.getFluidForFilledItem(tCurrentItem); + if (tFluid == null && tCurrentItem.getItem() instanceof IFluidContainerItem) + tFluid = ((IFluidContainerItem)tCurrentItem.getItem()).getFluid(tCurrentItem); + if (tFluid != null) { + if (getLockedFluidName() != null && !getLockedFluidName().equals(tFluid.getUnlocalizedName())) { + GT_Utility.sendChatToPlayer(aPlayer, String.format("%s %s", trans("151.3", + "Hatch is locked to a different fluid. To change the locking, empty it and made it locked to the next fluid with a screwdriver. Currently locked to") + , StatCollector.translateToLocal(getLockedFluidName()))); + } + else { + setLockedFluidName(tFluid.getUnlocalizedName()); + if (mMode == 8) + GT_Utility.sendChatToPlayer(aPlayer, String.format("%s (%s)", trans("151.1", "Outputs items and 1 specific Fluid"), tFluid.getLocalizedName())); + else + GT_Utility.sendChatToPlayer(aPlayer, String.format("%s (%s)", trans("151.2", "Outputs 1 specific Fluid"), tFluid.getLocalizedName())); + } + return true; + } + return false; + } + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { + if (tryToLockHatch(aPlayer, aSide)) + return true; + return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ); + } + public String trans(String aKey, String aEnglish){ return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_"+aKey, aEnglish, false); } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 2da97a1939..da80a9e231 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -8,8 +8,6 @@ import java.util.ArrayList; import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; import gregtech.api.gui.GT_Container_MultiMachine; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -19,7 +17,6 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Pollution; @@ -435,7 +432,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { NBTTagCompound tNBT = mInventory[1].getTagCompound(); if (tNBT != null) { NBTTagCompound tNBT2 = tNBT.getCompoundTag("GT.CraftingComponents");//tNBT2 dont use out if - if (!tNBT.getBoolean("mDis")) { + /*if (!tNBT.getBoolean("mDis")) { tNBT2 = new NBTTagCompound(); Materials tMaterial = GT_MetaGenerated_Tool.getPrimaryMaterial(mInventory[1]); ItemStack tTurbine = GT_OreDictUnificator.get(OrePrefixes.turbineBlade, tMaterial, 1); @@ -487,7 +484,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { tNBT.setBoolean("mDis", true); mInventory[1].setTagCompound(tNBT); - } + }*/ } ((GT_MetaGenerated_Tool) mInventory[1].getItem()).doDamage(mInventory[1], (long)getDamageToComponent(mInventory[1]) * (long) Math.min(mEUt / this.damageFactorLow, Math.pow(mEUt, this.damageFactorHigh))); if (mInventory[1].stackSize == 0) mInventory[1] = null; @@ -566,7 +563,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { //Isnt too low EUt check? int aAmpsToInject; int aRemainder; - + int ampsOnCurrentHatch; //xEUt *= 4;//this is effect of everclocking for (GT_MetaTileEntity_Hatch_Dynamo aDynamo : mDynamoHatches) { if (isValidMetaTileEntity(aDynamo)) { @@ -574,11 +571,14 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { aVoltage = aDynamo.maxEUOutput(); aAmpsToInject = (int) (leftToInject / aVoltage); aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage)); - long powerGain; - for (int i = 0; i < Math.min(aDynamo.maxAmperesOut(), aAmpsToInject > 0 ? aAmpsToInject : 1); i++) { - powerGain = aAmpsToInject > 0 ? aVoltage : aRemainder; - aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(powerGain, false); - injected += powerGain; + ampsOnCurrentHatch= (int) Math.min(aDynamo.maxAmperesOut(), aAmpsToInject); + for (int i = 0; i < ampsOnCurrentHatch; i++) { + aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aVoltage, false); + } + injected+=aVoltage*ampsOnCurrentHatch; + if(aRemainder>0 && ampsOnCurrentHatch<aDynamo.maxAmperesOut()){ + aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aRemainder, false); + injected+=aRemainder; } } } diff --git a/src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java b/src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java new file mode 100644 index 0000000000..8b26ef6423 --- /dev/null +++ b/src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java @@ -0,0 +1,24 @@ +package gregtech.api.objects; + +import cpw.mods.fml.common.Optional; +import gregtech.api.metatileentity.BaseMetaTileEntity; +import gregtech.common.tileentities.storage.GT_MetaTileEntity_DigitalChestBase; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + +@Optional.Interface(iface = "appeng.api.storage.IExternalStorageHandler", modid = "appliedenergistics2", striprefs = true) +public class AE2DigitalChestHandler implements appeng.api.storage.IExternalStorageHandler { + + @Optional.Method(modid = "appliedenergistics2") + public boolean canHandle(final TileEntity te, final ForgeDirection d, final appeng.api.storage.StorageChannel chan, final appeng.api.networking.security.BaseActionSource mySrc) { + return chan == appeng.api.storage.StorageChannel.ITEMS && te instanceof BaseMetaTileEntity && ((BaseMetaTileEntity) te).getMetaTileEntity() instanceof GT_MetaTileEntity_DigitalChestBase; + } + + @Optional.Method(modid = "appliedenergistics2") + public appeng.api.storage.IMEInventory getInventory(final TileEntity te, final ForgeDirection d, final appeng.api.storage.StorageChannel chan, final appeng.api.networking.security.BaseActionSource src) { + if (chan == appeng.api.storage.StorageChannel.ITEMS) { + return new appeng.me.storage.MEMonitorIInventory(new appeng.util.inv.IMEAdaptor((GT_MetaTileEntity_DigitalChestBase) (((BaseMetaTileEntity) te).getMetaTileEntity()), src)); + } + return null; + } +} diff --git a/src/main/java/gregtech/api/objects/GT_ChunkManager.java b/src/main/java/gregtech/api/objects/GT_ChunkManager.java new file mode 100644 index 0000000000..0012bc78f4 --- /dev/null +++ b/src/main/java/gregtech/api/objects/GT_ChunkManager.java @@ -0,0 +1,158 @@ +package gregtech.api.objects; + +import gregtech.GT_Mod; +import gregtech.api.enums.GT_Values; +import gregtech.api.interfaces.IChunkLoader; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Log; +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.ListMultimap; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraftforge.common.ForgeChunkManager; +import net.minecraftforge.common.ForgeChunkManager.Ticket; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +// This class handles re-initializing chunks after a server restart +public class GT_ChunkManager implements ForgeChunkManager.OrderedLoadingCallback, ForgeChunkManager.PlayerOrderedLoadingCallback { + private Map<TileEntity, Ticket> registeredTickets = new HashMap<>(); + public static GT_ChunkManager instance = new GT_ChunkManager(); + + public static void init() { + ForgeChunkManager.setForcedChunkLoadingCallback(GT_Mod.instance, instance); + //MinecraftForge.EVENT_BUS.register(instance); + } + + @Override + public void ticketsLoaded(List<Ticket> tickets, World world) {} + + // Determine if tickets should be kept. Based on if the ticket is a machine or working chunk ticket. Working chunk tickets are tossed + // and re-created when the machine re-activates. Machine tickets are kept only if the config alwaysReloadChunkloaders is true. Otherwise + // machine chunks are tossed and re-created only when the machine re-activates, similar to a Passive Anchor. + @Override + public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount) { + List<Ticket> validTickets = new ArrayList<>(); + if (GT_Values.alwaysReloadChunkloaders) { + for (Ticket ticket : tickets) { + int x = ticket.getModData().getInteger("OwnerX"); + int y = ticket.getModData().getInteger("OwnerY"); + int z = ticket.getModData().getInteger("OwnerZ"); + if (y > 0) { + TileEntity tile = world.getTileEntity(x, y, z); + if (tile != null && tile instanceof IGregTechTileEntity && ((IGregTechTileEntity)tile).isAllowedToWork()) { + ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(x >> 4, z >> 4)); + if (!registeredTickets.containsKey(tile)) { + registeredTickets.put(tile, ticket); + if (((IGregTechTileEntity)tile).getMetaTileEntity() instanceof IChunkLoader) + ForgeChunkManager.forceChunk(ticket, ((IChunkLoader)((IGregTechTileEntity)tile).getMetaTileEntity()).getActiveChunk()); + validTickets.add(ticket); + } + } + } + } + } + return validTickets ; + } + + // Determine if player tickets should be kept. This is where a ticket list per player would be created and maintained. When + // a player join event occurs, their name/UUID/whatevs is compared against tickets on this list and those tickets reactivated. + // Since that info would be maintained/dealt with on a per-player startup, the list returned back to Forge is empty. + @Override + public ListMultimap<String, Ticket> playerTicketsLoaded(ListMultimap<String, Ticket> tickets, World world) { + // Not currently used, so just return an empty list. + return ArrayListMultimap.create(); + } + + // Request a chunk to be loaded for this machine + // may pass null chunk to load just the machine itself, if "alwaysReloadChunkloaders" is enabled in config + static public boolean requestPlayerChunkLoad(TileEntity owner, ChunkCoordIntPair chunkXZ, String player) { + if (!GT_Values.enableChunkloaders) + return false; + if (!GT_Values.alwaysReloadChunkloaders && chunkXZ == null) + return false; + if (GT_Values.debugChunkloaders && chunkXZ != null) + GT_Log.out.println("GT_ChunkManager: Chunk request: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")"); + if (instance.registeredTickets.containsKey(owner)) { + ForgeChunkManager.forceChunk(instance.registeredTickets.get(owner), chunkXZ); + } else { + Ticket ticket = null; + if (player != "") + ticket = ForgeChunkManager.requestPlayerTicket(GT_Mod.instance, player, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL); + else + ticket = ForgeChunkManager.requestTicket(GT_Mod.instance, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL); + if (ticket == null) { + if (GT_Values.debugChunkloaders) + GT_Log.out.println("GT_ChunkManager: ForgeChunkManager.requestTicket failed"); + return false; + } + if (GT_Values.debugChunkloaders) + GT_Log.out.println("GT_ChunkManager: ticket issued for machine at: (" + owner.xCoord + ", " + owner.yCoord + ", " + owner.zCoord + ")" ); + NBTTagCompound tag = ticket.getModData(); + tag.setInteger("OwnerX", owner.xCoord); + tag.setInteger("OwnerY", owner.yCoord); + tag.setInteger("OwnerZ", owner.zCoord); + ForgeChunkManager.forceChunk(ticket, chunkXZ); + if (GT_Values.alwaysReloadChunkloaders) + ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(owner.xCoord << 4, owner.zCoord << 4)); + instance.registeredTickets.put(owner, ticket); + } + return true; + } + + static public boolean requestChunkLoad(TileEntity owner, ChunkCoordIntPair chunkXZ) { + return requestPlayerChunkLoad(owner, chunkXZ, ""); + } + + static public void releaseChunk(TileEntity owner, ChunkCoordIntPair chunkXZ) { + if (!GT_Values.enableChunkloaders) + return; + Ticket ticket = instance.registeredTickets.get(owner); + if (ticket != null) { + if (GT_Values.debugChunkloaders) + GT_Log.out.println("GT_ChunkManager: Chunk release: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")"); + ForgeChunkManager.unforceChunk(ticket, chunkXZ); + } + } + + static public void releaseTicket(TileEntity owner) { + if (!GT_Values.enableChunkloaders) + return; + Ticket ticket = instance.registeredTickets.get(owner); + if (ticket != null) { + if (GT_Values.debugChunkloaders) { + GT_Log.out.println("GT_ChunkManager: ticket released by machine at: (" + owner.xCoord + ", " + owner.yCoord + ", " + owner.zCoord + ")" ); + for (ChunkCoordIntPair chunk : ticket.getChunkList()) + GT_Log.out.println("GT_ChunkManager: Chunk release: (" + chunk.chunkXPos + ", " + chunk.chunkZPos + ")"); + } + ForgeChunkManager.releaseTicket(ticket); + instance.registeredTickets.remove(owner); + } + } + + public static void printTickets() { + GT_Log.out.println("GT_ChunkManager: Start forced chunks dump:"); + instance.registeredTickets.forEach((machine, ticket) -> { + GT_Log.out.print("GT_ChunkManager: Chunks forced by the machine at (" + machine.xCoord + ", " + machine.yCoord + ", " + machine.zCoord + ")"); + if (ticket.isPlayerTicket()) + GT_Log.out.print(" Owner: " + ticket.getPlayerName()); + GT_Log.out.print(" :"); + for (ChunkCoordIntPair c : ticket.getChunkList()) { + GT_Log.out.print("("); + GT_Log.out.print(c.chunkXPos); + GT_Log.out.print(", "); + GT_Log.out.print(c.chunkZPos); + GT_Log.out.print("), "); + } + }); + GT_Log.out.println("GT_ChunkManager: End forced chunks dump:"); + } +} diff --git a/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java b/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java index d8fae1917e..358e21a9a6 100644 --- a/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java +++ b/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java @@ -5,9 +5,6 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; -import com.google.common.collect.ImmutableMap; - -import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; @@ -16,322 +13,330 @@ import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; public class GT_Assemblyline_Server { - - - public static LinkedHashMap<String,String> lServerNames = new LinkedHashMap<String,String>(); - private static LinkedHashMap<String,String> internal2= new LinkedHashMap<String,String>(),internal3 = new LinkedHashMap<String,String>(),internal4= new LinkedHashMap<String,String>(); + + + public static LinkedHashMap<String, String> lServerNames = new LinkedHashMap<String, String>(); + private static LinkedHashMap<String, String> internal2 = new LinkedHashMap<String, String>(), internal3 = new LinkedHashMap<String, String>(), internal4 = new LinkedHashMap<String, String>(); private static HashMap<String, Property> internal = new HashMap<String, Property>(); - + public static void fillMap(FMLPreInitializationEvent aEvent) { - + String s = new String(aEvent.getModConfigurationDirectory().getAbsolutePath()); - s = s.substring(0, aEvent.getModConfigurationDirectory().getAbsolutePath().length()-6); + s = s.substring(0, aEvent.getModConfigurationDirectory().getAbsolutePath().length() - 6); s = s + "GregTech.lang"; File f = new File(s); s = ""; Configuration conf = new Configuration(f); - + ConfigCategory cat = conf.getCategory("languagefile"); internal.putAll(cat.getValues()); - for (Map.Entry<String, Property> entry : internal.entrySet()) - { - s=entry.getValue().getString().replaceAll("%", ""); + for (Map.Entry<String, Property> entry : internal.entrySet()) { + try { + s = entry.getValue().getString().replaceAll("%", ""); - if (entry.getKey().contains("metaitem") && s.contains("material")) - internal2.put(entry.getKey(), s); - else if (entry.getKey().contains("blockmachines") && s.contains("material")) - internal3.put(entry.getKey(), s); - else if ((entry.getKey().contains("blockores")||(entry.getKey().contains("blockmetal")||entry.getKey().contains("blockgem"))) && s.contains("material")) - internal4.put(entry.getKey(), s); - else - lServerNames.put(entry.getKey(), s); + if (entry.getKey().contains("metaitem") && s.contains("material")) + internal2.put(entry.getKey(), s); + else if (entry.getKey().contains("blockmachines") && s.contains("material")) + internal3.put(entry.getKey(), s); + else if ((entry.getKey().contains("blockores") || (entry.getKey().contains("blockmetal") || entry.getKey().contains("blockgem"))) && s.contains("material")) + internal4.put(entry.getKey(), s); + else + lServerNames.put(entry.getKey(), s); + } catch (Exception ignored) { + } } for (Map.Entry<String, String> entry : internal2.entrySet()) { - if (entry.getKey().contains("name")) { - int i = Integer.parseInt(entry.getKey().substring("gt.metaitem.01.".length(), entry.getKey().length()-".name".length())); - i=i%1000; - if (GregTech_API.sGeneratedMaterials[i] != null) - lServerNames.put(entry.getKey(), entry.getValue().replace("material",GregTech_API.sGeneratedMaterials[i].toString())); - else - lServerNames.put(entry.getKey(), null); + try { + if (entry.getKey().contains("name")) { + int i = Integer.parseInt(entry.getKey().substring("gt.metaitem.01.".length(), entry.getKey().length() - ".name".length())); + i = i % 1000; + if (GregTech_API.sGeneratedMaterials[i] != null) + lServerNames.put(entry.getKey(), entry.getValue().replace("material", GregTech_API.sGeneratedMaterials[i].toString())); + else + lServerNames.put(entry.getKey(), null); + } + } catch (Exception ignored) { } } for (Map.Entry<String, String> entry : internal3.entrySet()) { - if (entry.getKey().contains("cable")) - lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.cable.".length(), entry.getKey().length()-".01.name".length()))); - else if (entry.getKey().contains("gt_frame_")) - lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.gt_frame_".length(), entry.getKey().length()-".name".length()))); - else if(entry.getKey().contains("gt_pipe_")) { - if( - !entry.getKey().contains("_huge") && - !entry.getKey().contains("_large") && - !entry.getKey().contains("_nonuple")&& - !entry.getKey().contains("_quadruple")&& - !entry.getKey().contains("_small")&& - !entry.getKey().contains("_tiny") + try { + if (entry.getKey().contains("cable")) + lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.cable.".length(), entry.getKey().length() - ".01.name".length()))); + else if (entry.getKey().contains("gt_frame_")) + lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.gt_frame_".length(), entry.getKey().length() - ".name".length()))); + else if (entry.getKey().contains("gt_pipe_")) { + if ( + !entry.getKey().contains("_huge") && + !entry.getKey().contains("_large") && + !entry.getKey().contains("_nonuple") && + !entry.getKey().contains("_quadruple") && + !entry.getKey().contains("_small") && + !entry.getKey().contains("_tiny") ) - lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.gt_pipe_".length(), entry.getKey().length()-".name".length()))); - else if (entry.getKey().contains("_huge")||entry.getKey().contains("_tiny")) - lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.gt_pipe_".length(), entry.getKey().length()-"_tiny.name".length()))); - else if (entry.getKey().contains("_large")||entry.getKey().contains("_small")) - lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.gt_pipe_".length(), entry.getKey().length()-"_large.name".length()))); + lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.gt_pipe_".length(), entry.getKey().length() - ".name".length()))); + else if (entry.getKey().contains("_huge") || entry.getKey().contains("_tiny")) + lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.gt_pipe_".length(), entry.getKey().length() - "_tiny.name".length()))); + else if (entry.getKey().contains("_large") || entry.getKey().contains("_small")) + lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.gt_pipe_".length(), entry.getKey().length() - "_large.name".length()))); else if (entry.getKey().contains("_nonuple")) - lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.gt_pipe_".length(), entry.getKey().length()-"_nonuple.name".length()))); + lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.gt_pipe_".length(), entry.getKey().length() - "_nonuple.name".length()))); else if (entry.getKey().contains("_quadruple")) - lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.gt_pipe_".length(), entry.getKey().length()-"_quadruple.name".length()))); + lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.gt_pipe_".length(), entry.getKey().length() - "_quadruple.name".length()))); + } else if (entry.getKey().contains("wire")) + lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.wire.".length(), entry.getKey().length() - ".01.name".length()))); + else + lServerNames.put(entry.getKey(), entry.getValue()); + } catch (Exception ignored) { } - else if (entry.getKey().contains("wire")) - lServerNames.put(entry.getKey(), entry.getValue().replace("material", entry.getKey().substring("gt.blockmachines.wire.".length(), entry.getKey().length()-".01.name".length()))); - else - lServerNames.put(entry.getKey(), entry.getValue()); } for (Map.Entry<String, String> entry : internal4.entrySet()) { - if (entry.getKey().contains("blockores")) { - int i = Integer.parseInt(entry.getKey().substring("gt.blockores.".length(), entry.getKey().length()-".name".length())); - i=i%1000; - if (GregTech_API.sGeneratedMaterials[i] != null) - lServerNames.put(entry.getKey(), entry.getValue().replace("material",GregTech_API.sGeneratedMaterials[i].toString())); - else - lServerNames.put(entry.getKey(), null); - } - else if(entry.getKey().contains("blockmetal")) { - Materials[] mMats = null; - String t = entry.getKey().substring("gt.blockmetal".length()); - t=t.substring(0,1); - int i = Integer.parseInt(t); - switch (i) { - case 1: - mMats=new Materials[]{ - Materials.Adamantium, - Materials.Aluminium, - Materials.Americium, - Materials.AnnealedCopper, - Materials.Antimony, - Materials.Arsenic, - Materials.AstralSilver, - Materials.BatteryAlloy, - Materials.Beryllium, - Materials.Bismuth, - Materials.BismuthBronze, - Materials.BlackBronze, - Materials.BlackSteel, - Materials.BlueAlloy, - Materials.BlueSteel, - Materials.Brass - }; - break; - case 2: - mMats=new Materials[]{ - Materials.Bronze, - Materials.Caesium, - Materials.Cerium, - Materials.Chrome, - Materials.ChromiumDioxide, - Materials.Cobalt, - Materials.CobaltBrass, - Materials.Copper, - Materials.Cupronickel, - Materials.DamascusSteel, - Materials.DarkIron, - Materials.DeepIron, - Materials.Desh, - Materials.Duranium, - Materials.Dysprosium, - Materials.Electrum - }; - break; - case 3: - mMats=new Materials[]{ - Materials.ElectrumFlux, - Materials.Enderium, - Materials.Erbium, - Materials.Europium, - Materials.FierySteel, - Materials.Gadolinium, - Materials.Gallium, - Materials.Holmium, - Materials.HSLA, - Materials.Indium, - Materials.InfusedGold, - Materials.Invar, - Materials.Iridium, - Materials.IronMagnetic, - Materials.IronWood, - Materials.Kanthal - }; - break; - case 4: - mMats=new Materials[]{ - Materials.Knightmetal, - Materials.Lanthanum, - Materials.Lead, - Materials.Lutetium, - Materials.Magnalium, - Materials.Magnesium, - Materials.Manganese, - Materials.MeteoricIron, - Materials.MeteoricSteel, - Materials.Trinium, - Materials.Mithril, - Materials.Molybdenum, - Materials.Naquadah, - Materials.NaquadahAlloy, - Materials.NaquadahEnriched, - Materials.Naquadria - }; - break; - case 5: - mMats=new Materials[]{ - Materials.Neodymium, - Materials.NeodymiumMagnetic, - Materials.Neutronium, - Materials.Nichrome, - Materials.Nickel, - Materials.Niobium, - Materials.NiobiumNitride, - Materials.NiobiumTitanium, - Materials.Osmiridium, - Materials.Osmium, - Materials.Palladium, - Materials.PigIron, - Materials.Platinum, - Materials.Plutonium, - Materials.Plutonium241, - Materials.Praseodymium - }; - break; - case 6: - mMats=new Materials[]{ - Materials.Promethium, - Materials.RedAlloy, - Materials.RedSteel, - Materials.RoseGold, - Materials.Rubidium, - Materials.Samarium, - Materials.Scandium, - Materials.ShadowIron, - Materials.ShadowSteel, - Materials.Silicon, - Materials.Silver, - Materials.SolderingAlloy, - Materials.StainlessSteel, - Materials.Steel, - Materials.SteelMagnetic, - Materials.SterlingSilver - }; - break; - case 7: - mMats=new Materials[]{ - Materials.Sunnarium, - Materials.Tantalum, - Materials.Tellurium, - Materials.Terbium, - Materials.Thaumium, - Materials.Thorium, - Materials.Thulium, - Materials.Tin, - Materials.TinAlloy, - Materials.Titanium, - Materials.Tritanium, - Materials.Tungsten, - Materials.TungstenSteel, - Materials.Ultimet, - Materials.Uranium, - Materials.Uranium235 - }; - break; - case 8: - mMats=new Materials[]{ - Materials.Vanadium, - Materials.VanadiumGallium, - Materials.WroughtIron, - Materials.Ytterbium, - Materials.Yttrium, - Materials.YttriumBariumCuprate, - Materials.Zinc, - Materials.TungstenCarbide, - Materials.VanadiumSteel, - Materials.HSSG, - Materials.HSSE, - Materials.HSSS, - Materials.Steeleaf, - Materials.Ichorium - }; - break; - } - t = entry.getKey().substring("gt.blockmetal1.".length(), entry.getKey().length()-".name".length()); - i = Integer.parseInt(t); - lServerNames.put(entry.getKey(),"Block of "+mMats[i].toString()); - mMats = null; - } - else if(entry.getKey().contains("blockgem")) { - Materials[] mMats = null; - String t = entry.getKey().substring("gt.blockgem".length()); - t=t.substring(0,1); - int i = Integer.parseInt(t); - switch (i) { - case 1: - mMats=new Materials[]{ - Materials.InfusedAir, - Materials.Amber, - Materials.Amethyst, - Materials.InfusedWater, - Materials.BlueTopaz, - Materials.CertusQuartz, - Materials.Dilithium, - Materials.EnderEye, - Materials.EnderPearl, - Materials.FoolsRuby, - Materials.Force, - Materials.Forcicium, - Materials.Forcillium, - Materials.GreenSapphire, - Materials.InfusedFire, - Materials.Jasper - }; - break; - case 2: - mMats=new Materials[]{ - Materials.Lazurite, - Materials.Lignite, - Materials.Monazite, - Materials.Niter, - Materials.Olivine, - Materials.Opal, - Materials.InfusedOrder, - Materials.InfusedEntropy, - Materials.Phosphorus, - Materials.Quartzite, - Materials.GarnetRed, - Materials.Ruby, - Materials.Sapphire, - Materials.Sodalite, - Materials.Tanzanite, - Materials.InfusedEarth - }; - break; - case 3: - mMats=new Materials[]{ - Materials.Topaz, - Materials.Vinteum, - Materials.GarnetYellow, - Materials.NetherStar, - Materials.Charcoal, - Materials.Blaze - }; - break; + try { + if (entry.getKey().contains("blockores")) { + int i = Integer.parseInt(entry.getKey().substring("gt.blockores.".length(), entry.getKey().length() - ".name".length())); + i = i % 1000; + if (GregTech_API.sGeneratedMaterials[i] != null) + lServerNames.put(entry.getKey(), entry.getValue().replace("material", GregTech_API.sGeneratedMaterials[i].toString())); + else + lServerNames.put(entry.getKey(), null); + } else if (entry.getKey().contains("blockmetal")) { + Materials[] mMats = null; + String t = entry.getKey().substring("gt.blockmetal".length()); + t = t.substring(0, 1); + int i = Integer.parseInt(t); + switch (i) { + case 1: + mMats = new Materials[]{ + Materials.Adamantium, + Materials.Aluminium, + Materials.Americium, + Materials.AnnealedCopper, + Materials.Antimony, + Materials.Arsenic, + Materials.AstralSilver, + Materials.BatteryAlloy, + Materials.Beryllium, + Materials.Bismuth, + Materials.BismuthBronze, + Materials.BlackBronze, + Materials.BlackSteel, + Materials.BlueAlloy, + Materials.BlueSteel, + Materials.Brass + }; + break; + case 2: + mMats = new Materials[]{ + Materials.Bronze, + Materials.Caesium, + Materials.Cerium, + Materials.Chrome, + Materials.ChromiumDioxide, + Materials.Cobalt, + Materials.CobaltBrass, + Materials.Copper, + Materials.Cupronickel, + Materials.DamascusSteel, + Materials.DarkIron, + Materials.DeepIron, + Materials.Desh, + Materials.Duranium, + Materials.Dysprosium, + Materials.Electrum + }; + break; + case 3: + mMats = new Materials[]{ + Materials.ElectrumFlux, + Materials.Enderium, + Materials.Erbium, + Materials.Europium, + Materials.FierySteel, + Materials.Gadolinium, + Materials.Gallium, + Materials.Holmium, + Materials.HSLA, + Materials.Indium, + Materials.InfusedGold, + Materials.Invar, + Materials.Iridium, + Materials.IronMagnetic, + Materials.IronWood, + Materials.Kanthal + }; + break; + case 4: + mMats = new Materials[]{ + Materials.Knightmetal, + Materials.Lanthanum, + Materials.Lead, + Materials.Lutetium, + Materials.Magnalium, + Materials.Magnesium, + Materials.Manganese, + Materials.MeteoricIron, + Materials.MeteoricSteel, + Materials.Trinium, + Materials.Mithril, + Materials.Molybdenum, + Materials.Naquadah, + Materials.NaquadahAlloy, + Materials.NaquadahEnriched, + Materials.Naquadria + }; + break; + case 5: + mMats = new Materials[]{ + Materials.Neodymium, + Materials.NeodymiumMagnetic, + Materials.Neutronium, + Materials.Nichrome, + Materials.Nickel, + Materials.Niobium, + Materials.NiobiumNitride, + Materials.NiobiumTitanium, + Materials.Osmiridium, + Materials.Osmium, + Materials.Palladium, + Materials.PigIron, + Materials.Platinum, + Materials.Plutonium, + Materials.Plutonium241, + Materials.Praseodymium + }; + break; + case 6: + mMats = new Materials[]{ + Materials.Promethium, + Materials.RedAlloy, + Materials.RedSteel, + Materials.RoseGold, + Materials.Rubidium, + Materials.Samarium, + Materials.Scandium, + Materials.ShadowIron, + Materials.ShadowSteel, + Materials.Silicon, + Materials.Silver, + Materials.SolderingAlloy, + Materials.StainlessSteel, + Materials.Steel, + Materials.SteelMagnetic, + Materials.SterlingSilver + }; + break; + case 7: + mMats = new Materials[]{ + Materials.Sunnarium, + Materials.Tantalum, + Materials.Tellurium, + Materials.Terbium, + Materials.Thaumium, + Materials.Thorium, + Materials.Thulium, + Materials.Tin, + Materials.TinAlloy, + Materials.Titanium, + Materials.Tritanium, + Materials.Tungsten, + Materials.TungstenSteel, + Materials.Ultimet, + Materials.Uranium, + Materials.Uranium235 + }; + break; + case 8: + mMats = new Materials[]{ + Materials.Vanadium, + Materials.VanadiumGallium, + Materials.WroughtIron, + Materials.Ytterbium, + Materials.Yttrium, + Materials.YttriumBariumCuprate, + Materials.Zinc, + Materials.TungstenCarbide, + Materials.VanadiumSteel, + Materials.HSSG, + Materials.HSSE, + Materials.HSSS, + Materials.Steeleaf, + Materials.Ichorium, + Materials.Firestone + }; + break; + } + t = entry.getKey().substring("gt.blockmetal1.".length(), entry.getKey().length() - ".name".length()); + i = Integer.parseInt(t); + lServerNames.put(entry.getKey(), "Block of " + mMats[i].toString()); + mMats = null; + } else if (entry.getKey().contains("blockgem")) { + Materials[] mMats = null; + String t = entry.getKey().substring("gt.blockgem".length()); + t = t.substring(0, 1); + int i = Integer.parseInt(t); + switch (i) { + case 1: + mMats = new Materials[]{ + Materials.InfusedAir, + Materials.Amber, + Materials.Amethyst, + Materials.InfusedWater, + Materials.BlueTopaz, + Materials.CertusQuartz, + Materials.Dilithium, + Materials.EnderEye, + Materials.EnderPearl, + Materials.FoolsRuby, + Materials.Force, + Materials.Forcicium, + Materials.Forcillium, + Materials.GreenSapphire, + Materials.InfusedFire, + Materials.Jasper + }; + break; + case 2: + mMats = new Materials[]{ + Materials.Lazurite, + Materials.Lignite, + Materials.Monazite, + Materials.Niter, + Materials.Olivine, + Materials.Opal, + Materials.InfusedOrder, + Materials.InfusedEntropy, + Materials.Phosphorus, + Materials.Quartzite, + Materials.GarnetRed, + Materials.Ruby, + Materials.Sapphire, + Materials.Sodalite, + Materials.Tanzanite, + Materials.InfusedEarth + }; + break; + case 3: + mMats = new Materials[]{ + Materials.Topaz, + Materials.Vinteum, + Materials.GarnetYellow, + Materials.NetherStar, + Materials.Charcoal, + Materials.Blaze + }; + break; + } + t = entry.getKey().substring("gt.blockgem1.".length(), entry.getKey().length() - ".name".length()); + i = Integer.parseInt(t); + lServerNames.put(entry.getKey(), "Block of " + mMats[i].toString()); + mMats = null; } - t = entry.getKey().substring("gt.blockgem1.".length(), entry.getKey().length()-".name".length()); - i = Integer.parseInt(t); - lServerNames.put(entry.getKey(),"Block of "+mMats[i].toString()); - mMats = null; + } catch (Exception ignored) { } } - + internal = null; internal2 = null; internal3 = null; internal4 = null; } - -} +}
\ No newline at end of file diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index 8a1519234c..e195bf9b02 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -40,6 +40,7 @@ import net.minecraftforge.oredict.ShapelessOreRecipe; import java.util.*; import java.util.Map.Entry; +import java.util.stream.Collectors; import static gregtech.api.enums.GT_Values.*; @@ -777,6 +778,7 @@ public class GT_ModHandler { if (GT_Mod.gregtechproxy.mAddGTRecipesToIC2Machines) GT_Utility.removeSimpleIC2MachineRecipe(aInput, getOreWashingRecipeList(), null); if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.orewashing, aInput, true)) return false; RA.addOreWasherRecipe(aInput, (ItemStack)aOutput[0], (ItemStack)aOutput[1], (ItemStack)aOutput[2], GT_ModHandler.getWater(1000L), 500, 16); + RA.addOreWasherRecipe(aInput, (ItemStack)aOutput[0], (ItemStack)aOutput[1], (ItemStack)aOutput[2], GT_ModHandler.getDistilledWater(200L), 300, 16); if (GT_Mod.gregtechproxy.mAddGTRecipesToIC2Machines) { NBTTagCompound tNBT = new NBTTagCompound(); tNBT.setInteger("amount", aWaterAmount); @@ -1014,7 +1016,7 @@ public class GT_ModHandler { Character chr = (Character) aRecipe[idx]; Object in = aRecipe[idx + 1]; if (in instanceof ItemStack) { - tItemStackMap.put(chr, GT_Utility.copy((ItemStack) in)); + tItemStackMap.put(chr, GT_Utility.copy(in)); tItemDataMap.put(chr, GT_OreDictUnificator.getItemData((ItemStack) in)); } else if (in instanceof ItemData) { String tString = in.toString(); @@ -1392,7 +1394,7 @@ public class GT_ModHandler { * If you have multiple Mods, which add Bronze Armor for example * This also removes old Recipes from the List. */ - public static ArrayList<ItemStack> getVanillyToolRecipeOutputs(ItemStack... aRecipe) { + public static List<ItemStack> getVanillyToolRecipeOutputs(ItemStack... aRecipe) { if (!GregTech_API.sPostloadStarted || GregTech_API.sPostloadFinished) sSingleNonBlockDamagableRecipeList.clear(); if (sSingleNonBlockDamagableRecipeList.isEmpty()) { @@ -1431,7 +1433,7 @@ public class GT_ModHandler { } GT_Log.out.println("GT_Mod: Created a List of Tool Recipes containing " + sSingleNonBlockDamagableRecipeList.size() + " Recipes for recycling." + (sSingleNonBlockDamagableRecipeList.size() > 1024 ? " Scanning all these Recipes is the reason for the startup Lag you receive right now." : E)); } - ArrayList<ItemStack> rList = getRecipeOutputs(sSingleNonBlockDamagableRecipeList, true, aRecipe); + List<ItemStack> rList = getRecipeOutputs(sSingleNonBlockDamagableRecipeList, true, aRecipe); if (!GregTech_API.sPostloadStarted || GregTech_API.sPostloadFinished) sSingleNonBlockDamagableRecipeList.clear(); return rList; @@ -1441,49 +1443,95 @@ public class GT_ModHandler { * Gives you a list of the Outputs from a Crafting Recipe * If you have multiple Mods, which add Bronze Armor for example */ - public static ArrayList<ItemStack> getRecipeOutputs(ItemStack... aRecipe) { + public static List<ItemStack> getRecipeOutputs(ItemStack... aRecipe) { return getRecipeOutputs(CraftingManager.getInstance().getRecipeList(), false, aRecipe); } + private static List<IRecipe> bufferedRecipes = null; + + /** + * Gives you a list of the Outputs from a Crafting Recipe + * If you have multiple Mods, which add Bronze Armor for example + * Buffers a List which only has armor-alike crafting in it + */ + public static List<ItemStack> getRecipeOutputsBuffered(ItemStack... aRecipe) { + + if (bufferedRecipes == null) + bufferedRecipes = (List<IRecipe>) CraftingManager.getInstance().getRecipeList().stream().filter( + tRecipe -> !(tRecipe instanceof ShapelessRecipes) && !(tRecipe instanceof ShapelessOreRecipe) && !(tRecipe instanceof IGT_CraftingRecipe) + ) + .filter(tRecipe -> + { + try { + ItemStack tOutput = ((IRecipe) tRecipe).getRecipeOutput(); + if (tOutput.stackSize == 1 && tOutput.getMaxDamage() > 0 && tOutput.getMaxStackSize() == 1) { + return true; + } + } catch (Exception ignored) { + } + return false; + }) + .collect(Collectors.toList()); + return getRecipeOutputs(bufferedRecipes, false, aRecipe); + } + /** * Gives you a list of the Outputs from a Crafting Recipe * If you have multiple Mods, which add Bronze Armor for example */ - public static ArrayList<ItemStack> getRecipeOutputs(List<IRecipe> aList, boolean aDeleteFromList, ItemStack... aRecipe) { - ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); - if (aRecipe == null) return rList; - boolean temp = false; - for (byte i = 0; i < aRecipe.length; i++) { - if (aRecipe[i] != null) { - temp = true; - break; - } - } - if (!temp) return rList; + public static List<ItemStack> getRecipeOutputs(List<IRecipe> aList, boolean aDeleteFromList, ItemStack... aRecipe) { + List<ItemStack> rList = new ArrayList<>(); + if (aRecipe == null || Arrays.stream(aRecipe).noneMatch(Objects::nonNull)) + return rList; InventoryCrafting aCrafting = new InventoryCrafting(new Container() { @Override public boolean canInteractWith(EntityPlayer var1) { return false; } }, 3, 3); - for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); - for (int i = 0; i < aList.size(); i++) { - temp = false; + for (int i = 0; i < 9 && i < aRecipe.length; i++) + aCrafting.setInventorySlotContents(i, aRecipe[i]); + if (!aDeleteFromList) { + HashSet<ItemStack> stacks = new HashSet<>(); + aList.stream().filter( + tRecipe -> { + if (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe || tRecipe instanceof IGT_CraftingRecipe) + return false; + try { + return tRecipe.matches(aCrafting, DW); + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + return false; + } + } + ).forEach(tRecipe -> stacks.add(tRecipe.getCraftingResult(aCrafting))); + rList = stacks.stream().filter(tOutput -> tOutput.stackSize == 1 && tOutput.getMaxDamage() > 0 && tOutput.getMaxStackSize() == 1).collect(Collectors.toList()); + } else for (int i = 0; i < aList.size(); i++) { + boolean temp = false; + try { temp = aList.get(i).matches(aCrafting, DW); } catch (Throwable e) { e.printStackTrace(GT_Log.err); } if (temp) { - ItemStack tOutput = aList.get(i).getCraftingResult(aCrafting); + IRecipe tRecipe = aList.get(i); + ItemStack tOutput = tRecipe.getCraftingResult(aCrafting); + if (tOutput == null || tOutput.stackSize <= 0) { // Seriously, who would ever do that shit? if (!GregTech_API.sPostloadFinished) throw new GT_ItsNotMyFaultException("Seems another Mod added a Crafting Recipe with null Output. Tell the Developer of said Mod to fix that."); - } else { - rList.add(GT_Utility.copy(tOutput)); - if (aDeleteFromList) aList.remove(i--); + continue; } + if (tOutput.stackSize != 1) continue; + if (tOutput.getMaxDamage() <= 0) continue; + if (tOutput.getMaxStackSize() != 1) continue; + if (tRecipe instanceof ShapelessRecipes) continue; + if (tRecipe instanceof ShapelessOreRecipe) continue; + if (tRecipe instanceof IGT_CraftingRecipe) continue; + rList.add(GT_Utility.copy(tOutput)); + aList.remove(i--); } } return rList; @@ -1538,7 +1586,7 @@ public class GT_ModHandler { for (Entry<IRecipeInput, RecipeOutput> tEntry : aRecipeList.entrySet()) { if (tEntry.getKey().matches(aInput)) { if (tEntry.getKey().getAmount() <= aInput.stackSize) { - ItemStack[] tList = (ItemStack[]) tEntry.getValue().items.toArray(new ItemStack[tEntry.getValue().items.size()]); + ItemStack[] tList = tEntry.getValue().items.toArray(new ItemStack[tEntry.getValue().items.size()]); if (tList.length == 0) break; ItemStack[] rList = new ItemStack[aOutputSlots.length]; rRecipeMetaData.setTag("return", tEntry.getValue().metadata); diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 5a5ba21fa4..21bac2b246 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -546,7 +546,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public static final GT_Recipe_Map sSifterRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(105), "gt.recipe.sifter", "Sifter", null, RES_PATH_GUI + "basicmachines/Sifter", 1, 9, 1, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sPressRecipes = new GT_Recipe_Map_FormingPress(new HashSet<GT_Recipe>(300), "gt.recipe.press", "Forming Press", null, RES_PATH_GUI + "basicmachines/Press", 2, 1, 2, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sLaserEngraverRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(810), "gt.recipe.laserengraver", "Precision Laser Engraver", null, RES_PATH_GUI + "basicmachines/LaserEngraver", 2, 1, 2, 0, 1, E, 1, E, true, true);
- public static final GT_Recipe_Map sMixerRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(900), "gt.recipe.mixer", "Mixer", null, RES_PATH_GUI + "basicmachines/Mixer", 6, 1, 1, 0, 1, E, 1, E, true, true);
+ public static final GT_Recipe_Map sMixerRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(900), "gt.recipe.mixer", "Mixer", null, RES_PATH_GUI + "basicmachines/Mixer2", 9, 1, 1, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sAutoclaveRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(300), "gt.recipe.autoclave", "Autoclave", null, RES_PATH_GUI + "basicmachines/Autoclave", 1, 1, 1, 1, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sElectroMagneticSeparatorRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(50), "gt.recipe.electromagneticseparator", "Electromagnetic Separator", null, RES_PATH_GUI + "basicmachines/ElectromagneticSeparator", 1, 3, 1, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sPolarizerRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(300), "gt.recipe.polarizer", "Electromagnetic Polarizer", null, RES_PATH_GUI + "basicmachines/Polarizer", 1, 1, 1, 0, 1, E, 1, E, true, true);
@@ -586,7 +586,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { public static final GT_Recipe_Map sExtruderRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(13000), "gt.recipe.extruder", "Extruder", null, RES_PATH_GUI + "basicmachines/Extruder", 2, 1, 2, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sHammerRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(3800), "gt.recipe.hammer", "Forge Hammer", null, RES_PATH_GUI + "basicmachines/Hammer", 1, 1, 1, 0, 1, E, 1, E, true, true);
public static final GT_Recipe_Map sAmplifiers = new GT_Recipe_Map(new HashSet<GT_Recipe>(2), "gt.recipe.uuamplifier", "Amplifabricator", null, RES_PATH_GUI + "basicmachines/Amplifabricator", 1, 0, 1, 0, 1, E, 1, E, true, true);
- public static final GT_Recipe_Map sMassFabFakeRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(2), "gt.recipe.massfab", "Mass Fabrication", null, RES_PATH_GUI + "basicmachines/Massfabricator", 1, 0, 1, 0, 1, E, 1, E, true, true);
+ public static final GT_Recipe_Map sMassFabFakeRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(2), "gt.recipe.massfab", "Mass Fabrication", null, RES_PATH_GUI + "basicmachines/Massfabricator", 1, 0, 1, 0, 10, E, 1, E, true, true);
public static final GT_Recipe_Map_Fuel sDieselFuels = new GT_Recipe_Map_Fuel(new HashSet<GT_Recipe>(20), "gt.recipe.dieselgeneratorfuel", "Diesel Generator Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true);
public static final GT_Recipe_Map_Fuel sTurbineFuels = new GT_Recipe_Map_Fuel(new HashSet<GT_Recipe>(25), "gt.recipe.gasturbinefuel", "Gas Turbine Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true);
public static final GT_Recipe_Map_Fuel sHotFuels = new GT_Recipe_Map_Fuel(new HashSet<GT_Recipe>(10), "gt.recipe.thermalgeneratorfuel", "Thermal Generator Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, false);
@@ -814,7 +814,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { if (aInputs == null) return null;
int tAmount = 0;
for (ItemStack aInput : aInputs) if (aInput != null) tAmount++;
- if (tAmount < mMinimalInputItems) return null;
+ if (tAmount < mMinimalInputItems) return null;
}
}
@@ -1592,9 +1592,12 @@ public class GT_Recipe implements Comparable<GT_Recipe> { if (aInputs == null) {
aInputs = new ItemStack[0];
+ } else {
+ aInputs = GT_Utility.getArrayListWithoutTrailingNulls(aInputs).toArray(new ItemStack[0]);
}
+
for (ItemStack input : aInputs) {
- FluidStack inputFluidContent = FluidContainerRegistry.getFluidForFilledItem(input);
+ FluidStack inputFluidContent = FluidContainerRegistry.getFluidForFilledItem(input);
if (inputFluidContent != null) {
inputFluidContent.amount *= input.stackSize;
if (inputFluidContent.getFluid().getName().equals("ic2steam")) {
@@ -1628,8 +1631,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { }
aInputs = adjustedInputs.toArray(new ItemStack[adjustedInputs.size()]);
aFluidInputs = adjustedFluidInputs.toArray(new FluidStack[adjustedFluidInputs.size()]);
+
if (aOutputs == null) {
aOutputs = new ItemStack[0];
+ } else {
+ aOutputs = GT_Utility.getArrayListWithoutTrailingNulls(aOutputs).toArray(new ItemStack[0]);
}
for (ItemStack output : aOutputs) {
@@ -1677,34 +1683,36 @@ public class GT_Recipe implements Comparable<GT_Recipe> { ArrayList<PositionedStack> inputStacks = new ArrayList<PositionedStack>(inputlimit);
for (int i = 0; i < itemLimit; i++, j++) {
- if (GT_Values.allow_broken_recipemap) {
- if (this != null && this.mInputs != null && this.mInputs[i] != null)
- inputStacks.add(new FixedPositionedStack(this.mInputs[i].copy(), 48 - j % 3 * 18, (j >= 3 ? 5 : 23)));
- else {
- if (this.mOutputs != null && this.mOutputs.length > 0 && this.mOutputs[0] != null)
- GT_Log.out.println("recipe " + this.toString() + " Output 0:" + this.mOutputs[0].getDisplayName() + " has errored!");
- else
- GT_Log.out.println("recipe " + this.toString() + " has errored!");
- inputStacks.add(new FixedPositionedStack(new ItemStack(Items.command_block_minecart), 48 - j % 3 * 18, (j >= 3 ? 5 : 23)));
- }
- }else
+ if( this.mInputs == null || (this.mInputs[i] == null && (i == 0 && itemLimit == 1)) ) {
+ if (this.mOutputs != null && this.mOutputs.length > 0 && this.mOutputs[0] != null)
+ GT_Log.out.println("recipe " + this.toString() + " Output 0:" + this.mOutputs[0].getDisplayName() + " has errored!");
+ else
+ GT_Log.out.println("recipe " + this.toString() + " has errored!");
+
+ new Exception("Recipe Fixme").printStackTrace(GT_Log.out);
+ }
+
+
+ if ((this.mInputs != null && this.mInputs[i] != null) || !GT_Values.allow_broken_recipemap)
inputStacks.add(new FixedPositionedStack(this.mInputs[i].copy(), 48 - j % 3 * 18, (j >= 3 ? 5 : 23)));
+ else
+ inputStacks.add(new FixedPositionedStack(new ItemStack(Items.command_block_minecart), 48 - j % 3 * 18, (j >= 3 ? 5 : 23)));
}
for (int i = 0; i < fluidLimit; i++, j++) {
- if (GT_Values.allow_broken_recipemap) {
- if (this != null && this.mFluidInputs != null && this.mFluidInputs[i] != null)
- inputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(this.mFluidInputs[i], true), 48 - j % 3 * 18, (j >= 3 ? 5 : 23)));
- else {
- if (this.mOutputs != null && this.mOutputs.length > 0 && this.mOutputs[0] != null)
- GT_Log.out.println("recipe " + this.toString() + " Output 0:" + this.mOutputs[0].getDisplayName() + " has errored!");
- else
- GT_Log.out.println("recipe " + this.toString() + " has errored!");
- }
- }else
+ if (this.mFluidInputs == null || this.mFluidInputs[i] == null) {
+ if (this.mOutputs != null && this.mOutputs.length > 0 && this.mOutputs[0] != null)
+ GT_Log.out.println("recipe " + this.toString() + " Output 0:" + this.mOutputs[0].getDisplayName() + " has errored!");
+ else
+ GT_Log.out.println("recipe " + this.toString() + " has errored!");
+
+ new Exception("Recipe Fixme").printStackTrace(GT_Log.out);
+ }
+
+ if ((this.mFluidInputs != null && this.mFluidInputs[i] != null) || !GT_Values.allow_broken_recipemap)
inputStacks.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(this.mFluidInputs[i], true), 48 - j % 3 * 18, (j >= 3 ? 5 : 23)));
}
-
+
return inputStacks;
}
diff --git a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java index 0358dfec4b..d10f6da434 100644 --- a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java +++ b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java @@ -16,7 +16,8 @@ import java.util.Arrays; import java.util.List; import static gregtech.api.enums.GT_Values.*; - +import static gregtech.api.enums.Materials.Void; +import static gregtech.api.enums.Materials.*; /** * Class for Automatic Recipe registering. */ @@ -275,39 +276,77 @@ public class GT_RecipeRegistrator { } /** - * You give this Function a Material and it will scan almost everything for adding recycling Recipes + * Place Materials which you want to replace in Non-GT-Recipes here (warning HUGHE impact on loading times!) + */ + private final static Materials[] VANILLA_MATS = { + Cobalt, + Gold, + Iron, + Lead, + FierySteel, + Void, + Bronze, + Diamond, + Ruby, + Sapphire, + Steel, + IronWood, + Steeleaf, + Knightmetal, + Thaumium, + DarkSteel, + }; + + /** + * You give this Function a Material and it will scan almost everything for adding recycling Recipes and replacing Ingots, Gems etc. * - * @param aMat a Material, for example an Ingot or a Gem. - * @param aOutput the Dust you usually get from macerating aMat + * @param aMats Materials, for example an Ingot or a Gem. + * @param aPlate the Plate referenced to aMat * @param aRecipeReplacing allows to replace the Recipe with a Plate variant */ - public static synchronized void registerUsagesForMaterials(ItemStack aMat, String aPlate, boolean aRecipeReplacing) { - if (aMat == null) return; - aMat = GT_Utility.copy(aMat); - ItemStack tStack; - ItemData aItemData = GT_OreDictUnificator.getItemData(aMat); - if (aItemData == null || aItemData.mPrefix != OrePrefixes.ingot) aPlate = null; - if (aPlate != null && GT_OreDictUnificator.getFirstOre(aPlate, 1) == null) aPlate = null; - - sMt1.func_150996_a(aMat.getItem()); - sMt1.stackSize = 1; - Items.feather.setDamage(sMt1, Items.feather.getDamage(aMat)); - - sMt2.func_150996_a(new ItemStack(Blocks.dirt).getItem()); - sMt2.stackSize = 1; - Items.feather.setDamage(sMt2, 0); - - for (ItemStack[] tRecipe : sShapes1) { - int tAmount1 = 0; - for (ItemStack tMat : tRecipe) { - if (tMat == sMt1) tAmount1++; - } - if (aItemData != null && aItemData.hasValidPrefixMaterialData()) - for (ItemStack tCrafted : GT_ModHandler.getRecipeOutputs(tRecipe)) { - GT_OreDictUnificator.addItemData(tCrafted, new ItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tAmount1)); + public static synchronized void registerUsagesForMaterials(String aPlate, boolean aRecipeReplacing, ItemStack... aMats) { + for (ItemStack aMat : aMats) { + if (aMat == null) + continue; + + aMat = GT_Utility.copy(aMat); + + if (aMat == null) + continue; + + ItemData aItemData = GT_OreDictUnificator.getItemData(aMat); + if (aItemData == null || aItemData.mPrefix != OrePrefixes.ingot) aPlate = null; + if (aPlate != null && GT_OreDictUnificator.getFirstOre(aPlate, 1) == null) aPlate = null; + + sMt1.func_150996_a(aMat.getItem()); + sMt1.stackSize = 1; + Items.feather.setDamage(sMt1, Items.feather.getDamage(aMat)); + + sMt2.func_150996_a(new ItemStack(Blocks.dirt).getItem()); + sMt2.stackSize = 1; + Items.feather.setDamage(sMt2, 0); + + for (ItemStack[] tRecipe : sShapes1) { + int tAmount1 = 0; + for (ItemStack tMat : tRecipe) { + if (tMat == sMt1) tAmount1++; } + if (aItemData != null && aItemData.hasValidPrefixMaterialData()) + for (ItemStack tCrafted : GT_ModHandler.getRecipeOutputsBuffered(tRecipe)) { + GT_OreDictUnificator.addItemData(tCrafted, new ItemData(aItemData.mMaterial.mMaterial, aItemData.mMaterial.mAmount * tAmount1)); +// GT_Log.out.println("###################################################################################"); +// GT_Log.out.println("registerUsagesForMaterials used aPlate: "+aPlate); +// GT_Log.out.println("registerUsagesForMaterials used aPlate: "+aMat.getUnlocalizedName()); +// GT_Log.out.println("registerUsagesForMaterials used aPlate: "+aMat.getDisplayName()); +// GT_Log.out.println("###################################################################################"); + } + } + registerStickStuff(aPlate, aItemData, aRecipeReplacing); } + } + private static synchronized void registerStickStuff(String aPlate, ItemData aItemData, boolean aRecipeReplacing) { + ItemStack tStack; for (Materials tMaterial : sRodMaterialList) { ItemStack tMt2 = GT_OreDictUnificator.get(OrePrefixes.stick, tMaterial, 1); if (tMt2 != null) { @@ -331,6 +370,9 @@ public class GT_RecipeRegistrator { assert aItemData != null; if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.recipereplacements, aItemData.mMaterial.mMaterial + "." + sShapesA[i][0], true)) { if (null != (tStack = GT_ModHandler.removeRecipe(tRecipe))) { +// GT_Log.out.println("###################################################################################"); +// GT_Log.out.println("registerStickStuff used aPlate: "+aPlate); +// GT_Log.out.println("###################################################################################"); switch (sShapesA[i].length) { case 2: GT_ModHandler.addCraftingRecipe(tStack, GT_ModHandler.RecipeBits.BUFFERED, new Object[]{sShapesA[i][1], s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData}); @@ -350,4 +392,9 @@ public class GT_RecipeRegistrator { } } } + + public static boolean hasVanillaRecipes(Materials materials) { + return Arrays.stream(VANILLA_MATS).anyMatch(mat -> mat == materials); + } + } diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index c5d0b29106..9e0589c2cb 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -1,2340 +1,2364 @@ -package gregtech.api.util; - -import cofh.api.transport.IItemDuct; -import com.mojang.authlib.GameProfile; -import cpw.mods.fml.common.FMLCommonHandler; -import gregtech.api.GregTech_API; -import gregtech.api.damagesources.GT_DamageSources; -import gregtech.api.enchants.Enchantment_Radioactivity; -import gregtech.api.enums.*; -import gregtech.api.events.BlockScanningEvent; -import gregtech.api.interfaces.IDebugableBlock; -import gregtech.api.interfaces.IProjectileItem; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.*; -import gregtech.api.items.GT_EnergyArmor_Item; -import gregtech.api.items.GT_Generic_Item; -import gregtech.api.net.GT_Packet_Sound; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.ItemData; -import gregtech.api.threads.GT_Runnable_Sound; -import gregtech.common.GT_Proxy; -import ic2.api.recipe.IRecipeInput; -import ic2.api.recipe.RecipeInputItemStack; -import ic2.api.recipe.RecipeInputOreDict; -import ic2.api.recipe.RecipeOutput; -import net.minecraft.block.Block; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.*; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTBase.NBTPrimitive; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagString; -import net.minecraft.network.play.server.S07PacketRespawn; -import net.minecraft.network.play.server.S1DPacketEntityEffect; -import net.minecraft.network.play.server.S1FPacketSetExperience; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraft.world.WorldServer; -import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.BlockSnapshot; -import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.common.util.FakePlayerFactory; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.event.ForgeEventFactory; -import net.minecraftforge.event.world.BlockEvent; -import net.minecraftforge.fluids.*; -import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.text.NumberFormat; -import java.util.*; -import java.util.Map.Entry; - -import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.enums.GT_Values.*; -import static gregtech.common.GT_Proxy.GTPOLLUTION; -import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; - -/** - * NEVER INCLUDE THIS FILE IN YOUR MOD!!! - * <p/> - * Just a few Utility Functions I use. - */ -public class GT_Utility { - /** - * Forge screwed the Fluid Registry up again, so I make my own, which is also much more efficient than the stupid Stuff over there. - */ - private static final List<FluidContainerData> sFluidContainerList = new ArrayList<FluidContainerData>(); - private static final Map<GT_ItemStack, FluidContainerData> sFilledContainerToData = new /*Concurrent*/HashMap<GT_ItemStack, FluidContainerData>(); - private static final Map<GT_ItemStack, Map<Fluid, FluidContainerData>> sEmptyContainerToFluidToData = new /*Concurrent*/HashMap<GT_ItemStack, Map<Fluid, FluidContainerData>>(); - public static volatile int VERSION = 509; - public static boolean TE_CHECK = false, BC_CHECK = false, CHECK_ALL = true, RF_CHECK = false; - public static Map<GT_PlayedSound, Integer> sPlayedSoundMap = new /*Concurrent*/HashMap<GT_PlayedSound, Integer>(); - private static int sBookCount = 0; - - static { - GregTech_API.sItemStackMappings.add(sFilledContainerToData); - GregTech_API.sItemStackMappings.add(sEmptyContainerToFluidToData); - } - - public static int safeInt(long number, int margin){ - return number>Integer.MAX_VALUE-margin ? Integer.MAX_VALUE-margin :(int)number; - } - - public static int safeInt(long number){ - return number>GT_Values.V[GT_Values.V.length-1] ? safeInt(GT_Values.V[GT_Values.V.length-1],1) : number<Integer.MIN_VALUE ? Integer.MIN_VALUE : (int)number; - } - - public static Field getPublicField(Object aObject, String aField) { - Field rField = null; - try { - rField = aObject.getClass().getDeclaredField(aField); - } catch (Throwable e) {/*Do nothing*/} - return rField; - } - - public static Field getField(Object aObject, String aField) { - Field rField = null; - try { - rField = aObject.getClass().getDeclaredField(aField); - rField.setAccessible(true); - } catch (Throwable e) {/*Do nothing*/} - return rField; - } - - public static Field getField(Class aObject, String aField) { - Field rField = null; - try { - rField = aObject.getDeclaredField(aField); - rField.setAccessible(true); - } catch (Throwable e) {/*Do nothing*/} - return rField; - } - - public static Method getMethod(Class aObject, String aMethod, Class<?>... aParameterTypes) { - Method rMethod = null; - try { - rMethod = aObject.getMethod(aMethod, aParameterTypes); - rMethod.setAccessible(true); - } catch (Throwable e) {/*Do nothing*/} - return rMethod; - } - - public static Method getMethod(Object aObject, String aMethod, Class<?>... aParameterTypes) { - Method rMethod = null; - try { - rMethod = aObject.getClass().getMethod(aMethod, aParameterTypes); - rMethod.setAccessible(true); - } catch (Throwable e) {/*Do nothing*/} - return rMethod; - } - - public static Field getField(Object aObject, String aField, boolean aPrivate, boolean aLogErrors) { - try { - Field tField = (aObject instanceof Class) ? ((Class) aObject).getDeclaredField(aField) : (aObject instanceof String) ? Class.forName((String) aObject).getDeclaredField(aField) : aObject.getClass().getDeclaredField(aField); - if (aPrivate) tField.setAccessible(true); - return tField; - } catch (Throwable e) { - if (aLogErrors) e.printStackTrace(GT_Log.err); - } - return null; - } - - public static Object getFieldContent(Object aObject, String aField, boolean aPrivate, boolean aLogErrors) { - try { - Field tField = (aObject instanceof Class) ? ((Class) aObject).getDeclaredField(aField) : (aObject instanceof String) ? Class.forName((String) aObject).getDeclaredField(aField) : aObject.getClass().getDeclaredField(aField); - if (aPrivate) tField.setAccessible(true); - return tField.get(aObject instanceof Class || aObject instanceof String ? null : aObject); - } catch (Throwable e) { - if (aLogErrors) e.printStackTrace(GT_Log.err); - } - return null; - } - - public static Object callPublicMethod(Object aObject, String aMethod, Object... aParameters) { - return callMethod(aObject, aMethod, false, false, true, aParameters); - } - - public static Object callPrivateMethod(Object aObject, String aMethod, Object... aParameters) { - return callMethod(aObject, aMethod, true, false, true, aParameters); - } - - public static Object callMethod(Object aObject, String aMethod, boolean aPrivate, boolean aUseUpperCasedDataTypes, boolean aLogErrors, Object... aParameters) { - try { - Class<?>[] tParameterTypes = new Class<?>[aParameters.length]; - for (byte i = 0; i < aParameters.length; i++) { - if (aParameters[i] instanceof Class) { - tParameterTypes[i] = (Class) aParameters[i]; - aParameters[i] = null; - } else { - tParameterTypes[i] = aParameters[i].getClass(); - } - if (!aUseUpperCasedDataTypes) { - if (tParameterTypes[i] == Boolean.class) tParameterTypes[i] = boolean.class; - else if (tParameterTypes[i] == Byte.class) tParameterTypes[i] = byte.class; - else if (tParameterTypes[i] == Short.class) tParameterTypes[i] = short.class; - else if (tParameterTypes[i] == Integer.class) tParameterTypes[i] = int.class; - else if (tParameterTypes[i] == Long.class) tParameterTypes[i] = long.class; - else if (tParameterTypes[i] == Float.class) tParameterTypes[i] = float.class; - else if (tParameterTypes[i] == Double.class) tParameterTypes[i] = double.class; - } - } - - Method tMethod = (aObject instanceof Class) ? ((Class) aObject).getMethod(aMethod, tParameterTypes) : aObject.getClass().getMethod(aMethod, tParameterTypes); - if (aPrivate) tMethod.setAccessible(true); - return tMethod.invoke(aObject, aParameters); - } catch (Throwable e) { - if (aLogErrors) e.printStackTrace(GT_Log.err); - } - return null; - } - - public static Object callConstructor(String aClass, int aConstructorIndex, Object aReplacementObject, boolean aLogErrors, Object... aParameters) { - if (aConstructorIndex < 0) { - try { - for (Constructor tConstructor : Class.forName(aClass).getConstructors()) { - try { - return tConstructor.newInstance(aParameters); - } catch (Throwable e) {/*Do nothing*/} - } - } catch (Throwable e) { - if (aLogErrors) e.printStackTrace(GT_Log.err); - } - } else { - try { - return Class.forName(aClass).getConstructors()[aConstructorIndex].newInstance(aParameters); - } catch (Throwable e) { - if (aLogErrors) e.printStackTrace(GT_Log.err); - } - } - return aReplacementObject; - } - - public static String capitalizeString(String aString) { - if (aString != null && aString.length() > 0) - return aString.substring(0, 1).toUpperCase() + aString.substring(1); - return E; - } - - public static boolean getPotion(EntityLivingBase aPlayer, int aPotionIndex) { - try { - Field tPotionHashmap = null; - - Field[] var3 = EntityLiving.class.getDeclaredFields(); - int var4 = var3.length; - - for (int var5 = 0; var5 < var4; ++var5) { - Field var6 = var3[var5]; - if (var6.getType() == HashMap.class) { - tPotionHashmap = var6; - tPotionHashmap.setAccessible(true); - break; - } - } - - if (tPotionHashmap != null) - return ((HashMap) tPotionHashmap.get(aPlayer)).get(Integer.valueOf(aPotionIndex)) != null; - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - return false; - } - - public static String getClassName(Object aObject) { - if (aObject == null) return "null"; - return aObject.getClass().getName().substring(aObject.getClass().getName().lastIndexOf(".") + 1); - } - - public static void removePotion(EntityLivingBase aPlayer, int aPotionIndex) { - try { - Field tPotionHashmap = null; - - Field[] var3 = EntityLiving.class.getDeclaredFields(); - int var4 = var3.length; - - for (int var5 = 0; var5 < var4; ++var5) { - Field var6 = var3[var5]; - if (var6.getType() == HashMap.class) { - tPotionHashmap = var6; - tPotionHashmap.setAccessible(true); - break; - } - } - - if (tPotionHashmap != null) ((HashMap) tPotionHashmap.get(aPlayer)).remove(Integer.valueOf(aPotionIndex)); - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - } - - public static boolean getFullInvisibility(EntityPlayer aPlayer) { - try { - if (aPlayer.isInvisible()) { - for (int i = 0; i < 4; i++) { - if (aPlayer.inventory.armorInventory[i] != null) { - if (aPlayer.inventory.armorInventory[i].getItem() instanceof GT_EnergyArmor_Item) { - if ((((GT_EnergyArmor_Item) aPlayer.inventory.armorInventory[i].getItem()).mSpecials & 512) != 0) { - if (GT_ModHandler.canUseElectricItem(aPlayer.inventory.armorInventory[i], 10000)) { - return true; - } - } - } - } - } - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - return false; - } - - public static ItemStack suckOneItemStackAt(World aWorld, double aX, double aY, double aZ, double aL, double aH, double aW) { - for (EntityItem tItem : (ArrayList<EntityItem>) aWorld.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + aL, aY + aH, aZ + aW))) { - if (!tItem.isDead) { - aWorld.removeEntity(tItem); - tItem.setDead(); - return tItem.getEntityItem(); - } - } - return null; - } - - public static byte getOppositeSide(int aSide) { - return (byte) ForgeDirection.getOrientation(aSide).getOpposite().ordinal(); - } - - public static byte getTier(long l) { - byte i = -1; - while (++i < V.length) if (l <= V[i]) return i; - return i; - } - - public static void sendChatToPlayer(EntityPlayer aPlayer, String aChatMessage) { - if (aPlayer instanceof EntityPlayerMP && aChatMessage != null) { - aPlayer.addChatComponentMessage(new ChatComponentText(aChatMessage)); - } - } - - public static void checkAvailabilities() { - if (CHECK_ALL) { - try { - Class tClass = IItemDuct.class; - tClass.getCanonicalName(); - TE_CHECK = true; - } catch (Throwable e) {/**/} - try { - Class tClass = buildcraft.api.transport.IPipeTile.class; - tClass.getCanonicalName(); - BC_CHECK = true; - } catch (Throwable e) {/**/} - try { - Class tClass = cofh.api.energy.IEnergyReceiver.class; - tClass.getCanonicalName(); - RF_CHECK = true; - } catch (Throwable e) {/**/} - CHECK_ALL = false; - } - } - - public static boolean isConnectableNonInventoryPipe(Object aTileEntity, int aSide) { - if (aTileEntity == null) return false; - checkAvailabilities(); - if (TE_CHECK && aTileEntity instanceof IItemDuct) return true; - if (BC_CHECK && aTileEntity instanceof buildcraft.api.transport.IPipeTile) - return ((buildcraft.api.transport.IPipeTile) aTileEntity).isPipeConnected(ForgeDirection.getOrientation(aSide)); - if (GregTech_API.mTranslocator && aTileEntity instanceof codechicken.translocator.TileItemTranslocator) return true; - - return false; - } - /** - * Moves Stack from Inv-Slot to Inv-Slot, without checking if its even allowed. - * - * @return the Amount of moved Items - */ - public static byte moveStackIntoPipe(IInventory aTileEntity1, Object aTileEntity2, int[] aGrabSlots, int aGrabFrom, int aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) { - return moveStackIntoPipe(aTileEntity1, aTileEntity2, aGrabSlots, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, true); - } - - /** - * Moves Stack from Inv-Slot to Inv-Slot, without checking if its even allowed. - * - * @return the Amount of moved Items - */ - public static byte moveStackIntoPipe(IInventory aTileEntity1, Object aTileEntity2, int[] aGrabSlots, int aGrabFrom, int aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce, boolean dropItem) { - if (aTileEntity1 == null || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMaxMoveAtOnce <= 0 || aMinMoveAtOnce > aMaxMoveAtOnce) - return 0; - if (aTileEntity2 != null) { - checkAvailabilities(); - if (TE_CHECK && aTileEntity2 instanceof IItemDuct) { - for (int i = 0; i < aGrabSlots.length; i++) { - if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(aGrabSlots[i]), true, aInvertFilter)) { - if (isAllowedToTakeFromSlot(aTileEntity1, aGrabSlots[i], (byte) aGrabFrom, aTileEntity1.getStackInSlot(aGrabSlots[i]))) { - if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) <= aTileEntity1.getStackInSlot(aGrabSlots[i]).stackSize) { - ItemStack tStack = copyAmount(Math.min(aTileEntity1.getStackInSlot(aGrabSlots[i]).stackSize, Math.min(aMaxMoveAtOnce, aMaxTargetStackSize)), aTileEntity1.getStackInSlot(aGrabSlots[i])); - ItemStack rStack = ((IItemDuct) aTileEntity2).insertItem(ForgeDirection.getOrientation(aPutTo), copy(tStack)); - byte tMovedItemCount = (byte) (tStack.stackSize - (rStack == null ? 0 : rStack.stackSize)); - if (tMovedItemCount >= 1/*Math.max(aMinMoveAtOnce, aMinTargetStackSize)*/) { - //((cofh.api.transport.IItemConduit)aTileEntity2).insertItem(ForgeDirection.getOrientation(aPutTo), copyAmount(tMovedItemCount, tStack), F); - aTileEntity1.decrStackSize(aGrabSlots[i], tMovedItemCount); - aTileEntity1.markDirty(); - return tMovedItemCount; - } - } - } - } - } - return 0; - } - if (BC_CHECK && aTileEntity2 instanceof buildcraft.api.transport.IPipeTile) { - for (int i = 0; i < aGrabSlots.length; i++) { - if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(aGrabSlots[i]), true, aInvertFilter)) { - if (isAllowedToTakeFromSlot(aTileEntity1, aGrabSlots[i], (byte) aGrabFrom, aTileEntity1.getStackInSlot(aGrabSlots[i]))) { - if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) <= aTileEntity1.getStackInSlot(aGrabSlots[i]).stackSize) { - ItemStack tStack = copyAmount(Math.min(aTileEntity1.getStackInSlot(aGrabSlots[i]).stackSize, Math.min(aMaxMoveAtOnce, aMaxTargetStackSize)), aTileEntity1.getStackInSlot(aGrabSlots[i])); - byte tMovedItemCount = (byte) ((buildcraft.api.transport.IPipeTile) aTileEntity2).injectItem(copy(tStack), false, ForgeDirection.getOrientation(aPutTo)); - if (tMovedItemCount >= Math.max(aMinMoveAtOnce, aMinTargetStackSize)) { - tMovedItemCount = (byte) (((buildcraft.api.transport.IPipeTile) aTileEntity2).injectItem(copyAmount(tMovedItemCount, tStack), true, ForgeDirection.getOrientation(aPutTo))); - aTileEntity1.decrStackSize(aGrabSlots[i], tMovedItemCount); - aTileEntity1.markDirty(); - return tMovedItemCount; - } - } - } - } - } - return 0; - } - } - - ForgeDirection tDirection = ForgeDirection.getOrientation(aGrabFrom); - if (aTileEntity1 instanceof TileEntity && tDirection != ForgeDirection.UNKNOWN && tDirection.getOpposite() == ForgeDirection.getOrientation(aPutTo)) { - int tX = ((TileEntity) aTileEntity1).xCoord + tDirection.offsetX, tY = ((TileEntity) aTileEntity1).yCoord + tDirection.offsetY, tZ = ((TileEntity) aTileEntity1).zCoord + tDirection.offsetZ; - if (!hasBlockHitBox(((TileEntity) aTileEntity1).getWorldObj(), tX, tY, tZ) && dropItem) { - for (int i = 0; i < aGrabSlots.length; i++) { - if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(aGrabSlots[i]), true, aInvertFilter)) { - if (isAllowedToTakeFromSlot(aTileEntity1, aGrabSlots[i], (byte) aGrabFrom, aTileEntity1.getStackInSlot(aGrabSlots[i]))) { - if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) <= aTileEntity1.getStackInSlot(aGrabSlots[i]).stackSize) { - ItemStack tStack = copyAmount(Math.min(aTileEntity1.getStackInSlot(aGrabSlots[i]).stackSize, Math.min(aMaxMoveAtOnce, aMaxTargetStackSize)), aTileEntity1.getStackInSlot(aGrabSlots[i])); - EntityItem tEntity = new EntityItem(((TileEntity) aTileEntity1).getWorldObj(), tX + 0.5, tY + 0.5, tZ + 0.5, tStack); - tEntity.motionX = tEntity.motionY = tEntity.motionZ = 0; - ((TileEntity) aTileEntity1).getWorldObj().spawnEntityInWorld(tEntity); - aTileEntity1.decrStackSize(aGrabSlots[i], tStack.stackSize); - aTileEntity1.markDirty(); - return (byte) tStack.stackSize; - } - } - } - } - } - } - return 0; - } - - /** - * Moves Stack from Inv-Slot to Inv-Slot, without checking if its even allowed. (useful for internal Inventory Operations) - * - * @return the Amount of moved Items - */ - public static byte moveStackFromSlotAToSlotB(IInventory aTileEntity1, IInventory aTileEntity2, int aGrabFrom, int aPutTo, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) { - if (aTileEntity1 == null || aTileEntity2 == null || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMaxMoveAtOnce <= 0 || aMinMoveAtOnce > aMaxMoveAtOnce) - return 0; - - ItemStack tStack1 = aTileEntity1.getStackInSlot(aGrabFrom), tStack2 = aTileEntity2.getStackInSlot(aPutTo), tStack3 = null; - if (tStack1 != null) { - if (tStack2 != null && !areStacksEqual(tStack1, tStack2)) return 0; - tStack3 = copy(tStack1); - aMaxTargetStackSize = (byte) Math.min(aMaxTargetStackSize, Math.min(tStack3.getMaxStackSize(), Math.min(tStack2 == null ? Integer.MAX_VALUE : tStack2.getMaxStackSize(), aTileEntity2.getInventoryStackLimit()))); - tStack3.stackSize = Math.min(tStack3.stackSize, aMaxTargetStackSize - (tStack2 == null ? 0 : tStack2.stackSize)); - if (tStack3.stackSize > aMaxMoveAtOnce) tStack3.stackSize = aMaxMoveAtOnce; - if (tStack3.stackSize + (tStack2 == null ? 0 : tStack2.stackSize) >= Math.min(tStack3.getMaxStackSize(), aMinTargetStackSize) && tStack3.stackSize >= aMinMoveAtOnce) { - tStack3 = aTileEntity1.decrStackSize(aGrabFrom, tStack3.stackSize); - aTileEntity1.markDirty(); - if (tStack3 != null) { - if (tStack2 == null) { - aTileEntity2.setInventorySlotContents(aPutTo, copy(tStack3)); - aTileEntity2.markDirty(); - } else { - tStack2.stackSize += tStack3.stackSize; - aTileEntity2.markDirty(); - } - return (byte) tStack3.stackSize; - } - } - } - return 0; - } - - public static boolean isAllowedToTakeFromSlot(IInventory aTileEntity, int aSlot, byte aSide, ItemStack aStack) { - if (ForgeDirection.getOrientation(aSide) == ForgeDirection.UNKNOWN) { - return isAllowedToTakeFromSlot(aTileEntity, aSlot, (byte) 0, aStack) - || isAllowedToTakeFromSlot(aTileEntity, aSlot, (byte) 1, aStack) - || isAllowedToTakeFromSlot(aTileEntity, aSlot, (byte) 2, aStack) - || isAllowedToTakeFromSlot(aTileEntity, aSlot, (byte) 3, aStack) - || isAllowedToTakeFromSlot(aTileEntity, aSlot, (byte) 4, aStack) - || isAllowedToTakeFromSlot(aTileEntity, aSlot, (byte) 5, aStack); - } - if (aTileEntity instanceof ISidedInventory) - return ((ISidedInventory) aTileEntity).canExtractItem(aSlot, aStack, aSide); - return true; - } - - public static boolean isAllowedToPutIntoSlot(IInventory aTileEntity, int aSlot, byte aSide, ItemStack aStack, byte aMaxStackSize) { - ItemStack tStack = aTileEntity.getStackInSlot(aSlot); - if (tStack != null && (!areStacksEqual(tStack, aStack) || tStack.stackSize >= tStack.getMaxStackSize())) - return false; - if (ForgeDirection.getOrientation(aSide) == ForgeDirection.UNKNOWN) { - return isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 0, aStack, aMaxStackSize) - || isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 1, aStack, aMaxStackSize) - || isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 2, aStack, aMaxStackSize) - || isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 3, aStack, aMaxStackSize) - || isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 4, aStack, aMaxStackSize) - || isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 5, aStack, aMaxStackSize); - } - if (aTileEntity instanceof ISidedInventory && !((ISidedInventory) aTileEntity).canInsertItem(aSlot, aStack, aSide)) - return false; - return aSlot < aTileEntity.getSizeInventory() && aTileEntity.isItemValidForSlot(aSlot, aStack); - } - - /** - * Moves Stack from Inv-Side to Inv-Side. - * - * @return the Amount of moved Items - */ - public static byte moveOneItemStack(Object aTileEntity1, Object aTileEntity2, byte aGrabFrom, byte aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) { - if (aTileEntity1 instanceof IInventory) - return moveOneItemStack((IInventory) aTileEntity1, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, true); - return 0; - } - - /** - * This is only because I needed an additional Parameter for the Double Chest Check. - */ - private static byte moveOneItemStack(IInventory aTileEntity1, Object aTileEntity2, byte aGrabFrom, byte aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce, boolean aDoCheckChests) { - if (aTileEntity1 == null || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMaxMoveAtOnce <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMinMoveAtOnce > aMaxMoveAtOnce) - return 0; - - int[] tGrabSlots = null; - if (aTileEntity1 instanceof ISidedInventory) - tGrabSlots = ((ISidedInventory) aTileEntity1).getAccessibleSlotsFromSide(aGrabFrom); - if (tGrabSlots == null) { - tGrabSlots = new int[aTileEntity1.getSizeInventory()]; - for (int i = 0; i < tGrabSlots.length; i++) tGrabSlots[i] = i; - } - - if (aTileEntity2 != null && aTileEntity2 instanceof IInventory) { - int[] tPutSlots = null; - if (aTileEntity2 instanceof ISidedInventory) - tPutSlots = ((ISidedInventory) aTileEntity2).getAccessibleSlotsFromSide(aPutTo); - - if (tPutSlots == null) { - tPutSlots = new int[((IInventory) aTileEntity2).getSizeInventory()]; - for (int i = 0; i < tPutSlots.length; i++) tPutSlots[i] = i; - } - - for (int i = 0; i < tGrabSlots.length; i++) { - byte tMovedItemCount = 0; - for (int j = 0; j < tPutSlots.length; j++) { - if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(tGrabSlots[i]), true, aInvertFilter)) { - if (isAllowedToTakeFromSlot(aTileEntity1, tGrabSlots[i], aGrabFrom, aTileEntity1.getStackInSlot(tGrabSlots[i]))) { - if (isAllowedToPutIntoSlot((IInventory) aTileEntity2, tPutSlots[j], aPutTo, aTileEntity1.getStackInSlot(tGrabSlots[i]), aMaxTargetStackSize)) { - tMovedItemCount += moveStackFromSlotAToSlotB(aTileEntity1, (IInventory) aTileEntity2, tGrabSlots[i], tPutSlots[j], aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItemCount), aMinMoveAtOnce); - if (tMovedItemCount >= aMaxMoveAtOnce) { - return tMovedItemCount; - - } - } - } - } - } - if (tMovedItemCount > 0) return tMovedItemCount; - } - - if (aDoCheckChests && aTileEntity1 instanceof TileEntityChest) { - TileEntityChest tTileEntity1 = (TileEntityChest) aTileEntity1; - if (tTileEntity1.adjacentChestChecked) { - byte tAmount = 0; - if (tTileEntity1.adjacentChestXNeg != null) { - tAmount = moveOneItemStack(tTileEntity1.adjacentChestXNeg, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); - } else if (tTileEntity1.adjacentChestZNeg != null) { - tAmount = moveOneItemStack(tTileEntity1.adjacentChestZNeg, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); - } else if (tTileEntity1.adjacentChestXPos != null) { - tAmount = moveOneItemStack(tTileEntity1.adjacentChestXPos, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); - } else if (tTileEntity1.adjacentChestZPos != null) { - tAmount = moveOneItemStack(tTileEntity1.adjacentChestZPos, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); - } - if (tAmount != 0) return tAmount; - } - } - if (aDoCheckChests && aTileEntity2 instanceof TileEntityChest) { - TileEntityChest tTileEntity2 = (TileEntityChest) aTileEntity2; - if (tTileEntity2.adjacentChestChecked) { - byte tAmount = 0; - if (tTileEntity2.adjacentChestXNeg != null) { - tAmount = moveOneItemStack(aTileEntity1, tTileEntity2.adjacentChestXNeg, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); - } else if (tTileEntity2.adjacentChestZNeg != null) { - tAmount = moveOneItemStack(aTileEntity1, tTileEntity2.adjacentChestZNeg, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); - } else if (tTileEntity2.adjacentChestXPos != null) { - tAmount = moveOneItemStack(aTileEntity1, tTileEntity2.adjacentChestXPos, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); - } else if (tTileEntity2.adjacentChestZPos != null) { - tAmount = moveOneItemStack(aTileEntity1, tTileEntity2.adjacentChestZPos, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false); - } - if (tAmount != 0) return tAmount; - } - } - } - - return moveStackIntoPipe(aTileEntity1, aTileEntity2, tGrabSlots, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aDoCheckChests); - } - - /** - * Moves Stack from Inv-Side to Inv-Slot. - * - * @return the Amount of moved Items - */ - public static byte moveOneItemStackIntoSlot(Object aTileEntity1, Object aTileEntity2, byte aGrabFrom, int aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) { - if (aTileEntity1 == null || !(aTileEntity1 instanceof IInventory) || aPutTo < 0 || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMaxMoveAtOnce <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMinMoveAtOnce > aMaxMoveAtOnce) - return 0; - - int[] tGrabSlots = null; - if (aTileEntity1 instanceof ISidedInventory) - tGrabSlots = ((ISidedInventory) aTileEntity1).getAccessibleSlotsFromSide(aGrabFrom); - if (tGrabSlots == null) { - tGrabSlots = new int[((IInventory) aTileEntity1).getSizeInventory()]; - for (int i = 0; i < tGrabSlots.length; i++) tGrabSlots[i] = i; - } - - if (aTileEntity2 instanceof IInventory) { - for (int i = 0; i < tGrabSlots.length; i++) { - if (listContainsItem(aFilter, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlots[i]), true, aInvertFilter)) { - if (isAllowedToTakeFromSlot((IInventory) aTileEntity1, tGrabSlots[i], aGrabFrom, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlots[i]))) { - if (isAllowedToPutIntoSlot((IInventory) aTileEntity2, aPutTo, (byte) 6, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlots[i]), aMaxTargetStackSize)) { - byte tMovedItemCount = moveStackFromSlotAToSlotB((IInventory) aTileEntity1, (IInventory) aTileEntity2, tGrabSlots[i], aPutTo, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce); - if (tMovedItemCount > 0) return tMovedItemCount; - } - } - } - } - } - - moveStackIntoPipe(((IInventory) aTileEntity1), aTileEntity2, tGrabSlots, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce); - return 0; - } - - /** - * Moves Stack from Inv-Slot to Inv-Slot. - * - * @return the Amount of moved Items - */ - public static byte moveFromSlotToSlot(IInventory aTileEntity1, IInventory aTileEntity2, int aGrabFrom, int aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) { - if (aTileEntity1 == null || aTileEntity2 == null || aGrabFrom < 0 || aPutTo < 0 || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMaxMoveAtOnce <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMinMoveAtOnce > aMaxMoveAtOnce) - return 0; - if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(aGrabFrom), true, aInvertFilter)) { - if (isAllowedToTakeFromSlot(aTileEntity1, aGrabFrom, (byte) 6, aTileEntity1.getStackInSlot(aGrabFrom))) { - if (isAllowedToPutIntoSlot(aTileEntity2, aPutTo, (byte) 6, aTileEntity1.getStackInSlot(aGrabFrom), aMaxTargetStackSize)) { - byte tMovedItemCount = moveStackFromSlotAToSlotB(aTileEntity1, aTileEntity2, aGrabFrom, aPutTo, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce); - if (tMovedItemCount > 0) return tMovedItemCount; - } - } - } - return 0; - } - - public static boolean listContainsItem(Collection<ItemStack> aList, ItemStack aStack, boolean aTIfListEmpty, boolean aInvertFilter) { - if (aStack == null || aStack.stackSize < 1) return false; - if (aList == null) return aTIfListEmpty; - while (aList.contains(null)) aList.remove(null); - if (aList.size() < 1) return aTIfListEmpty; - Iterator<ItemStack> tIterator = aList.iterator(); - ItemStack tStack = null; - while (tIterator.hasNext()) - if ((tStack = tIterator.next()) != null && areStacksEqual(aStack, tStack)) return !aInvertFilter; - return aInvertFilter; - } - - public static boolean areStacksOrToolsEqual(ItemStack aStack1, ItemStack aStack2) { - if (aStack1 != null && aStack2 != null && aStack1.getItem() == aStack2.getItem()) { - if (aStack1.getItem().isDamageable()) return true; - return ((aStack1.getTagCompound() == null) == (aStack2.getTagCompound() == null)) && (aStack1.getTagCompound() == null || aStack1.getTagCompound().equals(aStack2.getTagCompound())) && (Items.feather.getDamage(aStack1) == Items.feather.getDamage(aStack2) || Items.feather.getDamage(aStack1) == W || Items.feather.getDamage(aStack2) == W); - } - return false; - } - - public static boolean areFluidsEqual(FluidStack aFluid1, FluidStack aFluid2) { - return areFluidsEqual(aFluid1, aFluid2, false); - } - - public static boolean areFluidsEqual(FluidStack aFluid1, FluidStack aFluid2, boolean aIgnoreNBT) { - return aFluid1 != null && aFluid2 != null && aFluid1.getFluid() == aFluid2.getFluid() && (aIgnoreNBT || ((aFluid1.tag == null) == (aFluid2.tag == null)) && (aFluid1.tag == null || aFluid1.tag.equals(aFluid2.tag))); - } - - public static boolean areStacksEqual(ItemStack aStack1, ItemStack aStack2) { - return areStacksEqual(aStack1, aStack2, false); - } - - public static boolean areStacksEqual(ItemStack aStack1, ItemStack aStack2, boolean aIgnoreNBT) { - return aStack1 != null && aStack2 != null && aStack1.getItem() == aStack2.getItem() && (aIgnoreNBT || ((aStack1.getTagCompound() == null) == (aStack2.getTagCompound() == null)) && (aStack1.getTagCompound() == null || aStack1.getTagCompound().equals(aStack2.getTagCompound()))) && (Items.feather.getDamage(aStack1) == Items.feather.getDamage(aStack2) || Items.feather.getDamage(aStack1) == W || Items.feather.getDamage(aStack2) == W); - } - - public static boolean areUnificationsEqual(ItemStack aStack1, ItemStack aStack2) { - return areUnificationsEqual(aStack1, aStack2, false); - } - - public static boolean areUnificationsEqual(ItemStack aStack1, ItemStack aStack2, boolean aIgnoreNBT) { - return areStacksEqual(GT_OreDictUnificator.get(aStack1), GT_OreDictUnificator.get(aStack2), aIgnoreNBT); - } - - public static String getFluidName(Fluid aFluid, boolean aLocalized) { - if (aFluid == null) return E; - String rName = aLocalized ? aFluid.getLocalizedName(new FluidStack(aFluid, 0)) : aFluid.getUnlocalizedName(); - if (rName.contains("fluid.") || rName.contains("tile.")) - return capitalizeString(rName.replaceAll("fluid.", E).replaceAll("tile.", E)); - return rName; - } - - public static String getFluidName(FluidStack aFluid, boolean aLocalized) { - if (aFluid == null) return E; - return getFluidName(aFluid.getFluid(), aLocalized); - } - - public static void reInit() { - sFilledContainerToData.clear(); - sEmptyContainerToFluidToData.clear(); - for (FluidContainerData tData : sFluidContainerList) { - sFilledContainerToData.put(new GT_ItemStack(tData.filledContainer), tData); - Map<Fluid, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData.get(new GT_ItemStack(tData.emptyContainer)); - if (tFluidToContainer == null) { - sEmptyContainerToFluidToData.put(new GT_ItemStack(tData.emptyContainer), tFluidToContainer = new /*Concurrent*/HashMap<Fluid, FluidContainerData>()); - GregTech_API.sFluidMappings.add(tFluidToContainer); - } - tFluidToContainer.put(tData.fluid.getFluid(), tData); - } - } - - public static void addFluidContainerData(FluidContainerData aData) { - sFluidContainerList.add(aData); - sFilledContainerToData.put(new GT_ItemStack(aData.filledContainer), aData); - Map<Fluid, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData.get(new GT_ItemStack(aData.emptyContainer)); - if (tFluidToContainer == null) { - sEmptyContainerToFluidToData.put(new GT_ItemStack(aData.emptyContainer), tFluidToContainer = new /*Concurrent*/HashMap<Fluid, FluidContainerData>()); - GregTech_API.sFluidMappings.add(tFluidToContainer); - } - tFluidToContainer.put(aData.fluid.getFluid(), aData); - } - - public static ItemStack fillFluidContainer(FluidStack aFluid, ItemStack aStack, boolean aRemoveFluidDirectly, boolean aCheckIFluidContainerItems) { - if (isStackInvalid(aStack) || aFluid == null) return null; - if (GT_ModHandler.isWater(aFluid) && ItemList.Bottle_Empty.isStackEqual(aStack)) { - if (aFluid.amount >= 250) { - if (aRemoveFluidDirectly) aFluid.amount -= 250; - return new ItemStack(Items.potionitem, 1, 0); - } - return null; - } - if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getFluid(aStack) == null && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) <= aFluid.amount) { - if (aRemoveFluidDirectly) - aFluid.amount -= ((IFluidContainerItem) aStack.getItem()).fill(aStack = copyAmount(1, aStack), aFluid, true); - else - ((IFluidContainerItem) aStack.getItem()).fill(aStack = copyAmount(1, aStack), aFluid, true); - return aStack; - } - Map<Fluid, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData.get(new GT_ItemStack(aStack)); - if (tFluidToContainer == null) return null; - FluidContainerData tData = tFluidToContainer.get(aFluid.getFluid()); - if (tData == null || tData.fluid.amount > aFluid.amount) return null; - if (aRemoveFluidDirectly) aFluid.amount -= tData.fluid.amount; - return copyAmount(1, tData.filledContainer); - } - - public static ItemStack getFluidDisplayStack(Fluid aFluid) { - return aFluid == null ? null : getFluidDisplayStack(new FluidStack(aFluid, 0), false); - } - - public static ItemStack getFluidDisplayStack(FluidStack aFluid, boolean aUseStackSize) { - if (aFluid == null || aFluid.getFluid() == null) return null; - int tmp = 0; - try { - tmp = aFluid.getFluid().getID(); - } catch (Exception e) { - System.err.println(e); - } - ItemStack rStack = ItemList.Display_Fluid.getWithDamage(aUseStackSize ? aFluid.amount / 1000 : 1, tmp); - NBTTagCompound tNBT = new NBTTagCompound(); - tNBT.setLong("mFluidDisplayAmount", aFluid.amount); - tNBT.setLong("mFluidDisplayHeat", aFluid.getFluid().getTemperature(aFluid)); - tNBT.setBoolean("mFluidState", aFluid.getFluid().isGaseous(aFluid)); - rStack.setTagCompound(tNBT); - return rStack; - } - - public static boolean containsFluid(ItemStack aStack, FluidStack aFluid, boolean aCheckIFluidContainerItems) { - if (isStackInvalid(aStack) || aFluid == null) return false; - if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) - return aFluid.isFluidEqual(((IFluidContainerItem) aStack.getItem()).getFluid(aStack = copyAmount(1, aStack))); - FluidContainerData tData = sFilledContainerToData.get(new GT_ItemStack(aStack)); - return tData == null ? false : tData.fluid.isFluidEqual(aFluid); - } - - public static FluidStack getFluidForFilledItem(ItemStack aStack, boolean aCheckIFluidContainerItems) { - if (isStackInvalid(aStack)) return null; - if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) - return ((IFluidContainerItem) aStack.getItem()).drain(copyAmount(1, aStack), Integer.MAX_VALUE, true); - FluidContainerData tData = sFilledContainerToData.get(new GT_ItemStack(aStack)); - return tData == null ? null : tData.fluid.copy(); - } - - public static ItemStack getContainerForFilledItem(ItemStack aStack, boolean aCheckIFluidContainerItems) { - if (isStackInvalid(aStack)) return null; - FluidContainerData tData = sFilledContainerToData.get(new GT_ItemStack(aStack)); - if (tData != null) return copyAmount(1, tData.emptyContainer); - if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) { - ((IFluidContainerItem) aStack.getItem()).drain(aStack = copyAmount(1, aStack), Integer.MAX_VALUE, true); - return aStack; - } - return null; - } - - public static ItemStack getContainerItem(ItemStack aStack, boolean aCheckIFluidContainerItems) { - if (isStackInvalid(aStack)) return null; - if (aStack.getItem().hasContainerItem(aStack)) return aStack.getItem().getContainerItem(aStack); - /** These are all special Cases, in which it is intended to have only GT Blocks outputting those Container Items */ - if (ItemList.Cell_Empty.isStackEqual(aStack, false, true)) return null; - if (ItemList.IC2_Fuel_Can_Filled.isStackEqual(aStack, false, true)) return ItemList.IC2_Fuel_Can_Empty.get(1); - if (aStack.getItem() == Items.potionitem || aStack.getItem() == Items.experience_bottle || ItemList.TF_Vial_FieryBlood.isStackEqual(aStack) || ItemList.TF_Vial_FieryTears.isStackEqual(aStack)) - return ItemList.Bottle_Empty.get(1); - - if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) { - ItemStack tStack = copyAmount(1, aStack); - ((IFluidContainerItem) aStack.getItem()).drain(tStack, Integer.MAX_VALUE, true); - if (!areStacksEqual(aStack, tStack)) return tStack; - return null; - } - - int tCapsuleCount = GT_ModHandler.getCapsuleCellContainerCount(aStack); - if (tCapsuleCount > 0) return ItemList.Cell_Empty.get(tCapsuleCount); - - if (ItemList.IC2_ForgeHammer.isStackEqual(aStack) || ItemList.IC2_WireCutter.isStackEqual(aStack)) - return copyMetaData(Items.feather.getDamage(aStack) + 1, aStack); - return null; - } - - public static synchronized boolean removeIC2BottleRecipe(ItemStack aContainer, ItemStack aInput, Map<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> aRecipeList, ItemStack aOutput){ - if ((isStackInvalid(aInput) && isStackInvalid(aOutput) && isStackInvalid(aContainer)) || aRecipeList == null) return false; - boolean rReturn = false; - Iterator<Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput>> tIterator = aRecipeList.entrySet().iterator(); - aOutput = GT_OreDictUnificator.get(aOutput); - while (tIterator.hasNext()) { - Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> tEntry = tIterator.next(); - if (aInput == null || tEntry.getKey().matches(aContainer, aInput)) { - List<ItemStack> tList = tEntry.getValue().items; - if (tList != null) for (ItemStack tOutput : tList) - if (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput)) { - tIterator.remove(); - rReturn = true; - break; - } - } - } - return rReturn; - } - - public static synchronized boolean removeSimpleIC2MachineRecipe(ItemStack aInput, Map<IRecipeInput, RecipeOutput> aRecipeList, ItemStack aOutput) { - if ((isStackInvalid(aInput) && isStackInvalid(aOutput)) || aRecipeList == null) return false; - boolean rReturn = false; - Iterator<Map.Entry<IRecipeInput, RecipeOutput>> tIterator = aRecipeList.entrySet().iterator(); - aOutput = GT_OreDictUnificator.get(aOutput); - while (tIterator.hasNext()) { - Map.Entry<IRecipeInput, RecipeOutput> tEntry = tIterator.next(); - if (aInput == null || tEntry.getKey().matches(aInput)) { - List<ItemStack> tList = tEntry.getValue().items; - if (tList != null) for (ItemStack tOutput : tList) - if (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput)) { - tIterator.remove(); - rReturn = true; - break; - } - } - } - return rReturn; - } - - public static boolean addSimpleIC2MachineRecipe(ItemStack aInput, Map<IRecipeInput, RecipeOutput> aRecipeList, NBTTagCompound aNBT, Object... aOutput) { - if (isStackInvalid(aInput) || aOutput.length == 0 || aRecipeList == null) return false; - ItemData tOreName = GT_OreDictUnificator.getAssociation(aInput); - for (int i = 0; i < aOutput.length; i++) { - if (aOutput[i] == null) { - GT_FML_LOGGER.info("EmptyIC2Output!" + aInput.getUnlocalizedName()); - return false; - } - } - ItemStack[] tStack = GT_OreDictUnificator.getStackArray(true, aOutput); - if(tStack==null||(tStack.length>0&>_Utility.areStacksEqual(aInput, tStack[0])))return false; - if (tOreName != null) { - if(tOreName.toString().equals("dustAsh")&&tStack[0].getUnlocalizedName().equals("tile.volcanicAsh"))return false; - aRecipeList.put(new RecipeInputOreDict(tOreName.toString(), aInput.stackSize), new RecipeOutput(aNBT, tStack)); - } else { - aRecipeList.put(new RecipeInputItemStack(copy(aInput), aInput.stackSize), new RecipeOutput(aNBT, tStack)); - } - return true; - } - - public static ItemStack getWrittenBook(String aMapping, ItemStack aStackToPutNBT) { - if (isStringInvalid(aMapping)) return null; - ItemStack rStack = GregTech_API.sBookList.get(aMapping); - if (rStack == null) return aStackToPutNBT; - if (aStackToPutNBT != null) { - aStackToPutNBT.setTagCompound(rStack.getTagCompound()); - return aStackToPutNBT; - } - return copyAmount(1, rStack); - } - - public static ItemStack getWrittenBook(String aMapping, String aTitle, String aAuthor, String... aPages) { - if (isStringInvalid(aMapping)) return null; - ItemStack rStack = GregTech_API.sBookList.get(aMapping); - if (rStack != null) return copyAmount(1, rStack); - if (isStringInvalid(aTitle) || isStringInvalid(aAuthor) || aPages.length <= 0) return null; - sBookCount++; - rStack = new ItemStack(Items.written_book, 1); - NBTTagCompound tNBT = new NBTTagCompound(); - tNBT.setString("title", GT_LanguageManager.addStringLocalization("Book." + aTitle + ".Name", aTitle)); - tNBT.setString("author", aAuthor); - NBTTagList tNBTList = new NBTTagList(); - for (byte i = 0; i < aPages.length; i++) { - aPages[i] = GT_LanguageManager.addStringLocalization("Book." + aTitle + ".Page" + ((i < 10) ? "0" + i : i), aPages[i]); - if (i < 48) { - if (aPages[i].length() < 256) - tNBTList.appendTag(new NBTTagString(aPages[i])); - else - GT_Log.err.println("WARNING: String for written Book too long! -> " + aPages[i]); - } else { - GT_Log.err.println("WARNING: Too much Pages for written Book! -> " + aTitle); - break; - } - } - tNBTList.appendTag(new NBTTagString("Credits to " + aAuthor + " for writing this Book. This was Book Nr. " + sBookCount + " at its creation. Gotta get 'em all!")); - tNBT.setTag("pages", tNBTList); - rStack.setTagCompound(tNBT); - GT_Log.out.println("GT_Mod: Added Book to Book List - Mapping: '" + aMapping + "' - Name: '" + aTitle + "' - Author: '" + aAuthor + "'"); - GregTech_API.sBookList.put(aMapping, rStack); - return copy(rStack); - } - - public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength) { - return doSoundAtClient(aSoundName, aTimeUntilNextSound, aSoundStrength, GT.getThePlayer()); - } - - public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength, Entity aEntity) { - if (aEntity == null) return false; - return doSoundAtClient(aSoundName, aTimeUntilNextSound, aSoundStrength, aEntity.posX, aEntity.posY, aEntity.posZ); - } - - public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength, double aX, double aY, double aZ) { - return doSoundAtClient(aSoundName, aTimeUntilNextSound, aSoundStrength, 1.01818028F, aX, aY, aZ); - } - - public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength, float aSoundModulation, double aX, double aY, double aZ) { - if (isStringInvalid(aSoundName) || !FMLCommonHandler.instance().getEffectiveSide().isClient() || GT.getThePlayer() == null || !GT.getThePlayer().worldObj.isRemote) - return false; - if (GregTech_API.sMultiThreadedSounds) - new Thread(new GT_Runnable_Sound(GT.getThePlayer().worldObj, MathHelper.floor_double(aX), MathHelper.floor_double(aY), MathHelper.floor_double(aZ), aTimeUntilNextSound, aSoundName, aSoundStrength, aSoundModulation), "Sound Effect").start(); - else - new GT_Runnable_Sound(GT.getThePlayer().worldObj, MathHelper.floor_double(aX), MathHelper.floor_double(aY), MathHelper.floor_double(aZ), aTimeUntilNextSound, aSoundName, aSoundStrength, aSoundModulation).run(); - return true; - } - - public static boolean sendSoundToPlayers(World aWorld, String aSoundName, float aSoundStrength, float aSoundModulation, int aX, int aY, int aZ) { - if (isStringInvalid(aSoundName) || aWorld == null || aWorld.isRemote) return false; - NW.sendPacketToAllPlayersInRange(aWorld, new GT_Packet_Sound(aSoundName, aSoundStrength, aSoundModulation, aX, (short) aY, aZ), aX, aZ); - return true; - } - - public static int stackToInt(ItemStack aStack) { - if (isStackInvalid(aStack)) return 0; - return Item.getIdFromItem(aStack.getItem()) | (Items.feather.getDamage(aStack) << 16); - } - - public static int stackToWildcard(ItemStack aStack) { - if (isStackInvalid(aStack)) return 0; - return Item.getIdFromItem(aStack.getItem()) | (W << 16); - } - - public static ItemStack intToStack(int aStack) { - int tID = aStack & (~0 >>> 16), tMeta = aStack >>> 16; - Item tItem = Item.getItemById(tID); - if (tItem != null) return new ItemStack(tItem, 1, tMeta); - return null; - } - - public static Integer[] stacksToIntegerArray(ItemStack... aStacks) { - Integer[] rArray = new Integer[aStacks.length]; - for (int i = 0; i < rArray.length; i++) { - rArray[i] = stackToInt(aStacks[i]); - } - return rArray; - } - - public static int[] stacksToIntArray(ItemStack... aStacks) { - int[] rArray = new int[aStacks.length]; - for (int i = 0; i < rArray.length; i++) { - rArray[i] = stackToInt(aStacks[i]); - } - return rArray; - } - - public static boolean arrayContains(Object aObject, Object... aObjects) { - return listContains(aObject, Arrays.asList(aObjects)); - } - - public static boolean listContains(Object aObject, Collection aObjects) { - if (aObjects == null) return false; - return aObjects.contains(aObject); - } - - public static <T> boolean arrayContainsNonNull(T... aArray) { - if (aArray != null) for (Object tObject : aArray) if (tObject != null) return true; - return false; - } - - public static <T> ArrayList<T> getArrayListWithoutNulls(T... aArray) { - if (aArray == null) return new ArrayList<T>(); - ArrayList<T> rList = new ArrayList<T>(Arrays.asList(aArray)); - for (int i = 0; i < rList.size(); i++) if (rList.get(i) == null) rList.remove(i--); - return rList; - } - - public static <T> ArrayList<T> getArrayListWithoutTrailingNulls(T... aArray) { - if (aArray == null) return new ArrayList<T>(); - ArrayList<T> rList = new ArrayList<T>(Arrays.asList(aArray)); - for (int i = rList.size() - 1; i >= 0 && rList.get(i) == null; ) rList.remove(i--); - return rList; - } - - public static Block getBlock(Object aBlock) { - return (Block) aBlock; - } - - public static Block getBlockFromStack(ItemStack itemStack) { - if (isStackInvalid(itemStack)) return Blocks.air; - return getBlockFromItem(itemStack.getItem()); - } - - public static Block getBlockFromItem(Item item) { - return Block.getBlockFromItem(item); - } - - public static boolean isBlockValid(Object aBlock) { - return (aBlock instanceof Block); - } - - public static boolean isBlockInvalid(Object aBlock) { - return aBlock == null || !(aBlock instanceof Block); - } - - public static boolean isStringValid(Object aString) { - return aString != null && !aString.toString().isEmpty(); - } - - public static boolean isStringInvalid(Object aString) { - return aString == null || aString.toString().isEmpty(); - } - - public static boolean isStackValid(Object aStack) { - return (aStack instanceof ItemStack) && ((ItemStack) aStack).getItem() != null && ((ItemStack) aStack).stackSize >= 0; - } - - public static boolean isStackInvalid(Object aStack) { - return aStack == null || !(aStack instanceof ItemStack) || ((ItemStack) aStack).getItem() == null || ((ItemStack) aStack).stackSize < 0; - } - - public static boolean isDebugItem(ItemStack aStack) { - return /*ItemList.Armor_Cheat.isStackEqual(aStack, T, T) || */areStacksEqual(GT_ModHandler.getIC2Item("debug", 1), aStack, true); - } - - public static ItemStack updateItemStack(ItemStack aStack) { - if (isStackValid(aStack) && aStack.getItem() instanceof GT_Generic_Item) - ((GT_Generic_Item) aStack.getItem()).isItemStackUsable(aStack); - return aStack; - } - - public static boolean isOpaqueBlock(World aWorld, int aX, int aY, int aZ) { - return aWorld.getBlock(aX, aY, aZ).isOpaqueCube(); - } - - public static boolean isBlockAir(World aWorld, int aX, int aY, int aZ) { - return aWorld.getBlock(aX, aY, aZ).isAir(aWorld, aX, aY, aZ); - } - - public static boolean hasBlockHitBox(World aWorld, int aX, int aY, int aZ) { - return aWorld.getBlock(aX, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) != null; - } - - public static void setCoordsOnFire(World aWorld, int aX, int aY, int aZ, boolean aReplaceCenter) { - if (aReplaceCenter) - if (aWorld.getBlock(aX, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) == null) - aWorld.setBlock(aX, aY, aZ, Blocks.fire); - if (aWorld.getBlock(aX + 1, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX + 1, aY, aZ) == null) - aWorld.setBlock(aX + 1, aY, aZ, Blocks.fire); - if (aWorld.getBlock(aX - 1, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX - 1, aY, aZ) == null) - aWorld.setBlock(aX - 1, aY, aZ, Blocks.fire); - if (aWorld.getBlock(aX, aY + 1, aZ).getCollisionBoundingBoxFromPool(aWorld, aX, aY + 1, aZ) == null) - aWorld.setBlock(aX, aY + 1, aZ, Blocks.fire); - if (aWorld.getBlock(aX, aY - 1, aZ).getCollisionBoundingBoxFromPool(aWorld, aX, aY - 1, aZ) == null) - aWorld.setBlock(aX, aY - 1, aZ, Blocks.fire); - if (aWorld.getBlock(aX, aY, aZ + 1).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ + 1) == null) - aWorld.setBlock(aX, aY, aZ + 1, Blocks.fire); - if (aWorld.getBlock(aX, aY, aZ - 1).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ - 1) == null) - aWorld.setBlock(aX, aY, aZ - 1, Blocks.fire); - } - - public static ItemStack getProjectile(SubTag aProjectileType, IInventory aInventory) { - if (aInventory != null) for (int i = 0, j = aInventory.getSizeInventory(); i < j; i++) { - ItemStack rStack = aInventory.getStackInSlot(i); - if (isStackValid(rStack) && rStack.getItem() instanceof IProjectileItem && ((IProjectileItem) rStack.getItem()).hasProjectile(aProjectileType, rStack)) - return updateItemStack(rStack); - } - return null; - } - - public static void removeNullStacksFromInventory(IInventory aInventory) { - if (aInventory != null) for (int i = 0, j = aInventory.getSizeInventory(); i < j; i++) { - ItemStack tStack = aInventory.getStackInSlot(i); - if (tStack != null && (tStack.stackSize == 0 || tStack.getItem() == null)) - aInventory.setInventorySlotContents(i, null); - } - } - - /** - * Initializes a new texture page. - */ - public static boolean addTexturePage(byte page){ - if(Textures.BlockIcons.casingTexturePages[page]==null){ - Textures.BlockIcons.casingTexturePages[page]=new ITexture[128]; - return true; - } - return false; - } - - /** - * Converts a Number to a String - */ - public static String parseNumberToString(int aNumber) { - boolean temp = true, negative = false; - - if (aNumber < 0) { - aNumber *= -1; - negative = true; - } - - StringBuilder tStringB = new StringBuilder(); - for (int i = 1000000000; i > 0; i /= 10) { - int tDigit = (aNumber / i) % 10; - if (temp && tDigit != 0) temp = false; - if (!temp) { - tStringB.append(tDigit); - if (i != 1) for (int j = i; j > 0; j /= 1000) if (j == 1) tStringB.append(","); - } - } - - String tString = tStringB.toString(); - - if (tString.equals(E)) tString = "0"; - - return negative ? "-" + tString : tString; - } - - public static NBTTagCompound getNBTContainingBoolean(NBTTagCompound aNBT, Object aTag, boolean aValue) { - if (aNBT == null) aNBT = new NBTTagCompound(); - aNBT.setBoolean(aTag.toString(), aValue); - return aNBT; - } - - public static NBTTagCompound getNBTContainingByte(NBTTagCompound aNBT, Object aTag, byte aValue) { - if (aNBT == null) aNBT = new NBTTagCompound(); - aNBT.setByte(aTag.toString(), aValue); - return aNBT; - } - - public static NBTTagCompound getNBTContainingShort(NBTTagCompound aNBT, Object aTag, short aValue) { - if (aNBT == null) aNBT = new NBTTagCompound(); - aNBT.setShort(aTag.toString(), aValue); - return aNBT; - } - - public static NBTTagCompound getNBTContainingInteger(NBTTagCompound aNBT, Object aTag, int aValue) { - if (aNBT == null) aNBT = new NBTTagCompound(); - aNBT.setInteger(aTag.toString(), aValue); - return aNBT; - } - - public static NBTTagCompound getNBTContainingFloat(NBTTagCompound aNBT, Object aTag, float aValue) { - if (aNBT == null) aNBT = new NBTTagCompound(); - aNBT.setFloat(aTag.toString(), aValue); - return aNBT; - } - - public static NBTTagCompound getNBTContainingDouble(NBTTagCompound aNBT, Object aTag, double aValue) { - if (aNBT == null) aNBT = new NBTTagCompound(); - aNBT.setDouble(aTag.toString(), aValue); - return aNBT; - } - - public static NBTTagCompound getNBTContainingString(NBTTagCompound aNBT, Object aTag, Object aValue) { - if (aNBT == null) aNBT = new NBTTagCompound(); - if (aValue == null) return aNBT; - aNBT.setString(aTag.toString(), aValue.toString()); - return aNBT; - } - - public static boolean isWearingFullFrostHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!isStackInList(aEntity.getEquipmentInSlot(i), GregTech_API.sFrostHazmatList)) return false; - return true; - } - - public static boolean isWearingFullHeatHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!isStackInList(aEntity.getEquipmentInSlot(i), GregTech_API.sHeatHazmatList)) return false; - return true; - } - - public static boolean isWearingFullBioHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!isStackInList(aEntity.getEquipmentInSlot(i), GregTech_API.sBioHazmatList)) return false; - return true; - } - - public static boolean isWearingFullRadioHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!isStackInList(aEntity.getEquipmentInSlot(i), GregTech_API.sRadioHazmatList)) return false; - return true; - } - - public static boolean isWearingFullElectroHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!isStackInList(aEntity.getEquipmentInSlot(i), GregTech_API.sElectroHazmatList)) return false; - return true; - } - - public static boolean isWearingFullGasHazmat(EntityLivingBase aEntity) { - for (byte i = 1; i < 5; i++) - if (!isStackInList(aEntity.getEquipmentInSlot(i), GregTech_API.sGasHazmatList)) return false; - return true; - } - - public static float getHeatDamageFromItem(ItemStack aStack) { - ItemData tData = GT_OreDictUnificator.getItemData(aStack); - return tData == null ? 0 : (tData.mPrefix == null ? 0 : tData.mPrefix.mHeatDamage) + (tData.hasValidMaterialData() ? tData.mMaterial.mMaterial.mHeatDamage : 0); - } - - public static int getRadioactivityLevel(ItemStack aStack) { - ItemData tData = GT_OreDictUnificator.getItemData(aStack); - if (tData != null && tData.hasValidMaterialData()) { - if (tData.mMaterial.mMaterial.mEnchantmentArmors instanceof Enchantment_Radioactivity) - return tData.mMaterial.mMaterial.mEnchantmentArmorsLevel; - if (tData.mMaterial.mMaterial.mEnchantmentTools instanceof Enchantment_Radioactivity) - return tData.mMaterial.mMaterial.mEnchantmentToolsLevel; - } - return EnchantmentHelper.getEnchantmentLevel(Enchantment_Radioactivity.INSTANCE.effectId, aStack); - } - - public static boolean isImmuneToBreathingGasses(EntityLivingBase aEntity) { - return isWearingFullGasHazmat(aEntity); - } - - public static boolean applyHeatDamage(EntityLivingBase aEntity, float aDamage) { - if (aDamage > 0 && aEntity != null && aEntity.getActivePotionEffect(Potion.fireResistance) == null && !isWearingFullHeatHazmat(aEntity)) { - aEntity.attackEntityFrom(GT_DamageSources.getHeatDamage(), aDamage); - return true; - } - return false; - } - - public static boolean applyFrostDamage(EntityLivingBase aEntity, float aDamage) { - if (aDamage > 0 && aEntity != null && !isWearingFullFrostHazmat(aEntity)) { - aEntity.attackEntityFrom(GT_DamageSources.getFrostDamage(), aDamage); - return true; - } - return false; - } - - public static boolean applyElectricityDamage(EntityLivingBase aEntity, long aVoltage, long aAmperage) { - long aDamage = getTier(aVoltage) * aAmperage * 4; - if (aDamage > 0 && aEntity != null && !isWearingFullElectroHazmat(aEntity)) { - aEntity.attackEntityFrom(GT_DamageSources.getElectricDamage(), aDamage); - return true; - } - return false; - } - - public static boolean applyRadioactivity(EntityLivingBase aEntity, int aLevel, int aAmountOfItems) { - if (aLevel > 0 && aEntity != null && aEntity.getCreatureAttribute() != EnumCreatureAttribute.UNDEAD && aEntity.getCreatureAttribute() != EnumCreatureAttribute.ARTHROPOD && !isWearingFullRadioHazmat(aEntity)) { - PotionEffect tEffect = null; - aEntity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, aLevel * 140 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.moveSlowdown)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, aLevel * 150 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.digSlowdown)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(Potion.confusion.id, aLevel * 130 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.confusion)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(Potion.weakness.id, aLevel * 150 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.weakness)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(Potion.hunger.id, aLevel * 130 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.hunger)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - aEntity.addPotionEffect(new PotionEffect(24 /* IC2 Radiation */, aLevel * 180 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.potionTypes[24])) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7))); - return true; - } - return false; - } - - public static ItemStack setStack(Object aSetStack, Object aToStack) { - if (isStackInvalid(aSetStack) || isStackInvalid(aToStack)) return null; - ((ItemStack) aSetStack).func_150996_a(((ItemStack) aToStack).getItem()); - ((ItemStack) aSetStack).stackSize = ((ItemStack) aToStack).stackSize; - Items.feather.setDamage((ItemStack) aSetStack, Items.feather.getDamage((ItemStack) aToStack)); - ((ItemStack) aSetStack).setTagCompound(((ItemStack) aToStack).getTagCompound()); - return (ItemStack) aSetStack; - } - - public static FluidStack[] copyFluidArray(FluidStack... aStacks) { - FluidStack[] rStacks = new FluidStack[aStacks.length]; - for (int i = 0; i < aStacks.length; i++) if (aStacks[i] != null) rStacks[i] = aStacks[i].copy(); - return rStacks; - } - - public static ItemStack[] copyStackArray(Object... aStacks) { - ItemStack[] rStacks = new ItemStack[aStacks.length]; - for (int i = 0; i < aStacks.length; i++) rStacks[i] = copy(aStacks[i]); - return rStacks; - } - - public static ItemStack copy(Object... aStacks) { - for (Object tStack : aStacks) if (isStackValid(tStack)) return ((ItemStack) tStack).copy(); - return null; - } - - public static ItemStack copyAmount(long aAmount, Object... aStacks) { - ItemStack rStack = copy(aStacks); - if (isStackInvalid(rStack)) return null; - if (aAmount > 64) aAmount = 64; - else if (aAmount == -1) aAmount = 111; - else if (aAmount < 0) aAmount = 0; - rStack.stackSize = (byte) aAmount; - return rStack; - } - - public static ItemStack copyMetaData(long aMetaData, Object... aStacks) { - ItemStack rStack = copy(aStacks); - if (isStackInvalid(rStack)) return null; - Items.feather.setDamage(rStack, (short) aMetaData); - return rStack; - } - - public static ItemStack copyAmountAndMetaData(long aAmount, long aMetaData, Object... aStacks) { - ItemStack rStack = copyAmount(aAmount, aStacks); - if (isStackInvalid(rStack)) return null; - Items.feather.setDamage(rStack, (short) aMetaData); - return rStack; - } - - /** - * returns a copy of an ItemStack with its Stacksize being multiplied by aMultiplier - */ - public static ItemStack mul(long aMultiplier, Object... aStacks) { - ItemStack rStack = copy(aStacks); - if (rStack == null) return null; - rStack.stackSize *= aMultiplier; - return rStack; - } - - /** - * Loads an ItemStack properly. - */ - public static ItemStack loadItem(NBTTagCompound aNBT, String aTagName) { - return loadItem(aNBT.getCompoundTag(aTagName)); - } - - public static FluidStack loadFluid(NBTTagCompound aNBT, String aTagName) { - return loadFluid(aNBT.getCompoundTag(aTagName)); - } - - /** - * Loads an ItemStack properly. - */ - public static ItemStack loadItem(NBTTagCompound aNBT) { - if (aNBT == null) return null; - ItemStack rStack = ItemStack.loadItemStackFromNBT(aNBT); - try { - if (rStack != null && (rStack.getItem().getClass().getName().startsWith("ic2.core.migration"))) { - rStack.getItem().onUpdate(rStack, DW, null, 0, false); - } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } - return GT_OreDictUnificator.get(true, rStack); - } - - /** - * Loads an FluidStack properly. - */ - public static FluidStack loadFluid(NBTTagCompound aNBT) { - if (aNBT == null) return null; - return FluidStack.loadFluidStackFromNBT(aNBT); - } - - public static <E> E selectItemInList(int aIndex, E aReplacement, List<E> aList) { - if (aList == null || aList.isEmpty()) return aReplacement; - if (aList.size() <= aIndex) return aList.get(aList.size() - 1); - if (aIndex < 0) return aList.get(0); - return aList.get(aIndex); - } - - public static <E> E selectItemInList(int aIndex, E aReplacement, E... aList) { - if (aList == null || aList.length == 0) return aReplacement; - if (aList.length <= aIndex) return aList[aList.length - 1]; - if (aIndex < 0) return aList[0]; - return aList[aIndex]; - } - - public static boolean isStackInList(ItemStack aStack, Collection<GT_ItemStack> aList) { - if (aStack == null) { - return false; - } - return isStackInList(new GT_ItemStack(aStack), aList); - } - - public static boolean isStackInList(GT_ItemStack aStack, Collection<GT_ItemStack> aList) { - return aStack != null && (aList.contains(aStack) || aList.contains(new GT_ItemStack(aStack.mItem, aStack.mStackSize, W))); - } - - /** - * re-maps all Keys of a Map after the Keys were weakened. - */ - public static <X, Y> Map<X, Y> reMap(Map<X, Y> aMap) { - Map<X, Y> tMap = new /*Concurrent*/HashMap<X, Y>(); - tMap.putAll(aMap); - aMap.clear(); - aMap.putAll(tMap); - return aMap; - } - - /** - * Why the fuck do neither Java nor Guava have a Function to do this? - */ - public static <X, Y extends Comparable> LinkedHashMap<X, Y> sortMapByValuesAcending(Map<X, Y> aMap) { - List<Map.Entry<X, Y>> tEntrySet = new LinkedList<Map.Entry<X, Y>>(aMap.entrySet()); - Collections.sort(tEntrySet, new Comparator<Map.Entry<X, Y>>() { - @Override - public int compare(Entry<X, Y> aValue1, Entry<X, Y> aValue2) { - return aValue1.getValue().compareTo(aValue2.getValue()); - } - }); - LinkedHashMap<X, Y> rMap = new LinkedHashMap<X, Y>(); - for (Map.Entry<X, Y> tEntry : tEntrySet) rMap.put(tEntry.getKey(), tEntry.getValue()); - return rMap; - } - - /** - * Why the fuck do neither Java nor Guava have a Function to do this? - */ - public static <X, Y extends Comparable> LinkedHashMap<X, Y> sortMapByValuesDescending(Map<X, Y> aMap) { - List<Map.Entry<X, Y>> tEntrySet = new LinkedList<Map.Entry<X, Y>>(aMap.entrySet()); - Collections.sort(tEntrySet, new Comparator<Map.Entry<X, Y>>() { - @Override - public int compare(Entry<X, Y> aValue1, Entry<X, Y> aValue2) { - return aValue2.getValue().compareTo(aValue1.getValue());//FB: RV - RV_NEGATING_RESULT_OF_COMPARETO - } - }); - LinkedHashMap<X, Y> rMap = new LinkedHashMap<X, Y>(); - for (Map.Entry<X, Y> tEntry : tEntrySet) rMap.put(tEntry.getKey(), tEntry.getValue()); - return rMap; - } - - /** - * Translates a Material Amount into an Amount of Fluid in Fluid Material Units. - */ - public static long translateMaterialToFluidAmount(long aMaterialAmount, boolean aRoundUp) { - return translateMaterialToAmount(aMaterialAmount, L, aRoundUp); - } - - /** - * Translates a Material Amount into an Amount of Fluid. Second Parameter for things like Bucket Amounts (1000) and similar - */ - public static long translateMaterialToAmount(long aMaterialAmount, long aAmountPerUnit, boolean aRoundUp) { - return Math.max(0, ((aMaterialAmount * aAmountPerUnit) / M) + (aRoundUp && (aMaterialAmount * aAmountPerUnit) % M > 0 ? 1 : 0)); - } - - /** - * This checks if the Dimension is really a Dimension and not another Planet or something. - * Used for my Teleporter. - */ - public static boolean isRealDimension(int aDimensionID) { - if(aDimensionID<=1 && aDimensionID>=-1 && !GregTech_API.sDimensionalList.contains(aDimensionID)) return true; - return !GregTech_API.sDimensionalList.contains(aDimensionID) && DimensionManager.isDimensionRegistered(aDimensionID); - } - - //public static boolean isRealDimension(int aDimensionID) { - // try { - // if (DimensionManager.getProvider(aDimensionID).getClass().getName().contains("com.xcompwiz.mystcraft")) - // return true; - // } catch (Throwable e) {/*Do nothing*/} - // try { - // if (DimensionManager.getProvider(aDimensionID).getClass().getName().contains("TwilightForest")) return true; - // } catch (Throwable e) {/*Do nothing*/} - // try { - // if (DimensionManager.getProvider(aDimensionID).getClass().getName().contains("galacticraft")) return true; - // } catch (Throwable e) {/*Do nothing*/} - // return GregTech_API.sDimensionalList.contains(aDimensionID); - //} - - public static boolean moveEntityToDimensionAtCoords(Entity entity, int aDimension, double aX, double aY, double aZ) { - //Credit goes to BrandonCore Author :!: - - if (entity == null || entity.worldObj.isRemote) return false; - if (entity.ridingEntity != null) entity.mountEntity(null); - if (entity.riddenByEntity != null) entity.riddenByEntity.mountEntity(null); - - World startWorld = entity.worldObj; - World destinationWorld = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(aDimension); - - if (destinationWorld == null) {return false;} - - boolean interDimensional = startWorld.provider.dimensionId != destinationWorld.provider.dimensionId; - if(!interDimensional)return false; - startWorld.updateEntityWithOptionalForce(entity, false);//added - - if ((entity instanceof EntityPlayerMP) && interDimensional) { - EntityPlayerMP player = (EntityPlayerMP) entity; - player.closeScreen();//added - player.dimension = aDimension; - player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, destinationWorld.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType())); - ((WorldServer) startWorld).getPlayerManager().removePlayer(player); - - startWorld.playerEntities.remove(player); - startWorld.updateAllPlayersSleepingFlag(); - int i = entity.chunkCoordX; - int j = entity.chunkCoordZ; - if ((entity.addedToChunk) && (startWorld.getChunkProvider().chunkExists(i, j))) { - startWorld.getChunkFromChunkCoords(i, j).removeEntity(entity); - startWorld.getChunkFromChunkCoords(i, j).isModified = true; - } - startWorld.loadedEntityList.remove(entity); - startWorld.onEntityRemoved(entity); - } - - entity.setLocationAndAngles(aX, aY, aZ, entity.rotationYaw, entity.rotationPitch); - - ((WorldServer) destinationWorld).theChunkProviderServer.loadChunk((int) aX >> 4, (int) aZ >> 4); - - destinationWorld.theProfiler.startSection("placing"); - if (interDimensional) { - if (!(entity instanceof EntityPlayer)) { - NBTTagCompound entityNBT = new NBTTagCompound(); - entity.isDead = false; - entityNBT.setString("id", EntityList.getEntityString(entity)); - entity.writeToNBT(entityNBT); - entity.isDead = true; - entity = EntityList.createEntityFromNBT(entityNBT, destinationWorld); - if (entity == null) { - return false; - } - entity.dimension = destinationWorld.provider.dimensionId; - } - destinationWorld.spawnEntityInWorld(entity); - entity.setWorld(destinationWorld); - } - entity.setLocationAndAngles(aX, aY, aZ, entity.rotationYaw, entity.rotationPitch); - - destinationWorld.updateEntityWithOptionalForce(entity, false); - entity.setLocationAndAngles(aX, aY, aZ, entity.rotationYaw, entity.rotationPitch); - - if ((entity instanceof EntityPlayerMP)) { - EntityPlayerMP player = (EntityPlayerMP) entity; - if (interDimensional) { - player.mcServer.getConfigurationManager().func_72375_a(player, (WorldServer) destinationWorld); - } - player.playerNetServerHandler.setPlayerLocation(aX, aY, aZ, player.rotationYaw, player.rotationPitch); - } - - destinationWorld.updateEntityWithOptionalForce(entity, false); - - if (((entity instanceof EntityPlayerMP)) && interDimensional) { - EntityPlayerMP player = (EntityPlayerMP) entity; - player.theItemInWorldManager.setWorld((WorldServer) destinationWorld); - player.mcServer.getConfigurationManager().updateTimeAndWeatherForPlayer(player, (WorldServer) destinationWorld); - player.mcServer.getConfigurationManager().syncPlayerInventory(player); - - for (PotionEffect potionEffect : (Iterable<PotionEffect>) player.getActivePotionEffects()) { - player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potionEffect)); - } - - player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel)); - FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, startWorld.provider.dimensionId, destinationWorld.provider.dimensionId); - } - entity.setLocationAndAngles(aX, aY, aZ, entity.rotationYaw, entity.rotationPitch); - - destinationWorld.theProfiler.endSection(); - entity.fallDistance = 0; - return true; - } - - public static int getScaleCoordinates(double aValue, int aScale) { - return (int)Math.floor(aValue / aScale); - } - - public static int getCoordinateScan(ArrayList<String> aList, EntityPlayer aPlayer, World aWorld, int aScanLevel, int aX, int aY, int aZ, int aSide, float aClickX, float aClickY, float aClickZ) { - if (aList == null) return 0; - - ArrayList<String> tList = new ArrayList<String>(); - int rEUAmount = 0; - - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - - Block tBlock = aWorld.getBlock(aX, aY, aZ); - - tList.add("----- X: " +EnumChatFormatting.AQUA+ aX +EnumChatFormatting.RESET+ " Y: " +EnumChatFormatting.AQUA+ aY +EnumChatFormatting.RESET+ " Z: " +EnumChatFormatting.AQUA+ aZ +EnumChatFormatting.RESET+ " D: " +EnumChatFormatting.AQUA+ aWorld.provider.dimensionId +EnumChatFormatting.RESET+ " -----"); - try { - if (tTileEntity != null && tTileEntity instanceof IInventory) - tList.add(trans("162","Name: ") +EnumChatFormatting.BLUE+ ((IInventory) tTileEntity).getInventoryName() +EnumChatFormatting.RESET+ trans("163"," MetaData: ") +EnumChatFormatting.AQUA+ aWorld.getBlockMetadata(aX, aY, aZ) +EnumChatFormatting.RESET); - else - tList.add(trans("162","Name: ") +EnumChatFormatting.BLUE+ tBlock.getUnlocalizedName() +EnumChatFormatting.RESET+ trans("163"," MetaData: ") +EnumChatFormatting.AQUA+ aWorld.getBlockMetadata(aX, aY, aZ) +EnumChatFormatting.RESET); - - tList.add(trans("164","Hardness: ") +EnumChatFormatting.YELLOW+ tBlock.getBlockHardness(aWorld, aX, aY, aZ) +EnumChatFormatting.RESET+ trans("165"," Blast Resistance: ") +EnumChatFormatting.YELLOW+ tBlock.getExplosionResistance(aPlayer, aWorld, aX, aY, aZ, aPlayer.posX, aPlayer.posY, aPlayer.posZ) +EnumChatFormatting.RESET); - if (tBlock.isBeaconBase(aWorld, aX, aY, aZ, aX, aY + 1, aZ)) tList.add(EnumChatFormatting.GOLD+ trans("166","Is valid Beacon Pyramid Material") +EnumChatFormatting.RESET); - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - if (tTileEntity != null) { - try { - if (tTileEntity instanceof IFluidHandler) { - rEUAmount += 500; - FluidTankInfo[] tTanks = ((IFluidHandler) tTileEntity).getTankInfo(ForgeDirection.getOrientation(aSide)); - if (tTanks != null) for (byte i = 0; i < tTanks.length; i++) { - tList.add(trans("167","Tank ") + i + ": " +EnumChatFormatting.GREEN+ GT_Utility.formatNumbers((tTanks[i].fluid == null ? 0 : tTanks[i].fluid.amount)) +EnumChatFormatting.RESET+ " L / " +EnumChatFormatting.YELLOW+ GT_Utility.formatNumbers(tTanks[i].capacity) +EnumChatFormatting.RESET+ " L " +EnumChatFormatting.GOLD+ getFluidName(tTanks[i].fluid, true)+EnumChatFormatting.RESET); - } - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof ic2.api.reactor.IReactorChamber) { - rEUAmount += 500; - tTileEntity = (TileEntity) (((ic2.api.reactor.IReactorChamber) tTileEntity).getReactor()); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof ic2.api.reactor.IReactor) { - rEUAmount += 500; - tList.add(trans("168","Heat: ") +EnumChatFormatting.GREEN+ ((ic2.api.reactor.IReactor) tTileEntity).getHeat() +EnumChatFormatting.RESET+ " / " +EnumChatFormatting.YELLOW+ ((ic2.api.reactor.IReactor) tTileEntity).getMaxHeat()+EnumChatFormatting.RESET); - tList.add(trans("169","HEM: ") +EnumChatFormatting.YELLOW+((ic2.api.reactor.IReactor) tTileEntity).getHeatEffectModifier() +EnumChatFormatting.RESET/*+ trans("170"," Base EU Output: ")/* + ((ic2.api.reactor.IReactor)tTileEntity).getOutput()*/); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof ic2.api.tile.IWrenchable) { - rEUAmount += 100; - tList.add(trans("171","Facing: ") +EnumChatFormatting.GREEN+ ((ic2.api.tile.IWrenchable) tTileEntity).getFacing() +EnumChatFormatting.RESET+ trans("172"," / Chance: ") +EnumChatFormatting.YELLOW+ (((ic2.api.tile.IWrenchable) tTileEntity).getWrenchDropRate() * 100) +EnumChatFormatting.RESET+ "%"); - tList.add(((ic2.api.tile.IWrenchable) tTileEntity).wrenchCanRemove(aPlayer) ? EnumChatFormatting.GREEN+ trans("173","You can remove this with a Wrench") +EnumChatFormatting.RESET : EnumChatFormatting.RED+ trans("174","You can NOT remove this with a Wrench") +EnumChatFormatting.RESET); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof ic2.api.energy.tile.IEnergyTile) { - rEUAmount += 200; - //aList.add(((ic2.api.energy.tile.IEnergyTile)tTileEntity).isAddedToEnergyNet()?"Added to E-net":"Not added to E-net! Bug?"); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof ic2.api.energy.tile.IEnergySink) { - rEUAmount += 400; - //aList.add("Demanded Energy: " + ((ic2.api.energy.tile.IEnergySink)tTileEntity).demandsEnergy()); - //tList.add("Max Safe Input: " + getTier(((ic2.api.energy.tile.IEnergySink)tTileEntity).getSinkTier())); - //tList.add("Max Safe Input: " + ((ic2.api.energy.tile.IEnergySink)tTileEntity).getMaxSafeInput()); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof ic2.api.energy.tile.IEnergySource) { - rEUAmount += 400; - //aList.add("Max Energy Output: " + ((ic2.api.energy.tile.IEnergySource)tTileEntity).getMaxEnergyOutput()); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof ic2.api.energy.tile.IEnergyConductor) { - rEUAmount += 200; - tList.add(trans("175","Conduction Loss: ") +EnumChatFormatting.YELLOW+ ((ic2.api.energy.tile.IEnergyConductor) tTileEntity).getConductionLoss()+EnumChatFormatting.RESET); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof ic2.api.tile.IEnergyStorage) { - rEUAmount += 200; - tList.add(trans("176","Contained Energy: ") +EnumChatFormatting.YELLOW+ ((ic2.api.tile.IEnergyStorage) tTileEntity).getStored() +EnumChatFormatting.RESET+ " EU / " +EnumChatFormatting.YELLOW+ ((ic2.api.tile.IEnergyStorage) tTileEntity).getCapacity()+EnumChatFormatting.RESET+" EU"); - //aList.add(((ic2.api.tile.IEnergyStorage)tTileEntity).isTeleporterCompatible(ic2.api.Direction.YP)?"Teleporter Compatible":"Not Teleporter Compatible"); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof IUpgradableMachine) { - rEUAmount += 500; - if (((IUpgradableMachine) tTileEntity).hasMufflerUpgrade()) tList.add(EnumChatFormatting.GREEN+ trans("177","Has Muffler Upgrade") +EnumChatFormatting.RESET); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof IMachineProgress) { - rEUAmount += 400; - int tValue = 0; - if (0 < (tValue = ((IMachineProgress) tTileEntity).getMaxProgress())) - tList.add(trans("178","Progress/Load: ") +EnumChatFormatting.GREEN+GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress()) +EnumChatFormatting.RESET+ " / " +EnumChatFormatting.YELLOW+GT_Utility.formatNumbers(tValue) +EnumChatFormatting.RESET); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof ICoverable) { - rEUAmount += 300; - String tString = ((ICoverable) tTileEntity).getCoverBehaviorAtSide((byte) aSide).getDescription((byte) aSide, ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide), ((ICoverable) tTileEntity).getCoverDataAtSide((byte) aSide), (ICoverable) tTileEntity); - if (tString != null && !tString.equals(E)) tList.add(tString); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof IBasicEnergyContainer && ((IBasicEnergyContainer) tTileEntity).getEUCapacity() > 0) { - tList.add(trans("179","Max IN: ") +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getInputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(((IBasicEnergyContainer) tTileEntity).getInputVoltage())] + ") " +EnumChatFormatting.RESET+ trans("182"," EU at ") +EnumChatFormatting.RED+((IBasicEnergyContainer)tTileEntity).getInputAmperage()+EnumChatFormatting.RESET+trans("183"," A")); - tList.add(trans("181","Max OUT: ") +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getOutputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(((IBasicEnergyContainer) tTileEntity).getOutputVoltage())] + ") " +EnumChatFormatting.RESET+ trans("182"," EU at ") +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getOutputAmperage() +EnumChatFormatting.RESET+ trans("183"," A")); - tList.add(trans("184","Energy: ") +EnumChatFormatting.GREEN+ GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getStoredEU()) +EnumChatFormatting.RESET+ " EU / " +EnumChatFormatting.YELLOW+ GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getEUCapacity()) +EnumChatFormatting.RESET+ " EU"); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof IGregTechTileEntity) { - tList.add(trans("186","Owned by: ") +EnumChatFormatting.BLUE+ ((IGregTechTileEntity) tTileEntity).getOwnerName()+EnumChatFormatting.RESET); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof IGregTechDeviceInformation && ((IGregTechDeviceInformation) tTileEntity).isGivingInformation()) { - tList.addAll(Arrays.asList(((IGregTechDeviceInformation) tTileEntity).getInfoData())); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof ic2.api.crops.ICropTile) { - if (((ic2.api.crops.ICropTile) tTileEntity).getScanLevel() < 4) { - rEUAmount += 10000; - ((ic2.api.crops.ICropTile) tTileEntity).setScanLevel((byte) 4); - } - if (((ic2.api.crops.ICropTile) tTileEntity).getID() >= 0 && ((ic2.api.crops.ICropTile) tTileEntity).getID() < ic2.api.crops.Crops.instance.getCropList().length && ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()] != null) { - rEUAmount += 1000; - tList.add(trans("187","Type -- Crop-Name: ") + ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].name() - + trans("188"," Growth: ") + ((ic2.api.crops.ICropTile) tTileEntity).getGrowth() - + trans("189"," Gain: ") + ((ic2.api.crops.ICropTile) tTileEntity).getGain() - + trans("190"," Resistance: ") + ((ic2.api.crops.ICropTile) tTileEntity).getResistance() - ); - tList.add(trans("191","Plant -- Fertilizer: ") + ((ic2.api.crops.ICropTile) tTileEntity).getNutrientStorage() - + trans("192"," Water: ") + ((ic2.api.crops.ICropTile) tTileEntity).getHydrationStorage() - + trans("193"," Weed-Ex: ") + ((ic2.api.crops.ICropTile) tTileEntity).getWeedExStorage() - + trans("194"," Scan-Level: ") + ((ic2.api.crops.ICropTile) tTileEntity).getScanLevel() - ); - tList.add(trans("195","Environment -- Nutrients: ") + ((ic2.api.crops.ICropTile) tTileEntity).getNutrients() - + trans("196"," Humidity: ") + ((ic2.api.crops.ICropTile) tTileEntity).getHumidity() - + trans("197"," Air-Quality: ") + ((ic2.api.crops.ICropTile) tTileEntity).getAirQuality() - ); - StringBuilder tStringB = new StringBuilder(); - for (String tAttribute : ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].attributes()) { - tStringB.append(", ").append(tAttribute); - } - String tString = tStringB.toString(); - tList.add(trans("198","Attributes:") + tString.replaceFirst(",", E)); - tList.add(trans("199","Discovered by: ") + ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].discoveredBy()); - } - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - } - - if (aPlayer.capabilities.isCreativeMode) { - FluidStack tFluid = undergroundOilReadInformation(aWorld.getChunkFromBlockCoords(aX,aZ));//-# to only read - if (tFluid!=null) - tList.add(EnumChatFormatting.GOLD+tFluid.getLocalizedName()+EnumChatFormatting.RESET+": " +EnumChatFormatting.YELLOW+ tFluid.amount +EnumChatFormatting.RESET+" L"); - else - tList.add(EnumChatFormatting.GOLD+trans("201","Nothing")+EnumChatFormatting.RESET+": " +EnumChatFormatting.YELLOW+ '0' +EnumChatFormatting.RESET+" L"); - } -// if(aPlayer.capabilities.isCreativeMode){ - int[] chunkData = GT_Proxy.dimensionWiseChunkData.get(aWorld.provider.dimensionId).get(aWorld.getChunkFromBlockCoords(aX,aZ).getChunkCoordIntPair()); - if(chunkData !=null){ - if(chunkData[GTPOLLUTION]>0){ - tList.add(trans("202","Pollution in Chunk: ")+EnumChatFormatting.RED+chunkData[GTPOLLUTION]+EnumChatFormatting.RESET+trans("203"," gibbl")); - }else{ - tList.add(EnumChatFormatting.GREEN+trans("204","No Pollution in Chunk! HAYO!")+EnumChatFormatting.RESET); - } - }else{ - tList.add(EnumChatFormatting.GREEN+trans("204","No Pollution in Chunk! HAYO!")+EnumChatFormatting.RESET); - } - - try { - if (tBlock instanceof IDebugableBlock) { - rEUAmount += 500; - ArrayList<String> temp = ((IDebugableBlock) tBlock).getDebugInfo(aPlayer, aX, aY, aZ, 3); - if (temp != null) tList.addAll(temp); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - - BlockScanningEvent tEvent = new BlockScanningEvent(aWorld, aPlayer, aX, aY, aZ, (byte) aSide, aScanLevel, tBlock, tTileEntity, tList, aClickX, aClickY, aClickZ); - tEvent.mEUCost = rEUAmount; - MinecraftForge.EVENT_BUS.post(tEvent); - if (!tEvent.isCanceled()) aList.addAll(tList); - return tEvent.mEUCost; - } - - public static String trans(String aKey, String aEnglish){ - return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_"+aKey, aEnglish, false); - } - - /** - * @return an Array containing the X and the Y Coordinate of the clicked Point, with the top left Corner as Origin, like on the Texture Sheet. return values should always be between [0.0F and 0.99F]. - */ - public static float[] getClickedFacingCoords(byte aSide, float aX, float aY, float aZ) { - switch (aSide) { - case 0: - return new float[]{Math.min(0.99F, Math.max(0, 1 - aX)), Math.min(0.99F, Math.max(0, aZ))}; - case 1: - return new float[]{Math.min(0.99F, Math.max(0, aX)), Math.min(0.99F, Math.max(0, aZ))}; - case 2: - return new float[]{Math.min(0.99F, Math.max(0, 1 - aX)), Math.min(0.99F, Math.max(0, 1 - aY))}; - case 3: - return new float[]{Math.min(0.99F, Math.max(0, aX)), Math.min(0.99F, Math.max(0, 1 - aY))}; - case 4: - return new float[]{Math.min(0.99F, Math.max(0, aZ)), Math.min(0.99F, Math.max(0, 1 - aY))}; - case 5: - return new float[]{Math.min(0.99F, Math.max(0, 1 - aZ)), Math.min(0.99F, Math.max(0, 1 - aY))}; - default: - return new float[]{0.5F, 0.5F}; - } - } - - /** - * This Function determines the direction a Block gets when being Wrenched. - * returns -1 if invalid. Even though that could never happen. - */ - public static byte determineWrenchingSide(byte aSide, float aX, float aY, float aZ) { - byte tBack = getOppositeSide(aSide); - switch (aSide) { - case 0: - case 1: - if (aX < 0.25) { - if (aZ < 0.25) return tBack; - if (aZ > 0.75) return tBack; - return 4; - } - if (aX > 0.75) { - if (aZ < 0.25) return tBack; - if (aZ > 0.75) return tBack; - return 5; - } - if (aZ < 0.25) return 2; - if (aZ > 0.75) return 3; - return aSide; - case 2: - case 3: - if (aX < 0.25) { - if (aY < 0.25) return tBack; - if (aY > 0.75) return tBack; - return 4; - } - if (aX > 0.75) { - if (aY < 0.25) return tBack; - if (aY > 0.75) return tBack; - return 5; - } - if (aY < 0.25) return 0; - if (aY > 0.75) return 1; - return aSide; - case 4: - case 5: - if (aZ < 0.25) { - if (aY < 0.25) return tBack; - if (aY > 0.75) return tBack; - return 2; - } - if (aZ > 0.75) { - if (aY < 0.25) return tBack; - if (aY > 0.75) return tBack; - return 3; - } - if (aY < 0.25) return 0; - if (aY > 0.75) return 1; - return aSide; - } - return -1; - } - - public static String formatNumbers(long aNumber) { - DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.US); - DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols(); - symbols.setGroupingSeparator(' '); - return formatter.format(aNumber); - } - - /* - * Check if stack has enough items of given type and subtract from stack, if there's no creative or 111 stack. - */ - public static boolean consumeItems(EntityPlayer player, ItemStack stack, Item item, int count) { - if (stack != null && stack.getItem() == item && stack.stackSize >= count) { - if ((!player.capabilities.isCreativeMode) && (stack.stackSize != 111)) - stack.stackSize -= count; - return true; - } - return false; - } - - /* - * Check if stack has enough items of given gregtech material (will be oredicted) - * and subtract from stack, if there's no creative or 111 stack. - */ - public static boolean consumeItems(EntityPlayer player, ItemStack stack, gregtech.api.enums.Materials mat, int count) { - if (stack != null - && GT_OreDictUnificator.getItemData(stack).mMaterial.mMaterial == mat - && stack.stackSize >= count) { - if ((!player.capabilities.isCreativeMode) && (stack.stackSize != 111)) - stack.stackSize -= count; - return true; - } - return false; - } - - public static ArrayList<String> sortByValueToList( Map<String, Integer> map ) { - List<Map.Entry<String, Integer>> list = - new LinkedList<Map.Entry<String, Integer>>( map.entrySet() ); - Collections.sort( list, new Comparator<Map.Entry<String, Integer>>() - { - public int compare( Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2 ) - { - return o2.getValue() - o1.getValue(); - } - } ); - - ArrayList<String> result = new ArrayList<String>(); - for (Map.Entry<String, Integer> e : list) - result.add(e.getKey()); - return result; - } - - public static String joinListToString(List<String> list) { - StringBuilder result = new StringBuilder(32); - for (String s : list) - result.append(result.length()==0?s:'|'+s); - return result.toString(); - } - - public static ItemStack getIntegratedCircuit(int config){ - return ItemList.Circuit_Integrated.getWithDamage(0, config, new Object[0]); - } - - public static float getBlockHardnessAt(World aWorld, int aX, int aY, int aZ) { - return aWorld.getBlock(aX, aY, aZ).getBlockHardness(aWorld, aX, aY, aZ); - } - - public static FakePlayer getFakePlayer(IGregTechTileEntity aBaseMetaTileEntity) { - if (aBaseMetaTileEntity.getWorld() instanceof WorldServer) { - return FakePlayerFactory.get((WorldServer) aBaseMetaTileEntity.getWorld(), new GameProfile(null, aBaseMetaTileEntity.getOwnerName())); - } - return null; - } - - public static boolean eraseBlockByFakePlayer(FakePlayer aPlayer, int aX, int aY, int aZ, boolean isSimulate) { - if (aPlayer == null) return false; - World aWorld = aPlayer.worldObj; - BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(aX, aY, aZ, aWorld, aWorld.getBlock(aX, aY, aZ), aWorld.getBlockMetadata(aX, aY, aZ), aPlayer); - MinecraftForge.EVENT_BUS.post(event); - if (!event.isCanceled()) { - if (!isSimulate) return aWorld.setBlockToAir(aX, aY, aZ); - return true; - } - return false; - } - - public static boolean setBlockByFakePlayer(FakePlayer aPlayer, int aX, int aY, int aZ, Block aBlock, int aMeta, boolean isSimulate) { - if (aPlayer == null) return false; - World aWorld = aPlayer.worldObj; - BlockEvent.PlaceEvent event = ForgeEventFactory.onPlayerBlockPlace(aPlayer, new BlockSnapshot(aWorld, aX, aY, aZ, aBlock, aMeta), ForgeDirection.UNKNOWN); - if (!event.isCanceled()) { - if (!isSimulate) return aWorld.setBlock(aX, aY, aZ, aBlock, aMeta, 3); - return true; - } - return false; - } - - public static class ItemNBT { - public static void setNBT(ItemStack aStack, NBTTagCompound aNBT) { - if (aNBT == null) { - aStack.setTagCompound(null); - return; - } - ArrayList<String> tTagsToRemove = new ArrayList<String>(); - for (Object tKey : aNBT.func_150296_c()) { - NBTBase tValue = aNBT.getTag((String) tKey); - if (tValue == null || (tValue instanceof NBTPrimitive && ((NBTPrimitive) tValue).func_150291_c() == 0) || (tValue instanceof NBTTagString && isStringInvalid(((NBTTagString) tValue).func_150285_a_()))) - tTagsToRemove.add((String) tKey); - } - for (Object tKey : tTagsToRemove) aNBT.removeTag((String) tKey); - aStack.setTagCompound(aNBT.hasNoTags() ? null : aNBT); - } - - public static NBTTagCompound getNBT(ItemStack aStack) { - NBTTagCompound rNBT = aStack.getTagCompound(); - return rNBT == null ? new NBTTagCompound() : rNBT; - } - - public static void setPunchCardData(ItemStack aStack, String aPunchCardData) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setString("GT.PunchCardData", aPunchCardData); - setNBT(aStack, tNBT); - } - - public static String getPunchCardData(ItemStack aStack) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getString("GT.PunchCardData"); - } - - public static void setLighterFuel(ItemStack aStack, long aFuel) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setLong("GT.LighterFuel", aFuel); - setNBT(aStack, tNBT); - } - - public static long getLighterFuel(ItemStack aStack) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getLong("GT.LighterFuel"); - } - - public static void setMapID(ItemStack aStack, short aMapID) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setShort("map_id", aMapID); - setNBT(aStack, tNBT); - } - - public static short getMapID(ItemStack aStack) { - NBTTagCompound tNBT = getNBT(aStack); - if (!tNBT.hasKey("map_id")) return -1; - return tNBT.getShort("map_id"); - } - - public static void setBookTitle(ItemStack aStack, String aTitle) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setString("title", aTitle); - setNBT(aStack, tNBT); - } - - public static String getBookTitle(ItemStack aStack) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getString("title"); - } - - public static void setBookAuthor(ItemStack aStack, String aAuthor) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setString("author", aAuthor); - setNBT(aStack, tNBT); - } - - public static String getBookAuthor(ItemStack aStack) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getString("author"); - } - - public static void setProspectionData(ItemStack aStack, int aX, int aY, int aZ, int aDim, FluidStack aFluid, String... aOres) { - NBTTagCompound tNBT = getNBT(aStack); - String tData = aX + "," + aY + "," + aZ + "," + aDim + ","; - if (aFluid!=null) - tData += (aFluid.amount) + "," + aFluid.getLocalizedName() + ",";//TODO CHECK IF THAT /5000 is needed (Not needed) - for (String tString : aOres) { - tData += tString + ","; - } - tNBT.setString("prospection", tData); - setNBT(aStack, tNBT); - } - - public static void setAdvancedProspectionData( - byte aTier, - ItemStack aStack, - int aX, short aY, int aZ, int aDim, - ArrayList<String> aOils, - ArrayList<String> aNearOres, - ArrayList<String> aMiddleOres, - ArrayList<String> aFarOres, - int aNear, int aMiddle, int aRadius) { - - setBookTitle(aStack, "Raw Prospection Data"); - - NBTTagCompound tNBT = GT_Utility.ItemNBT.getNBT(aStack); - - tNBT.setByte("prospection_tier", aTier); - tNBT.setString("prospection_pos", "Dim: " + aDim + "\nX: " + aX + " Y: " + aY + " Z: " + aZ); - - // ores - tNBT.setString("prospection_near", joinListToString(aNearOres)); - tNBT.setString("prospection_middle", joinListToString(aMiddleOres)); - tNBT.setString("prospection_far", joinListToString(aFarOres)); - - // oils - ArrayList<String> tOilsTransformed = new ArrayList<String>(aOils.size()); - for (String aStr : aOils) { - String[] aStats = aStr.split(","); - tOilsTransformed.add(aStats[0] + ": " + aStats[1] + "L " + aStats[2]); - } - - tNBT.setString("prospection_oils", joinListToString(tOilsTransformed)); - - tNBT.setString("prospection_bounds", aNear + "|" + aMiddle + "|" + aRadius); - - setNBT(aStack, tNBT); - } - - public static void convertProspectionData(ItemStack aStack) { - NBTTagCompound tNBT = getNBT(aStack); - byte tTier = tNBT.getByte("prospection_tier"); - - if (tTier == 0) { // basic prospection data - String tData = tNBT.getString("prospection"); - String[] tDataArray = tData.split(","); - if (tDataArray.length > 6) { - tNBT.setString("author", " Dim: " + tDataArray[3] + "X: " + tDataArray[0] + " Y: " + tDataArray[1] + " Z: " + tDataArray[2]); - NBTTagList tNBTList = new NBTTagList(); - String tOres = " Prospected Ores: "; - for (int i = 6; tDataArray.length > i; i++) { - tOres += (tDataArray[i] + " "); - } - tNBTList.appendTag(new NBTTagString("Tier " + tTier + " Prospecting Data From: X" + tDataArray[0] + " Z:" + tDataArray[2] + " Dim:" + tDataArray[3] + " Produces " + tDataArray[4] + "L " + tDataArray[5] + " " + tOres)); - tNBT.setTag("pages", tNBTList); - } - setNBT(aStack, tNBT); - } else { // advanced prospection data - String tPos = tNBT.getString("prospection_pos"); - String[] tBounds = tNBT.getString("prospection_bounds").split("\\|"); - - String tNearOresStr = tNBT.getString("prospection_near"); - String tMiddleOresStr = tNBT.getString("prospection_middle"); - String tFarOresStr = tNBT.getString("prospection_far"); - String tOilsStr = tNBT.getString("prospection_oils"); - - String[] tNearOres = tNearOresStr.isEmpty() ? null : tNearOresStr.split("\\|"); - String[] tMiddleOres = tMiddleOresStr.isEmpty() ? null : tMiddleOresStr.split("\\|"); - String[] tFarOres = tFarOresStr.isEmpty() ? null : tFarOresStr.split("\\|"); - String[] tOils = tOilsStr.isEmpty() ? null : tOilsStr.split("\\|"); - - NBTTagList tNBTList = new NBTTagList(); - - String tPageText = "Prospector report\n" - + tPos + "\n\n" - + "Ores found:\n" - + "Close <" + tBounds[0] + " blocks: " + (tNearOres != null ? tNearOres.length : 0) + "\n" - + "Mid <" + tBounds[1] + " blocks: " + (tMiddleOres != null ? tMiddleOres.length : 0) + "\n" - + "Far <" + tBounds[2] + " blocks: " + (tFarOres != null ? tFarOres.length : 0) + "\n" - + "Oils: " + (tOils != null ? tOils.length : 0) + "\n\n" - + "Lists sorted by volume\n" - + "Location is center of chunk with ore"; - tNBTList.appendTag(new NBTTagString(tPageText)); - - if (tNearOres != null) - fillBookWithList(tNBTList, "Close Range Ores%s\n\n", "\n", 7, tNearOres); - if (tMiddleOres != null) - fillBookWithList(tNBTList, "Mid Range Ores%s\n\n", "\n", 7, tMiddleOres); - if (tFarOres != null) - fillBookWithList(tNBTList, "Far Range Ores%s\n\n", "\n", 7, tFarOres); - - if (tOils != null) - fillBookWithList(tNBTList, "Oils%s\n\n", "\n", 9, tOils); - - tPageText = "Oil notes\n\n" - + "Prospects from NW to SE 324 chunks (9 8x8 oilfields)\n around and gives min-max amount" + "\n\n" - + "[1][2][3]" + "\n" - + "[4][5][6]" + "\n" - + "[7][8][9]" + "\n" - + "\n" - + "[5] - Prospector"; - tNBTList.appendTag(new NBTTagString(tPageText)); - - tNBT.setString("author", tPos.replace("\n"," ")); - tNBT.setTag("pages", tNBTList); - setNBT(aStack, tNBT); - } - } - - public static void fillBookWithList(NBTTagList aBook, String aPageHeader, String aListDelimiter, int aItemsPerPage, String[] list) { - String aPageFormatter = " %d/%d"; - int tTotalPages = list.length / aItemsPerPage + (list.length % aItemsPerPage > 0 ? 1 : 0); - int tPage = 0; - String tPageText; - do { - tPageText = ""; - for (int i = tPage*aItemsPerPage; i < (tPage+1)*aItemsPerPage && i < list.length; i += 1) - tPageText += (tPageText.isEmpty() ? "" : aListDelimiter) + list[i]; - - if (!tPageText.isEmpty()) { - String tPageCounter = tTotalPages > 1 ? String.format(aPageFormatter, tPage + 1, tTotalPages) : ""; - NBTTagString tPageTag = new NBTTagString(String.format(aPageHeader, tPageCounter) + tPageText); - aBook.appendTag(tPageTag); - } - - ++tPage; - } while (!tPageText.isEmpty()); - } - - public static void addEnchantment(ItemStack aStack, Enchantment aEnchantment, int aLevel) { - NBTTagCompound tNBT = getNBT(aStack), tEnchantmentTag; - if (!tNBT.hasKey("ench", 9)) tNBT.setTag("ench", new NBTTagList()); - NBTTagList tList = tNBT.getTagList("ench", 10); - - boolean temp = true; - - for (int i = 0; i < tList.tagCount(); i++) { - tEnchantmentTag = tList.getCompoundTagAt(i); - if (tEnchantmentTag.getShort("id") == aEnchantment.effectId) { - tEnchantmentTag.setShort("id", (short) aEnchantment.effectId); - tEnchantmentTag.setShort("lvl", (byte) aLevel); - temp = false; - break; - } - } - - if (temp) { - tEnchantmentTag = new NBTTagCompound(); - tEnchantmentTag.setShort("id", (short) aEnchantment.effectId); - tEnchantmentTag.setShort("lvl", (byte) aLevel); - tList.appendTag(tEnchantmentTag); - } - aStack.setTagCompound(tNBT); - } - } - - /** - * THIS IS BULLSHIT!!! WHY DO I HAVE TO DO THIS SHIT JUST TO HAVE ENCHANTS PROPERLY!?! - */ - public static class GT_EnchantmentHelper { - private static final BullshitIteratorA mBullshitIteratorA = new BullshitIteratorA(); - private static final BullshitIteratorB mBullshitIteratorB = new BullshitIteratorB(); - - private static void applyBullshit(IBullshit aBullshitModifier, ItemStack aStack) { - if (aStack != null) { - NBTTagList nbttaglist = aStack.getEnchantmentTagList(); - if (nbttaglist != null) { - try { - for (int i = 0; i < nbttaglist.tagCount(); ++i) { - short short1 = nbttaglist.getCompoundTagAt(i).getShort("id"); - short short2 = nbttaglist.getCompoundTagAt(i).getShort("lvl"); - if (Enchantment.enchantmentsList[short1] != null) - aBullshitModifier.calculateModifier(Enchantment.enchantmentsList[short1], short2); - } - } catch (Throwable e) {/**/} - } - } - } - - private static void applyArrayOfBullshit(IBullshit aBullshitModifier, ItemStack[] aStacks) { - ItemStack[] aitemstack1 = aStacks; - int i = aStacks.length; - for (int j = 0; j < i; ++j) { - ItemStack itemstack = aitemstack1[j]; - applyBullshit(aBullshitModifier, itemstack); - } - } - - public static void applyBullshitA(EntityLivingBase aPlayer, Entity aEntity, ItemStack aStack) { - mBullshitIteratorA.mPlayer = aPlayer; - mBullshitIteratorA.mEntity = aEntity; - if (aPlayer != null) applyArrayOfBullshit(mBullshitIteratorA, aPlayer.getLastActiveItems()); - if (aStack != null) applyBullshit(mBullshitIteratorA, aStack); - } - - public static void applyBullshitB(EntityLivingBase aPlayer, Entity aEntity, ItemStack aStack) { - mBullshitIteratorB.mPlayer = aPlayer; - mBullshitIteratorB.mEntity = aEntity; - if (aPlayer != null) applyArrayOfBullshit(mBullshitIteratorB, aPlayer.getLastActiveItems()); - if (aStack != null) applyBullshit(mBullshitIteratorB, aStack); - } - - interface IBullshit { - void calculateModifier(Enchantment aEnchantment, int aLevel); - } - - static final class BullshitIteratorA implements IBullshit { - public EntityLivingBase mPlayer; - public Entity mEntity; - - BullshitIteratorA() { - } - - @Override - public void calculateModifier(Enchantment aEnchantment, int aLevel) { - aEnchantment.func_151367_b(mPlayer, mEntity, aLevel); - } - } - - static final class BullshitIteratorB implements IBullshit { - public EntityLivingBase mPlayer; - public Entity mEntity; - - BullshitIteratorB() { - } - - @Override - public void calculateModifier(Enchantment aEnchantment, int aLevel) { - aEnchantment.func_151368_a(mPlayer, mEntity, aLevel); - } - } - } - - public static String toSubscript(long no){ - char[] chars=Long.toString(no).toCharArray(); - for(int i=0;i<chars.length;i++){ - chars[i]+=8272; - } - return new String(chars); - } - - public static boolean isPartOfMaterials(ItemStack aStack, Materials aMaterials){ - return GT_OreDictUnificator.getAssociation(aStack) != null ? GT_OreDictUnificator.getAssociation(aStack).mMaterial.mMaterial.equals(aMaterials) : false; - } - - public static boolean isPartOfOrePrefix(ItemStack aStack, OrePrefixes aPrefix){ - return GT_OreDictUnificator.getAssociation(aStack) != null ? GT_OreDictUnificator.getAssociation(aStack).mPrefix.equals(aPrefix) : false; - } - -} +package gregtech.api.util;
+
+import cofh.api.transport.IItemDuct;
+import com.mojang.authlib.GameProfile;
+import cpw.mods.fml.common.FMLCommonHandler;
+import gregtech.api.GregTech_API;
+import gregtech.api.damagesources.GT_DamageSources;
+import gregtech.api.enchants.Enchantment_Radioactivity;
+import gregtech.api.enums.*;
+import gregtech.api.events.BlockScanningEvent;
+import gregtech.api.interfaces.IDebugableBlock;
+import gregtech.api.interfaces.IProjectileItem;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.*;
+import gregtech.api.items.GT_EnergyArmor_Item;
+import gregtech.api.items.GT_Generic_Item;
+import gregtech.api.net.GT_Packet_Sound;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.ItemData;
+import gregtech.api.threads.GT_Runnable_Sound;
+import gregtech.common.GT_Proxy;
+import ic2.api.recipe.IRecipeInput;
+import ic2.api.recipe.RecipeInputItemStack;
+import ic2.api.recipe.RecipeInputOreDict;
+import ic2.api.recipe.RecipeOutput;
+import net.minecraft.block.Block;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.entity.*;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.nbt.NBTBase.NBTPrimitive;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.nbt.NBTTagString;
+import net.minecraft.network.play.server.S07PacketRespawn;
+import net.minecraft.network.play.server.S1DPacketEntityEffect;
+import net.minecraft.network.play.server.S1FPacketSetExperience;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityChest;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldServer;
+import net.minecraftforge.common.DimensionManager;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.common.util.BlockSnapshot;
+import net.minecraftforge.common.util.FakePlayer;
+import net.minecraftforge.common.util.FakePlayerFactory;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.event.ForgeEventFactory;
+import net.minecraftforge.event.world.BlockEvent;
+import net.minecraftforge.fluids.*;
+import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.NumberFormat;
+import java.util.*;
+import java.util.Map.Entry;
+
+import static gregtech.GT_Mod.GT_FML_LOGGER;
+import static gregtech.api.enums.GT_Values.*;
+import static gregtech.common.GT_Proxy.GTPOLLUTION;
+import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ * <p/>
+ * Just a few Utility Functions I use.
+ */
+public class GT_Utility {
+ /**
+ * Forge screwed the Fluid Registry up again, so I make my own, which is also much more efficient than the stupid Stuff over there.
+ */
+ private static final List<FluidContainerData> sFluidContainerList = new ArrayList<FluidContainerData>();
+ private static final Map<GT_ItemStack, FluidContainerData> sFilledContainerToData = new /*Concurrent*/HashMap<GT_ItemStack, FluidContainerData>();
+ private static final Map<GT_ItemStack, Map<Fluid, FluidContainerData>> sEmptyContainerToFluidToData = new /*Concurrent*/HashMap<GT_ItemStack, Map<Fluid, FluidContainerData>>();
+ public static volatile int VERSION = 509;
+ public static boolean TE_CHECK = false, BC_CHECK = false, CHECK_ALL = true, RF_CHECK = false;
+ public static Map<GT_PlayedSound, Integer> sPlayedSoundMap = new /*Concurrent*/HashMap<GT_PlayedSound, Integer>();
+ private static int sBookCount = 0;
+ public static UUID defaultUuid = null; // maybe default non-null? UUID.fromString("00000000-0000-0000-0000-000000000000");
+
+ static {
+ GregTech_API.sItemStackMappings.add(sFilledContainerToData);
+ GregTech_API.sItemStackMappings.add(sEmptyContainerToFluidToData);
+ }
+
+ public static int safeInt(long number, int margin){
+ return number>Integer.MAX_VALUE-margin ? Integer.MAX_VALUE-margin :(int)number;
+ }
+
+ public static int safeInt(long number){
+ return number>GT_Values.V[GT_Values.V.length-1] ? safeInt(GT_Values.V[GT_Values.V.length-1],1) : number<Integer.MIN_VALUE ? Integer.MIN_VALUE : (int)number;
+ }
+
+ public static Field getPublicField(Object aObject, String aField) {
+ Field rField = null;
+ try {
+ rField = aObject.getClass().getDeclaredField(aField);
+ } catch (Throwable e) {/*Do nothing*/}
+ return rField;
+ }
+
+ public static Field getField(Object aObject, String aField) {
+ Field rField = null;
+ try {
+ rField = aObject.getClass().getDeclaredField(aField);
+ rField.setAccessible(true);
+ } catch (Throwable e) {/*Do nothing*/}
+ return rField;
+ }
+
+ public static Field getField(Class aObject, String aField) {
+ Field rField = null;
+ try {
+ rField = aObject.getDeclaredField(aField);
+ rField.setAccessible(true);
+ } catch (Throwable e) {/*Do nothing*/}
+ return rField;
+ }
+
+ public static Method getMethod(Class aObject, String aMethod, Class<?>... aParameterTypes) {
+ Method rMethod = null;
+ try {
+ rMethod = aObject.getMethod(aMethod, aParameterTypes);
+ rMethod.setAccessible(true);
+ } catch (Throwable e) {/*Do nothing*/}
+ return rMethod;
+ }
+
+ public static Method getMethod(Object aObject, String aMethod, Class<?>... aParameterTypes) {
+ Method rMethod = null;
+ try {
+ rMethod = aObject.getClass().getMethod(aMethod, aParameterTypes);
+ rMethod.setAccessible(true);
+ } catch (Throwable e) {/*Do nothing*/}
+ return rMethod;
+ }
+
+ public static Field getField(Object aObject, String aField, boolean aPrivate, boolean aLogErrors) {
+ try {
+ Field tField = (aObject instanceof Class) ? ((Class) aObject).getDeclaredField(aField) : (aObject instanceof String) ? Class.forName((String) aObject).getDeclaredField(aField) : aObject.getClass().getDeclaredField(aField);
+ if (aPrivate) tField.setAccessible(true);
+ return tField;
+ } catch (Throwable e) {
+ if (aLogErrors) e.printStackTrace(GT_Log.err);
+ }
+ return null;
+ }
+
+ public static Object getFieldContent(Object aObject, String aField, boolean aPrivate, boolean aLogErrors) {
+ try {
+ Field tField = (aObject instanceof Class) ? ((Class) aObject).getDeclaredField(aField) : (aObject instanceof String) ? Class.forName((String) aObject).getDeclaredField(aField) : aObject.getClass().getDeclaredField(aField);
+ if (aPrivate) tField.setAccessible(true);
+ return tField.get(aObject instanceof Class || aObject instanceof String ? null : aObject);
+ } catch (Throwable e) {
+ if (aLogErrors) e.printStackTrace(GT_Log.err);
+ }
+ return null;
+ }
+
+ public static Object callPublicMethod(Object aObject, String aMethod, Object... aParameters) {
+ return callMethod(aObject, aMethod, false, false, true, aParameters);
+ }
+
+ public static Object callPrivateMethod(Object aObject, String aMethod, Object... aParameters) {
+ return callMethod(aObject, aMethod, true, false, true, aParameters);
+ }
+
+ public static Object callMethod(Object aObject, String aMethod, boolean aPrivate, boolean aUseUpperCasedDataTypes, boolean aLogErrors, Object... aParameters) {
+ try {
+ Class<?>[] tParameterTypes = new Class<?>[aParameters.length];
+ for (byte i = 0; i < aParameters.length; i++) {
+ if (aParameters[i] instanceof Class) {
+ tParameterTypes[i] = (Class) aParameters[i];
+ aParameters[i] = null;
+ } else {
+ tParameterTypes[i] = aParameters[i].getClass();
+ }
+ if (!aUseUpperCasedDataTypes) {
+ if (tParameterTypes[i] == Boolean.class) tParameterTypes[i] = boolean.class;
+ else if (tParameterTypes[i] == Byte.class) tParameterTypes[i] = byte.class;
+ else if (tParameterTypes[i] == Short.class) tParameterTypes[i] = short.class;
+ else if (tParameterTypes[i] == Integer.class) tParameterTypes[i] = int.class;
+ else if (tParameterTypes[i] == Long.class) tParameterTypes[i] = long.class;
+ else if (tParameterTypes[i] == Float.class) tParameterTypes[i] = float.class;
+ else if (tParameterTypes[i] == Double.class) tParameterTypes[i] = double.class;
+ }
+ }
+
+ Method tMethod = (aObject instanceof Class) ? ((Class) aObject).getMethod(aMethod, tParameterTypes) : aObject.getClass().getMethod(aMethod, tParameterTypes);
+ if (aPrivate) tMethod.setAccessible(true);
+ return tMethod.invoke(aObject, aParameters);
+ } catch (Throwable e) {
+ if (aLogErrors) e.printStackTrace(GT_Log.err);
+ }
+ return null;
+ }
+
+ public static Object callConstructor(String aClass, int aConstructorIndex, Object aReplacementObject, boolean aLogErrors, Object... aParameters) {
+ if (aConstructorIndex < 0) {
+ try {
+ for (Constructor tConstructor : Class.forName(aClass).getConstructors()) {
+ try {
+ return tConstructor.newInstance(aParameters);
+ } catch (Throwable e) {/*Do nothing*/}
+ }
+ } catch (Throwable e) {
+ if (aLogErrors) e.printStackTrace(GT_Log.err);
+ }
+ } else {
+ try {
+ return Class.forName(aClass).getConstructors()[aConstructorIndex].newInstance(aParameters);
+ } catch (Throwable e) {
+ if (aLogErrors) e.printStackTrace(GT_Log.err);
+ }
+ }
+ return aReplacementObject;
+ }
+
+ public static String capitalizeString(String aString) {
+ if (aString != null && aString.length() > 0)
+ return aString.substring(0, 1).toUpperCase() + aString.substring(1);
+ return E;
+ }
+
+ public static boolean getPotion(EntityLivingBase aPlayer, int aPotionIndex) {
+ try {
+ Field tPotionHashmap = null;
+
+ Field[] var3 = EntityLiving.class.getDeclaredFields();
+ int var4 = var3.length;
+
+ for (int var5 = 0; var5 < var4; ++var5) {
+ Field var6 = var3[var5];
+ if (var6.getType() == HashMap.class) {
+ tPotionHashmap = var6;
+ tPotionHashmap.setAccessible(true);
+ break;
+ }
+ }
+
+ if (tPotionHashmap != null)
+ return ((HashMap) tPotionHashmap.get(aPlayer)).get(Integer.valueOf(aPotionIndex)) != null;
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ return false;
+ }
+
+ public static String getClassName(Object aObject) {
+ if (aObject == null) return "null";
+ return aObject.getClass().getName().substring(aObject.getClass().getName().lastIndexOf(".") + 1);
+ }
+
+ public static void removePotion(EntityLivingBase aPlayer, int aPotionIndex) {
+ try {
+ Field tPotionHashmap = null;
+
+ Field[] var3 = EntityLiving.class.getDeclaredFields();
+ int var4 = var3.length;
+
+ for (int var5 = 0; var5 < var4; ++var5) {
+ Field var6 = var3[var5];
+ if (var6.getType() == HashMap.class) {
+ tPotionHashmap = var6;
+ tPotionHashmap.setAccessible(true);
+ break;
+ }
+ }
+
+ if (tPotionHashmap != null) ((HashMap) tPotionHashmap.get(aPlayer)).remove(Integer.valueOf(aPotionIndex));
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ }
+
+ public static boolean getFullInvisibility(EntityPlayer aPlayer) {
+ try {
+ if (aPlayer.isInvisible()) {
+ for (int i = 0; i < 4; i++) {
+ if (aPlayer.inventory.armorInventory[i] != null) {
+ if (aPlayer.inventory.armorInventory[i].getItem() instanceof GT_EnergyArmor_Item) {
+ if ((((GT_EnergyArmor_Item) aPlayer.inventory.armorInventory[i].getItem()).mSpecials & 512) != 0) {
+ if (GT_ModHandler.canUseElectricItem(aPlayer.inventory.armorInventory[i], 10000)) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ return false;
+ }
+
+ public static ItemStack suckOneItemStackAt(World aWorld, double aX, double aY, double aZ, double aL, double aH, double aW) {
+ for (EntityItem tItem : (ArrayList<EntityItem>) aWorld.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + aL, aY + aH, aZ + aW))) {
+ if (!tItem.isDead) {
+ aWorld.removeEntity(tItem);
+ tItem.setDead();
+ return tItem.getEntityItem();
+ }
+ }
+ return null;
+ }
+
+ public static byte getOppositeSide(int aSide) {
+ return (byte) ForgeDirection.getOrientation(aSide).getOpposite().ordinal();
+ }
+
+ public static byte getTier(long l) {
+ byte i = -1;
+ while (++i < V.length) if (l <= V[i]) return i;
+ return i;
+ }
+
+ public static void sendChatToPlayer(EntityPlayer aPlayer, String aChatMessage) {
+ if (aPlayer instanceof EntityPlayerMP && aChatMessage != null) {
+ aPlayer.addChatComponentMessage(new ChatComponentText(aChatMessage));
+ }
+ }
+
+ public static void checkAvailabilities() {
+ if (CHECK_ALL) {
+ try {
+ Class tClass = IItemDuct.class;
+ tClass.getCanonicalName();
+ TE_CHECK = true;
+ } catch (Throwable e) {/**/}
+ try {
+ Class tClass = buildcraft.api.transport.IPipeTile.class;
+ tClass.getCanonicalName();
+ BC_CHECK = true;
+ } catch (Throwable e) {/**/}
+ try {
+ Class tClass = cofh.api.energy.IEnergyReceiver.class;
+ tClass.getCanonicalName();
+ RF_CHECK = true;
+ } catch (Throwable e) {/**/}
+ CHECK_ALL = false;
+ }
+ }
+
+ public static boolean isConnectableNonInventoryPipe(Object aTileEntity, int aSide) {
+ if (aTileEntity == null) return false;
+ checkAvailabilities();
+ if (TE_CHECK && aTileEntity instanceof IItemDuct) return true;
+ if (BC_CHECK && aTileEntity instanceof buildcraft.api.transport.IPipeTile)
+ return ((buildcraft.api.transport.IPipeTile) aTileEntity).isPipeConnected(ForgeDirection.getOrientation(aSide));
+ if (GregTech_API.mTranslocator && aTileEntity instanceof codechicken.translocator.TileItemTranslocator) return true;
+
+ return false;
+ }
+ /**
+ * Moves Stack from Inv-Slot to Inv-Slot, without checking if its even allowed.
+ *
+ * @return the Amount of moved Items
+ */
+ public static byte moveStackIntoPipe(IInventory aTileEntity1, Object aTileEntity2, int[] aGrabSlots, int aGrabFrom, int aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) {
+ return moveStackIntoPipe(aTileEntity1, aTileEntity2, aGrabSlots, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, true);
+ }
+
+ /**
+ * Moves Stack from Inv-Slot to Inv-Slot, without checking if its even allowed.
+ *
+ * @return the Amount of moved Items
+ */
+ public static byte moveStackIntoPipe(IInventory aTileEntity1, Object aTileEntity2, int[] aGrabSlots, int aGrabFrom, int aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce, boolean dropItem) {
+ if (aTileEntity1 == null || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMaxMoveAtOnce <= 0 || aMinMoveAtOnce > aMaxMoveAtOnce)
+ return 0;
+ if (aTileEntity2 != null) {
+ checkAvailabilities();
+ if (TE_CHECK && aTileEntity2 instanceof IItemDuct) {
+ for (int i = 0; i < aGrabSlots.length; i++) {
+ if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(aGrabSlots[i]), true, aInvertFilter)) {
+ if (isAllowedToTakeFromSlot(aTileEntity1, aGrabSlots[i], (byte) aGrabFrom, aTileEntity1.getStackInSlot(aGrabSlots[i]))) {
+ if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) <= aTileEntity1.getStackInSlot(aGrabSlots[i]).stackSize) {
+ ItemStack tStack = copyAmount(Math.min(aTileEntity1.getStackInSlot(aGrabSlots[i]).stackSize, Math.min(aMaxMoveAtOnce, aMaxTargetStackSize)), aTileEntity1.getStackInSlot(aGrabSlots[i]));
+ ItemStack rStack = ((IItemDuct) aTileEntity2).insertItem(ForgeDirection.getOrientation(aPutTo), copy(tStack));
+ byte tMovedItemCount = (byte) (tStack.stackSize - (rStack == null ? 0 : rStack.stackSize));
+ if (tMovedItemCount >= 1/*Math.max(aMinMoveAtOnce, aMinTargetStackSize)*/) {
+ //((cofh.api.transport.IItemConduit)aTileEntity2).insertItem(ForgeDirection.getOrientation(aPutTo), copyAmount(tMovedItemCount, tStack), F);
+ aTileEntity1.decrStackSize(aGrabSlots[i], tMovedItemCount);
+ aTileEntity1.markDirty();
+ return tMovedItemCount;
+ }
+ }
+ }
+ }
+ }
+ return 0;
+ }
+ if (BC_CHECK && aTileEntity2 instanceof buildcraft.api.transport.IPipeTile) {
+ for (int i = 0; i < aGrabSlots.length; i++) {
+ if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(aGrabSlots[i]), true, aInvertFilter)) {
+ if (isAllowedToTakeFromSlot(aTileEntity1, aGrabSlots[i], (byte) aGrabFrom, aTileEntity1.getStackInSlot(aGrabSlots[i]))) {
+ if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) <= aTileEntity1.getStackInSlot(aGrabSlots[i]).stackSize) {
+ ItemStack tStack = copyAmount(Math.min(aTileEntity1.getStackInSlot(aGrabSlots[i]).stackSize, Math.min(aMaxMoveAtOnce, aMaxTargetStackSize)), aTileEntity1.getStackInSlot(aGrabSlots[i]));
+ byte tMovedItemCount = (byte) ((buildcraft.api.transport.IPipeTile) aTileEntity2).injectItem(copy(tStack), false, ForgeDirection.getOrientation(aPutTo));
+ if (tMovedItemCount >= Math.max(aMinMoveAtOnce, aMinTargetStackSize)) {
+ tMovedItemCount = (byte) (((buildcraft.api.transport.IPipeTile) aTileEntity2).injectItem(copyAmount(tMovedItemCount, tStack), true, ForgeDirection.getOrientation(aPutTo)));
+ aTileEntity1.decrStackSize(aGrabSlots[i], tMovedItemCount);
+ aTileEntity1.markDirty();
+ return tMovedItemCount;
+ }
+ }
+ }
+ }
+ }
+ return 0;
+ }
+ }
+
+ ForgeDirection tDirection = ForgeDirection.getOrientation(aGrabFrom);
+ if (aTileEntity1 instanceof TileEntity && tDirection != ForgeDirection.UNKNOWN && tDirection.getOpposite() == ForgeDirection.getOrientation(aPutTo)) {
+ int tX = ((TileEntity) aTileEntity1).xCoord + tDirection.offsetX, tY = ((TileEntity) aTileEntity1).yCoord + tDirection.offsetY, tZ = ((TileEntity) aTileEntity1).zCoord + tDirection.offsetZ;
+ if (!hasBlockHitBox(((TileEntity) aTileEntity1).getWorldObj(), tX, tY, tZ) && dropItem) {
+ for (int i = 0; i < aGrabSlots.length; i++) {
+ if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(aGrabSlots[i]), true, aInvertFilter)) {
+ if (isAllowedToTakeFromSlot(aTileEntity1, aGrabSlots[i], (byte) aGrabFrom, aTileEntity1.getStackInSlot(aGrabSlots[i]))) {
+ if (Math.max(aMinMoveAtOnce, aMinTargetStackSize) <= aTileEntity1.getStackInSlot(aGrabSlots[i]).stackSize) {
+ ItemStack tStack = copyAmount(Math.min(aTileEntity1.getStackInSlot(aGrabSlots[i]).stackSize, Math.min(aMaxMoveAtOnce, aMaxTargetStackSize)), aTileEntity1.getStackInSlot(aGrabSlots[i]));
+ EntityItem tEntity = new EntityItem(((TileEntity) aTileEntity1).getWorldObj(), tX + 0.5, tY + 0.5, tZ + 0.5, tStack);
+ tEntity.motionX = tEntity.motionY = tEntity.motionZ = 0;
+ ((TileEntity) aTileEntity1).getWorldObj().spawnEntityInWorld(tEntity);
+ aTileEntity1.decrStackSize(aGrabSlots[i], tStack.stackSize);
+ aTileEntity1.markDirty();
+ return (byte) tStack.stackSize;
+ }
+ }
+ }
+ }
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * Moves Stack from Inv-Slot to Inv-Slot, without checking if its even allowed. (useful for internal Inventory Operations)
+ *
+ * @return the Amount of moved Items
+ */
+ public static byte moveStackFromSlotAToSlotB(IInventory aTileEntity1, IInventory aTileEntity2, int aGrabFrom, int aPutTo, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) {
+ if (aTileEntity1 == null || aTileEntity2 == null || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMaxMoveAtOnce <= 0 || aMinMoveAtOnce > aMaxMoveAtOnce)
+ return 0;
+
+ ItemStack tStack1 = aTileEntity1.getStackInSlot(aGrabFrom), tStack2 = aTileEntity2.getStackInSlot(aPutTo), tStack3 = null;
+ if (tStack1 != null) {
+ if (tStack2 != null && !areStacksEqual(tStack1, tStack2)) return 0;
+ tStack3 = copy(tStack1);
+ aMaxTargetStackSize = (byte) Math.min(aMaxTargetStackSize, Math.min(tStack3.getMaxStackSize(), Math.min(tStack2 == null ? Integer.MAX_VALUE : tStack2.getMaxStackSize(), aTileEntity2.getInventoryStackLimit())));
+ tStack3.stackSize = Math.min(tStack3.stackSize, aMaxTargetStackSize - (tStack2 == null ? 0 : tStack2.stackSize));
+ if (tStack3.stackSize > aMaxMoveAtOnce) tStack3.stackSize = aMaxMoveAtOnce;
+ if (tStack3.stackSize + (tStack2 == null ? 0 : tStack2.stackSize) >= Math.min(tStack3.getMaxStackSize(), aMinTargetStackSize) && tStack3.stackSize >= aMinMoveAtOnce) {
+ tStack3 = aTileEntity1.decrStackSize(aGrabFrom, tStack3.stackSize);
+ aTileEntity1.markDirty();
+ if (tStack3 != null) {
+ if (tStack2 == null) {
+ aTileEntity2.setInventorySlotContents(aPutTo, copy(tStack3));
+ aTileEntity2.markDirty();
+ } else {
+ tStack2.stackSize += tStack3.stackSize;
+ aTileEntity2.markDirty();
+ }
+ return (byte) tStack3.stackSize;
+ }
+ }
+ }
+ return 0;
+ }
+
+ public static boolean isAllowedToTakeFromSlot(IInventory aTileEntity, int aSlot, byte aSide, ItemStack aStack) {
+ if (ForgeDirection.getOrientation(aSide) == ForgeDirection.UNKNOWN) {
+ return isAllowedToTakeFromSlot(aTileEntity, aSlot, (byte) 0, aStack)
+ || isAllowedToTakeFromSlot(aTileEntity, aSlot, (byte) 1, aStack)
+ || isAllowedToTakeFromSlot(aTileEntity, aSlot, (byte) 2, aStack)
+ || isAllowedToTakeFromSlot(aTileEntity, aSlot, (byte) 3, aStack)
+ || isAllowedToTakeFromSlot(aTileEntity, aSlot, (byte) 4, aStack)
+ || isAllowedToTakeFromSlot(aTileEntity, aSlot, (byte) 5, aStack);
+ }
+ if (aTileEntity instanceof ISidedInventory)
+ return ((ISidedInventory) aTileEntity).canExtractItem(aSlot, aStack, aSide);
+ return true;
+ }
+
+ public static boolean isAllowedToPutIntoSlot(IInventory aTileEntity, int aSlot, byte aSide, ItemStack aStack, byte aMaxStackSize) {
+ ItemStack tStack = aTileEntity.getStackInSlot(aSlot);
+ if (tStack != null && (!areStacksEqual(tStack, aStack) || tStack.stackSize >= tStack.getMaxStackSize()))
+ return false;
+ if (ForgeDirection.getOrientation(aSide) == ForgeDirection.UNKNOWN) {
+ return isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 0, aStack, aMaxStackSize)
+ || isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 1, aStack, aMaxStackSize)
+ || isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 2, aStack, aMaxStackSize)
+ || isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 3, aStack, aMaxStackSize)
+ || isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 4, aStack, aMaxStackSize)
+ || isAllowedToPutIntoSlot(aTileEntity, aSlot, (byte) 5, aStack, aMaxStackSize);
+ }
+ if (aTileEntity instanceof ISidedInventory && !((ISidedInventory) aTileEntity).canInsertItem(aSlot, aStack, aSide))
+ return false;
+ return aSlot < aTileEntity.getSizeInventory() && aTileEntity.isItemValidForSlot(aSlot, aStack);
+ }
+
+ /**
+ * Moves Stack from Inv-Side to Inv-Side.
+ *
+ * @return the Amount of moved Items
+ */
+ public static byte moveOneItemStack(Object aTileEntity1, Object aTileEntity2, byte aGrabFrom, byte aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) {
+ if (aTileEntity1 instanceof IInventory)
+ return moveOneItemStack((IInventory) aTileEntity1, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, true);
+ return 0;
+ }
+
+ /**
+ * This is only because I needed an additional Parameter for the Double Chest Check.
+ */
+ private static byte moveOneItemStack(IInventory aTileEntity1, Object aTileEntity2, byte aGrabFrom, byte aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce, boolean aDoCheckChests) {
+ if (aTileEntity1 == null || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMaxMoveAtOnce <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMinMoveAtOnce > aMaxMoveAtOnce)
+ return 0;
+
+ int[] tGrabSlots = null;
+ if (aTileEntity1 instanceof ISidedInventory)
+ tGrabSlots = ((ISidedInventory) aTileEntity1).getAccessibleSlotsFromSide(aGrabFrom);
+ if (tGrabSlots == null) {
+ tGrabSlots = new int[aTileEntity1.getSizeInventory()];
+ for (int i = 0; i < tGrabSlots.length; i++) tGrabSlots[i] = i;
+ }
+
+ if (aTileEntity2 != null && aTileEntity2 instanceof IInventory) {
+ int[] tPutSlots = null;
+ if (aTileEntity2 instanceof ISidedInventory)
+ tPutSlots = ((ISidedInventory) aTileEntity2).getAccessibleSlotsFromSide(aPutTo);
+
+ if (tPutSlots == null) {
+ tPutSlots = new int[((IInventory) aTileEntity2).getSizeInventory()];
+ for (int i = 0; i < tPutSlots.length; i++) tPutSlots[i] = i;
+ }
+
+ for (int i = 0; i < tGrabSlots.length; i++) {
+ byte tMovedItemCount = 0;
+ for (int j = 0; j < tPutSlots.length; j++) {
+ if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(tGrabSlots[i]), true, aInvertFilter)) {
+ if (isAllowedToTakeFromSlot(aTileEntity1, tGrabSlots[i], aGrabFrom, aTileEntity1.getStackInSlot(tGrabSlots[i]))) {
+ if (isAllowedToPutIntoSlot((IInventory) aTileEntity2, tPutSlots[j], aPutTo, aTileEntity1.getStackInSlot(tGrabSlots[i]), aMaxTargetStackSize)) {
+ tMovedItemCount += moveStackFromSlotAToSlotB(aTileEntity1, (IInventory) aTileEntity2, tGrabSlots[i], tPutSlots[j], aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItemCount), aMinMoveAtOnce);
+ if (tMovedItemCount >= aMaxMoveAtOnce) {
+ return tMovedItemCount;
+
+ }
+ }
+ }
+ }
+ }
+ if (tMovedItemCount > 0) return tMovedItemCount;
+ }
+
+ if (aDoCheckChests && aTileEntity1 instanceof TileEntityChest) {
+ TileEntityChest tTileEntity1 = (TileEntityChest) aTileEntity1;
+ if (tTileEntity1.adjacentChestChecked) {
+ byte tAmount = 0;
+ if (tTileEntity1.adjacentChestXNeg != null) {
+ tAmount = moveOneItemStack(tTileEntity1.adjacentChestXNeg, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false);
+ } else if (tTileEntity1.adjacentChestZNeg != null) {
+ tAmount = moveOneItemStack(tTileEntity1.adjacentChestZNeg, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false);
+ } else if (tTileEntity1.adjacentChestXPos != null) {
+ tAmount = moveOneItemStack(tTileEntity1.adjacentChestXPos, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false);
+ } else if (tTileEntity1.adjacentChestZPos != null) {
+ tAmount = moveOneItemStack(tTileEntity1.adjacentChestZPos, aTileEntity2, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false);
+ }
+ if (tAmount != 0) return tAmount;
+ }
+ }
+ if (aDoCheckChests && aTileEntity2 instanceof TileEntityChest) {
+ TileEntityChest tTileEntity2 = (TileEntityChest) aTileEntity2;
+ if (tTileEntity2.adjacentChestChecked) {
+ byte tAmount = 0;
+ if (tTileEntity2.adjacentChestXNeg != null) {
+ tAmount = moveOneItemStack(aTileEntity1, tTileEntity2.adjacentChestXNeg, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false);
+ } else if (tTileEntity2.adjacentChestZNeg != null) {
+ tAmount = moveOneItemStack(aTileEntity1, tTileEntity2.adjacentChestZNeg, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false);
+ } else if (tTileEntity2.adjacentChestXPos != null) {
+ tAmount = moveOneItemStack(aTileEntity1, tTileEntity2.adjacentChestXPos, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false);
+ } else if (tTileEntity2.adjacentChestZPos != null) {
+ tAmount = moveOneItemStack(aTileEntity1, tTileEntity2.adjacentChestZPos, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, false);
+ }
+ if (tAmount != 0) return tAmount;
+ }
+ }
+ }
+
+ return moveStackIntoPipe(aTileEntity1, aTileEntity2, tGrabSlots, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aDoCheckChests);
+ }
+
+ /**
+ * Moves Stack from Inv-Side to Inv-Slot.
+ *
+ * @return the Amount of moved Items
+ */
+ public static byte moveOneItemStackIntoSlot(Object aTileEntity1, Object aTileEntity2, byte aGrabFrom, int aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) {
+ if (aTileEntity1 == null || !(aTileEntity1 instanceof IInventory) || aPutTo < 0 || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMaxMoveAtOnce <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMinMoveAtOnce > aMaxMoveAtOnce)
+ return 0;
+
+ int[] tGrabSlots = null;
+ if (aTileEntity1 instanceof ISidedInventory)
+ tGrabSlots = ((ISidedInventory) aTileEntity1).getAccessibleSlotsFromSide(aGrabFrom);
+ if (tGrabSlots == null) {
+ tGrabSlots = new int[((IInventory) aTileEntity1).getSizeInventory()];
+ for (int i = 0; i < tGrabSlots.length; i++) tGrabSlots[i] = i;
+ }
+
+ if (aTileEntity2 instanceof IInventory) {
+ for (int i = 0; i < tGrabSlots.length; i++) {
+ if (listContainsItem(aFilter, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlots[i]), true, aInvertFilter)) {
+ if (isAllowedToTakeFromSlot((IInventory) aTileEntity1, tGrabSlots[i], aGrabFrom, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlots[i]))) {
+ if (isAllowedToPutIntoSlot((IInventory) aTileEntity2, aPutTo, (byte) 6, ((IInventory) aTileEntity1).getStackInSlot(tGrabSlots[i]), aMaxTargetStackSize)) {
+ byte tMovedItemCount = moveStackFromSlotAToSlotB((IInventory) aTileEntity1, (IInventory) aTileEntity2, tGrabSlots[i], aPutTo, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce);
+ if (tMovedItemCount > 0) return tMovedItemCount;
+ }
+ }
+ }
+ }
+ }
+
+ moveStackIntoPipe(((IInventory) aTileEntity1), aTileEntity2, tGrabSlots, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce);
+ return 0;
+ }
+
+ /**
+ * Moves Stack from Inv-Slot to Inv-Slot.
+ *
+ * @return the Amount of moved Items
+ */
+ public static byte moveFromSlotToSlot(IInventory aTileEntity1, IInventory aTileEntity2, int aGrabFrom, int aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce) {
+ if (aTileEntity1 == null || aTileEntity2 == null || aGrabFrom < 0 || aPutTo < 0 || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMaxMoveAtOnce <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMinMoveAtOnce > aMaxMoveAtOnce)
+ return 0;
+ if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(aGrabFrom), true, aInvertFilter)) {
+ if (isAllowedToTakeFromSlot(aTileEntity1, aGrabFrom, (byte) 6, aTileEntity1.getStackInSlot(aGrabFrom))) {
+ if (isAllowedToPutIntoSlot(aTileEntity2, aPutTo, (byte) 6, aTileEntity1.getStackInSlot(aGrabFrom), aMaxTargetStackSize)) {
+ byte tMovedItemCount = moveStackFromSlotAToSlotB(aTileEntity1, aTileEntity2, aGrabFrom, aPutTo, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce);
+ if (tMovedItemCount > 0) return tMovedItemCount;
+ }
+ }
+ }
+ return 0;
+ }
+
+ public static boolean listContainsItem(Collection<ItemStack> aList, ItemStack aStack, boolean aTIfListEmpty, boolean aInvertFilter) {
+ if (aStack == null || aStack.stackSize < 1) return false;
+ if (aList == null) return aTIfListEmpty;
+ while (aList.contains(null)) aList.remove(null);
+ if (aList.size() < 1) return aTIfListEmpty;
+ Iterator<ItemStack> tIterator = aList.iterator();
+ ItemStack tStack = null;
+ while (tIterator.hasNext())
+ if ((tStack = tIterator.next()) != null && areStacksEqual(aStack, tStack)) return !aInvertFilter;
+ return aInvertFilter;
+ }
+
+ public static boolean areStacksOrToolsEqual(ItemStack aStack1, ItemStack aStack2) {
+ if (aStack1 != null && aStack2 != null && aStack1.getItem() == aStack2.getItem()) {
+ if (aStack1.getItem().isDamageable()) return true;
+ return ((aStack1.getTagCompound() == null) == (aStack2.getTagCompound() == null)) && (aStack1.getTagCompound() == null || aStack1.getTagCompound().equals(aStack2.getTagCompound())) && (Items.feather.getDamage(aStack1) == Items.feather.getDamage(aStack2) || Items.feather.getDamage(aStack1) == W || Items.feather.getDamage(aStack2) == W);
+ }
+ return false;
+ }
+
+ public static boolean areFluidsEqual(FluidStack aFluid1, FluidStack aFluid2) {
+ return areFluidsEqual(aFluid1, aFluid2, false);
+ }
+
+ public static boolean areFluidsEqual(FluidStack aFluid1, FluidStack aFluid2, boolean aIgnoreNBT) {
+ return aFluid1 != null && aFluid2 != null && aFluid1.getFluid() == aFluid2.getFluid() && (aIgnoreNBT || ((aFluid1.tag == null) == (aFluid2.tag == null)) && (aFluid1.tag == null || aFluid1.tag.equals(aFluid2.tag)));
+ }
+
+ public static boolean areStacksEqual(ItemStack aStack1, ItemStack aStack2) {
+ return areStacksEqual(aStack1, aStack2, false);
+ }
+
+ public static boolean areStacksEqual(ItemStack aStack1, ItemStack aStack2, boolean aIgnoreNBT) {
+ return aStack1 != null && aStack2 != null && aStack1.getItem() == aStack2.getItem() && (aIgnoreNBT || ((aStack1.getTagCompound() == null) == (aStack2.getTagCompound() == null)) && (aStack1.getTagCompound() == null || aStack1.getTagCompound().equals(aStack2.getTagCompound()))) && (Items.feather.getDamage(aStack1) == Items.feather.getDamage(aStack2) || Items.feather.getDamage(aStack1) == W || Items.feather.getDamage(aStack2) == W);
+ }
+
+ public static boolean areUnificationsEqual(ItemStack aStack1, ItemStack aStack2) {
+ return areUnificationsEqual(aStack1, aStack2, false);
+ }
+
+ public static boolean areUnificationsEqual(ItemStack aStack1, ItemStack aStack2, boolean aIgnoreNBT) {
+ return areStacksEqual(GT_OreDictUnificator.get(aStack1), GT_OreDictUnificator.get(aStack2), aIgnoreNBT);
+ }
+
+ public static String getFluidName(Fluid aFluid, boolean aLocalized) {
+ if (aFluid == null) return E;
+ String rName = aLocalized ? aFluid.getLocalizedName(new FluidStack(aFluid, 0)) : aFluid.getUnlocalizedName();
+ if (rName.contains("fluid.") || rName.contains("tile."))
+ return capitalizeString(rName.replaceAll("fluid.", E).replaceAll("tile.", E));
+ return rName;
+ }
+
+ public static String getFluidName(FluidStack aFluid, boolean aLocalized) {
+ if (aFluid == null) return E;
+ return getFluidName(aFluid.getFluid(), aLocalized);
+ }
+
+ public static void reInit() {
+ sFilledContainerToData.clear();
+ sEmptyContainerToFluidToData.clear();
+ for (FluidContainerData tData : sFluidContainerList) {
+ sFilledContainerToData.put(new GT_ItemStack(tData.filledContainer), tData);
+ Map<Fluid, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData.get(new GT_ItemStack(tData.emptyContainer));
+ if (tFluidToContainer == null) {
+ sEmptyContainerToFluidToData.put(new GT_ItemStack(tData.emptyContainer), tFluidToContainer = new /*Concurrent*/HashMap<Fluid, FluidContainerData>());
+ GregTech_API.sFluidMappings.add(tFluidToContainer);
+ }
+ tFluidToContainer.put(tData.fluid.getFluid(), tData);
+ }
+ }
+
+ public static void addFluidContainerData(FluidContainerData aData) {
+ sFluidContainerList.add(aData);
+ sFilledContainerToData.put(new GT_ItemStack(aData.filledContainer), aData);
+ Map<Fluid, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData.get(new GT_ItemStack(aData.emptyContainer));
+ if (tFluidToContainer == null) {
+ sEmptyContainerToFluidToData.put(new GT_ItemStack(aData.emptyContainer), tFluidToContainer = new /*Concurrent*/HashMap<Fluid, FluidContainerData>());
+ GregTech_API.sFluidMappings.add(tFluidToContainer);
+ }
+ tFluidToContainer.put(aData.fluid.getFluid(), aData);
+ }
+
+ public static ItemStack fillFluidContainer(FluidStack aFluid, ItemStack aStack, boolean aRemoveFluidDirectly, boolean aCheckIFluidContainerItems) {
+ if (isStackInvalid(aStack) || aFluid == null) return null;
+ if (GT_ModHandler.isWater(aFluid) && ItemList.Bottle_Empty.isStackEqual(aStack)) {
+ if (aFluid.amount >= 250) {
+ if (aRemoveFluidDirectly) aFluid.amount -= 250;
+ return new ItemStack(Items.potionitem, 1, 0);
+ }
+ return null;
+ }
+ if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getFluid(aStack) == null && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) <= aFluid.amount) {
+ if (aRemoveFluidDirectly)
+ aFluid.amount -= ((IFluidContainerItem) aStack.getItem()).fill(aStack = copyAmount(1, aStack), aFluid, true);
+ else
+ ((IFluidContainerItem) aStack.getItem()).fill(aStack = copyAmount(1, aStack), aFluid, true);
+ return aStack;
+ }
+ Map<Fluid, FluidContainerData> tFluidToContainer = sEmptyContainerToFluidToData.get(new GT_ItemStack(aStack));
+ if (tFluidToContainer == null) return null;
+ FluidContainerData tData = tFluidToContainer.get(aFluid.getFluid());
+ if (tData == null || tData.fluid.amount > aFluid.amount) return null;
+ if (aRemoveFluidDirectly) aFluid.amount -= tData.fluid.amount;
+ return copyAmount(1, tData.filledContainer);
+ }
+
+ public static ItemStack getFluidDisplayStack(Fluid aFluid) {
+ return aFluid == null ? null : getFluidDisplayStack(new FluidStack(aFluid, 0), false);
+ }
+
+ public static ItemStack getFluidDisplayStack(FluidStack aFluid, boolean aUseStackSize) {
+ if (aFluid == null || aFluid.getFluid() == null) return null;
+ int tmp = 0;
+ try {
+ tmp = aFluid.getFluid().getID();
+ } catch (Exception e) {
+ System.err.println(e);
+ }
+ ItemStack rStack = ItemList.Display_Fluid.getWithDamage(aUseStackSize ? aFluid.amount / 1000 : 1, tmp);
+ NBTTagCompound tNBT = new NBTTagCompound();
+ tNBT.setLong("mFluidDisplayAmount", aFluid.amount);
+ tNBT.setLong("mFluidDisplayHeat", aFluid.getFluid().getTemperature(aFluid));
+ tNBT.setBoolean("mFluidState", aFluid.getFluid().isGaseous(aFluid));
+ rStack.setTagCompound(tNBT);
+ return rStack;
+ }
+
+ public static boolean containsFluid(ItemStack aStack, FluidStack aFluid, boolean aCheckIFluidContainerItems) {
+ if (isStackInvalid(aStack) || aFluid == null) return false;
+ if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0)
+ return aFluid.isFluidEqual(((IFluidContainerItem) aStack.getItem()).getFluid(aStack = copyAmount(1, aStack)));
+ FluidContainerData tData = sFilledContainerToData.get(new GT_ItemStack(aStack));
+ return tData == null ? false : tData.fluid.isFluidEqual(aFluid);
+ }
+
+ public static FluidStack getFluidForFilledItem(ItemStack aStack, boolean aCheckIFluidContainerItems) {
+ if (isStackInvalid(aStack)) return null;
+ if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0)
+ return ((IFluidContainerItem) aStack.getItem()).drain(copyAmount(1, aStack), Integer.MAX_VALUE, true);
+ FluidContainerData tData = sFilledContainerToData.get(new GT_ItemStack(aStack));
+ return tData == null ? null : tData.fluid.copy();
+ }
+
+ public static ItemStack getContainerForFilledItem(ItemStack aStack, boolean aCheckIFluidContainerItems) {
+ if (isStackInvalid(aStack)) return null;
+ FluidContainerData tData = sFilledContainerToData.get(new GT_ItemStack(aStack));
+ if (tData != null) return copyAmount(1, tData.emptyContainer);
+ if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) {
+ ((IFluidContainerItem) aStack.getItem()).drain(aStack = copyAmount(1, aStack), Integer.MAX_VALUE, true);
+ return aStack;
+ }
+ return null;
+ }
+
+ public static ItemStack getContainerItem(ItemStack aStack, boolean aCheckIFluidContainerItems) {
+ if (isStackInvalid(aStack)) return null;
+ if (aStack.getItem().hasContainerItem(aStack)) return aStack.getItem().getContainerItem(aStack);
+ /** These are all special Cases, in which it is intended to have only GT Blocks outputting those Container Items */
+ if (ItemList.Cell_Empty.isStackEqual(aStack, false, true)) return null;
+ if (ItemList.IC2_Fuel_Can_Filled.isStackEqual(aStack, false, true)) return ItemList.IC2_Fuel_Can_Empty.get(1);
+ if (aStack.getItem() == Items.potionitem || aStack.getItem() == Items.experience_bottle || ItemList.TF_Vial_FieryBlood.isStackEqual(aStack) || ItemList.TF_Vial_FieryTears.isStackEqual(aStack))
+ return ItemList.Bottle_Empty.get(1);
+
+ if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) {
+ ItemStack tStack = copyAmount(1, aStack);
+ ((IFluidContainerItem) aStack.getItem()).drain(tStack, Integer.MAX_VALUE, true);
+ if (!areStacksEqual(aStack, tStack)) return tStack;
+ return null;
+ }
+
+ int tCapsuleCount = GT_ModHandler.getCapsuleCellContainerCount(aStack);
+ if (tCapsuleCount > 0) return ItemList.Cell_Empty.get(tCapsuleCount);
+
+ if (ItemList.IC2_ForgeHammer.isStackEqual(aStack) || ItemList.IC2_WireCutter.isStackEqual(aStack))
+ return copyMetaData(Items.feather.getDamage(aStack) + 1, aStack);
+ return null;
+ }
+
+ public static synchronized boolean removeIC2BottleRecipe(ItemStack aContainer, ItemStack aInput, Map<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> aRecipeList, ItemStack aOutput){
+ if ((isStackInvalid(aInput) && isStackInvalid(aOutput) && isStackInvalid(aContainer)) || aRecipeList == null) return false;
+ boolean rReturn = false;
+ Iterator<Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput>> tIterator = aRecipeList.entrySet().iterator();
+ aOutput = GT_OreDictUnificator.get(aOutput);
+ while (tIterator.hasNext()) {
+ Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> tEntry = tIterator.next();
+ if (aInput == null || tEntry.getKey().matches(aContainer, aInput)) {
+ List<ItemStack> tList = tEntry.getValue().items;
+ if (tList != null) for (ItemStack tOutput : tList)
+ if (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput)) {
+ tIterator.remove();
+ rReturn = true;
+ break;
+ }
+ }
+ }
+ return rReturn;
+ }
+
+ public static synchronized boolean removeSimpleIC2MachineRecipe(ItemStack aInput, Map<IRecipeInput, RecipeOutput> aRecipeList, ItemStack aOutput) {
+ if ((isStackInvalid(aInput) && isStackInvalid(aOutput)) || aRecipeList == null) return false;
+ boolean rReturn = false;
+ Iterator<Map.Entry<IRecipeInput, RecipeOutput>> tIterator = aRecipeList.entrySet().iterator();
+ aOutput = GT_OreDictUnificator.get(aOutput);
+ while (tIterator.hasNext()) {
+ Map.Entry<IRecipeInput, RecipeOutput> tEntry = tIterator.next();
+ if (aInput == null || tEntry.getKey().matches(aInput)) {
+ List<ItemStack> tList = tEntry.getValue().items;
+ if (tList != null) for (ItemStack tOutput : tList)
+ if (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput)) {
+ tIterator.remove();
+ rReturn = true;
+ break;
+ }
+ }
+ }
+ return rReturn;
+ }
+
+ public static boolean addSimpleIC2MachineRecipe(ItemStack aInput, Map<IRecipeInput, RecipeOutput> aRecipeList, NBTTagCompound aNBT, Object... aOutput) {
+ if (isStackInvalid(aInput) || aOutput.length == 0 || aRecipeList == null) return false;
+ ItemData tOreName = GT_OreDictUnificator.getAssociation(aInput);
+ for (int i = 0; i < aOutput.length; i++) {
+ if (aOutput[i] == null) {
+ GT_FML_LOGGER.info("EmptyIC2Output!" + aInput.getUnlocalizedName());
+ return false;
+ }
+ }
+ ItemStack[] tStack = GT_OreDictUnificator.getStackArray(true, aOutput);
+ if(tStack==null||(tStack.length>0&>_Utility.areStacksEqual(aInput, tStack[0])))return false;
+ if (tOreName != null) {
+ if(tOreName.toString().equals("dustAsh")&&tStack[0].getUnlocalizedName().equals("tile.volcanicAsh"))return false;
+ aRecipeList.put(new RecipeInputOreDict(tOreName.toString(), aInput.stackSize), new RecipeOutput(aNBT, tStack));
+ } else {
+ aRecipeList.put(new RecipeInputItemStack(copy(aInput), aInput.stackSize), new RecipeOutput(aNBT, tStack));
+ }
+ return true;
+ }
+
+ public static ItemStack getWrittenBook(String aMapping, ItemStack aStackToPutNBT) {
+ if (isStringInvalid(aMapping)) return null;
+ ItemStack rStack = GregTech_API.sBookList.get(aMapping);
+ if (rStack == null) return aStackToPutNBT;
+ if (aStackToPutNBT != null) {
+ aStackToPutNBT.setTagCompound(rStack.getTagCompound());
+ return aStackToPutNBT;
+ }
+ return copyAmount(1, rStack);
+ }
+
+ public static ItemStack getWrittenBook(String aMapping, String aTitle, String aAuthor, String... aPages) {
+ if (isStringInvalid(aMapping)) return null;
+ ItemStack rStack = GregTech_API.sBookList.get(aMapping);
+ if (rStack != null) return copyAmount(1, rStack);
+ if (isStringInvalid(aTitle) || isStringInvalid(aAuthor) || aPages.length <= 0) return null;
+ sBookCount++;
+ rStack = new ItemStack(Items.written_book, 1);
+ NBTTagCompound tNBT = new NBTTagCompound();
+ tNBT.setString("title", GT_LanguageManager.addStringLocalization("Book." + aTitle + ".Name", aTitle));
+ tNBT.setString("author", aAuthor);
+ NBTTagList tNBTList = new NBTTagList();
+ for (byte i = 0; i < aPages.length; i++) {
+ aPages[i] = GT_LanguageManager.addStringLocalization("Book." + aTitle + ".Page" + ((i < 10) ? "0" + i : i), aPages[i]);
+ if (i < 48) {
+ if (aPages[i].length() < 256)
+ tNBTList.appendTag(new NBTTagString(aPages[i]));
+ else
+ GT_Log.err.println("WARNING: String for written Book too long! -> " + aPages[i]);
+ } else {
+ GT_Log.err.println("WARNING: Too much Pages for written Book! -> " + aTitle);
+ break;
+ }
+ }
+ tNBTList.appendTag(new NBTTagString("Credits to " + aAuthor + " for writing this Book. This was Book Nr. " + sBookCount + " at its creation. Gotta get 'em all!"));
+ tNBT.setTag("pages", tNBTList);
+ rStack.setTagCompound(tNBT);
+ GT_Log.out.println("GT_Mod: Added Book to Book List - Mapping: '" + aMapping + "' - Name: '" + aTitle + "' - Author: '" + aAuthor + "'");
+ GregTech_API.sBookList.put(aMapping, rStack);
+ return copy(rStack);
+ }
+
+ public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength) {
+ return doSoundAtClient(aSoundName, aTimeUntilNextSound, aSoundStrength, GT.getThePlayer());
+ }
+
+ public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength, Entity aEntity) {
+ if (aEntity == null) return false;
+ return doSoundAtClient(aSoundName, aTimeUntilNextSound, aSoundStrength, aEntity.posX, aEntity.posY, aEntity.posZ);
+ }
+
+ public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength, double aX, double aY, double aZ) {
+ return doSoundAtClient(aSoundName, aTimeUntilNextSound, aSoundStrength, 1.01818028F, aX, aY, aZ);
+ }
+
+ public static boolean doSoundAtClient(String aSoundName, int aTimeUntilNextSound, float aSoundStrength, float aSoundModulation, double aX, double aY, double aZ) {
+ if (isStringInvalid(aSoundName) || !FMLCommonHandler.instance().getEffectiveSide().isClient() || GT.getThePlayer() == null || !GT.getThePlayer().worldObj.isRemote)
+ return false;
+ if (GregTech_API.sMultiThreadedSounds)
+ new Thread(new GT_Runnable_Sound(GT.getThePlayer().worldObj, MathHelper.floor_double(aX), MathHelper.floor_double(aY), MathHelper.floor_double(aZ), aTimeUntilNextSound, aSoundName, aSoundStrength, aSoundModulation), "Sound Effect").start();
+ else
+ new GT_Runnable_Sound(GT.getThePlayer().worldObj, MathHelper.floor_double(aX), MathHelper.floor_double(aY), MathHelper.floor_double(aZ), aTimeUntilNextSound, aSoundName, aSoundStrength, aSoundModulation).run();
+ return true;
+ }
+
+ public static boolean sendSoundToPlayers(World aWorld, String aSoundName, float aSoundStrength, float aSoundModulation, int aX, int aY, int aZ) {
+ if (isStringInvalid(aSoundName) || aWorld == null || aWorld.isRemote) return false;
+ NW.sendPacketToAllPlayersInRange(aWorld, new GT_Packet_Sound(aSoundName, aSoundStrength, aSoundModulation, aX, (short) aY, aZ), aX, aZ);
+ return true;
+ }
+
+ public static int stackToInt(ItemStack aStack) {
+ if (isStackInvalid(aStack)) return 0;
+ return Item.getIdFromItem(aStack.getItem()) | (Items.feather.getDamage(aStack) << 16);
+ }
+
+ public static int stackToWildcard(ItemStack aStack) {
+ if (isStackInvalid(aStack)) return 0;
+ return Item.getIdFromItem(aStack.getItem()) | (W << 16);
+ }
+
+ public static ItemStack intToStack(int aStack) {
+ int tID = aStack & (~0 >>> 16), tMeta = aStack >>> 16;
+ Item tItem = Item.getItemById(tID);
+ if (tItem != null) return new ItemStack(tItem, 1, tMeta);
+ return null;
+ }
+
+ public static Integer[] stacksToIntegerArray(ItemStack... aStacks) {
+ Integer[] rArray = new Integer[aStacks.length];
+ for (int i = 0; i < rArray.length; i++) {
+ rArray[i] = stackToInt(aStacks[i]);
+ }
+ return rArray;
+ }
+
+ public static int[] stacksToIntArray(ItemStack... aStacks) {
+ int[] rArray = new int[aStacks.length];
+ for (int i = 0; i < rArray.length; i++) {
+ rArray[i] = stackToInt(aStacks[i]);
+ }
+ return rArray;
+ }
+
+ public static boolean arrayContains(Object aObject, Object... aObjects) {
+ return listContains(aObject, Arrays.asList(aObjects));
+ }
+
+ public static boolean listContains(Object aObject, Collection aObjects) {
+ if (aObjects == null) return false;
+ return aObjects.contains(aObject);
+ }
+
+ public static <T> boolean arrayContainsNonNull(T... aArray) {
+ if (aArray != null) for (Object tObject : aArray) if (tObject != null) return true;
+ return false;
+ }
+
+ public static <T> ArrayList<T> getArrayListWithoutNulls(T... aArray) {
+ if (aArray == null) return new ArrayList<T>();
+ ArrayList<T> rList = new ArrayList<T>(Arrays.asList(aArray));
+ for (int i = 0; i < rList.size(); i++) if (rList.get(i) == null) rList.remove(i--);
+ return rList;
+ }
+
+ public static <T> ArrayList<T> getArrayListWithoutTrailingNulls(T... aArray) {
+ if (aArray == null) return new ArrayList<T>();
+ ArrayList<T> rList = new ArrayList<T>(Arrays.asList(aArray));
+ for (int i = rList.size() - 1; i >= 0 && rList.get(i) == null; ) rList.remove(i--);
+ return rList;
+ }
+
+ public static Block getBlock(Object aBlock) {
+ return (Block) aBlock;
+ }
+
+ public static Block getBlockFromStack(ItemStack itemStack) {
+ if (isStackInvalid(itemStack)) return Blocks.air;
+ return getBlockFromItem(itemStack.getItem());
+ }
+
+ public static Block getBlockFromItem(Item item) {
+ return Block.getBlockFromItem(item);
+ }
+
+ public static boolean isBlockValid(Object aBlock) {
+ return (aBlock instanceof Block);
+ }
+
+ public static boolean isBlockInvalid(Object aBlock) {
+ return aBlock == null || !(aBlock instanceof Block);
+ }
+
+ public static boolean isStringValid(Object aString) {
+ return aString != null && !aString.toString().isEmpty();
+ }
+
+ public static boolean isStringInvalid(Object aString) {
+ return aString == null || aString.toString().isEmpty();
+ }
+
+ public static boolean isStackValid(Object aStack) {
+ return (aStack instanceof ItemStack) && ((ItemStack) aStack).getItem() != null && ((ItemStack) aStack).stackSize >= 0;
+ }
+
+ public static boolean isStackInvalid(Object aStack) {
+ return aStack == null || !(aStack instanceof ItemStack) || ((ItemStack) aStack).getItem() == null || ((ItemStack) aStack).stackSize < 0;
+ }
+
+ public static boolean isDebugItem(ItemStack aStack) {
+ return /*ItemList.Armor_Cheat.isStackEqual(aStack, T, T) || */areStacksEqual(GT_ModHandler.getIC2Item("debug", 1), aStack, true);
+ }
+
+ public static ItemStack updateItemStack(ItemStack aStack) {
+ if (isStackValid(aStack) && aStack.getItem() instanceof GT_Generic_Item)
+ ((GT_Generic_Item) aStack.getItem()).isItemStackUsable(aStack);
+ return aStack;
+ }
+
+ public static boolean isOpaqueBlock(World aWorld, int aX, int aY, int aZ) {
+ return aWorld.getBlock(aX, aY, aZ).isOpaqueCube();
+ }
+
+ public static boolean isBlockAir(World aWorld, int aX, int aY, int aZ) {
+ return aWorld.getBlock(aX, aY, aZ).isAir(aWorld, aX, aY, aZ);
+ }
+
+ public static boolean hasBlockHitBox(World aWorld, int aX, int aY, int aZ) {
+ return aWorld.getBlock(aX, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) != null;
+ }
+
+ public static void setCoordsOnFire(World aWorld, int aX, int aY, int aZ, boolean aReplaceCenter) {
+ if (aReplaceCenter)
+ if (aWorld.getBlock(aX, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) == null)
+ aWorld.setBlock(aX, aY, aZ, Blocks.fire);
+ if (aWorld.getBlock(aX + 1, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX + 1, aY, aZ) == null)
+ aWorld.setBlock(aX + 1, aY, aZ, Blocks.fire);
+ if (aWorld.getBlock(aX - 1, aY, aZ).getCollisionBoundingBoxFromPool(aWorld, aX - 1, aY, aZ) == null)
+ aWorld.setBlock(aX - 1, aY, aZ, Blocks.fire);
+ if (aWorld.getBlock(aX, aY + 1, aZ).getCollisionBoundingBoxFromPool(aWorld, aX, aY + 1, aZ) == null)
+ aWorld.setBlock(aX, aY + 1, aZ, Blocks.fire);
+ if (aWorld.getBlock(aX, aY - 1, aZ).getCollisionBoundingBoxFromPool(aWorld, aX, aY - 1, aZ) == null)
+ aWorld.setBlock(aX, aY - 1, aZ, Blocks.fire);
+ if (aWorld.getBlock(aX, aY, aZ + 1).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ + 1) == null)
+ aWorld.setBlock(aX, aY, aZ + 1, Blocks.fire);
+ if (aWorld.getBlock(aX, aY, aZ - 1).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ - 1) == null)
+ aWorld.setBlock(aX, aY, aZ - 1, Blocks.fire);
+ }
+
+ public static ItemStack getProjectile(SubTag aProjectileType, IInventory aInventory) {
+ if (aInventory != null) for (int i = 0, j = aInventory.getSizeInventory(); i < j; i++) {
+ ItemStack rStack = aInventory.getStackInSlot(i);
+ if (isStackValid(rStack) && rStack.getItem() instanceof IProjectileItem && ((IProjectileItem) rStack.getItem()).hasProjectile(aProjectileType, rStack))
+ return updateItemStack(rStack);
+ }
+ return null;
+ }
+
+ public static void removeNullStacksFromInventory(IInventory aInventory) {
+ if (aInventory != null) for (int i = 0, j = aInventory.getSizeInventory(); i < j; i++) {
+ ItemStack tStack = aInventory.getStackInSlot(i);
+ if (tStack != null && (tStack.stackSize == 0 || tStack.getItem() == null))
+ aInventory.setInventorySlotContents(i, null);
+ }
+ }
+
+ /**
+ * Initializes a new texture page.
+ */
+ public static boolean addTexturePage(byte page){
+ if(Textures.BlockIcons.casingTexturePages[page]==null){
+ Textures.BlockIcons.casingTexturePages[page]=new ITexture[128];
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Converts a Number to a String
+ */
+ public static String parseNumberToString(int aNumber) {
+ boolean temp = true, negative = false;
+
+ if (aNumber < 0) {
+ aNumber *= -1;
+ negative = true;
+ }
+
+ StringBuilder tStringB = new StringBuilder();
+ for (int i = 1000000000; i > 0; i /= 10) {
+ int tDigit = (aNumber / i) % 10;
+ if (temp && tDigit != 0) temp = false;
+ if (!temp) {
+ tStringB.append(tDigit);
+ if (i != 1) for (int j = i; j > 0; j /= 1000) if (j == 1) tStringB.append(",");
+ }
+ }
+
+ String tString = tStringB.toString();
+
+ if (tString.equals(E)) tString = "0";
+
+ return negative ? "-" + tString : tString;
+ }
+
+ public static NBTTagCompound getNBTContainingBoolean(NBTTagCompound aNBT, Object aTag, boolean aValue) {
+ if (aNBT == null) aNBT = new NBTTagCompound();
+ aNBT.setBoolean(aTag.toString(), aValue);
+ return aNBT;
+ }
+
+ public static NBTTagCompound getNBTContainingByte(NBTTagCompound aNBT, Object aTag, byte aValue) {
+ if (aNBT == null) aNBT = new NBTTagCompound();
+ aNBT.setByte(aTag.toString(), aValue);
+ return aNBT;
+ }
+
+ public static NBTTagCompound getNBTContainingShort(NBTTagCompound aNBT, Object aTag, short aValue) {
+ if (aNBT == null) aNBT = new NBTTagCompound();
+ aNBT.setShort(aTag.toString(), aValue);
+ return aNBT;
+ }
+
+ public static NBTTagCompound getNBTContainingInteger(NBTTagCompound aNBT, Object aTag, int aValue) {
+ if (aNBT == null) aNBT = new NBTTagCompound();
+ aNBT.setInteger(aTag.toString(), aValue);
+ return aNBT;
+ }
+
+ public static NBTTagCompound getNBTContainingFloat(NBTTagCompound aNBT, Object aTag, float aValue) {
+ if (aNBT == null) aNBT = new NBTTagCompound();
+ aNBT.setFloat(aTag.toString(), aValue);
+ return aNBT;
+ }
+
+ public static NBTTagCompound getNBTContainingDouble(NBTTagCompound aNBT, Object aTag, double aValue) {
+ if (aNBT == null) aNBT = new NBTTagCompound();
+ aNBT.setDouble(aTag.toString(), aValue);
+ return aNBT;
+ }
+
+ public static NBTTagCompound getNBTContainingString(NBTTagCompound aNBT, Object aTag, Object aValue) {
+ if (aNBT == null) aNBT = new NBTTagCompound();
+ if (aValue == null) return aNBT;
+ aNBT.setString(aTag.toString(), aValue.toString());
+ return aNBT;
+ }
+
+ public static boolean isWearingFullFrostHazmat(EntityLivingBase aEntity) {
+ for (byte i = 1; i < 5; i++)
+ if (!isStackInList(aEntity.getEquipmentInSlot(i), GregTech_API.sFrostHazmatList)) return false;
+ return true;
+ }
+
+ public static boolean isWearingFullHeatHazmat(EntityLivingBase aEntity) {
+ for (byte i = 1; i < 5; i++)
+ if (!isStackInList(aEntity.getEquipmentInSlot(i), GregTech_API.sHeatHazmatList)) return false;
+ return true;
+ }
+
+ public static boolean isWearingFullBioHazmat(EntityLivingBase aEntity) {
+ for (byte i = 1; i < 5; i++)
+ if (!isStackInList(aEntity.getEquipmentInSlot(i), GregTech_API.sBioHazmatList)) return false;
+ return true;
+ }
+
+ public static boolean isWearingFullRadioHazmat(EntityLivingBase aEntity) {
+ for (byte i = 1; i < 5; i++)
+ if (!isStackInList(aEntity.getEquipmentInSlot(i), GregTech_API.sRadioHazmatList)) return false;
+ return true;
+ }
+
+ public static boolean isWearingFullElectroHazmat(EntityLivingBase aEntity) {
+ for (byte i = 1; i < 5; i++)
+ if (!isStackInList(aEntity.getEquipmentInSlot(i), GregTech_API.sElectroHazmatList)) return false;
+ return true;
+ }
+
+ public static boolean isWearingFullGasHazmat(EntityLivingBase aEntity) {
+ for (byte i = 1; i < 5; i++)
+ if (!isStackInList(aEntity.getEquipmentInSlot(i), GregTech_API.sGasHazmatList)) return false;
+ return true;
+ }
+
+ public static float getHeatDamageFromItem(ItemStack aStack) {
+ ItemData tData = GT_OreDictUnificator.getItemData(aStack);
+ return tData == null ? 0 : (tData.mPrefix == null ? 0 : tData.mPrefix.mHeatDamage) + (tData.hasValidMaterialData() ? tData.mMaterial.mMaterial.mHeatDamage : 0);
+ }
+
+ public static int getRadioactivityLevel(ItemStack aStack) {
+ ItemData tData = GT_OreDictUnificator.getItemData(aStack);
+ if (tData != null && tData.hasValidMaterialData()) {
+ if (tData.mMaterial.mMaterial.mEnchantmentArmors instanceof Enchantment_Radioactivity)
+ return tData.mMaterial.mMaterial.mEnchantmentArmorsLevel;
+ if (tData.mMaterial.mMaterial.mEnchantmentTools instanceof Enchantment_Radioactivity)
+ return tData.mMaterial.mMaterial.mEnchantmentToolsLevel;
+ }
+ return EnchantmentHelper.getEnchantmentLevel(Enchantment_Radioactivity.INSTANCE.effectId, aStack);
+ }
+
+ public static boolean isImmuneToBreathingGasses(EntityLivingBase aEntity) {
+ return isWearingFullGasHazmat(aEntity);
+ }
+
+ public static boolean applyHeatDamage(EntityLivingBase aEntity, float aDamage) {
+ if (aDamage > 0 && aEntity != null && aEntity.getActivePotionEffect(Potion.fireResistance) == null && !isWearingFullHeatHazmat(aEntity)) {
+ aEntity.attackEntityFrom(GT_DamageSources.getHeatDamage(), aDamage);
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean applyFrostDamage(EntityLivingBase aEntity, float aDamage) {
+ if (aDamage > 0 && aEntity != null && !isWearingFullFrostHazmat(aEntity)) {
+ aEntity.attackEntityFrom(GT_DamageSources.getFrostDamage(), aDamage);
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean applyElectricityDamage(EntityLivingBase aEntity, long aVoltage, long aAmperage) {
+ long aDamage = getTier(aVoltage) * aAmperage * 4;
+ if (aDamage > 0 && aEntity != null && !isWearingFullElectroHazmat(aEntity)) {
+ aEntity.attackEntityFrom(GT_DamageSources.getElectricDamage(), aDamage);
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean applyRadioactivity(EntityLivingBase aEntity, int aLevel, int aAmountOfItems) {
+ if (aLevel > 0 && aEntity != null && aEntity.getCreatureAttribute() != EnumCreatureAttribute.UNDEAD && aEntity.getCreatureAttribute() != EnumCreatureAttribute.ARTHROPOD && !isWearingFullRadioHazmat(aEntity)) {
+ PotionEffect tEffect = null;
+ aEntity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, aLevel * 140 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.moveSlowdown)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7)));
+ aEntity.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, aLevel * 150 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.digSlowdown)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7)));
+ aEntity.addPotionEffect(new PotionEffect(Potion.confusion.id, aLevel * 130 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.confusion)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7)));
+ aEntity.addPotionEffect(new PotionEffect(Potion.weakness.id, aLevel * 150 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.weakness)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7)));
+ aEntity.addPotionEffect(new PotionEffect(Potion.hunger.id, aLevel * 130 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.hunger)) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7)));
+ aEntity.addPotionEffect(new PotionEffect(24 /* IC2 Radiation */, aLevel * 180 * aAmountOfItems + Math.max(0, ((tEffect = aEntity.getActivePotionEffect(Potion.potionTypes[24])) == null ? 0 : tEffect.getDuration())), Math.max(0, (5 * aLevel) / 7)));
+ return true;
+ }
+ return false;
+ }
+
+ public static ItemStack setStack(Object aSetStack, Object aToStack) {
+ if (isStackInvalid(aSetStack) || isStackInvalid(aToStack)) return null;
+ ((ItemStack) aSetStack).func_150996_a(((ItemStack) aToStack).getItem());
+ ((ItemStack) aSetStack).stackSize = ((ItemStack) aToStack).stackSize;
+ Items.feather.setDamage((ItemStack) aSetStack, Items.feather.getDamage((ItemStack) aToStack));
+ ((ItemStack) aSetStack).setTagCompound(((ItemStack) aToStack).getTagCompound());
+ return (ItemStack) aSetStack;
+ }
+
+ public static FluidStack[] copyFluidArray(FluidStack... aStacks) {
+ FluidStack[] rStacks = new FluidStack[aStacks.length];
+ for (int i = 0; i < aStacks.length; i++) if (aStacks[i] != null) rStacks[i] = aStacks[i].copy();
+ return rStacks;
+ }
+
+ public static ItemStack[] copyStackArray(Object... aStacks) {
+ ItemStack[] rStacks = new ItemStack[aStacks.length];
+ for (int i = 0; i < aStacks.length; i++) rStacks[i] = copy(aStacks[i]);
+ return rStacks;
+ }
+
+ public static ItemStack copy(Object... aStacks) {
+ for (Object tStack : aStacks) if (isStackValid(tStack)) return ((ItemStack) tStack).copy();
+ return null;
+ }
+
+ public static ItemStack copyAmount(long aAmount, Object... aStacks) {
+ ItemStack rStack = copy(aStacks);
+ if (isStackInvalid(rStack)) return null;
+ if (aAmount > 64) aAmount = 64;
+ else if (aAmount == -1) aAmount = 111;
+ else if (aAmount < 0) aAmount = 0;
+ rStack.stackSize = (byte) aAmount;
+ return rStack;
+ }
+
+ public static ItemStack copyMetaData(long aMetaData, Object... aStacks) {
+ ItemStack rStack = copy(aStacks);
+ if (isStackInvalid(rStack)) return null;
+ Items.feather.setDamage(rStack, (short) aMetaData);
+ return rStack;
+ }
+
+ public static ItemStack copyAmountAndMetaData(long aAmount, long aMetaData, Object... aStacks) {
+ ItemStack rStack = copyAmount(aAmount, aStacks);
+ if (isStackInvalid(rStack)) return null;
+ Items.feather.setDamage(rStack, (short) aMetaData);
+ return rStack;
+ }
+
+ /**
+ * returns a copy of an ItemStack with its Stacksize being multiplied by aMultiplier
+ */
+ public static ItemStack mul(long aMultiplier, Object... aStacks) {
+ ItemStack rStack = copy(aStacks);
+ if (rStack == null) return null;
+ rStack.stackSize *= aMultiplier;
+ return rStack;
+ }
+
+ /**
+ * Loads an ItemStack properly.
+ */
+ public static ItemStack loadItem(NBTTagCompound aNBT, String aTagName) {
+ return loadItem(aNBT.getCompoundTag(aTagName));
+ }
+
+ public static FluidStack loadFluid(NBTTagCompound aNBT, String aTagName) {
+ return loadFluid(aNBT.getCompoundTag(aTagName));
+ }
+
+ /**
+ * Loads an ItemStack properly.
+ */
+ public static ItemStack loadItem(NBTTagCompound aNBT) {
+ if (aNBT == null) return null;
+ ItemStack rStack = ItemStack.loadItemStackFromNBT(aNBT);
+ try {
+ if (rStack != null && (rStack.getItem().getClass().getName().startsWith("ic2.core.migration"))) {
+ rStack.getItem().onUpdate(rStack, DW, null, 0, false);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ return GT_OreDictUnificator.get(true, rStack);
+ }
+
+ /**
+ * Loads an FluidStack properly.
+ */
+ public static FluidStack loadFluid(NBTTagCompound aNBT) {
+ if (aNBT == null) return null;
+ return FluidStack.loadFluidStackFromNBT(aNBT);
+ }
+
+ public static <E> E selectItemInList(int aIndex, E aReplacement, List<E> aList) {
+ if (aList == null || aList.isEmpty()) return aReplacement;
+ if (aList.size() <= aIndex) return aList.get(aList.size() - 1);
+ if (aIndex < 0) return aList.get(0);
+ return aList.get(aIndex);
+ }
+
+ public static <E> E selectItemInList(int aIndex, E aReplacement, E... aList) {
+ if (aList == null || aList.length == 0) return aReplacement;
+ if (aList.length <= aIndex) return aList[aList.length - 1];
+ if (aIndex < 0) return aList[0];
+ return aList[aIndex];
+ }
+
+ public static boolean isStackInList(ItemStack aStack, Collection<GT_ItemStack> aList) {
+ if (aStack == null) {
+ return false;
+ }
+ return isStackInList(new GT_ItemStack(aStack), aList);
+ }
+
+ public static boolean isStackInList(GT_ItemStack aStack, Collection<GT_ItemStack> aList) {
+ return aStack != null && (aList.contains(aStack) || aList.contains(new GT_ItemStack(aStack.mItem, aStack.mStackSize, W)));
+ }
+
+ /**
+ * re-maps all Keys of a Map after the Keys were weakened.
+ */
+ public static <X, Y> Map<X, Y> reMap(Map<X, Y> aMap) {
+ Map<X, Y> tMap = new /*Concurrent*/HashMap<X, Y>();
+ tMap.putAll(aMap);
+ aMap.clear();
+ aMap.putAll(tMap);
+ return aMap;
+ }
+
+ /**
+ * Why the fuck do neither Java nor Guava have a Function to do this?
+ */
+ public static <X, Y extends Comparable> LinkedHashMap<X, Y> sortMapByValuesAcending(Map<X, Y> aMap) {
+ List<Map.Entry<X, Y>> tEntrySet = new LinkedList<Map.Entry<X, Y>>(aMap.entrySet());
+ Collections.sort(tEntrySet, new Comparator<Map.Entry<X, Y>>() {
+ @Override
+ public int compare(Entry<X, Y> aValue1, Entry<X, Y> aValue2) {
+ return aValue1.getValue().compareTo(aValue2.getValue());
+ }
+ });
+ LinkedHashMap<X, Y> rMap = new LinkedHashMap<X, Y>();
+ for (Map.Entry<X, Y> tEntry : tEntrySet) rMap.put(tEntry.getKey(), tEntry.getValue());
+ return rMap;
+ }
+
+ /**
+ * Why the fuck do neither Java nor Guava have a Function to do this?
+ */
+ public static <X, Y extends Comparable> LinkedHashMap<X, Y> sortMapByValuesDescending(Map<X, Y> aMap) {
+ List<Map.Entry<X, Y>> tEntrySet = new LinkedList<Map.Entry<X, Y>>(aMap.entrySet());
+ Collections.sort(tEntrySet, new Comparator<Map.Entry<X, Y>>() {
+ @Override
+ public int compare(Entry<X, Y> aValue1, Entry<X, Y> aValue2) {
+ return aValue2.getValue().compareTo(aValue1.getValue());//FB: RV - RV_NEGATING_RESULT_OF_COMPARETO
+ }
+ });
+ LinkedHashMap<X, Y> rMap = new LinkedHashMap<X, Y>();
+ for (Map.Entry<X, Y> tEntry : tEntrySet) rMap.put(tEntry.getKey(), tEntry.getValue());
+ return rMap;
+ }
+
+ /**
+ * Translates a Material Amount into an Amount of Fluid in Fluid Material Units.
+ */
+ public static long translateMaterialToFluidAmount(long aMaterialAmount, boolean aRoundUp) {
+ return translateMaterialToAmount(aMaterialAmount, L, aRoundUp);
+ }
+
+ /**
+ * Translates a Material Amount into an Amount of Fluid. Second Parameter for things like Bucket Amounts (1000) and similar
+ */
+ public static long translateMaterialToAmount(long aMaterialAmount, long aAmountPerUnit, boolean aRoundUp) {
+ return Math.max(0, ((aMaterialAmount * aAmountPerUnit) / M) + (aRoundUp && (aMaterialAmount * aAmountPerUnit) % M > 0 ? 1 : 0));
+ }
+
+ /**
+ * This checks if the Dimension is really a Dimension and not another Planet or something.
+ * Used for my Teleporter.
+ */
+ public static boolean isRealDimension(int aDimensionID) {
+ if(aDimensionID<=1 && aDimensionID>=-1 && !GregTech_API.sDimensionalList.contains(aDimensionID)) return true;
+ return !GregTech_API.sDimensionalList.contains(aDimensionID) && DimensionManager.isDimensionRegistered(aDimensionID);
+ }
+
+ //public static boolean isRealDimension(int aDimensionID) {
+ // try {
+ // if (DimensionManager.getProvider(aDimensionID).getClass().getName().contains("com.xcompwiz.mystcraft"))
+ // return true;
+ // } catch (Throwable e) {/*Do nothing*/}
+ // try {
+ // if (DimensionManager.getProvider(aDimensionID).getClass().getName().contains("TwilightForest")) return true;
+ // } catch (Throwable e) {/*Do nothing*/}
+ // try {
+ // if (DimensionManager.getProvider(aDimensionID).getClass().getName().contains("galacticraft")) return true;
+ // } catch (Throwable e) {/*Do nothing*/}
+ // return GregTech_API.sDimensionalList.contains(aDimensionID);
+ //}
+
+ public static boolean moveEntityToDimensionAtCoords(Entity entity, int aDimension, double aX, double aY, double aZ) {
+ //Credit goes to BrandonCore Author :!:
+
+ if (entity == null || entity.worldObj.isRemote) return false;
+ if (entity.ridingEntity != null) entity.mountEntity(null);
+ if (entity.riddenByEntity != null) entity.riddenByEntity.mountEntity(null);
+
+ World startWorld = entity.worldObj;
+ World destinationWorld = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(aDimension);
+
+ if (destinationWorld == null) {return false;}
+
+ boolean interDimensional = startWorld.provider.dimensionId != destinationWorld.provider.dimensionId;
+ if(!interDimensional)return false;
+ startWorld.updateEntityWithOptionalForce(entity, false);//added
+
+ if ((entity instanceof EntityPlayerMP) && interDimensional) {
+ EntityPlayerMP player = (EntityPlayerMP) entity;
+ player.closeScreen();//added
+ player.dimension = aDimension;
+ player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.difficultySetting, destinationWorld.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));
+ ((WorldServer) startWorld).getPlayerManager().removePlayer(player);
+
+ startWorld.playerEntities.remove(player);
+ startWorld.updateAllPlayersSleepingFlag();
+ int i = entity.chunkCoordX;
+ int j = entity.chunkCoordZ;
+ if ((entity.addedToChunk) && (startWorld.getChunkProvider().chunkExists(i, j))) {
+ startWorld.getChunkFromChunkCoords(i, j).removeEntity(entity);
+ startWorld.getChunkFromChunkCoords(i, j).isModified = true;
+ }
+ startWorld.loadedEntityList.remove(entity);
+ startWorld.onEntityRemoved(entity);
+ }
+
+ entity.setLocationAndAngles(aX, aY, aZ, entity.rotationYaw, entity.rotationPitch);
+
+ ((WorldServer) destinationWorld).theChunkProviderServer.loadChunk((int) aX >> 4, (int) aZ >> 4);
+
+ destinationWorld.theProfiler.startSection("placing");
+ if (interDimensional) {
+ if (!(entity instanceof EntityPlayer)) {
+ NBTTagCompound entityNBT = new NBTTagCompound();
+ entity.isDead = false;
+ entityNBT.setString("id", EntityList.getEntityString(entity));
+ entity.writeToNBT(entityNBT);
+ entity.isDead = true;
+ entity = EntityList.createEntityFromNBT(entityNBT, destinationWorld);
+ if (entity == null) {
+ return false;
+ }
+ entity.dimension = destinationWorld.provider.dimensionId;
+ }
+ destinationWorld.spawnEntityInWorld(entity);
+ entity.setWorld(destinationWorld);
+ }
+ entity.setLocationAndAngles(aX, aY, aZ, entity.rotationYaw, entity.rotationPitch);
+
+ destinationWorld.updateEntityWithOptionalForce(entity, false);
+ entity.setLocationAndAngles(aX, aY, aZ, entity.rotationYaw, entity.rotationPitch);
+
+ if ((entity instanceof EntityPlayerMP)) {
+ EntityPlayerMP player = (EntityPlayerMP) entity;
+ if (interDimensional) {
+ player.mcServer.getConfigurationManager().func_72375_a(player, (WorldServer) destinationWorld);
+ }
+ player.playerNetServerHandler.setPlayerLocation(aX, aY, aZ, player.rotationYaw, player.rotationPitch);
+ }
+
+ destinationWorld.updateEntityWithOptionalForce(entity, false);
+
+ if (((entity instanceof EntityPlayerMP)) && interDimensional) {
+ EntityPlayerMP player = (EntityPlayerMP) entity;
+ player.theItemInWorldManager.setWorld((WorldServer) destinationWorld);
+ player.mcServer.getConfigurationManager().updateTimeAndWeatherForPlayer(player, (WorldServer) destinationWorld);
+ player.mcServer.getConfigurationManager().syncPlayerInventory(player);
+
+ for (PotionEffect potionEffect : (Iterable<PotionEffect>) player.getActivePotionEffects()) {
+ player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potionEffect));
+ }
+
+ player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));
+ FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, startWorld.provider.dimensionId, destinationWorld.provider.dimensionId);
+ }
+ entity.setLocationAndAngles(aX, aY, aZ, entity.rotationYaw, entity.rotationPitch);
+
+ destinationWorld.theProfiler.endSection();
+ entity.fallDistance = 0;
+ return true;
+ }
+
+ public static int getScaleCoordinates(double aValue, int aScale) {
+ return (int)Math.floor(aValue / aScale);
+ }
+
+ public static int getCoordinateScan(ArrayList<String> aList, EntityPlayer aPlayer, World aWorld, int aScanLevel, int aX, int aY, int aZ, int aSide, float aClickX, float aClickY, float aClickZ) {
+ if (aList == null) return 0;
+
+ ArrayList<String> tList = new ArrayList<String>();
+ int rEUAmount = 0;
+
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+
+ Block tBlock = aWorld.getBlock(aX, aY, aZ);
+
+ tList.add("----- X: " +EnumChatFormatting.AQUA+ aX +EnumChatFormatting.RESET+ " Y: " +EnumChatFormatting.AQUA+ aY +EnumChatFormatting.RESET+ " Z: " +EnumChatFormatting.AQUA+ aZ +EnumChatFormatting.RESET+ " D: " +EnumChatFormatting.AQUA+ aWorld.provider.dimensionId +EnumChatFormatting.RESET+ " -----");
+ try {
+ if (tTileEntity != null && tTileEntity instanceof IInventory)
+ tList.add(trans("162","Name: ") +EnumChatFormatting.BLUE+ ((IInventory) tTileEntity).getInventoryName() +EnumChatFormatting.RESET+ trans("163"," MetaData: ") +EnumChatFormatting.AQUA+ aWorld.getBlockMetadata(aX, aY, aZ) +EnumChatFormatting.RESET);
+ else
+ tList.add(trans("162","Name: ") +EnumChatFormatting.BLUE+ tBlock.getUnlocalizedName() +EnumChatFormatting.RESET+ trans("163"," MetaData: ") +EnumChatFormatting.AQUA+ aWorld.getBlockMetadata(aX, aY, aZ) +EnumChatFormatting.RESET);
+
+ tList.add(trans("164","Hardness: ") +EnumChatFormatting.YELLOW+ tBlock.getBlockHardness(aWorld, aX, aY, aZ) +EnumChatFormatting.RESET+ trans("165"," Blast Resistance: ") +EnumChatFormatting.YELLOW+ tBlock.getExplosionResistance(aPlayer, aWorld, aX, aY, aZ, aPlayer.posX, aPlayer.posY, aPlayer.posZ) +EnumChatFormatting.RESET);
+ if (tBlock.isBeaconBase(aWorld, aX, aY, aZ, aX, aY + 1, aZ)) tList.add(EnumChatFormatting.GOLD+ trans("166","Is valid Beacon Pyramid Material") +EnumChatFormatting.RESET);
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ if (tTileEntity != null) {
+ try {
+ if (tTileEntity instanceof IFluidHandler) {
+ rEUAmount += 500;
+ FluidTankInfo[] tTanks = ((IFluidHandler) tTileEntity).getTankInfo(ForgeDirection.getOrientation(aSide));
+ if (tTanks != null) for (byte i = 0; i < tTanks.length; i++) {
+ tList.add(trans("167","Tank ") + i + ": " +EnumChatFormatting.GREEN+ GT_Utility.formatNumbers((tTanks[i].fluid == null ? 0 : tTanks[i].fluid.amount)) +EnumChatFormatting.RESET+ " L / " +EnumChatFormatting.YELLOW+ GT_Utility.formatNumbers(tTanks[i].capacity) +EnumChatFormatting.RESET+ " L " +EnumChatFormatting.GOLD+ getFluidName(tTanks[i].fluid, true)+EnumChatFormatting.RESET);
+ }
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof ic2.api.reactor.IReactorChamber) {
+ rEUAmount += 500;
+ tTileEntity = (TileEntity) (((ic2.api.reactor.IReactorChamber) tTileEntity).getReactor());
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof ic2.api.reactor.IReactor) {
+ rEUAmount += 500;
+ tList.add(trans("168","Heat: ") +EnumChatFormatting.GREEN+ ((ic2.api.reactor.IReactor) tTileEntity).getHeat() +EnumChatFormatting.RESET+ " / " +EnumChatFormatting.YELLOW+ ((ic2.api.reactor.IReactor) tTileEntity).getMaxHeat()+EnumChatFormatting.RESET);
+ tList.add(trans("169","HEM: ") +EnumChatFormatting.YELLOW+((ic2.api.reactor.IReactor) tTileEntity).getHeatEffectModifier() +EnumChatFormatting.RESET/*+ trans("170"," Base EU Output: ")/* + ((ic2.api.reactor.IReactor)tTileEntity).getOutput()*/);
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof ic2.api.tile.IWrenchable) {
+ rEUAmount += 100;
+ tList.add(trans("171","Facing: ") +EnumChatFormatting.GREEN+ ((ic2.api.tile.IWrenchable) tTileEntity).getFacing() +EnumChatFormatting.RESET+ trans("172"," / Chance: ") +EnumChatFormatting.YELLOW+ (((ic2.api.tile.IWrenchable) tTileEntity).getWrenchDropRate() * 100) +EnumChatFormatting.RESET+ "%");
+ tList.add(((ic2.api.tile.IWrenchable) tTileEntity).wrenchCanRemove(aPlayer) ? EnumChatFormatting.GREEN+ trans("173","You can remove this with a Wrench") +EnumChatFormatting.RESET : EnumChatFormatting.RED+ trans("174","You can NOT remove this with a Wrench") +EnumChatFormatting.RESET);
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof ic2.api.energy.tile.IEnergyTile) {
+ rEUAmount += 200;
+ //aList.add(((ic2.api.energy.tile.IEnergyTile)tTileEntity).isAddedToEnergyNet()?"Added to E-net":"Not added to E-net! Bug?");
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof ic2.api.energy.tile.IEnergySink) {
+ rEUAmount += 400;
+ //aList.add("Demanded Energy: " + ((ic2.api.energy.tile.IEnergySink)tTileEntity).demandsEnergy());
+ //tList.add("Max Safe Input: " + getTier(((ic2.api.energy.tile.IEnergySink)tTileEntity).getSinkTier()));
+ //tList.add("Max Safe Input: " + ((ic2.api.energy.tile.IEnergySink)tTileEntity).getMaxSafeInput());
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof ic2.api.energy.tile.IEnergySource) {
+ rEUAmount += 400;
+ //aList.add("Max Energy Output: " + ((ic2.api.energy.tile.IEnergySource)tTileEntity).getMaxEnergyOutput());
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof ic2.api.energy.tile.IEnergyConductor) {
+ rEUAmount += 200;
+ tList.add(trans("175","Conduction Loss: ") +EnumChatFormatting.YELLOW+ ((ic2.api.energy.tile.IEnergyConductor) tTileEntity).getConductionLoss()+EnumChatFormatting.RESET);
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof ic2.api.tile.IEnergyStorage) {
+ rEUAmount += 200;
+ tList.add(trans("176","Contained Energy: ") +EnumChatFormatting.YELLOW+ ((ic2.api.tile.IEnergyStorage) tTileEntity).getStored() +EnumChatFormatting.RESET+ " EU / " +EnumChatFormatting.YELLOW+ ((ic2.api.tile.IEnergyStorage) tTileEntity).getCapacity()+EnumChatFormatting.RESET+" EU");
+ //aList.add(((ic2.api.tile.IEnergyStorage)tTileEntity).isTeleporterCompatible(ic2.api.Direction.YP)?"Teleporter Compatible":"Not Teleporter Compatible");
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof IUpgradableMachine) {
+ rEUAmount += 500;
+ if (((IUpgradableMachine) tTileEntity).hasMufflerUpgrade()) tList.add(EnumChatFormatting.GREEN+ trans("177","Has Muffler Upgrade") +EnumChatFormatting.RESET);
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof IMachineProgress) {
+ rEUAmount += 400;
+ int tValue = 0;
+ if (0 < (tValue = ((IMachineProgress) tTileEntity).getMaxProgress()))
+ tList.add(trans("178","Progress/Load: ") +EnumChatFormatting.GREEN+GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress()) +EnumChatFormatting.RESET+ " / " +EnumChatFormatting.YELLOW+GT_Utility.formatNumbers(tValue) +EnumChatFormatting.RESET);
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof ICoverable) {
+ rEUAmount += 300;
+ String tString = ((ICoverable) tTileEntity).getCoverBehaviorAtSide((byte) aSide).getDescription((byte) aSide, ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide), ((ICoverable) tTileEntity).getCoverDataAtSide((byte) aSide), (ICoverable) tTileEntity);
+ if (tString != null && !tString.equals(E)) tList.add(tString);
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof IBasicEnergyContainer && ((IBasicEnergyContainer) tTileEntity).getEUCapacity() > 0) {
+ tList.add(trans("179","Max IN: ") +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getInputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(((IBasicEnergyContainer) tTileEntity).getInputVoltage())] + ") " +EnumChatFormatting.RESET+ trans("182"," EU at ") +EnumChatFormatting.RED+((IBasicEnergyContainer)tTileEntity).getInputAmperage()+EnumChatFormatting.RESET+trans("183"," A"));
+ tList.add(trans("181","Max OUT: ") +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getOutputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(((IBasicEnergyContainer) tTileEntity).getOutputVoltage())] + ") " +EnumChatFormatting.RESET+ trans("182"," EU at ") +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getOutputAmperage() +EnumChatFormatting.RESET+ trans("183"," A"));
+ tList.add(trans("184","Energy: ") +EnumChatFormatting.GREEN+ GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getStoredEU()) +EnumChatFormatting.RESET+ " EU / " +EnumChatFormatting.YELLOW+ GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getEUCapacity()) +EnumChatFormatting.RESET+ " EU");
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof IGregTechTileEntity) {
+ tList.add(trans("186","Owned by: ") +EnumChatFormatting.BLUE+ ((IGregTechTileEntity) tTileEntity).getOwnerName()+EnumChatFormatting.RESET);
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof IGregTechDeviceInformation && ((IGregTechDeviceInformation) tTileEntity).isGivingInformation()) {
+ tList.addAll(Arrays.asList(((IGregTechDeviceInformation) tTileEntity).getInfoData()));
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ try {
+ if (tTileEntity instanceof ic2.api.crops.ICropTile) {
+ if (((ic2.api.crops.ICropTile) tTileEntity).getScanLevel() < 4) {
+ rEUAmount += 10000;
+ ((ic2.api.crops.ICropTile) tTileEntity).setScanLevel((byte) 4);
+ }
+ if (((ic2.api.crops.ICropTile) tTileEntity).getID() >= 0 && ((ic2.api.crops.ICropTile) tTileEntity).getID() < ic2.api.crops.Crops.instance.getCropList().length && ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()] != null) {
+ rEUAmount += 1000;
+ tList.add(trans("187","Type -- Crop-Name: ") + ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].name()
+ + trans("188"," Growth: ") + ((ic2.api.crops.ICropTile) tTileEntity).getGrowth()
+ + trans("189"," Gain: ") + ((ic2.api.crops.ICropTile) tTileEntity).getGain()
+ + trans("190"," Resistance: ") + ((ic2.api.crops.ICropTile) tTileEntity).getResistance()
+ );
+ tList.add(trans("191","Plant -- Fertilizer: ") + ((ic2.api.crops.ICropTile) tTileEntity).getNutrientStorage()
+ + trans("192"," Water: ") + ((ic2.api.crops.ICropTile) tTileEntity).getHydrationStorage()
+ + trans("193"," Weed-Ex: ") + ((ic2.api.crops.ICropTile) tTileEntity).getWeedExStorage()
+ + trans("194"," Scan-Level: ") + ((ic2.api.crops.ICropTile) tTileEntity).getScanLevel()
+ );
+ tList.add(trans("195","Environment -- Nutrients: ") + ((ic2.api.crops.ICropTile) tTileEntity).getNutrients()
+ + trans("196"," Humidity: ") + ((ic2.api.crops.ICropTile) tTileEntity).getHumidity()
+ + trans("197"," Air-Quality: ") + ((ic2.api.crops.ICropTile) tTileEntity).getAirQuality()
+ );
+ StringBuilder tStringB = new StringBuilder();
+ for (String tAttribute : ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].attributes()) {
+ tStringB.append(", ").append(tAttribute);
+ }
+ String tString = tStringB.toString();
+ tList.add(trans("198","Attributes:") + tString.replaceFirst(",", E));
+ tList.add(trans("199","Discovered by: ") + ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].discoveredBy());
+ }
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+ }
+
+ if (aPlayer.capabilities.isCreativeMode) {
+ FluidStack tFluid = undergroundOilReadInformation(aWorld.getChunkFromBlockCoords(aX,aZ));//-# to only read
+ if (tFluid!=null)
+ tList.add(EnumChatFormatting.GOLD+tFluid.getLocalizedName()+EnumChatFormatting.RESET+": " +EnumChatFormatting.YELLOW+ tFluid.amount +EnumChatFormatting.RESET+" L");
+ else
+ tList.add(EnumChatFormatting.GOLD+trans("201","Nothing")+EnumChatFormatting.RESET+": " +EnumChatFormatting.YELLOW+ '0' +EnumChatFormatting.RESET+" L");
+ }
+// if(aPlayer.capabilities.isCreativeMode){
+ int[] chunkData = GT_Proxy.dimensionWiseChunkData.get(aWorld.provider.dimensionId).get(aWorld.getChunkFromBlockCoords(aX,aZ).getChunkCoordIntPair());
+ if(chunkData !=null){
+ if(chunkData[GTPOLLUTION]>0){
+ tList.add(trans("202","Pollution in Chunk: ")+EnumChatFormatting.RED+chunkData[GTPOLLUTION]+EnumChatFormatting.RESET+trans("203"," gibbl"));
+ }else{
+ tList.add(EnumChatFormatting.GREEN+trans("204","No Pollution in Chunk! HAYO!")+EnumChatFormatting.RESET);
+ }
+ }else{
+ tList.add(EnumChatFormatting.GREEN+trans("204","No Pollution in Chunk! HAYO!")+EnumChatFormatting.RESET);
+ }
+
+ try {
+ if (tBlock instanceof IDebugableBlock) {
+ rEUAmount += 500;
+ ArrayList<String> temp = ((IDebugableBlock) tBlock).getDebugInfo(aPlayer, aX, aY, aZ, 3);
+ if (temp != null) tList.addAll(temp);
+ }
+ } catch (Throwable e) {
+ if (D1) e.printStackTrace(GT_Log.err);
+ }
+
+ BlockScanningEvent tEvent = new BlockScanningEvent(aWorld, aPlayer, aX, aY, aZ, (byte) aSide, aScanLevel, tBlock, tTileEntity, tList, aClickX, aClickY, aClickZ);
+ tEvent.mEUCost = rEUAmount;
+ MinecraftForge.EVENT_BUS.post(tEvent);
+ if (!tEvent.isCanceled()) aList.addAll(tList);
+ return tEvent.mEUCost;
+ }
+
+ public static String trans(String aKey, String aEnglish){
+ return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_"+aKey, aEnglish, false);
+ }
+
+ /**
+ * @return an Array containing the X and the Y Coordinate of the clicked Point, with the top left Corner as Origin, like on the Texture Sheet. return values should always be between [0.0F and 0.99F].
+ */
+ public static float[] getClickedFacingCoords(byte aSide, float aX, float aY, float aZ) {
+ switch (aSide) {
+ case 0:
+ return new float[]{Math.min(0.99F, Math.max(0, 1 - aX)), Math.min(0.99F, Math.max(0, aZ))};
+ case 1:
+ return new float[]{Math.min(0.99F, Math.max(0, aX)), Math.min(0.99F, Math.max(0, aZ))};
+ case 2:
+ return new float[]{Math.min(0.99F, Math.max(0, 1 - aX)), Math.min(0.99F, Math.max(0, 1 - aY))};
+ case 3:
+ return new float[]{Math.min(0.99F, Math.max(0, aX)), Math.min(0.99F, Math.max(0, 1 - aY))};
+ case 4:
+ return new float[]{Math.min(0.99F, Math.max(0, aZ)), Math.min(0.99F, Math.max(0, 1 - aY))};
+ case 5:
+ return new float[]{Math.min(0.99F, Math.max(0, 1 - aZ)), Math.min(0.99F, Math.max(0, 1 - aY))};
+ default:
+ return new float[]{0.5F, 0.5F};
+ }
+ }
+
+ /**
+ * This Function determines the direction a Block gets when being Wrenched.
+ * returns -1 if invalid. Even though that could never happen.
+ */
+ public static byte determineWrenchingSide(byte aSide, float aX, float aY, float aZ) {
+ byte tBack = getOppositeSide(aSide);
+ switch (aSide) {
+ case 0:
+ case 1:
+ if (aX < 0.25) {
+ if (aZ < 0.25) return tBack;
+ if (aZ > 0.75) return tBack;
+ return 4;
+ }
+ if (aX > 0.75) {
+ if (aZ < 0.25) return tBack;
+ if (aZ > 0.75) return tBack;
+ return 5;
+ }
+ if (aZ < 0.25) return 2;
+ if (aZ > 0.75) return 3;
+ return aSide;
+ case 2:
+ case 3:
+ if (aX < 0.25) {
+ if (aY < 0.25) return tBack;
+ if (aY > 0.75) return tBack;
+ return 4;
+ }
+ if (aX > 0.75) {
+ if (aY < 0.25) return tBack;
+ if (aY > 0.75) return tBack;
+ return 5;
+ }
+ if (aY < 0.25) return 0;
+ if (aY > 0.75) return 1;
+ return aSide;
+ case 4:
+ case 5:
+ if (aZ < 0.25) {
+ if (aY < 0.25) return tBack;
+ if (aY > 0.75) return tBack;
+ return 2;
+ }
+ if (aZ > 0.75) {
+ if (aY < 0.25) return tBack;
+ if (aY > 0.75) return tBack;
+ return 3;
+ }
+ if (aY < 0.25) return 0;
+ if (aY > 0.75) return 1;
+ return aSide;
+ }
+ return -1;
+ }
+
+ public static String formatNumbers(long aNumber) {
+ DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.US);
+ DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols();
+ symbols.setGroupingSeparator(' ');
+ return formatter.format(aNumber);
+ }
+
+ /*
+ * Check if stack has enough items of given type and subtract from stack, if there's no creative or 111 stack.
+ */
+ public static boolean consumeItems(EntityPlayer player, ItemStack stack, Item item, int count) {
+ if (stack != null && stack.getItem() == item && stack.stackSize >= count) {
+ if ((!player.capabilities.isCreativeMode) && (stack.stackSize != 111))
+ stack.stackSize -= count;
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * Check if stack has enough items of given gregtech material (will be oredicted)
+ * and subtract from stack, if there's no creative or 111 stack.
+ */
+ public static boolean consumeItems(EntityPlayer player, ItemStack stack, gregtech.api.enums.Materials mat, int count) {
+ if (stack != null
+ && GT_OreDictUnificator.getItemData(stack).mMaterial.mMaterial == mat
+ && stack.stackSize >= count) {
+ if ((!player.capabilities.isCreativeMode) && (stack.stackSize != 111))
+ stack.stackSize -= count;
+ return true;
+ }
+ return false;
+ }
+
+ public static ArrayList<String> sortByValueToList( Map<String, Integer> map ) {
+ List<Map.Entry<String, Integer>> list =
+ new LinkedList<Map.Entry<String, Integer>>( map.entrySet() );
+ Collections.sort( list, new Comparator<Map.Entry<String, Integer>>()
+ {
+ public int compare( Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2 )
+ {
+ return o2.getValue() - o1.getValue();
+ }
+ } );
+
+ ArrayList<String> result = new ArrayList<String>();
+ for (Map.Entry<String, Integer> e : list)
+ result.add(e.getKey());
+ return result;
+ }
+
+ public static String joinListToString(List<String> list) {
+ StringBuilder result = new StringBuilder(32);
+ for (String s : list)
+ result.append(result.length()==0?s:'|'+s);
+ return result.toString();
+ }
+
+ public static ItemStack getIntegratedCircuit(int config){
+ return ItemList.Circuit_Integrated.getWithDamage(0, config, new Object[0]);
+ }
+
+ public static float getBlockHardnessAt(World aWorld, int aX, int aY, int aZ) {
+ return aWorld.getBlock(aX, aY, aZ).getBlockHardness(aWorld, aX, aY, aZ);
+ }
+
+ public static FakePlayer getFakePlayer(IGregTechTileEntity aBaseMetaTileEntity) {
+ if (aBaseMetaTileEntity.getWorld() instanceof WorldServer) {
+ return FakePlayerFactory.get((WorldServer) aBaseMetaTileEntity.getWorld(), new GameProfile(aBaseMetaTileEntity.getOwnerUuid(), aBaseMetaTileEntity.getOwnerName()));
+ }
+ return null;
+ }
+
+ public static boolean eraseBlockByFakePlayer(FakePlayer aPlayer, int aX, int aY, int aZ, boolean isSimulate) {
+ if (aPlayer == null) return false;
+ World aWorld = aPlayer.worldObj;
+ BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(aX, aY, aZ, aWorld, aWorld.getBlock(aX, aY, aZ), aWorld.getBlockMetadata(aX, aY, aZ), aPlayer);
+ MinecraftForge.EVENT_BUS.post(event);
+ if (!event.isCanceled()) {
+ if (!isSimulate) return aWorld.setBlockToAir(aX, aY, aZ);
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean setBlockByFakePlayer(FakePlayer aPlayer, int aX, int aY, int aZ, Block aBlock, int aMeta, boolean isSimulate) {
+ if (aPlayer == null) return false;
+ World aWorld = aPlayer.worldObj;
+ BlockEvent.PlaceEvent event = ForgeEventFactory.onPlayerBlockPlace(aPlayer, new BlockSnapshot(aWorld, aX, aY, aZ, aBlock, aMeta), ForgeDirection.UNKNOWN);
+ if (!event.isCanceled()) {
+ if (!isSimulate) return aWorld.setBlock(aX, aY, aZ, aBlock, aMeta, 3);
+ return true;
+ }
+ return false;
+ }
+
+ public static class ItemNBT {
+ public static void setNBT(ItemStack aStack, NBTTagCompound aNBT) {
+ if (aNBT == null) {
+ aStack.setTagCompound(null);
+ return;
+ }
+ ArrayList<String> tTagsToRemove = new ArrayList<String>();
+ for (Object tKey : aNBT.func_150296_c()) {
+ NBTBase tValue = aNBT.getTag((String) tKey);
+ if (tValue == null || (tValue instanceof NBTPrimitive && ((NBTPrimitive) tValue).func_150291_c() == 0) || (tValue instanceof NBTTagString && isStringInvalid(((NBTTagString) tValue).func_150285_a_())))
+ tTagsToRemove.add((String) tKey);
+ }
+ for (Object tKey : tTagsToRemove) aNBT.removeTag((String) tKey);
+ aStack.setTagCompound(aNBT.hasNoTags() ? null : aNBT);
+ }
+
+ public static NBTTagCompound getNBT(ItemStack aStack) {
+ NBTTagCompound rNBT = aStack.getTagCompound();
+ return rNBT == null ? new NBTTagCompound() : rNBT;
+ }
+
+ public static void setPunchCardData(ItemStack aStack, String aPunchCardData) {
+ NBTTagCompound tNBT = getNBT(aStack);
+ tNBT.setString("GT.PunchCardData", aPunchCardData);
+ setNBT(aStack, tNBT);
+ }
+
+ public static String getPunchCardData(ItemStack aStack) {
+ NBTTagCompound tNBT = getNBT(aStack);
+ return tNBT.getString("GT.PunchCardData");
+ }
+
+ public static void setLighterFuel(ItemStack aStack, long aFuel) {
+ NBTTagCompound tNBT = getNBT(aStack);
+ tNBT.setLong("GT.LighterFuel", aFuel);
+ setNBT(aStack, tNBT);
+ }
+
+ public static long getLighterFuel(ItemStack aStack) {
+ NBTTagCompound tNBT = getNBT(aStack);
+ return tNBT.getLong("GT.LighterFuel");
+ }
+
+ public static void setMapID(ItemStack aStack, short aMapID) {
+ NBTTagCompound tNBT = getNBT(aStack);
+ tNBT.setShort("map_id", aMapID);
+ setNBT(aStack, tNBT);
+ }
+
+ public static short getMapID(ItemStack aStack) {
+ NBTTagCompound tNBT = getNBT(aStack);
+ if (!tNBT.hasKey("map_id")) return -1;
+ return tNBT.getShort("map_id");
+ }
+
+ public static void setBookTitle(ItemStack aStack, String aTitle) {
+ NBTTagCompound tNBT = getNBT(aStack);
+ tNBT.setString("title", aTitle);
+ setNBT(aStack, tNBT);
+ }
+
+ public static String getBookTitle(ItemStack aStack) {
+ NBTTagCompound tNBT = getNBT(aStack);
+ return tNBT.getString("title");
+ }
+
+ public static void setBookAuthor(ItemStack aStack, String aAuthor) {
+ NBTTagCompound tNBT = getNBT(aStack);
+ tNBT.setString("author", aAuthor);
+ setNBT(aStack, tNBT);
+ }
+
+ public static String getBookAuthor(ItemStack aStack) {
+ NBTTagCompound tNBT = getNBT(aStack);
+ return tNBT.getString("author");
+ }
+
+ public static void setProspectionData(ItemStack aStack, int aX, int aY, int aZ, int aDim, FluidStack aFluid, String... aOres) {
+ NBTTagCompound tNBT = getNBT(aStack);
+ String tData = aX + "," + aY + "," + aZ + "," + aDim + ",";
+ if (aFluid!=null)
+ tData += (aFluid.amount) + "," + aFluid.getLocalizedName() + ",";//TODO CHECK IF THAT /5000 is needed (Not needed)
+ for (String tString : aOres) {
+ tData += tString + ",";
+ }
+ tNBT.setString("prospection", tData);
+ setNBT(aStack, tNBT);
+ }
+
+ public static void setAdvancedProspectionData(
+ byte aTier,
+ ItemStack aStack,
+ int aX, short aY, int aZ, int aDim,
+ ArrayList<String> aOils,
+ ArrayList<String> aOres,
+ int aRadius) {
+
+ setBookTitle(aStack, "Raw Prospection Data");
+
+ NBTTagCompound tNBT = GT_Utility.ItemNBT.getNBT(aStack);
+
+ tNBT.setByte("prospection_tier", aTier);
+ tNBT.setString("prospection_pos", "Dim: " + aDim + "\nX: " + aX + " Y: " + aY + " Z: " + aZ);
+
+ // ores
+ Collections.sort(aOres);
+ tNBT.setString("prospection_ores", joinListToString(aOres));
+
+ // oils
+ ArrayList<String> tOilsTransformed = new ArrayList<String>(aOils.size());
+ for (String aStr : aOils) {
+ String[] aStats = aStr.split(",");
+ tOilsTransformed.add(aStats[0] + ": " + aStats[1] + "L " + aStats[2]);
+ }
+
+ tNBT.setString("prospection_oils", joinListToString(tOilsTransformed));
+
+ String tOilsPosStr = "X: " + Math.floorDiv(aX, 16*8)*16*8 + " Z: " + Math.floorDiv(aZ, 16*8)*16*8 + "\n";
+ int xOff = aX - Math.floorDiv(aX, 16*8)*16*8;
+ xOff = xOff/16;
+ int xOffRemain = 7 - xOff;
+
+ int zOff = aZ - Math.floorDiv(aZ, 16*8)*16*8;
+ zOff = zOff/16;
+ int zOffRemain = 7 - zOff;
+
+ for( ; zOff > 0; zOff-- ) {
+ tOilsPosStr = tOilsPosStr.concat("--------\n");
+ }
+ for( ; xOff > 0; xOff-- ) {
+ tOilsPosStr = tOilsPosStr.concat("-");
+ }
+
+ tOilsPosStr = tOilsPosStr.concat("P");
+
+ for( ; xOffRemain > 0; xOffRemain-- ) {
+ tOilsPosStr = tOilsPosStr.concat("-");
+ }
+ tOilsPosStr = tOilsPosStr.concat("\n");
+ for( ; zOffRemain > 0; zOffRemain-- ) {
+ tOilsPosStr = tOilsPosStr.concat("--------\n");
+ }
+ tOilsPosStr = tOilsPosStr.concat( " X: " + (Math.floorDiv(aX, 16*8) + 1)*16*8 + " Z: " + (Math.floorDiv(aZ, 16*8) + 1)*16*8 ); // +1 oilfied to find bottomright of [5]
+
+ tNBT.setString("prospection_oils_pos", tOilsPosStr);
+
+ tNBT.setString("prospection_radius", String.valueOf(aRadius));
+
+ setNBT(aStack, tNBT);
+ }
+
+ public static void convertProspectionData(ItemStack aStack) {
+ NBTTagCompound tNBT = getNBT(aStack);
+ byte tTier = tNBT.getByte("prospection_tier");
+
+ if (tTier == 0) { // basic prospection data
+ String tData = tNBT.getString("prospection");
+ String[] tDataArray = tData.split(",");
+ if (tDataArray.length > 6) {
+ tNBT.setString("author", " Dim: " + tDataArray[3] + "X: " + tDataArray[0] + " Y: " + tDataArray[1] + " Z: " + tDataArray[2]);
+ NBTTagList tNBTList = new NBTTagList();
+ String tOres = " Prospected Ores: ";
+ for (int i = 6; tDataArray.length > i; i++) {
+ tOres += (tDataArray[i] + " ");
+ }
+ tNBTList.appendTag(new NBTTagString("Tier " + tTier + " Prospecting Data From: X" + tDataArray[0] + " Z:" + tDataArray[2] + " Dim:" + tDataArray[3] + " Produces " + tDataArray[4] + "L " + tDataArray[5] + " " + tOres));
+ tNBT.setTag("pages", tNBTList);
+ }
+ setNBT(aStack, tNBT);
+ } else { // advanced prospection data
+ String tPos = tNBT.getString("prospection_pos");
+ String tRadius = tNBT.getString("prospection_radius");
+
+ String tOresStr = tNBT.getString("prospection_ores");
+ String tOilsStr = tNBT.getString("prospection_oils");
+ String tOilsPosStr = tNBT.getString("prospection_oils_pos");
+
+ String[] tOres = tOresStr.isEmpty() ? null : tOresStr.split("\\|");
+ String[] tOils = tOilsStr.isEmpty() ? null : tOilsStr.split("\\|");
+
+ NBTTagList tNBTList = new NBTTagList();
+
+ String tPageText = "Prospector report\n"
+ + tPos + "\n\n"
+ + "Oils: " + (tOils != null ? tOils.length : 0) + "\n\n"
+ + "Ores within " + tRadius + " blocks\n\n"
+ + "Location is center of orevein\n\n"
+ + "Check NEI to confirm orevein type";
+ tNBTList.appendTag(new NBTTagString(tPageText));
+
+ if (tOres != null)
+ fillBookWithList(tNBTList, "Ores Found %s\n\n", "\n", 7, tOres);
+
+
+ if (tOils != null)
+ fillBookWithList(tNBTList, "Oils%s\n\n", "\n", 9, tOils);
+
+ tPageText = "Oil notes\n\n"
+ + "Prospects from NW to SE 576 chunks"
+ + "(9 8x8 oilfields)\n around and gives min-max amount" + "\n\n"
+ + "[1][2][3]" + "\n"
+ + "[4][5][6]" + "\n"
+ + "[7][8][9]" + "\n"
+ + "\n"
+ + "[5] - Prospector in this 8x8 area";
+ tNBTList.appendTag(new NBTTagString(tPageText));
+
+ tPageText = "Corners of [5] are \n" +
+ tOilsPosStr + "\n" +
+ "P - Prospector in 8x8 field";
+ tNBTList.appendTag(new NBTTagString(tPageText));
+
+ tNBT.setString("author", tPos.replace("\n"," "));
+ tNBT.setTag("pages", tNBTList);
+ setNBT(aStack, tNBT);
+ }
+ }
+
+ public static void fillBookWithList(NBTTagList aBook, String aPageHeader, String aListDelimiter, int aItemsPerPage, String[] list) {
+ String aPageFormatter = " %d/%d";
+ int tTotalPages = list.length / aItemsPerPage + (list.length % aItemsPerPage > 0 ? 1 : 0);
+ int tPage = 0;
+ String tPageText;
+ do {
+ tPageText = "";
+ for (int i = tPage*aItemsPerPage; i < (tPage+1)*aItemsPerPage && i < list.length; i += 1)
+ tPageText += (tPageText.isEmpty() ? "" : aListDelimiter) + list[i];
+
+ if (!tPageText.isEmpty()) {
+ String tPageCounter = tTotalPages > 1 ? String.format(aPageFormatter, tPage + 1, tTotalPages) : "";
+ NBTTagString tPageTag = new NBTTagString(String.format(aPageHeader, tPageCounter) + tPageText);
+ aBook.appendTag(tPageTag);
+ }
+
+ ++tPage;
+ } while (!tPageText.isEmpty());
+ }
+
+ public static void addEnchantment(ItemStack aStack, Enchantment aEnchantment, int aLevel) {
+ NBTTagCompound tNBT = getNBT(aStack), tEnchantmentTag;
+ if (!tNBT.hasKey("ench", 9)) tNBT.setTag("ench", new NBTTagList());
+ NBTTagList tList = tNBT.getTagList("ench", 10);
+
+ boolean temp = true;
+
+ for (int i = 0; i < tList.tagCount(); i++) {
+ tEnchantmentTag = tList.getCompoundTagAt(i);
+ if (tEnchantmentTag.getShort("id") == aEnchantment.effectId) {
+ tEnchantmentTag.setShort("id", (short) aEnchantment.effectId);
+ tEnchantmentTag.setShort("lvl", (byte) aLevel);
+ temp = false;
+ break;
+ }
+ }
+
+ if (temp) {
+ tEnchantmentTag = new NBTTagCompound();
+ tEnchantmentTag.setShort("id", (short) aEnchantment.effectId);
+ tEnchantmentTag.setShort("lvl", (byte) aLevel);
+ tList.appendTag(tEnchantmentTag);
+ }
+ aStack.setTagCompound(tNBT);
+ }
+ }
+
+ /**
+ * THIS IS BULLSHIT!!! WHY DO I HAVE TO DO THIS SHIT JUST TO HAVE ENCHANTS PROPERLY!?!
+ */
+ public static class GT_EnchantmentHelper {
+ private static final BullshitIteratorA mBullshitIteratorA = new BullshitIteratorA();
+ private static final BullshitIteratorB mBullshitIteratorB = new BullshitIteratorB();
+
+ private static void applyBullshit(IBullshit aBullshitModifier, ItemStack aStack) {
+ if (aStack != null) {
+ NBTTagList nbttaglist = aStack.getEnchantmentTagList();
+ if (nbttaglist != null) {
+ try {
+ for (int i = 0; i < nbttaglist.tagCount(); ++i) {
+ short short1 = nbttaglist.getCompoundTagAt(i).getShort("id");
+ short short2 = nbttaglist.getCompoundTagAt(i).getShort("lvl");
+ if (Enchantment.enchantmentsList[short1] != null)
+ aBullshitModifier.calculateModifier(Enchantment.enchantmentsList[short1], short2);
+ }
+ } catch (Throwable e) {/**/}
+ }
+ }
+ }
+
+ private static void applyArrayOfBullshit(IBullshit aBullshitModifier, ItemStack[] aStacks) {
+ ItemStack[] aitemstack1 = aStacks;
+ int i = aStacks.length;
+ for (int j = 0; j < i; ++j) {
+ ItemStack itemstack = aitemstack1[j];
+ applyBullshit(aBullshitModifier, itemstack);
+ }
+ }
+
+ public static void applyBullshitA(EntityLivingBase aPlayer, Entity aEntity, ItemStack aStack) {
+ mBullshitIteratorA.mPlayer = aPlayer;
+ mBullshitIteratorA.mEntity = aEntity;
+ if (aPlayer != null) applyArrayOfBullshit(mBullshitIteratorA, aPlayer.getLastActiveItems());
+ if (aStack != null) applyBullshit(mBullshitIteratorA, aStack);
+ }
+
+ public static void applyBullshitB(EntityLivingBase aPlayer, Entity aEntity, ItemStack aStack) {
+ mBullshitIteratorB.mPlayer = aPlayer;
+ mBullshitIteratorB.mEntity = aEntity;
+ if (aPlayer != null) applyArrayOfBullshit(mBullshitIteratorB, aPlayer.getLastActiveItems());
+ if (aStack != null) applyBullshit(mBullshitIteratorB, aStack);
+ }
+
+ interface IBullshit {
+ void calculateModifier(Enchantment aEnchantment, int aLevel);
+ }
+
+ static final class BullshitIteratorA implements IBullshit {
+ public EntityLivingBase mPlayer;
+ public Entity mEntity;
+
+ BullshitIteratorA() {
+ }
+
+ @Override
+ public void calculateModifier(Enchantment aEnchantment, int aLevel) {
+ aEnchantment.func_151367_b(mPlayer, mEntity, aLevel);
+ }
+ }
+
+ static final class BullshitIteratorB implements IBullshit {
+ public EntityLivingBase mPlayer;
+ public Entity mEntity;
+
+ BullshitIteratorB() {
+ }
+
+ @Override
+ public void calculateModifier(Enchantment aEnchantment, int aLevel) {
+ aEnchantment.func_151368_a(mPlayer, mEntity, aLevel);
+ }
+ }
+ }
+
+ public static String toSubscript(long no){
+ char[] chars=Long.toString(no).toCharArray();
+ for(int i=0;i<chars.length;i++){
+ chars[i]+=8272;
+ }
+ return new String(chars);
+ }
+
+ public static boolean isPartOfMaterials(ItemStack aStack, Materials aMaterials){
+ return GT_OreDictUnificator.getAssociation(aStack) != null ? GT_OreDictUnificator.getAssociation(aStack).mMaterial.mMaterial.equals(aMaterials) : false;
+ }
+
+ public static boolean isPartOfOrePrefix(ItemStack aStack, OrePrefixes aPrefix){
+ return GT_OreDictUnificator.getAssociation(aStack) != null ? GT_OreDictUnificator.getAssociation(aStack).mPrefix.equals(aPrefix) : false;
+ }
+
+}
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index f99d4083c9..234920448d 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -21,7 +21,11 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Item; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.net.GT_Packet_Pollution; -import gregtech.api.objects.*; +import gregtech.api.objects.GT_Fluid; +import gregtech.api.objects.GT_FluidStack; +import gregtech.api.objects.GT_UO_DimensionList; +import gregtech.api.objects.ItemData; +import gregtech.api.objects.GT_ChunkManager; import gregtech.api.util.*; import gregtech.common.entities.GT_Entity_Arrow; import gregtech.common.gui.GT_ContainerVolumetricFlask; @@ -171,6 +175,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { public boolean mHideRecyclingRecipes = true; public boolean mPollution = true; public boolean mExplosionItemDrop = false; + public boolean mUseGreatlyShrukenReplacementList = true; public int mSkeletonsShootGTArrows = 16; public int mMaxEqualEntitiesAtOneSpot = 3; public int mFlintChance = 30; @@ -246,7 +251,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { if (aOre.mPrefix != null) { if (!aOre.mPrefix.isIgnored(aOre.mMaterial)) { aOre.mPrefix.processOre(aOre.mMaterial == null ? Materials._NULL : aOre.mMaterial, aOre.mEvent.Name, aOre.mModID, - GT_Utility.copyAmount(1L, new Object[]{aOre.mEvent.Ore})); + GT_Utility.copyAmount(1L, aOre.mEvent.Ore)); } } else { // GT_FML_LOGGER.info("Thingy Name: "+ aOre.mEvent.Name+ " !!!Unknown 'Thingy' detected!!! This Object seems to probably not follow a valid OreDictionary Convention, or I missed a Convention. Please report to GregTech Intergalactical for additional compatiblity. This is not an Error, an Issue nor a Lag Source, it is just an Information, which you should pass to me."); @@ -344,7 +349,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { ItemList.IC2_Hops.set(GT_ModHandler.getIC2Item("hops", 1L)); ItemList.IC2_Resin.set(GT_ModHandler.getIC2Item("resin", 1L)); ItemList.IC2_Plantball.set(GT_ModHandler.getIC2Item("plantBall", 1L)); - ItemList.IC2_PlantballCompressed.set(GT_ModHandler.getIC2Item("compressedPlantBall", 1L, ItemList.IC2_Plantball.get(1L, new Object[0]))); + ItemList.IC2_PlantballCompressed.set(GT_ModHandler.getIC2Item("compressedPlantBall", 1L, ItemList.IC2_Plantball.get(1L))); ItemList.IC2_Crop_Seeds.set(GT_ModHandler.getIC2Item("cropSeed", 1L)); ItemList.IC2_Grin_Powder.set(GT_ModHandler.getIC2Item("grinPowder", 1L)); ItemList.IC2_Energium_Dust.set(GT_ModHandler.getIC2Item("energiumDust", 1L)); @@ -393,11 +398,11 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { ItemList.Food_Baked_Potato.set(new ItemStack(Items.baked_potato, 1, 0)); ItemList.Food_Poisonous_Potato.set(new ItemStack(Items.poisonous_potato, 1, 0)); - OrePrefixes.bottle.mContainerItem = ItemList.Bottle_Empty.get(1L, new Object[0]); + OrePrefixes.bottle.mContainerItem = ItemList.Bottle_Empty.get(1L); OrePrefixes.bucket.mContainerItem = new ItemStack(Items.bucket, 1); - OrePrefixes.cellPlasma.mContainerItem = ItemList.Cell_Empty.get(1L, new Object[0]); - OrePrefixes.cellMolten.mContainerItem = ItemList.Cell_Empty.get(1L, new Object[0]); - OrePrefixes.cell.mContainerItem = ItemList.Cell_Empty.get(1L, new Object[0]); + OrePrefixes.cellPlasma.mContainerItem = ItemList.Cell_Empty.get(1L); + OrePrefixes.cellMolten.mContainerItem = ItemList.Cell_Empty.get(1L); + OrePrefixes.cell.mContainerItem = ItemList.Cell_Empty.get(1L); GregTech_API.sFrostHazmatList.add(GT_ModHandler.getIC2Item("hazmatHelmet", 1L, 32767)); GregTech_API.sFrostHazmatList.add(GT_ModHandler.getIC2Item("hazmatChestplate", 1L, 32767)); @@ -435,8 +440,8 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { GT_ModHandler.sNonReplaceableItems.add(new ItemStack(Items.bow, 1, 32767)); GT_ModHandler.sNonReplaceableItems.add(new ItemStack(Items.fishing_rod, 1, 32767)); - GT_ModHandler.sNonReplaceableItems.add(ItemList.IC2_ForgeHammer.getWithDamage(1L, 32767L, new Object[0])); - GT_ModHandler.sNonReplaceableItems.add(ItemList.IC2_WireCutter.getWithDamage(1L, 32767L, new Object[0])); + GT_ModHandler.sNonReplaceableItems.add(ItemList.IC2_ForgeHammer.getWithDamage(1L, 32767L)); + GT_ModHandler.sNonReplaceableItems.add(ItemList.IC2_WireCutter.getWithDamage(1L, 32767L)); GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getIC2Item("painter", 1L, 32767)); GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getIC2Item("blackPainter", 1L, 32767)); GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getIC2Item("redPainter", 1L, 32767)); @@ -495,6 +500,9 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { RecipeSorter.register("gregtech:shaped", GT_Shaped_Recipe.class, RecipeSorter.Category.SHAPED, "after:minecraft:shaped before:minecraft:shapeless"); RecipeSorter.register("gregtech:shapeless", GT_Shapeless_Recipe.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); + + // Register chunk manager with Forge + GT_ChunkManager.init(); } public void onLoad() { @@ -528,8 +536,8 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { new Thread(new GT_PlayerActivityLogger()).start(); } GregTech_API.sPostloadStarted = true; - GT_OreDictUnificator.addItemData(new ItemStack(Items.iron_door, 1), new ItemData(Materials.Iron, 21772800L, new MaterialStack[0])); - GT_OreDictUnificator.addItemData(new ItemStack(Items.wooden_door, 1, 32767), new ItemData(Materials.Wood, 21772800L, new MaterialStack[0])); + GT_OreDictUnificator.addItemData(new ItemStack(Items.iron_door, 1), new ItemData(Materials.Iron, 21772800L)); + GT_OreDictUnificator.addItemData(new ItemStack(Items.wooden_door, 1, 32767), new ItemData(Materials.Wood, 21772800L)); for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { if ((tData.filledContainer.getItem() == Items.potionitem) && (tData.filledContainer.getItemDamage() == 0)) { tData.fluid.amount = 0; @@ -570,9 +578,9 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustImpure, aMaterial.mMacerateInto, 1L), tBits, new Object[]{"h", "X", 'X', OrePrefixes.dirtyGravel.get(aMaterial)}); GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 4L), tBits, - new Object[]{" X", " ", 'X', OrePrefixes.dust.get(aMaterial)}); + new Object[]{" X ", 'X', OrePrefixes.dust.get(aMaterial)}); GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustTiny, aMaterial, 9L), tBits, - new Object[]{"X ", " ", 'X', OrePrefixes.dust.get(aMaterial)}); + new Object[]{"X ", 'X', OrePrefixes.dust.get(aMaterial)}); GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 1L), tBits, new Object[]{"XX", "XX", 'X', OrePrefixes.dustSmall.get(aMaterial)}); GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 1L), tBits, @@ -728,7 +736,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { if ((this.mSkeletonsShootGTArrows > 0) && (aEvent.entity.getClass() == EntityArrow.class) && (aEvent.entity.worldObj.rand.nextInt(this.mSkeletonsShootGTArrows) == 0) && ((((EntityArrow) aEvent.entity).shootingEntity instanceof EntitySkeleton))) { - aEvent.entity.worldObj.spawnEntityInWorld(new GT_Entity_Arrow((EntityArrow) aEvent.entity, (ItemStack) OrePrefixes.arrowGtWood.mPrefixedItems + aEvent.entity.worldObj.spawnEntityInWorld(new GT_Entity_Arrow((EntityArrow) aEvent.entity, OrePrefixes.arrowGtWood.mPrefixedItems .get(aEvent.entity.worldObj.rand.nextInt(OrePrefixes.arrowGtWood.mPrefixedItems.size())))); aEvent.entity.setDead(); } @@ -928,7 +936,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } else if (aEvent.Name.contains(" ")) { GT_Log.ore.println(tModToName + " is getting re-registered because the OreDict Name containing invalid spaces."); - GT_OreDictUnificator.registerOre(aEvent.Name.replaceAll(" ", ""), GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore})); + GT_OreDictUnificator.registerOre(aEvent.Name.replaceAll(" ", ""), GT_Utility.copyAmount(1L, aEvent.Ore)); aEvent.Ore.setStackDisplayName("Invalid OreDictionary Tag"); return; } @@ -979,7 +987,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { return; } if (!aPrefix.isIgnored(aMaterial)) { - aPrefix.add(GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore})); + aPrefix.add(GT_Utility.copyAmount(1L, aEvent.Ore)); } if (aMaterial != Materials._NULL) { Materials tReRegisteredMaterial; @@ -987,7 +995,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { tReRegisteredMaterial, aEvent.Ore)) { tReRegisteredMaterial = (Materials) i$.next(); } - aMaterial.add(GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore})); + aMaterial.add(GT_Utility.copyAmount(1L, aEvent.Ore)); if (GregTech_API.sThaumcraftCompat != null && aPrefix.doGenerateItem(aMaterial) && !aPrefix.isIgnored(aMaterial)) { List<TC_AspectStack> tAspects = new ArrayList<TC_AspectStack>(); @@ -1133,11 +1141,11 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { return; } } else { - aPrefix.add(GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore})); + aPrefix.add(GT_Utility.copyAmount(1L, aEvent.Ore)); } } } else if (aPrefix.mIsSelfReferencing) { - aPrefix.add(GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore})); + aPrefix.add(GT_Utility.copyAmount(1L, aEvent.Ore)); } else { GT_Log.ore.println(tModToName + " uses a Prefix as full OreDict Name, and is therefor invalid."); aEvent.Ore.setStackDisplayName("Invalid OreDictionary Tag"); @@ -1157,12 +1165,12 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { break; case plank: if (tName.equals("Wood")) { - GT_OreDictUnificator.addItemData(aEvent.Ore, new ItemData(Materials.Wood, 3628800L, new MaterialStack[0])); + GT_OreDictUnificator.addItemData(aEvent.Ore, new ItemData(Materials.Wood, 3628800L)); } break; case slab: if (tName.equals("Wood")) { - GT_OreDictUnificator.addItemData(aEvent.Ore, new ItemData(Materials.Wood, 1814400L, new MaterialStack[0])); + GT_OreDictUnificator.addItemData(aEvent.Ore, new ItemData(Materials.Wood, 1814400L)); } break; case sheet: @@ -1262,7 +1270,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { if (((tEntity instanceof EntityItem)) && (this.mItemDespawnTime != 6000) && (((EntityItem) tEntity).lifespan == 6000)) { ((EntityItem) tEntity).lifespan = this.mItemDespawnTime; } else if (((tEntity instanceof EntityLivingBase)) && (this.mMaxEqualEntitiesAtOneSpot > 0) && (!(tEntity instanceof EntityPlayer)) - && (((EntityLivingBase) tEntity).canBePushed()) && (((EntityLivingBase) tEntity).getHealth() > 0.0F)) { + && (tEntity.canBePushed()) && (((EntityLivingBase) tEntity).getHealth() > 0.0F)) { List tList = tEntity.worldObj.getEntitiesWithinAABBExcludingEntity(tEntity, tEntity.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); Class tClass = tEntity.getClass(); @@ -1571,7 +1579,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } int rFuelValue = 0; if ((aFuel.getItem() instanceof GT_MetaGenerated_Item)) { - Short tFuelValue = (Short) ((GT_MetaGenerated_Item) aFuel.getItem()).mBurnValues.get(Short.valueOf((short) aFuel.getItemDamage())); + Short tFuelValue = ((GT_MetaGenerated_Item) aFuel.getItem()).mBurnValues.get(Short.valueOf((short) aFuel.getItemDamage())); if (tFuelValue != null) { rFuelValue = Math.max(rFuelValue, tFuelValue.shortValue()); } @@ -1674,10 +1682,10 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { rFuelValue = Math.max(rFuelValue, 600); } else if (GT_Utility.areStacksEqual(aFuel, new ItemStack(Items.wooden_door, 1))) { rFuelValue = Math.max(rFuelValue, 600); - } else if (GT_Utility.areStacksEqual(aFuel, ItemList.Block_MSSFUEL.get(1, new Object[0]))) { + } else if (GT_Utility.areStacksEqual(aFuel, ItemList.Block_MSSFUEL.get(1))) { rFuelValue = Math.max(rFuelValue, 150000); } - if (GT_Utility.areStacksEqual(aFuel, ItemList.Block_SSFUEL.get(1, new Object[0]))) { + if (GT_Utility.areStacksEqual(aFuel, ItemList.Block_SSFUEL.get(1))) { rFuelValue = Math.max(rFuelValue, 100000); } @@ -1685,28 +1693,28 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } public Fluid addAutoGeneratedCorrespondingFluid(Materials aMaterial){ - return addFluid(aMaterial.mName.toLowerCase(Locale.ENGLISH), "molten.autogenerated", aMaterial.mDefaultLocalName, aMaterial, - aMaterial.mRGBa, 1, aMaterial.getLiquidTemperature(), GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000); + return addFluid(aMaterial.mName.toLowerCase(Locale.ENGLISH), "molten.autogenerated", aMaterial.mDefaultLocalName, aMaterial, + aMaterial.mRGBa, 1, aMaterial.getLiquidTemperature(), GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), ItemList.Cell_Empty.get(1L), 1000); } public Fluid addAutoGeneratedCorrespondingGas(Materials aMaterial) { - return addFluid(aMaterial.mName.toLowerCase(Locale.ENGLISH), "molten.autogenerated", aMaterial.mDefaultLocalName, aMaterial, - aMaterial.mRGBa, 2, aMaterial.getGasTemperature(), GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000); + return addFluid(aMaterial.mName.toLowerCase(Locale.ENGLISH), "molten.autogenerated", aMaterial.mDefaultLocalName, aMaterial, + aMaterial.mRGBa, 2, aMaterial.getGasTemperature(), GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), ItemList.Cell_Empty.get(1L), 1000); } public Fluid addAutogeneratedMoltenFluid(Materials aMaterial) { return addFluid("molten." + aMaterial.mName.toLowerCase(Locale.ENGLISH), "molten.autogenerated", "Molten " + aMaterial.mDefaultLocalName, aMaterial, - aMaterial.mMoltenRGBa, 4, aMaterial.mMeltingPoint <= 0 ? 1000 : aMaterial.mMeltingPoint, GT_OreDictUnificator.get(OrePrefixes.cellMolten, aMaterial, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 144); + aMaterial.mMoltenRGBa, 4, aMaterial.mMeltingPoint <= 0 ? 1000 : aMaterial.mMeltingPoint, GT_OreDictUnificator.get(OrePrefixes.cellMolten, aMaterial, 1L), ItemList.Cell_Empty.get(1L), 144); } public Fluid addAutogeneratedWetFluid(Materials aMaterial) { return addFluid("wet." + aMaterial.mName.toLowerCase(Locale.ENGLISH), "wet.autogenerated", "Wet " + aMaterial.mDefaultLocalName, aMaterial, - aMaterial.mMoltenRGBa, 4, aMaterial.mMeltingPoint <= 0 ? 1000 : aMaterial.mMeltingPoint, GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 144); + aMaterial.mMoltenRGBa, 4, aMaterial.mMeltingPoint <= 0 ? 1000 : aMaterial.mMeltingPoint, GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), ItemList.Cell_Empty.get(1L), 144); } public Fluid addAutogeneratedPlasmaFluid(Materials aMaterial) { return addFluid("plasma." + aMaterial.mName.toLowerCase(Locale.ENGLISH), "plasma.autogenerated", aMaterial.mDefaultLocalName + " Plasma", aMaterial, - aMaterial.mMoltenRGBa, 3, 10000, GT_OreDictUnificator.get(OrePrefixes.cellPlasma, aMaterial, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000); + aMaterial.mMoltenRGBa, 3, 10000, GT_OreDictUnificator.get(OrePrefixes.cellPlasma, aMaterial, 1L), ItemList.Cell_Empty.get(1L), 1000); } public void addAutoGeneratedHydroCrackedFluids(Materials aMaterial){ diff --git a/src/main/java/gregtech/common/GT_RecipeAdder.java b/src/main/java/gregtech/common/GT_RecipeAdder.java index 4a1a3e0ceb..49c891e91f 100644 --- a/src/main/java/gregtech/common/GT_RecipeAdder.java +++ b/src/main/java/gregtech/common/GT_RecipeAdder.java @@ -998,10 +998,14 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { public boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt) {
- return addMixerRecipe(aInput1, aInput2, aInput3, aInput4, null, null, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt);
+ return addMixerRecipe(aInput1, aInput2, aInput3, aInput4, null, null, null, null, null, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt);
}
public boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, ItemStack aInput5, ItemStack aInput6, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt) {
+ return addMixerRecipe(aInput1, aInput2, aInput3, aInput4, aInput5, aInput6, null, null, null, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt);
+
+ }
+ public boolean addMixerRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aInput3, ItemStack aInput4, ItemStack aInput5, ItemStack aInput6, ItemStack aInput7, ItemStack aInput8,ItemStack aInput9, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt) {
if (((aInput1 == null) && (aFluidInput == null)) || ((aOutput == null) && (aFluidOutput == null))) {
return false;
}
@@ -1011,7 +1015,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { if ((aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("mixer", aFluidOutput.getFluid().getName(), aDuration)) <= 0)) {
return false;
}
- GT_Recipe.GT_Recipe_Map.sMixerRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2, aInput3, aInput4, aInput5, aInput6}, new ItemStack[]{aOutput}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0);
+ GT_Recipe.GT_Recipe_Map.sMixerRecipes.addRecipe(true, new ItemStack[]{aInput1, aInput2, aInput3, aInput4, aInput5, aInput6, aInput7, aInput8, aInput9}, new ItemStack[]{aOutput}, null, null, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, aDuration, aEUt, 0);
return true;
}
diff --git a/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java b/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java index 986fd22a1f..bb390faeea 100644 --- a/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java +++ b/src/main/java/gregtech/common/GT_Worldgen_GT_Ore_Layer.java @@ -1,12 +1,10 @@ package gregtech.common;
-import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.util.GT_Log;
import gregtech.api.world.GT_Worldgen;
import gregtech.common.blocks.GT_TileEntity_Ores;
-import gregtech.loaders.misc.GT_Achievements;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java index c5393f0be1..085570e546 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java @@ -9,11 +9,8 @@ import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures; import gregtech.api.items.GT_Generic_Block; import gregtech.api.objects.GT_CopiedBlockTexture; -import gregtech.api.objects.ItemData; -import gregtech.api.objects.MaterialStack; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java index 1fa33e2a1d..773268d424 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java @@ -156,6 +156,7 @@ public class GT_Item_Machines tTileEntity.setInitialValuesAsNBT(tTileEntity.isServerSide() ? aStack.getTagCompound() : null, tDamage);
if (aPlayer != null) {
tTileEntity.setOwnerName(aPlayer.getDisplayName());
+ tTileEntity.setOwnerUuid(aPlayer.getUniqueID());
}
tTileEntity.getMetaTileEntity().initDefaultModes(aStack.getTagCompound());
final byte aSide = GT_Utility.getOppositeSide(side);
diff --git a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java index 7b9067270f..6c4a03420d 100644 --- a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java @@ -10,7 +10,6 @@ import gregtech.api.interfaces.tileentity.ITexturedTileEntity; import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.XSTR; -import gregtech.api.util.GT_Log; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_02.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_02.java index e708ece935..2708e3777e 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_02.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_02.java @@ -5,7 +5,6 @@ import gregtech.api.enums.*; import gregtech.api.items.GT_MetaGenerated_Item_X32;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.objects.ItemData;
-import gregtech.api.objects.MaterialStack;
import gregtech.api.util.*;
import gregtech.common.items.behaviors.Behaviour_Arrow;
import net.minecraft.dispenser.IBlockSource;
diff --git a/src/main/java/gregtech/common/items/GT_NeutronReflector_Item.java b/src/main/java/gregtech/common/items/GT_NeutronReflector_Item.java index eee76c233e..805754996a 100644 --- a/src/main/java/gregtech/common/items/GT_NeutronReflector_Item.java +++ b/src/main/java/gregtech/common/items/GT_NeutronReflector_Item.java @@ -1,8 +1,6 @@ package gregtech.common.items; -import gregtech.api.GregTech_API; import gregtech.api.items.GT_Generic_Item; -import gregtech.api.items.GT_RadioactiveCellIC_Item; import ic2.api.reactor.IReactor; import ic2.api.reactor.IReactorComponent; import net.minecraft.item.ItemStack; diff --git a/src/main/java/gregtech/common/items/ItemComb.java b/src/main/java/gregtech/common/items/ItemComb.java index c66671c44f..d60a60a3fd 100644 --- a/src/main/java/gregtech/common/items/ItemComb.java +++ b/src/main/java/gregtech/common/items/ItemComb.java @@ -147,7 +147,7 @@ public class ItemComb extends Item { GT_Values.RA.addCentrifugeRecipe(tComb, GT_Values.NI, GT_Values.NF, GT_Values.NF, ItemList.FR_RefractoryWax.get(1, new Object[0]),GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.VibrantAlloy, 1), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, new int[] {5000, 7000}, 384, 480); addProcessHV(tComb, Materials.Chrome, 50); tComb = getStackForType(CombType.ENERGETICALLOY); - GT_Values.RA.addCentrifugeRecipe(tComb, GT_Values.NI, GT_Values.NF, GT_Values.NF, ItemList.FR_RefractoryWax.get(1, new Object[0]),GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.VibrantAlloy, 1), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, new int[] {5000, 8000}, 384, 480); + GT_Values.RA.addCentrifugeRecipe(tComb, GT_Values.NI, GT_Values.NF, GT_Values.NF, ItemList.FR_RefractoryWax.get(1, new Object[0]),GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.EnergeticAlloy, 1), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, new int[] {5000, 8000}, 384, 480); addProcessHV(tComb, Materials.Gold, 60); tComb = getStackForType(CombType.ELECTRICALSTEEL); GT_Values.RA.addCentrifugeRecipe(tComb, GT_Values.NI, GT_Values.NF, GT_Values.NF, ItemList.FR_RefractoryWax.get(1, new Object[0]),GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.ElectricalSteel, 1), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, new int[] {5000, 10000}, 128, 5); @@ -378,6 +378,7 @@ public class ItemComb extends Item { addProcessIV(tComb,Materials.Tungstate,80); addProcessIV(tComb,Materials.Scheelite,75); addProcessIV(tComb,Materials.Lithium,75); + addProcessIV(tComb,Materials.Tungsten,50); tComb = getStackForType(CombType.PLATINUM); addProcessHV(tComb,Materials.Platinum,40); addProcessHV(tComb,Materials.Cooperite,40); diff --git a/src/main/java/gregtech/common/misc/GT_Command.java b/src/main/java/gregtech/common/misc/GT_Command.java new file mode 100644 index 0000000000..9d53027026 --- /dev/null +++ b/src/main/java/gregtech/common/misc/GT_Command.java @@ -0,0 +1,91 @@ +package gregtech.common.misc; + +import gregtech.api.enums.GT_Values; +import gregtech.api.objects.GT_ChunkManager; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.util.ChatComponentText; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Stream; + +public final class GT_Command extends CommandBase { + + @Override + public String getCommandName() { + return "gt"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "Usage: gt <subcommand>. Valid subcommands are: toggle, chunks."; + } + private void printHelp(ICommandSender sender) { + sender.addChatMessage(new ChatComponentText("Usage: gt <toggle|chunks>")); + sender.addChatMessage(new ChatComponentText("\"toggle D1\" - toggles general.Debug (D1)")); + sender.addChatMessage(new ChatComponentText("\"toggle D2\" - toggles general.Debug2 (D2)")); + sender.addChatMessage(new ChatComponentText("\"toggle debugCleanroom\" - toggles cleanroom debug log")); + sender.addChatMessage(new ChatComponentText("\"toggle debugDriller\" - toggles oil drill debug log")); + sender.addChatMessage(new ChatComponentText("\"toggle debugWorldGen\" - toggles generic worldgen debug")); + sender.addChatMessage(new ChatComponentText("\"toggle debugOrevein\" - toggles worldgen ore vein debug")); + sender.addChatMessage(new ChatComponentText("\"toggle debugSmallOres\" - toggles worldgen small vein debug")); + sender.addChatMessage(new ChatComponentText("\"toggle debugStones\" - toggles worldgen stones debug")); + sender.addChatMessage(new ChatComponentText("\"toggle debugChunkloaders\" - toggles chunkloaders debug")); + sender.addChatMessage(new ChatComponentText("\"chunks\" - print a list of the force loaded chunks")); + } + + @Override + public List addTabCompletionOptions(ICommandSender sender, String[] ss) { + List<String> l = new ArrayList<>(); + Stream<String> keywords = Arrays.stream(new String[]{"toggle", "chunks"}); + String test = ss.length == 0 ? "" : ss[0].trim(); + if (ss.length == 0 || ss.length == 1 && (test.isEmpty() || keywords.anyMatch(s -> s.startsWith(test)))) { + keywords.forEach(s -> { + if (test.isEmpty() || s.startsWith(test)) + l.add(s); + }); + } else if (test.equals("toggle")) { + String test1 = ss.length == 1 ? "" : ss[1].trim(); + Arrays.stream(new String[]{"D1", "D2", "debugCleanroom", "debugDriller", "debugWorldGen", "debugOrevein", "debugSmallOres", "debugStones", "debugChunkloaders"}).forEach(s -> { + if (test1.isEmpty() || s.startsWith(test1)) + l.add(s); + }); + } + return l; + } + + @Override + public void processCommand(ICommandSender sender, String[] strings) { + if (strings.length < 1 || (!strings[0].equals("toggle") && !strings[0].equals("chunks"))) { + printHelp(sender); + return; + } + switch (strings[0]) { + case "toggle": + if (strings.length < 2) { + printHelp(sender); + return; + } + try { + Field field = GT_Values.class.getDeclaredField(strings[1]); + if (field.getType() != boolean.class) { + sender.addChatMessage(new ChatComponentText("Wrong variable: " + strings[1])); + return; + } + boolean b = !field.getBoolean(null); + field.setBoolean(null, b); + sender.addChatMessage(new ChatComponentText(strings[1] + " = " + (b ? "true" : "false"))); + } catch (Exception e) { + sender.addChatMessage(new ChatComponentText("No such variable: " + strings[0])); + } + break; + case "chunks": + GT_ChunkManager.printTickets(); + sender.addChatMessage(new ChatComponentText("Forced chunks logged to GregTech.log")); + break; + } + } +} diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java index 8f8fa352a8..d7fd69edb2 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java @@ -8,14 +8,17 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_Boiler; import gregtech.common.gui.GT_GUIContainer_Boiler; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; + public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { public GT_MetaTileEntity_Boiler_Solar(int aID, String aName, String aNameRegional) { @@ -89,9 +92,44 @@ public class GT_MetaTileEntity_Boiler_Solar this.mRunTime = aNBT.getInteger("mRunTime"); } + @Override + public String[] getInfoData() { + return new String[]{ + "Heat Capacity: " + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.mTemperature * 100 / maxProgresstime()) + " % " + EnumChatFormatting.RESET + + " Hot time: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(this.mRunTime*25/20)+EnumChatFormatting.RESET+" s", + "Min output: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(this.basicMaxOuput*20/25)+EnumChatFormatting.RESET+ " L/s" + + " Max output: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(this.basicOutput*20/25)+EnumChatFormatting.RESET+" L/s", + "Current Output: " + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(getCalcificationOutput()*20/25) +EnumChatFormatting.RESET+" L/s"}; + } + + @Override + public boolean isGivingInformation() { + return true; + } + protected int basicOutput = 150; protected int basicMaxOuput = 50; - protected int basicTemperatureMod = 1; + protected int basicTemperatureMod = 5; + protected int basicLossTimerLimit = 45; + + // Calcification start time is 43200*25/20=54,000s or 15 hours of game time. + static final int CALCIFICATION_TIME = 43200; + + public int getCalcificationOutput() { // Returns how much output the boiler can do. + if (this.mTemperature < 100 ) { + return 0; + } + if (this.mRunTime > CALCIFICATION_TIME) { + // Calcification takes about 2/3 CALCIFICATION_TIME to completely calcify on basic solar. For HP solar, it takes about 2x CALCIFICATION_TIME + return Math.max(this.basicMaxOuput, this.basicOutput - ((this.mRunTime - CALCIFICATION_TIME) / (CALCIFICATION_TIME/150))); // Every 288*25 ticks, or 6 minutes, lose 1 L output. + } else { + return this.basicOutput; + } + } + + public int getBasicOutput() { + return this.basicOutput; + } public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L)) { @@ -99,7 +137,7 @@ public class GT_MetaTileEntity_Boiler_Solar this.mTemperature = 20; this.mLossTimer = 0; } - if (++this.mLossTimer > 45) { + if (++this.mLossTimer > basicLossTimerLimit) { this.mTemperature -= basicTemperatureMod; this.mLossTimer = 0; } @@ -116,7 +154,7 @@ public class GT_MetaTileEntity_Boiler_Solar } } } - if (aTick % 25L == 0L) { + if (aTick % 25L == 0L) { // Every 25 ticks since 1L of water = 150L of steam. So for 120L, have to use 25 instead of 20. if (this.mTemperature > 100) { if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0)) { this.mHadNoWater = true; @@ -126,12 +164,11 @@ public class GT_MetaTileEntity_Boiler_Solar aBaseMetaTileEntity.doExplosion(2048L); return; } - this.mFluid.amount -= basicTemperatureMod; + this.mFluid.amount -= (basicOutput/150); mRunTime += 1; - int tOutput = basicOutput; - if (mRunTime > 10000) { - tOutput = Math.max(basicMaxOuput, basicOutput - ((mRunTime - 10000) / 100)); - } + + int tOutput = getCalcificationOutput(); + if (this.mSteam == null) { this.mSteam = GT_ModHandler.getSteam(tOutput); } else if (GT_ModHandler.isSteam(this.mSteam)) { @@ -153,7 +190,7 @@ public class GT_MetaTileEntity_Boiler_Solar boolean bRain = aBaseMetaTileEntity.getWorld().isRaining() && aBaseMetaTileEntity.getBiome().rainfall > 0.0F; mProcessingEnergy += bRain && aBaseMetaTileEntity.getWorld().skylightSubtracted >= 4 || !aBaseMetaTileEntity.getSkyAtSide((byte) 1) ? 0 : !bRain && aBaseMetaTileEntity.getWorld().isDaytime() ? 8*basicTemperatureMod : basicTemperatureMod; } - if ((this.mTemperature < 500) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L)) { + if ((this.mTemperature < maxProgresstime()) && (this.mProcessingEnergy > 0) && (aTick % 12L == 0L)) { this.mProcessingEnergy -= basicTemperatureMod; this.mTemperature += basicTemperatureMod; } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java index 376ce4784c..594d338204 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java @@ -14,22 +14,22 @@ public class GT_MetaTileEntity_Boiler_Solar_Steel extends GT_MetaTileEntity_Boil public GT_MetaTileEntity_Boiler_Solar_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); basicOutput = 450; - basicMaxOuput = 120; - basicTemperatureMod = 3; + basicMaxOuput = 150; + basicLossTimerLimit = 75; // Cools down slower than normal boiler } public GT_MetaTileEntity_Boiler_Solar_Steel(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); basicOutput = 450; - basicMaxOuput = 120; - basicTemperatureMod = 3; + basicMaxOuput = 150; + basicLossTimerLimit = 75; } public GT_MetaTileEntity_Boiler_Solar_Steel(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); basicOutput = 450; - basicMaxOuput = 120; - basicTemperatureMod = 3; + basicMaxOuput = 150; + basicLossTimerLimit = 75; } public ITexture[][][] getTextureSet(ITexture[] aTextures) { @@ -68,10 +68,6 @@ public class GT_MetaTileEntity_Boiler_Solar_Steel extends GT_MetaTileEntity_Boil return 32000; } - public int maxProgresstime() { - return 1500; - } - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Boiler_Solar_Steel(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java index 0f73cb46d3..b92307002e 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java @@ -7,7 +7,6 @@ import gregtech.api.enums.TC_Aspects; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; import gregtech.api.objects.GT_RenderedTexture; diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java index b52e57901b..5c0e2cbf25 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java @@ -33,8 +33,6 @@ import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_BasicMachine { boolean ready = false; int radius; - int near; - int middle; int step; int cX; int cZ; @@ -55,9 +53,6 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER) }); radius = aRadius; - near = radius / 3; - near = near + near % 2; // making near value even; - middle = near * 2; step = aStep; } @@ -74,24 +69,19 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba + "x" + radius*2 + " ONLY blocks below prospector", - "Near < " + near, - "Middle < " + middle, - "Far >= " + middle, - "Oil prospecting area 3x3 oilfields"}; + "Oil prospecting area 3x3 oilfields, each is 8x8 chunks"}; } protected GT_MetaTileEntity_AdvSeismicProspector(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, - String aGUIName, String aNEIName, int aNear, int aMiddle, int aRadius, int aStep) { + String aGUIName, String aNEIName, int aRadius, int aStep) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); radius = aRadius; - near = aNear; - middle = aMiddle; step = aStep; } public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_AdvSeismicProspector(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, - this.mGUIName, this.mNEIName, this.near, this.middle, this.radius, this.step); + this.mGUIName, this.mNEIName, this.radius, this.step); } @Override @@ -113,10 +103,9 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba this.ready = false; // prospecting ores - HashMap<String, Integer> tNearOres = new HashMap<String, Integer>(); - HashMap<String, Integer> tMiddleOres = new HashMap<String, Integer>(); - HashMap<String, Integer> tFarOres = new HashMap<String, Integer>(); - prospectOres(tNearOres, tMiddleOres, tFarOres); + HashMap<String, Integer> tOres = new HashMap<String, Integer>(36); + + prospectOres(tOres); // prospecting oils ArrayList<String> tOils = new ArrayList<String>(); @@ -129,10 +118,8 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId, tOils, - GT_Utility.sortByValueToList(tNearOres), - GT_Utility.sortByValueToList(tMiddleOres), - GT_Utility.sortByValueToList(tFarOres), - near, middle, radius); + GT_Utility.sortByValueToList(tOres), + radius); } } @@ -145,8 +132,8 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord()); int oilfieldSize = 8; - int xChunk = (tChunk.xPosition / oilfieldSize) * oilfieldSize - ((tChunk.xPosition < 0 && tChunk.xPosition % oilfieldSize != 0) ? oilfieldSize : 0); - int zChunk = (tChunk.zPosition / oilfieldSize) * oilfieldSize - ((tChunk.zPosition < 0 && tChunk.zPosition % oilfieldSize != 0) ? oilfieldSize : 0); + int xChunk = Math.floorDiv(tChunk.xPosition , oilfieldSize) * oilfieldSize - ((tChunk.xPosition < 0 && tChunk.xPosition % oilfieldSize != 0) ? oilfieldSize : 0); + int zChunk = Math.floorDiv(tChunk.zPosition , oilfieldSize) * oilfieldSize - ((tChunk.zPosition < 0 && tChunk.zPosition % oilfieldSize != 0) ? oilfieldSize : 0); LinkedHashMap<ChunkCoordIntPair, FluidStack> tFluids = new LinkedHashMap<>(); int oilFieldCount = 0; @@ -186,28 +173,35 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba // aOils.put(x + "," + z + "," + (tFluid.amount / 5000) + "," + tFluid.getLocalizedName(), tFluid.amount / 5000); //} - private void prospectOres(Map<String, Integer> aNearOres, Map<String, Integer> aMiddleOres, Map<String, Integer> aFarOres) { + private void prospectOres(Map<String, Integer> aOres) { int tLeftXBound = this.getBaseMetaTileEntity().getXCoord() - radius; int tRightXBound = tLeftXBound + 2*radius; int tLeftZBound = this.getBaseMetaTileEntity().getZCoord() - radius; int tRightZBound = tLeftZBound + 2*radius; - for (int i = tLeftXBound; i <= tRightXBound; i += step) + for (int i = tLeftXBound; i <= tRightXBound; i += step) { + if ( (Math.abs(i)/16-1)%3!=0 ) { + continue; + } for (int k = tLeftZBound; k <= tRightZBound; k += step) { + if ( (Math.abs(k)/16-1)%3!=0 ) { + continue; + } + int di = Math.abs(i - this.getBaseMetaTileEntity().getXCoord()); int dk = Math.abs(k - this.getBaseMetaTileEntity().getZCoord()); - cX = (i/16)*16; - cZ = (k/16)*16; + cX = (Math.floorDiv(i,16))*16; + + cZ = (Math.floorDiv(k,16))*16; + + String separator = (cX +8)+ "," + (cZ + 8) + " --------"; + aOres.put(separator, 1); + prospectHole(i, k, aOres); - if (di <= near && dk <= near) - prospectHole(i, k, aNearOres); - else if (di <= middle && dk <= middle) - prospectHole(i, k, aMiddleOres); - else - prospectHole(i, k, aFarOres); } + } } private void prospectHole(int i, int k, Map<String, Integer> aOres) { @@ -245,7 +239,7 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba } private static void countOre(Map<String, Integer> map, String ore, int cCX, int cCZ) { - ore = ore + " at " + (cCX +8)+ "," + (cCZ + 8); + ore = (cCX +8)+ "," + (cCZ + 8) + " has " + ore; Integer oldCount = map.get(ore); oldCount = (oldCount == null) ? 0 : oldCount; diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java index 8efebe98a5..8b947a740b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java @@ -1,7 +1,6 @@ package gregtech.common.tileentities.machines.basic;
import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -9,7 +8,6 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
-import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java index 26024cafee..9757974cee 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java @@ -13,10 +13,13 @@ import gregtech.api.util.GT_Utility; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_TileEntity_Ores; import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.FakePlayer; import java.util.ArrayList; @@ -35,17 +38,36 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { final static int[] SPEED = new int[]{160, 160, 80, 40, 20}; //Miner cycle time per tier final static int[] ENERGY = new int[]{8, 8, 32, 128, 512}; //Miner energy consumption per tier + private int radiusConfig; //Miner configured radius + public GT_MetaTileEntity_Miner(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, new String[]{"Digging ore instead of you", ENERGY[aTier] + " EU/t, " + SPEED[aTier] / 20 + " sec per block", - "Work area " + (RADIUS[aTier] * 2 + 1) + "x" + (RADIUS[aTier] * 2 + 1), "Fortune bonus of " + aTier * 2}, 2, 2, "Miner.png", "", new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM"))); + super(aID, aName, aNameRegional, aTier, 1, + new String[]{ + "Digging ore instead of you", + "Use Screwdriver to regulate work area", + ENERGY[aTier] + " EU/t, " + SPEED[aTier] / 20 + " sec per block", + "Maximum work area " + (RADIUS[aTier] * 2 + 1) + "x" + (RADIUS[aTier] * 2 + 1), + "Fortune bonus of " + aTier}, + 2, 2, "Miner.png", "", + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT")), + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE")), + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), + new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM"))); + radiusConfig = RADIUS[mTier]; } public GT_MetaTileEntity_Miner(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); + radiusConfig = RADIUS[mTier]; } public GT_MetaTileEntity_Miner(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 1, aDescription, aTextures, 2, 2, aGUIName, aNEIName); + radiusConfig = RADIUS[mTier]; } @@ -68,6 +90,27 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { } @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + if (aSide != getBaseMetaTileEntity().getFrontFacing() && aSide != mMainFacing) { + if (aPlayer.isSneaking()) { + if (radiusConfig >= 0) { + radiusConfig--; + } + if (radiusConfig < 0) + radiusConfig = RADIUS[mTier]; + } else { + if (radiusConfig <= RADIUS[mTier]) { + radiusConfig++; + } + if (radiusConfig > RADIUS[mTier]) + radiusConfig = 0; + } + GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + (radiusConfig * 2 + 1) + "x" + (radiusConfig * 2 + 1));//TODO Add translation support + } + } + + @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide()) { @@ -107,17 +150,17 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { moveOneDown(aBaseMetaTileEntity); return; } - if (drillZ > RADIUS[mTier]) { + if (drillZ > radiusConfig) { moveOneDown(aBaseMetaTileEntity); return; } - while (drillZ <= RADIUS[mTier]) { - while (drillX <= RADIUS[mTier]) { + while (drillZ <= radiusConfig) { + while (drillX <= radiusConfig) { Block block = aBaseMetaTileEntity.getBlockOffset(drillX, drillY, drillZ); int blockMeta = aBaseMetaTileEntity.getMetaIDOffset(drillX, drillY, drillZ); if (block instanceof GT_Block_Ores_Abstract) { TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(drillX, drillY, drillZ); - if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) { + if (tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) { mineBlock(aBaseMetaTileEntity, drillX, drillY, drillZ); return; } @@ -130,7 +173,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { } drillX++; } - drillX = -RADIUS[mTier]; + drillX = -radiusConfig; drillZ++; } } @@ -141,6 +184,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { public long maxEUStore() { return mTier == 1 ? 4096 : V[mTier] * 64; } + public boolean moveOneDown(IGregTechTileEntity aBaseMetaTileEntity) { int xCoord = aBaseMetaTileEntity.getXCoord(); int zCoord = aBaseMetaTileEntity.getZCoord(); @@ -191,7 +235,14 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { private ArrayList<ItemStack> getBlockDrops(final Block oreBlock, int posX, int posY, int posZ) { final int blockMeta = getBaseMetaTileEntity().getMetaID(posX, posY, posZ); - return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier*2 + 1); + return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier); + } + + @Override + public void setItemNBT(NBTTagCompound aNBT) { + super.setItemNBT(aNBT); + aNBT.setByte("mTier", mTier); + aNBT.setInteger("radiusConfig", radiusConfig); } @Override @@ -201,6 +252,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { aNBT.setInteger("drillX", drillX); aNBT.setInteger("drillY", drillY); aNBT.setInteger("drillZ", drillZ); + aNBT.setInteger("radiusConfig", radiusConfig); } @Override @@ -210,15 +262,29 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { drillX = aNBT.getInteger("drillX"); drillY = aNBT.getInteger("drillY"); drillZ = aNBT.getInteger("drillZ"); + if (aNBT.hasKey("radiusConfig")) + radiusConfig = aNBT.getInteger("radiusConfig"); } private FakePlayer mFakePlayer = null; protected FakePlayer getFakePlayer(IGregTechTileEntity aBaseTile) { - if (mFakePlayer == null) mFakePlayer = GT_Utility.getFakePlayer(aBaseTile); - mFakePlayer.setWorld(aBaseTile.getWorld()); - mFakePlayer.setPosition(aBaseTile.getXCoord(), aBaseTile.getYCoord(), aBaseTile.getZCoord()); + if (mFakePlayer == null) + mFakePlayer = GT_Utility.getFakePlayer(aBaseTile); + if (mFakePlayer != null) { + mFakePlayer.setWorld(aBaseTile.getWorld()); + mFakePlayer.setPosition(aBaseTile.getXCoord(), aBaseTile.getYCoord(), aBaseTile.getZCoord()); + } return mFakePlayer; } + + @Override + public String[] getInfoData() { + return new String[]{ + EnumChatFormatting.BLUE+StatCollector.translateToLocal("GT5U.machines.miner")+EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + (radiusConfig * 2 + 1)+ + EnumChatFormatting.RESET+" " + StatCollector.translateToLocal("GT5U.machines.blocks") + }; + } } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java index dcb516efa5..e4a2ffe771 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java @@ -18,6 +18,8 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; import net.minecraft.world.ChunkPosition; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.ForgeDirection; @@ -25,12 +27,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.IFluidHandler; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; +import java.util.*; import static gregtech.api.enums.GT_Values.D1; import static gregtech.api.enums.GT_Values.V; @@ -48,26 +45,31 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { return (16 * ((long) Math.pow(4, aTier))); } - public ArrayDeque<ChunkPosition> mPumpList = new ArrayDeque<ChunkPosition>(); + public ArrayDeque<ChunkPosition> mPumpList = new ArrayDeque<>(); public boolean wasPumping = false; public int mPumpTimer = 0; public int mPumpCountBelow = 0; public Block mPrimaryPumpedBlock = null; public Block mSecondaryPumpedBlock = null; + private int radiusConfig; //Pump configured radius + public GT_MetaTileEntity_Pump(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 3, new String[]{"The best way to empty Oceans! Outputs on top", - "Pumping Area: " + (GT_MetaTileEntity_Pump.getMaxDistanceForTier((byte)aTier) * 2 + 1) + "x" + - (GT_MetaTileEntity_Pump.getMaxDistanceForTier((byte)aTier) * 2 + 1)}); + "Maximum pumping area: " + (getMaxDistanceForTier((byte) aTier) * 2 + 1) + "x" + (getMaxDistanceForTier((byte) aTier) * 2 + 1), + "Use Screwdriver to regulate pumping area"}); + radiusConfig = getMaxDistanceForTier(mTier); } public GT_MetaTileEntity_Pump(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); + radiusConfig = getMaxDistanceForTier(mTier); } public GT_MetaTileEntity_Pump(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, 3, aDescription, aTextures); + radiusConfig = getMaxDistanceForTier(mTier); } @Override @@ -84,17 +86,48 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { aNBT.setString("mPumpedBlock1", this.mPrimaryPumpedBlock == null ? "" : Block.blockRegistry.getNameForObject(this.mPrimaryPumpedBlock)); aNBT.setString("mPumpedBlock2", this.mSecondaryPumpedBlock == null ? "" : Block.blockRegistry.getNameForObject(this.mSecondaryPumpedBlock)); aNBT.setBoolean("wasPumping", wasPumping); + aNBT.setInteger("radiusConfig", radiusConfig); } public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); this.wasPumping = aNBT.getBoolean("wasPumping"); + if (aNBT.hasKey("radiusConfig")) + this.radiusConfig = aNBT.getInteger("radiusConfig"); this.mPrimaryPumpedBlock = Block.getBlockFromName(aNBT.getString("mPumpedBlock1")); this.mSecondaryPumpedBlock = Block.getBlockFromName(aNBT.getString("mPumpedBlock2")); if (D1) { GT_Log.out.println("PUMP: NBT:Load - WasPumping - " + this.wasPumping + "(" + aNBT.getString("mPumpedBlock1") + ") " + this.mPrimaryPumpedBlock); } + } + + @Override + public void setItemNBT(NBTTagCompound aNBT) { + super.setItemNBT(aNBT); + aNBT.setInteger("radiusConfig", radiusConfig); + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + int max = getMaxPumpableDistance(); + if (aPlayer.isSneaking()) { + if (radiusConfig >= 0) { + radiusConfig--; + } + if (radiusConfig < 0) + radiusConfig = max; + } else { + if (radiusConfig <= max) { + radiusConfig++; + } + if (radiusConfig > max) + radiusConfig = 0; + } + GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + (radiusConfig * 2 + 1) + "x" + (radiusConfig * 2 + 1));//TODO Add translation support + + clearQueue(false); } @@ -351,11 +384,11 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } private void rebuildPumpQueue(int aX, int yStart, int aZ, int yEnd) { - int mDist = this.getMaxPumpableDistance(); + int mDist = this.radiusConfig; doTickProfilingInThisTick = false; - ArrayDeque<ChunkPosition> fluidsToSearch = new ArrayDeque<ChunkPosition>(); - ArrayDeque<ChunkPosition> fluidsFound = new ArrayDeque<ChunkPosition>(); - Set<ChunkPosition> checked = new HashSet<ChunkPosition>(); + ArrayDeque<ChunkPosition> fluidsToSearch = new ArrayDeque<>(); + ArrayDeque<ChunkPosition> fluidsFound = new ArrayDeque<>(); + Set<ChunkPosition> checked = new HashSet<>(); this.clearQueue(false); for (int aY = yStart ; this.mPumpList.isEmpty() && aY >= yEnd ; aY--) { @@ -364,22 +397,23 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { fluidsToSearch.add(new ChunkPosition(aX, aY, aZ)); while (!fluidsToSearch.isEmpty()) { - Iterator<ChunkPosition> i$ = fluidsToSearch.iterator(); - while(i$.hasNext()) { - ChunkPosition tPos = i$.next(); - + for (ChunkPosition tPos : fluidsToSearch) { // Look all around - if (tPos.chunkPosX < aX + mDist) queueFluid(tPos.chunkPosX + 1, tPos.chunkPosY, tPos.chunkPosZ, fluidsFound, checked); - if (tPos.chunkPosX > aX - mDist) queueFluid(tPos.chunkPosX - 1, tPos.chunkPosY, tPos.chunkPosZ, fluidsFound, checked); - if (tPos.chunkPosZ < aZ + mDist) queueFluid(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ + 1, fluidsFound, checked); - if (tPos.chunkPosZ > aZ - mDist) queueFluid(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ - 1, fluidsFound, checked); + if (tPos.chunkPosX < aX + mDist) + queueFluid(tPos.chunkPosX + 1, tPos.chunkPosY, tPos.chunkPosZ, fluidsFound, checked); + if (tPos.chunkPosX > aX - mDist) + queueFluid(tPos.chunkPosX - 1, tPos.chunkPosY, tPos.chunkPosZ, fluidsFound, checked); + if (tPos.chunkPosZ < aZ + mDist) + queueFluid(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ + 1, fluidsFound, checked); + if (tPos.chunkPosZ > aZ - mDist) + queueFluid(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ - 1, fluidsFound, checked); // And then look up queueFluid(tPos.chunkPosX, tPos.chunkPosY + 1, tPos.chunkPosZ, this.mPumpList, checked); } this.mPumpList.addAll(fluidsFound); fluidsToSearch = fluidsFound; - fluidsFound = new ArrayDeque<ChunkPosition>(); + fluidsFound = new ArrayDeque<>(); } // Make sure we don't have the pipe location in the queue @@ -486,7 +520,10 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { @Override public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) { - aList.addAll(Arrays.asList("Primary pumping fluid: " + (this.mPrimaryPumpedBlock != null ? this.mPrimaryPumpedBlock.getLocalizedName() : "None"), + aList.addAll(Arrays.asList( EnumChatFormatting.BLUE+StatCollector.translateToLocal("GT5U.machines.pump")+EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + (radiusConfig * 2 + 1)+ + EnumChatFormatting.RESET+" " + StatCollector.translateToLocal("GT5U.machines.blocks"), + "Primary pumping fluid: " + (this.mPrimaryPumpedBlock != null ? this.mPrimaryPumpedBlock.getLocalizedName() : "None"), "Secondary pumping fluid: " + (this.mSecondaryPumpedBlock != null ? this.mSecondaryPumpedBlock.getLocalizedName() : "None"), "Pumps below: " + mPumpCountBelow, "Queue size: " + mPumpList.size(), @@ -613,4 +650,13 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { mFakePlayer.setPosition(aBaseTile.getXCoord(), aBaseTile.getYCoord(), aBaseTile.getZCoord()); return mFakePlayer; } + + @Override + public String[] getInfoData() { + return new String[]{ + EnumChatFormatting.BLUE+StatCollector.translateToLocal("GT5U.machines.pump")+EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + (radiusConfig * 2 + 1)+ + EnumChatFormatting.RESET+" " + StatCollector.translateToLocal("GT5U.machines.blocks") + }; + } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java index 2a2cb978b7..98b8d3b005 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java @@ -44,15 +44,15 @@ public class GT_MetaTileEntity_AssemblyLine public String[] getDescription() {
return new String[]{"Assembling Line",
"Size: 3x(5-16)x4, variable length",
- "Bottom: Steel Machine Casing(or Maintenance or Input Hatch),",
- "Input Bus (Last Output Bus), Steel Machine Casing",
- "Middle: Reinforced Glass, Assembly Line, Reinforced Glass",
- "UpMiddle: Grate Machine Casing,",
- " Assembler Machine Casing,",
- " Grate Machine Casing (or Controller or Data Access Hatch)",
- "Top: Steel Casing(or Energy Hatch)",
- "Up to 16 repeating slices, last is Output Bus",
- "Optional 1x Data Access Hatch next to the Controller"};
+ "From Bottom to Top, Left to Right",
+ "Layer 1 - Solid Steel Machine Casing, Input Bus (last is Output Bus), Solid Steel Machine Casing",
+ " - Casings can be replaced by Maint or Input Hatch",
+ "Layer 2 - Reinforced Glass, Assembling Line Casing, Reinforced Glass",
+ "Layer 3 - Grate Machine Casing, Assembler Machine Casing, Grate Machine Casing",
+ "Layer 4 - Empty, Solid Steel Machine Casing, Empty - Casing can be replaced by Energy Hatch",
+ "Up to 16 repeating slices, First replaces 1 Grate with Assembly Line,",
+ "Last has Output Bus instead of Input Bus",
+ "Optional - Replace 1x Grate with Data Access Hatch next to the Controller"};
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
@@ -86,7 +86,7 @@ public class GT_MetaTileEntity_AssemblyLine if(GT_Values.D1)
GT_FML_LOGGER.info("Stick accepted, " + tDataStickList.size() + " Data Sticks found");
- ItemStack[] tStack = new ItemStack[15];
+ ItemStack tStack[] = new ItemStack[15];
FluidStack[] tFluids = new FluidStack[4];
boolean findRecipe = false;
nextDS:for (ItemStack tDataStick : tDataStickList){
@@ -144,7 +144,7 @@ public class GT_MetaTileEntity_AssemblyLine continue nextDS;
}
FluidStack fluidInHatch = mInputHatches.get(i).mFluid;
- if (!GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) {
+ if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) {
if(GT_Values.D1)
GT_FML_LOGGER.info(i+" not accepted");
continue nextDS;
@@ -171,17 +171,11 @@ public class GT_MetaTileEntity_AssemblyLine continue;
mEUt = tTag.getInteger("eu");
- if (Math.abs(this.mEUt) > this.getMaxInputVoltage()) {
- if(GT_Values.D1)
- GT_FML_LOGGER.info("Found avaiable recipe, but Voltage too low!");
- return false;
- }
if(GT_Values.D1)GT_FML_LOGGER.info("Find avaiable recipe");
findRecipe = true;
break;
}
- if (!findRecipe)
- return false;
+ if (!findRecipe) return false;
if(GT_Values.D1)GT_FML_LOGGER.info("All checked start consuming inputs");
for (int i = 0; i < 15; i++) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java index 6a6ed14663..95b45e2cc4 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java @@ -31,7 +31,7 @@ public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_Pri "Controller has to be placed in the (front) center of the second layer", "Useable for Steel and general Pyrometallurgy", "Size(WxHxD): 3x4x3 (Hollow, with opening on top)", - "Built from 32 Fired Brick Blocks", + "Built from 32 Firebricks", "Causes 200 Pollution per second"}; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java index 46c9acd232..d6e31418f5 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java @@ -40,7 +40,7 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas "Controller Block for the Cleanroom", "Min(WxHxD): 3x4x3 (Hollow), Max(WxHxD): 15x15x15 (Hollow)", "Controller (Top center)", - "Top besides contoller and edges: Filter Casings", + "Top besides contoller and edges: Filter Machine Casing", "1 Reinforced Door (keep closed for 100% efficency)", "1x LV or 1x MV Energy Hatch, 1x Maintainance Hatch", "Up to 10 Machine Hull Item & Energy transfer through walls", diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java index 1dfdf0f58d..b6ebd46b94 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java @@ -266,6 +266,9 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock StatCollector.translateToLocal("GT5U.multiblock.energy")+": " + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU", + getIdealStatus() == getRepairStatus() ? + EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.maintenance.false")+EnumChatFormatting.RESET : + EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.maintenance.true")+EnumChatFormatting.RESET, StatCollector.translateToLocal("GT5U.engine.output")+": " +EnumChatFormatting.RED+(-mEUt*mEfficiency/10000)+EnumChatFormatting.RESET+" EU/t", StatCollector.translateToLocal("GT5U.engine.consumption")+": " +EnumChatFormatting.YELLOW+fuelConsumption+EnumChatFormatting.RESET+" L/t", StatCollector.translateToLocal("GT5U.engine.value")+": " +EnumChatFormatting.YELLOW+fuelValue+EnumChatFormatting.RESET+" EU/L", diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java index 52ec86e2cc..87b78ff0d0 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java @@ -11,13 +11,17 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_ChunkManager; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.ChunkCoordIntPair; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.ForgeDirection; @@ -43,6 +47,10 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu protected int workState; protected static final int STATE_DOWNWARD = 0, STATE_AT_BOTTOM = 1, STATE_UPWARD = 2; + protected boolean mChunkLoadingEnabled = true; + protected ChunkCoordIntPair mCurrentChunk = null; + protected boolean mWorkChunkNeedsReload = true; + public GT_MetaTileEntity_DrillerBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); initFields(); @@ -72,13 +80,52 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setInteger("workState", workState); + aNBT.setBoolean("chunkLoadingEnabled", mChunkLoadingEnabled); + aNBT.setBoolean("isChunkloading", mCurrentChunk != null); + if (mCurrentChunk != null) { + aNBT.setInteger("loadedChunkXPos", mCurrentChunk.chunkXPos); + aNBT.setInteger("loadedChunkZPos", mCurrentChunk.chunkZPos); + } } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); workState = aNBT.getInteger("workState"); - if (aNBT.hasKey("isPickingPipes")) workState = aNBT.getBoolean("isPickingPipes") ? STATE_UPWARD : STATE_DOWNWARD; + if (aNBT.hasKey("isPickingPipes")) + workState = aNBT.getBoolean("isPickingPipes") ? STATE_UPWARD : STATE_DOWNWARD; + if (aNBT.hasKey("chunkLoadingEnabled")) + mChunkLoadingEnabled = aNBT.getBoolean("chunkLoadingEnabled"); + if (aNBT.getBoolean("isChunkloading")) { + mCurrentChunk = new ChunkCoordIntPair(aNBT.getInteger("loadedChunkXPos"), aNBT.getInteger("loadedChunkZPos")); + } + } + + @Override + public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (aSide == getBaseMetaTileEntity().getFrontFacing()) { + mChunkLoadingEnabled = !mChunkLoadingEnabled; + GT_Utility.sendChatToPlayer(aPlayer, mChunkLoadingEnabled ? trans("502", "Mining chunk loading enabled") : trans("503", "Mining chunk loading disabled")); + return true; + } + return super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ); + } + + @Override + public void onRemoval() { + if (mChunkLoadingEnabled) + GT_ChunkManager.releaseTicket((TileEntity)getBaseMetaTileEntity()); + super.onRemoval(); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (aBaseMetaTileEntity.isServerSide() && mCurrentChunk != null && !mWorkChunkNeedsReload && !aBaseMetaTileEntity.isAllowedToWork()) { + // if machine has stopped, stop chunkloading + GT_ChunkManager.releaseTicket((TileEntity)aBaseMetaTileEntity); + mWorkChunkNeedsReload = true; + } } protected boolean tryPickPipe() { @@ -413,5 +460,4 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu } return false; } - } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java index 3797806460..8d4d81a5d2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java @@ -9,7 +9,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; import net.minecraft.block.Block; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java index fb3f58efd5..01410440d8 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java @@ -9,9 +9,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; @@ -42,6 +40,7 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar "Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)", "1x Plasma Input Hatch (Side centered)", "1x Maintenance Hatch (Side centered)", + "1x Output Hatch (Side centered, optional)", "1x Dynamo Hatch (Back centered)", "Tungstensteel Turbine Casings for the rest (24 at least!)", "Needs a Turbine Item (Inside controller GUI)"}; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java index 6e6c2c7922..76f8e7f87f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java @@ -4,15 +4,17 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; -import java.lang.Math; //Java was written by idiots import static gregtech.api.enums.GT_Values.VN; import static gregtech.api.enums.GT_Values.debugDriller; @@ -26,6 +28,8 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D private ArrayList<Chunk> mOilFieldChunks = new ArrayList<Chunk>(); private int mOilId = 0; + private int chunkRangeConfig = getRangeInChunks(); + public GT_MetaTileEntity_OilDrillBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -38,12 +42,15 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setInteger("mOilId", mOilId); + aNBT.setInteger("chunkRangeConfig", chunkRangeConfig); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); mOilId = aNBT.getInteger("mOilId"); + if (aNBT.hasKey("chunkRangeConfig")) + chunkRangeConfig = aNBT.getInteger("chunkRangeConfig"); } protected String[] getDescriptionInternal(String tierSuffix) { @@ -57,7 +64,8 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D "1x Output Hatch (One of base casings)", "1x Maintenance Hatch (One of base casings)", "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)", - "Working on " + getRangeInChunks() + " * " + getRangeInChunks() + " chunks", + "Working on " + getRangeInChunks() + "x" + getRangeInChunks() + " chunks", + "Use Screwdriver to configure range", "Use Programmed Circuits to ignore near exhausted oil field"}; } @@ -70,6 +78,25 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D protected abstract int getRangeInChunks(); @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + if (aPlayer.isSneaking()) { + if (chunkRangeConfig > 0) { + chunkRangeConfig--; + } + if (chunkRangeConfig == 0) + chunkRangeConfig = getRangeInChunks(); + } else { + if (chunkRangeConfig <= getRangeInChunks()) { + chunkRangeConfig++; + } + if (chunkRangeConfig > getRangeInChunks()) + chunkRangeConfig = 1; + } + GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + chunkRangeConfig + "x" + chunkRangeConfig + StatCollector.translateToLocal("GT5U.machines.chunks"));//TODO Add translation support + } + + @Override protected boolean checkHatches() { return !mMaintenanceHatches.isEmpty() && !mOutputHatches.isEmpty() && !mEnergyHatches.isEmpty(); } @@ -82,7 +109,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D this.mEUt = -7 << (tier << 1);//(1/4) A of current tier when at bottom (7/8) A of current tier while mining this.mMaxProgresstime = Math.max(1, (workState == STATE_AT_BOTTOM ? - (64 * (getRangeInChunks() * getRangeInChunks()))>>(getMinTier()-1) : + (64 * (chunkRangeConfig * chunkRangeConfig))>>(getMinTier()-1) : 120 ) >> tier); } @@ -123,7 +150,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D if (mOilFieldChunks.isEmpty()) { Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord()); - int range = getRangeInChunks(); + int range = chunkRangeConfig; int xChunk = Math.floorDiv(tChunk.xPosition,range) * range; //Java was written by idiots. For negative values, / returns rounded towards zero. Fucking morons. int zChunk = Math.floorDiv(tChunk.zPosition,range) * range; if (debugDriller) { @@ -206,4 +233,13 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D } return tOil.amount == 0 ? null : tOil; } + + @Override + public String[] getInfoData() { + return new String[]{ + EnumChatFormatting.BLUE+StatCollector.translateToLocal("GT5U.machines.oilfluidpump")+EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + (chunkRangeConfig)+ " x " + (chunkRangeConfig) + + EnumChatFormatting.RESET+" " + StatCollector.translateToLocal("GT5U.machines.chunks") + }; + } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java index a528e39472..9a0422ebfc 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java @@ -4,7 +4,9 @@ import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.interfaces.IChunkLoader; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_ChunkManager; import gregtech.api.objects.ItemData; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; @@ -12,39 +14,87 @@ import gregtech.api.util.GT_Utility; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_TileEntity_Ores; import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.ChunkPosition; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; import static gregtech.api.enums.GT_Values.VN; -public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_DrillerBase { - +public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_DrillerBase implements IChunkLoader { private final ArrayList<ChunkPosition> oreBlockPositions = new ArrayList<>(); - protected int mTier=1; + protected int mTier = 1; + private int chunkRadiusConfig = getRadiusInChunks(); - public GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) { + GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } - public GT_MetaTileEntity_OreDrillingPlantBase(String aName) { + GT_MetaTileEntity_OreDrillingPlantBase(String aName) { super(aName); } @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("chunkRadiusConfig", chunkRadiusConfig); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + if (aNBT.hasKey("chunkRadiusConfig")) + chunkRadiusConfig = aNBT.getInteger("chunkRadiusConfig"); + } + + @Override + public ChunkCoordIntPair getActiveChunk(){return mCurrentChunk;} + + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "OreDrillingPlant.png"); } @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + if (aPlayer.isSneaking()) { + if (chunkRadiusConfig > 0) { + chunkRadiusConfig--; + } + if (chunkRadiusConfig == 0) + chunkRadiusConfig = getRadiusInChunks(); + } else { + if (chunkRadiusConfig <= getRadiusInChunks()) { + chunkRadiusConfig++; + } + if (chunkRadiusConfig > getRadiusInChunks()) + chunkRadiusConfig = 1; + } + GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + (chunkRadiusConfig << 4) + StatCollector.translateToLocal("GT5U.machines.radius"));//TODO Add translation support + } + + @Override protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { - if (yHead != oldYHead) oreBlockPositions.clear(); + if (yHead != oldYHead) + oreBlockPositions.clear(); + if (mWorkChunkNeedsReload && mChunkLoadingEnabled) { // ask to load machine itself + GT_ChunkManager.requestChunkLoad((TileEntity) getBaseMetaTileEntity(), null); + mWorkChunkNeedsReload = false; + } fillMineListIfEmpty(xDrill, yDrill, zDrill, xPipe, zPipe, yHead); if (oreBlockPositions.isEmpty()) { switch (tryLowerPipeState()) { @@ -55,7 +105,9 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile //new layer - fill again fillMineListIfEmpty(xDrill, yDrill, zDrill, xPipe, zPipe, yHead); } - + return processOreList(); + } + private boolean processOreList(){ ChunkPosition oreBlockPos = null; Block oreBlock = null; @@ -70,14 +122,76 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile return false; } if (oreBlock != null && oreBlock != Blocks.air) { - ArrayList<ItemStack> oreBlockDrops = getBlockDrops(oreBlock, oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); + Collection<ItemStack> oreBlockDrops = getBlockDrops(oreBlock, oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); getBaseMetaTileEntity().getWorld().setBlockToAir(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); mOutputItems = getOutputByDrops(oreBlockDrops); } - return true; } + @Override + protected boolean workingAtBottom(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { + if (!mChunkLoadingEnabled || chunkRadiusConfig == 1) + return super.workingAtBottom(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead); + + if (mCurrentChunk == null) { + createInitialWorkingChunk(xDrill, zDrill); + return true; + } + + if (mWorkChunkNeedsReload) { + GT_ChunkManager.requestChunkLoad((TileEntity)getBaseMetaTileEntity(), mCurrentChunk); + mWorkChunkNeedsReload = false; + return true; + } + if (oreBlockPositions.isEmpty()){ + fillChunkMineList(yHead, yDrill); + if (oreBlockPositions.isEmpty()) { + GT_ChunkManager.releaseChunk((TileEntity)getBaseMetaTileEntity(), mCurrentChunk); + if (!moveToNextChunk(xDrill >> 4, zDrill >> 4)) + workState = STATE_UPWARD; + return true; + } + } + return processOreList(); + } + private void createInitialWorkingChunk(int xDrill, int zDrill) { + final int centerX = xDrill >> 4; + final int centerZ = zDrill >> 4; + mCurrentChunk = new ChunkCoordIntPair(centerX - chunkRadiusConfig + 1, centerZ - chunkRadiusConfig + 1); + GT_ChunkManager.requestChunkLoad((TileEntity)getBaseMetaTileEntity(), mCurrentChunk); + mWorkChunkNeedsReload = false; + } + + @Override + protected boolean workingUpward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) { + if (!mChunkLoadingEnabled || chunkRadiusConfig == 1 || oreBlockPositions.isEmpty()) + return super.workingUpward(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead); + boolean result = processOreList(); + if (oreBlockPositions.isEmpty()) + GT_ChunkManager.releaseTicket((TileEntity)getBaseMetaTileEntity()); + return result; + } + private boolean moveToNextChunk(int centerX, int centerZ){ + if (mCurrentChunk == null) + return false; + int nextChunkX = mCurrentChunk.chunkXPos + 1; + int nextChunkZ = mCurrentChunk.chunkZPos; + if (nextChunkX >= (centerX + chunkRadiusConfig)){ + nextChunkX = centerX - chunkRadiusConfig + 1; + ++nextChunkZ; + } + if (nextChunkZ >= (centerZ + chunkRadiusConfig)) { + mCurrentChunk = null; + return false; + } + // skip center chunk - dug in workingDownward() + if (nextChunkX == centerX && nextChunkZ == centerZ) + ++nextChunkX; + mCurrentChunk = new ChunkCoordIntPair(nextChunkX, nextChunkZ); + GT_ChunkManager.requestChunkLoad((TileEntity)getBaseMetaTileEntity(), new ChunkCoordIntPair(nextChunkX, nextChunkZ)); + return true; + } @Override protected boolean checkHatches(){ return !mMaintenanceHatches.isEmpty() && !mInputHatches.isEmpty() && !mOutputBusses.isEmpty() && !mEnergyHatches.isEmpty(); @@ -89,34 +203,30 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile this.mEfficiencyIncrease = 10000; int tier = Math.max(1, GT_Utility.getTier(getMaxInputVoltage())); this.mEUt = -3 * (1 << (tier << 1)); - this.mMaxProgresstime = (workState == STATE_DOWNWARD ? getBaseProgressTime() : 80) / (1 <<tier); + this.mMaxProgresstime = ((workState == STATE_DOWNWARD || workState == STATE_AT_BOTTOM) ? getBaseProgressTime() : 80) / (1 <<tier); this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); } - private ItemStack[] getOutputByDrops(ArrayList<ItemStack> oreBlockDrops) { + private ItemStack[] getOutputByDrops(Collection<ItemStack> oreBlockDrops) { long voltage = getMaxInputVoltage(); - ArrayList<ItemStack> outputItems = new ArrayList<>(); - while (!oreBlockDrops.isEmpty()) { - ItemStack currentItem = oreBlockDrops.remove(0).copy(); + Collection<ItemStack> outputItems = new HashSet<>(); + oreBlockDrops.forEach(currentItem -> { if (!doUseMaceratorRecipe(currentItem)) { - multiplyStackSize(currentItem); - outputItems.add(currentItem); - continue; + outputItems.add(multiplyStackSize(currentItem)); + return; } - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(getBaseMetaTileEntity(), false, voltage, null, currentItem); if (tRecipe == null) { outputItems.add(currentItem); - continue; + return; } - for (int i = 0; i < tRecipe.mOutputs.length; i++) { ItemStack recipeOutput = tRecipe.mOutputs[i].copy(); if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(i)) multiplyStackSize(recipeOutput); outputItems.add(recipeOutput); } - } + }); return outputItems.toArray(new ItemStack[0]); } @@ -129,17 +239,17 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile && itemData.mMaterial.mMaterial != Materials.Oilsands; } - private void multiplyStackSize(ItemStack itemStack) { + private ItemStack multiplyStackSize(ItemStack itemStack) { itemStack.stackSize *= getBaseMetaTileEntity().getRandomNumber(4) + 1; + return itemStack; } - private ArrayList<ItemStack> getBlockDrops(final Block oreBlock, int posX, int posY, int posZ) { + private Collection<ItemStack> getBlockDrops(final Block oreBlock, int posX, int posY, int posZ) { final int blockMeta = getBaseMetaTileEntity().getMetaID(posX, posY, posZ); if (oreBlock.canSilkHarvest(getBaseMetaTileEntity().getWorld(), null, posX, posY, posZ, blockMeta)) { - return new ArrayList<ItemStack>() {{ - add(new ItemStack(oreBlock, 1, blockMeta)); - }}; - } else return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier*5+1); + return Collections.singleton(new ItemStack(oreBlock, 1, blockMeta)); + } else + return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier + 3); } private boolean tryConsumeDrillingFluid() { @@ -150,26 +260,50 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile return true; } + private void fillChunkMineList(int yHead, int yDrill) { + if (mCurrentChunk == null || !oreBlockPositions.isEmpty()) + return; + final int minX = mCurrentChunk.chunkXPos << 4; + final int maxX = minX + 16; + final int minZ = mCurrentChunk.chunkZPos << 4; + final int maxZ = minZ + 16; + for (int x = minX; x < maxX; ++x) + for (int z = minZ; z < maxZ; ++z) + for (int y = yHead; y < yDrill; ++y) + tryAddOreBlockToMineList(x, y, z); + } + private void fillMineListIfEmpty(int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead) { - if (!oreBlockPositions.isEmpty()) return; + if (!oreBlockPositions.isEmpty()) + return; tryAddOreBlockToMineList(xPipe, yHead - 1, zPipe); - if (yHead == yDrill) return; //skip controller block layer + if (yHead == yDrill) + return; //skip controller block layer - int radius = getRadiusInChunks() << 4; - for (int xOff = -radius; xOff <= radius; xOff++) - for (int zOff = -radius; zOff <= radius; zOff++) - tryAddOreBlockToMineList(xDrill + xOff, yHead, zDrill + zOff); + if (mChunkLoadingEnabled) { + int startX = (xDrill >> 4) << 4; + int startZ = (zDrill >> 4) << 4; + for (int x = startX; x < (startX + 16); ++x) + for (int z = startZ; z < (startZ + 16); ++z) + tryAddOreBlockToMineList(x, yHead, z); + } else { + int radius = chunkRadiusConfig << 4; + for (int xOff = -radius; xOff <= radius; xOff++) + for (int zOff = -radius; zOff <= radius; zOff++) + tryAddOreBlockToMineList(xDrill + xOff, yHead, zDrill + zOff); + } } private void tryAddOreBlockToMineList(int x, int y, int z) { Block block = getBaseMetaTileEntity().getBlock(x, y, z); int blockMeta = getBaseMetaTileEntity().getMetaID(x, y, z); ChunkPosition blockPos = new ChunkPosition(x, y, z); - if (oreBlockPositions.contains(blockPos)) return; + if (oreBlockPositions.contains(blockPos)) + return; if (block instanceof GT_Block_Ores_Abstract) { TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntity(x, y, z); - if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) + if (tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) oreBlockPositions.add(blockPos); } else { ItemData association = GT_OreDictUnificator.getAssociation(new ItemStack(block, 1, blockMeta)); @@ -195,7 +329,18 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile "1x Output Bus (Any bottom layer casing)", "1x Maintenance Hatch (Any bottom layer casing)", "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)", - "Radius is " + (getRadiusInChunks() << 4) + " blocks", - "Fortune bonus of " + mTier * 5}; + "Use Screwdriver to configure block radius", + "Use Soldering iron to turn off chunk mode", + "Maximum radius is " + (getRadiusInChunks() << 4) + " blocks", + "Fortune bonus of " + (mTier + 3)}; + } + + @Override + public String[] getInfoData() { + return new String[]{ + EnumChatFormatting.BLUE+StatCollector.translateToLocal("GT5U.machines.minermulti")+EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.machines.workarea")+": " + EnumChatFormatting.GREEN + (chunkRadiusConfig * 2 + 1)+ + EnumChatFormatting.RESET+" " + StatCollector.translateToLocal("GT5U.machines.chunks") + }; } -}
\ No newline at end of file +} diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java index a1f0e4827b..401cf62c8c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java @@ -3,15 +3,12 @@ package gregtech.common.tileentities.machines.multi; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -29,9 +26,8 @@ import java.util.Arrays; public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlockBase { private int coilMetaID; - public static GT_CopiedBlockTexture mTextureULV = new GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0, Dyes.MACHINE_METAL.mRGBa); - - //private final int CASING_INDEX = 22; + //public static GT_CopiedBlockTexture mTextureULV = new GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0, Dyes.MACHINE_METAL.mRGBa); + private final int CASING_INDEX = 1090; public GT_MetaTileEntity_PyrolyseOven(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -61,9 +57,9 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{mTextureULV, new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[8][66], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN)}; } - return new ITexture[]{mTextureULV}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[8][66]}; } public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { @@ -172,7 +168,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock } } } else if (h == 3) {// innen decke (ulv casings + input + muffler) - if ((!addInputToMachineList(tTileEntity, 22)) && (!addMufflerToMachineList(tTileEntity, 22))) { + if ((!addInputToMachineList(tTileEntity, CASING_INDEX)) && (!addMufflerToMachineList(tTileEntity, CASING_INDEX))) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) { return false; } @@ -187,7 +183,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock } } else {// Aeusserer 5x5 ohne hoehe if (h == 0) {// aussen boden (controller, output, energy, maintainance, rest ulv casings) - if ((!addMaintenanceToMachineList(tTileEntity, 22)) && (!addOutputToMachineList(tTileEntity, 22)) && (!addEnergyInputToMachineList(tTileEntity, 22))) { + if ((!addMaintenanceToMachineList(tTileEntity, CASING_INDEX)) && (!addOutputToMachineList(tTileEntity, CASING_INDEX)) && (!addEnergyInputToMachineList(tTileEntity, CASING_INDEX))) { if ((xDir + i != 0) || (zDir + j != 0)) {//no controller if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) { return false; diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java new file mode 100644 index 0000000000..43c1778d8f --- /dev/null +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java @@ -0,0 +1,299 @@ +package gregtech.common.tileentities.storage; + +import cpw.mods.fml.common.Optional; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; +import gregtech.api.objects.AE2DigitalChestHandler; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Utility; +import gregtech.common.gui.GT_Container_QuantumChest; +import gregtech.common.gui.GT_GUIContainer_QuantumChest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; + +@Optional.Interface(iface = "appeng.api.storage.IMEInventory", modid = "appliedenergistics2") +public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEntity_TieredMachineBlock implements appeng.api.storage.IMEInventory<appeng.api.storage.data.IAEItemStack> { + public GT_MetaTileEntity_DigitalChestBase(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 3, "This Chest stores " + CommonSizeCompute(aTier) + " Blocks"); + } + + public GT_MetaTileEntity_DigitalChestBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + public GT_MetaTileEntity_DigitalChestBase(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return true; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isValidSlot(int aIndex) { + return true; + } + + @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_QuantumChest(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_QuantumChest(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + + if (getBaseMetaTileEntity().isServerSide() && getBaseMetaTileEntity().isAllowedToWork()) { + if ((getItemCount() <= 0)) { + setItemStack(null); + setItemCount(0); + } + if (getItemStack() == null && mInventory[0] != null) { + setItemStack(mInventory[0].copy()); + } + int count = getItemCount(); + ItemStack stack = getItemStack(); + if ((mInventory[0] != null) && (count < getMaxItemCount()) && GT_Utility.areStacksEqual(mInventory[0], stack)) { + count += mInventory[0].stackSize; + if (count > getMaxItemCount()) { + mInventory[0].stackSize = (count - getMaxItemCount()); + count = getMaxItemCount(); + } else { + mInventory[0] = null; + } + } + if (mInventory[1] == null && stack != null) { + mInventory[1] = stack.copy(); + mInventory[1].stackSize = Math.min(stack.getMaxStackSize(), count); + count -= mInventory[1].stackSize; + } else if ((count > 0) && GT_Utility.areStacksEqual(mInventory[1], stack) && mInventory[1].getMaxStackSize() > mInventory[1].stackSize) { + int tmp = Math.min(count, mInventory[1].getMaxStackSize() - mInventory[1].stackSize); + mInventory[1].stackSize += tmp; + count -= tmp; + } + setItemCount(count); + if (stack != null) { + mInventory[2] = stack.copy(); + mInventory[2].stackSize = Math.min(stack.getMaxStackSize(), count); + } else { + mInventory[2] = null; + } + } + } + + abstract protected int getItemCount(); + abstract public void setItemCount(int aCount); + abstract protected ItemStack getItemStack(); + abstract protected void setItemStack(ItemStack s); + + @Override + public int getProgresstime() { + return getItemCount() + (mInventory[0] == null ? 0 : mInventory[0].stackSize) + (mInventory[1] == null ? 0 : mInventory[1].stackSize); + } + + @Override + public int maxProgresstime() { + return getMaxItemCount(); + } + + protected static int CommonSizeCompute(int tier){ + switch(tier){ + case 1: + return 4000000; + case 2: + return 8000000; + case 3: + return 16000000; + case 4: + return 32000000; + case 5: + return 64000000; + case 6: + return 128000000; + case 7: + return 256000000; + case 8: + return 512000000; + case 9: + return 1024000000; + case 10: + return 2147483640; + default: + return 0; + } + } + + @Override + public int getMaxItemCount() { + return CommonSizeCompute(mTier); + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aIndex == 1; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aIndex == 0 && (mInventory[0] == null || GT_Utility.areStacksEqual(mInventory[0], aStack)); + } + + abstract protected String chestName(); + + @Optional.Method(modid = "appliedenergistics2") + public static void registerAEIntegration() { + appeng.api.AEApi.instance().registries().externalStorage().addExternalStorageInterface(new AE2DigitalChestHandler()); + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setInteger("mItemCount", getItemCount()); + if (getItemStack() != null) + aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound())); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + if (aNBT.hasKey("mItemCount")) + setItemCount(aNBT.getInteger("mItemCount")); + if (aNBT.hasKey("mItemStack")) + setItemStack(ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack"))); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aBaseMetaTileEntity.getFrontFacing() == 0 && aSide == 4) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_QCHEST)}; + } + return aSide == aBaseMetaTileEntity.getFrontFacing() ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_QCHEST)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]};//aSide != aFacing ? mMachineBlock != 0 ? new ITexture[] {Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]} : new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]} : mMachineBlock != 0 ? aActive ? getTexturesActive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : getTexturesInactive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : aActive ? getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]) : getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]); + } + + @Override + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + return new ITexture[0][0][0]; + } + + @Override + public String[] getInfoData() { + + if (getItemStack() == null) { + return new String[]{ + EnumChatFormatting.BLUE + chestName() + EnumChatFormatting.RESET, + "Stored Items:", + EnumChatFormatting.GOLD + "No Items" + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + "0" + EnumChatFormatting.RESET + " " + + EnumChatFormatting.YELLOW + getMaxItemCount() + EnumChatFormatting.RESET + }; + } + return new String[]{ + EnumChatFormatting.BLUE + chestName() + EnumChatFormatting.RESET, + "Stored Items:", + EnumChatFormatting.GOLD + getItemStack().getDisplayName() + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + Integer.toString(getItemCount()) + EnumChatFormatting.RESET + " " + + EnumChatFormatting.YELLOW + getMaxItemCount() + EnumChatFormatting.RESET + }; + } + + @Optional.Method(modid = "appliedenergistics2") + public appeng.api.storage.data.IAEItemStack injectItems(final appeng.api.storage.data.IAEItemStack input, final appeng.api.config.Actionable mode, final appeng.api.networking.security.BaseActionSource src) { + final ItemStack inputStack = input.getItemStack(); + if (inputStack == null) + return null; + ItemStack storedStack = getItemStack(); + if (storedStack != null) { + if (GT_Utility.areStacksEqual(storedStack, inputStack)) { + if (input.getStackSize() + getItemCount() > getMaxItemCount()) + return createOverflowStack(input.getStackSize() + getItemCount(), mode); + else { + if (mode != appeng.api.config.Actionable.SIMULATE) + setItemCount(getItemCount() + (int) input.getStackSize()); + } + return null; + } else + return input; + } else { + if (mode != appeng.api.config.Actionable.SIMULATE) + setItemStack(inputStack.copy()); + if (input.getStackSize() > getMaxItemCount()) + return createOverflowStack(input.getStackSize(), mode); + else if (mode != appeng.api.config.Actionable.SIMULATE) + setItemCount((int) input.getStackSize()); + return null; + } + } + + @Optional.Method(modid = "appliedenergistics2") + private appeng.api.storage.data.IAEItemStack createOverflowStack(long size, appeng.api.config.Actionable mode) { + final appeng.api.storage.data.IAEItemStack overflow = appeng.util.item.AEItemStack.create(getItemStack()); + overflow.setStackSize(size - getMaxItemCount()); + if (mode != appeng.api.config.Actionable.SIMULATE) + setItemCount(getMaxItemCount()); + return overflow; + } + + @Optional.Method(modid = "appliedenergistics2") + public appeng.api.storage.data.IAEItemStack extractItems(final appeng.api.storage.data.IAEItemStack request, final appeng.api.config.Actionable mode, final appeng.api.networking.security.BaseActionSource src) { + if (request.equals(getItemStack())) { + if (request.getStackSize() >= getItemCount()) { + appeng.util.item.AEItemStack result = appeng.util.item.AEItemStack.create(getItemStack()); + result.setStackSize(getItemCount()); + if (mode != appeng.api.config.Actionable.SIMULATE) + setItemCount(0); + return result; + } else { + if (mode != appeng.api.config.Actionable.SIMULATE) + setItemCount(getItemCount() - (int) request.getStackSize()); + return request.copy(); + } + } + return null; + } + + @Optional.Method(modid = "appliedenergistics2") + public appeng.api.storage.StorageChannel getChannel() { + return appeng.api.storage.StorageChannel.ITEMS; + } + + @Optional.Method(modid = "appliedenergistics2") + public appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> getAvailableItems(final appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> out) { + ItemStack storedStack = getItemStack(); + if (storedStack != null) { + appeng.util.item.AEItemStack s = appeng.util.item.AEItemStack.create(storedStack); + s.setStackSize(getItemCount()); + out.add(s); + } + return out; + } +} diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java index 5ab451bb03..20d333783e 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumChest.java @@ -1,213 +1,39 @@ package gregtech.common.tileentities.storage; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import gregtech.common.gui.GT_Container_QuantumChest; -import gregtech.common.gui.GT_GUIContainer_QuantumChest; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -public class GT_MetaTileEntity_QuantumChest extends GT_MetaTileEntity_TieredMachineBlock { +public class GT_MetaTileEntity_QuantumChest extends GT_MetaTileEntity_DigitalChestBase { public int mItemCount = 0; public ItemStack mItemStack = null; public GT_MetaTileEntity_QuantumChest(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, "This Chest stores " + CommonSizeCompute(aTier) + " Blocks"); + super(aID, aName, aNameRegional, aTier); } public GT_MetaTileEntity_QuantumChest(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); + super(aName, aTier, aDescription, aTextures); } public GT_MetaTileEntity_QuantumChest(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; + super(aName, aTier, aDescription, aTextures); } @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_QuantumChest(mName, mTier, mDescriptionArray, mTextures); } - - @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_QuantumChest(aPlayerInventory, aBaseMetaTileEntity); - } - + protected String chestName(){ return "Quantum Chest"; } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_QuantumChest(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); - } - + protected int getItemCount() { return mItemCount; } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - - if (getBaseMetaTileEntity().isServerSide() && getBaseMetaTileEntity().isAllowedToWork()) { - if ((getItemCount() <= 0)) { - this.mItemStack = null; - this.mItemCount = 0; - } - if (this.mItemStack == null && this.mInventory[0] != null) { - this.mItemStack = mInventory[0].copy(); - } - if ((this.mInventory[0] != null) && (this.mItemCount < getMaxItemCount()) && GT_Utility.areStacksEqual(this.mInventory[0], this.mItemStack)) { - this.mItemCount += this.mInventory[0].stackSize; - if (this.mItemCount > getMaxItemCount()) { - this.mInventory[0].stackSize = (this.mItemCount - getMaxItemCount()); - this.mItemCount = getMaxItemCount(); - } else { - this.mInventory[0] = null; - } - } - if (this.mInventory[1] == null && mItemStack != null) { - this.mInventory[1] = mItemStack.copy(); - this.mInventory[1].stackSize = Math.min(mItemStack.getMaxStackSize(), this.mItemCount); - this.mItemCount -= this.mInventory[1].stackSize; - } else if ((this.mItemCount > 0) && GT_Utility.areStacksEqual(this.mInventory[1], this.mItemStack) && this.mInventory[1].getMaxStackSize() > this.mInventory[1].stackSize) { - int tmp = Math.min(this.mItemCount, this.mInventory[1].getMaxStackSize() - this.mInventory[1].stackSize); - this.mInventory[1].stackSize += tmp; - this.mItemCount -= tmp; - } - if (this.mItemStack != null) { - this.mInventory[2] = this.mItemStack.copy(); - this.mInventory[2].stackSize = Math.min(mItemStack.getMaxStackSize(), this.mItemCount); - } else { - this.mInventory[2] = null; - } - } - } - - private int getItemCount() { - return this.mItemCount; - } - public void setItemCount(int aCount) { - this.mItemCount = aCount; - } - - public int getProgresstime() { - return this.mItemCount + (this.mInventory[0] == null ? 0 : this.mInventory[0].stackSize) + (this.mInventory[1] == null ? 0 : this.mInventory[1].stackSize); - } - - public int maxProgresstime() { - return getMaxItemCount(); - } - - private static int CommonSizeCompute(int tier){ - switch(tier){ - case 6: - return 128000000; - case 7: - return 256000000; - case 8: - return 512000000; - case 9: - return 1024000000; - case 10: - return 2147483640; - default: - return 0; - } - } - - public int getMaxItemCount() { - return CommonSizeCompute(mTier); - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aIndex==1; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aIndex==0&&(mInventory[0]==null||GT_Utility.areStacksEqual(this.mInventory[0], aStack)); - } - - @Override - public String[] getInfoData() { - - if (mItemStack == null) { - return new String[]{ - EnumChatFormatting.BLUE + "Quantum Chest"+ EnumChatFormatting.RESET, - "Stored Items:", - EnumChatFormatting.GOLD+ "No Items"+ EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + "0" + EnumChatFormatting.RESET+" "+ - EnumChatFormatting.YELLOW + Integer.toString(getMaxItemCount())+ EnumChatFormatting.RESET - }; - } - return new String[]{ - EnumChatFormatting.BLUE + "Quantum Chest"+ EnumChatFormatting.RESET, - "Stored Items:", - EnumChatFormatting.GOLD + mItemStack.getDisplayName() + EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + Integer.toString(mItemCount) + EnumChatFormatting.RESET+" "+ - EnumChatFormatting.YELLOW + Integer.toString(getMaxItemCount())+ EnumChatFormatting.RESET - }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mItemCount", this.mItemCount); - if (this.mItemStack != null) - aNBT.setTag("mItemStack", this.mItemStack.writeToNBT(new NBTTagCompound())); + mItemCount = aCount; } - @Override - public void loadNBTData(NBTTagCompound aNBT) { - if (aNBT.hasKey("mItemCount")) - this.mItemCount = aNBT.getInteger("mItemCount"); - if (aNBT.hasKey("mItemStack")) - this.mItemStack = ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack")); - } - + protected ItemStack getItemStack(){ return mItemStack; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aBaseMetaTileEntity.getFrontFacing() == 0 && aSide == 4) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_QCHEST)}; - } - return aSide == aBaseMetaTileEntity.getFrontFacing() ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_QCHEST)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]};//aSide != aFacing ? mMachineBlock != 0 ? new ITexture[] {Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]} : new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]} : mMachineBlock != 0 ? aActive ? getTexturesActive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : getTexturesInactive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : aActive ? getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]) : getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]); - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - return new ITexture[0][0][0]; - } + protected void setItemStack(ItemStack s){ mItemStack = s; } } diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java index 5b4e5549c3..3f53058f8d 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java @@ -1,250 +1,39 @@ package gregtech.common.tileentities.storage; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import gregtech.common.gui.GT_Container_QuantumChest; -import gregtech.common.gui.GT_GUIContainer_QuantumChest; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -public class GT_MetaTileEntity_SuperChest extends GT_MetaTileEntity_TieredMachineBlock { +public class GT_MetaTileEntity_SuperChest extends GT_MetaTileEntity_DigitalChestBase { public int mItemCount = 0; public ItemStack mItemStack = null; - public GT_MetaTileEntity_SuperChest(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, "This Chest stores " + CommonSizeCompute(aTier) + " Blocks"); - } - - public GT_MetaTileEntity_SuperChest(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - } - - @Override - public boolean isSimpleMachine() { - return true; - } - @Override - public boolean isFacingValid(byte aFacing) { - return true; + public GT_MetaTileEntity_SuperChest(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier); } - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; + public GT_MetaTileEntity_SuperChest(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); } - @Override - public boolean isValidSlot(int aIndex) { - return true; + public GT_MetaTileEntity_SuperChest(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); } - @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_SuperChest(mName, mTier, mDescriptionArray, mTextures); } - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - -// public void onRightclick(EntityPlayer aPlayer) -// { -// ItemStack tPlayerItem = aPlayer.inventory.getCurrentItem(); -// if (tPlayerItem == null) -// { -// if (this.mItemID > 0) -// { -// for (int i = 0; (this.mItemCount < getMaxItemCount()) && (i < aPlayer.field_71071_by.func_70302_i_()); i++) -// { -// if ((aPlayer.field_71071_by.func_70301_a(i) != null) && (aPlayer.field_71071_by.func_70301_a(i).field_77993_c == this.mItemID) && (aPlayer.field_71071_by.func_70301_a(i).func_77960_j() == this.mItemMeta) && (!aPlayer.field_71071_by.func_70301_a(i).func_77942_o())) -// { -// this.mItemCount += aPlayer.field_71071_by.func_70301_a(i).field_77994_a; -// if (aPlayer.field_71071_by.func_70301_a(i).field_77994_a == 111) -// { -// this.mItemCount = (getMaxItemCount() + 192 - (this.mItemCount + (this.mInventory[0] == null ? 0 : this.mInventory[0].field_77994_a) + (this.mInventory[1] == null ? 0 : this.mInventory[1].field_77994_a) + (this.mInventory[2] == null ? 0 : this.mInventory[2].field_77994_a))); -// } -// else if (this.mItemCount > getMaxItemCount()) -// { -// aPlayer.field_71071_by.func_70301_a(i).field_77994_a = (this.mItemCount - getMaxItemCount()); -// this.mItemCount = getMaxItemCount(); -// } -// else -// { -// aPlayer.field_71071_by.func_70301_a(i).field_77994_a = 0; -// } -// } -// if ((aPlayer.field_71071_by.func_70301_a(i) != null) && (aPlayer.field_71071_by.func_70301_a(i).field_77994_a <= 0)) { -// aPlayer.field_71071_by.func_70299_a(i, null); -// } -// } -// GT_Utility.sendChatToPlayer(aPlayer, this.mItemCount + (this.mInventory[0] == null ? 0 : this.mInventory[0].field_77994_a) + (this.mInventory[1] == null ? 0 : this.mInventory[1].field_77994_a) + (this.mInventory[2] == null ? 0 : this.mInventory[2].field_77994_a) + " of " + new ItemStack(this.mItemID, 1, this.mItemMeta).func_82833_r()); -// } -// } -// if (aPlayer.field_71069_bz != null) { -// aPlayer.field_71069_bz.func_75142_b(); -// } -// } - + protected String chestName(){ return "Super Chest"; } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_QuantumChest(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_QuantumChest(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); - } - + protected int getItemCount() { return mItemCount; } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - - if (getBaseMetaTileEntity().isServerSide() && getBaseMetaTileEntity().isAllowedToWork()) { -// if(mInventory[0]!=null)GT_FML_LOGGER.info("input: "+mInventory[0].stackSize); -// GT_FML_LOGGER.info("store: "+mItemCount); -// if(mInventory[0]!=null)GT_FML_LOGGER.info("output: "+mInventory[2].stackSize); - if ((getItemCount() <= 0)) { - this.mItemStack = null; - this.mItemCount = 0; - } - if (this.mItemStack == null && this.mInventory[0] != null) { - this.mItemStack = mInventory[0].copy(); - } - if ((this.mInventory[0] != null) && (this.mItemCount < getMaxItemCount()) && GT_Utility.areStacksEqual(this.mInventory[0], this.mItemStack)) { - this.mItemCount += this.mInventory[0].stackSize; - if (this.mItemCount > getMaxItemCount()) { - this.mInventory[0].stackSize = (this.mItemCount - getMaxItemCount()); - this.mItemCount = getMaxItemCount(); - } else { - this.mInventory[0] = null; - } - } - if (this.mInventory[1] == null && mItemStack != null) { - this.mInventory[1] = mItemStack.copy(); - this.mInventory[1].stackSize = Math.min(mItemStack.getMaxStackSize(), this.mItemCount); - this.mItemCount -= this.mInventory[1].stackSize; - } else if ((this.mItemCount > 0) && GT_Utility.areStacksEqual(this.mInventory[1], this.mItemStack) && this.mInventory[1].getMaxStackSize() > this.mInventory[1].stackSize) { - int tmp = Math.min(this.mItemCount, this.mInventory[1].getMaxStackSize() - this.mInventory[1].stackSize); - this.mInventory[1].stackSize += tmp; - this.mItemCount -= tmp; - } - if (this.mItemStack != null) { - this.mInventory[2] = this.mItemStack.copy(); - this.mInventory[2].stackSize = Math.min(mItemStack.getMaxStackSize(), this.mItemCount); - } else { - this.mInventory[2] = null; - } - } - } - - private int getItemCount() { - return this.mItemCount; - } - public void setItemCount(int aCount) { - this.mItemCount = aCount; - } - - public int getProgresstime() { - return this.mItemCount + (this.mInventory[0] == null ? 0 : this.mInventory[0].stackSize) + (this.mInventory[1] == null ? 0 : this.mInventory[1].stackSize); - } - - public int maxProgresstime() { - return getMaxItemCount(); - } - - private static int CommonSizeCompute(int tier){ - switch(tier){ - case 1: - return 4000000; - case 2: - return 8000000; - case 3: - return 16000000; - case 4: - return 32000000; - case 5: - return 64000000; - default: - return 0; - } + mItemCount = aCount; } - - public int getMaxItemCount() { - return CommonSizeCompute(mTier); - } - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aIndex==1; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aIndex==0&&(mInventory[0]==null||GT_Utility.areStacksEqual(this.mInventory[0], aStack)); - } - + protected ItemStack getItemStack(){ return mItemStack; } @Override - public String[] getInfoData() { - - if (mItemStack == null) { - return new String[]{ - EnumChatFormatting.BLUE + "Super Chest"+ EnumChatFormatting.RESET, - "Stored Items:", - EnumChatFormatting.GOLD+ "No Items"+ EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + "0" + EnumChatFormatting.RESET+" "+ - EnumChatFormatting.YELLOW + Integer.toString(getMaxItemCount())+ EnumChatFormatting.RESET - }; - } - return new String[]{ - EnumChatFormatting.BLUE + "Super Chest"+ EnumChatFormatting.RESET, - "Stored Items:", - EnumChatFormatting.GOLD + mItemStack.getDisplayName() + EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + Integer.toString(mItemCount) + EnumChatFormatting.RESET+" "+ - EnumChatFormatting.YELLOW + Integer.toString(getMaxItemCount())+ EnumChatFormatting.RESET - }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mItemCount", this.mItemCount); - if (this.mItemStack != null) - aNBT.setTag("mItemStack", this.mItemStack.writeToNBT(new NBTTagCompound())); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - if (aNBT.hasKey("mItemCount")) - this.mItemCount = aNBT.getInteger("mItemCount"); - if (aNBT.hasKey("mItemStack")) - this.mItemStack = ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack")); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aBaseMetaTileEntity.getFrontFacing() == 0 && aSide == 4) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SCHEST)}; - } - return aSide == aBaseMetaTileEntity.getFrontFacing() ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SCHEST)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - return new ITexture[0][0][0]; - } + protected void setItemStack(ItemStack s){ mItemStack = s; } } diff --git a/src/main/java/gregtech/loaders/load/GT_FuelLoader.java b/src/main/java/gregtech/loaders/load/GT_FuelLoader.java index 79983bdfdb..816b242136 100644 --- a/src/main/java/gregtech/loaders/load/GT_FuelLoader.java +++ b/src/main/java/gregtech/loaders/load/GT_FuelLoader.java @@ -1,8 +1,6 @@ package gregtech.loaders.load;
-import cpw.mods.fml.common.Loader;
import gregtech.GT_Mod;
-import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
@@ -14,7 +12,6 @@ import gregtech.api.util.GT_Recipe; import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.FluidStack;
public class GT_FuelLoader
implements Runnable {
diff --git a/src/main/java/gregtech/loaders/misc/GT_Achievements.java b/src/main/java/gregtech/loaders/misc/GT_Achievements.java index 1431688496..5965bf6035 100644 --- a/src/main/java/gregtech/loaders/misc/GT_Achievements.java +++ b/src/main/java/gregtech/loaders/misc/GT_Achievements.java @@ -27,8 +27,6 @@ import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.fluids.FluidStack; import thaumcraft.api.ThaumcraftApiHelper; -import java.util.ArrayList; -import java.util.List; import java.util.concurrent.ConcurrentHashMap; public class GT_Achievements { diff --git a/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java b/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java index a0f46c1fa1..81044cc532 100644 --- a/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java +++ b/src/main/java/gregtech/loaders/misc/GT_BeeDefinition.java @@ -26,10 +26,9 @@ import gregtech.common.bees.GT_AlleleBeeSpecies; import gregtech.common.bees.GT_Bee_Mutation; import gregtech.common.items.CombType; import net.minecraft.block.Block; -import net.minecraft.init.Items; import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.BiomeDictionary; import org.apache.commons.lang3.text.WordUtils; import java.util.Arrays; @@ -1041,8 +1040,9 @@ public enum GT_BeeDefinition implements IBeeDefinition { @Override protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation(getSpecies(FORRESTRY,"Hermitic"), LAPIS.species, 10); - tMutation.requireResource("blockCertusQuartz"); + IBeeMutationCustom tMutation = registerMutation(getSpecies(FORRESTRY, "Hermitic"), LAPIS.species, 10); + if (Loader.isModLoaded("appliedenergistics2")) + tMutation.requireResource(GameRegistry.findBlock("appliedenergistics2", "tile.BlockQuartz"), 0); } }, FLUIX(GT_BranchDefinition.GEM, "FluixDust", true, 0xA375FF, 0xB591FF) { @@ -1062,7 +1062,8 @@ public enum GT_BeeDefinition implements IBeeDefinition { @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(REDSTONE.species, LAPIS.species, 7); - tMutation.requireResource("blockFluix"); + if (Loader.isModLoaded("appliedenergistics2")) + tMutation.requireResource(GameRegistry.findBlock("appliedenergistics2", "tile.BlockFluix"), 0); } }, RUBY(GT_BranchDefinition.GEM, "Ruby", false, 0xE6005C, 0xCC0052) { @@ -1103,7 +1104,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(CERTUS.species, LAPIS.species, 5); - tMutation.requireResource(GregTech_API.sBlockGem2, 13); + tMutation.requireResource(GregTech_API.sBlockGem2, 12); } }, DIAMOND(GT_BranchDefinition.GEM, "Diamond", false, 0xCCFFFF, 0xA3CCCC) { @@ -2092,7 +2093,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(CALLISTO.species, LEAD.species, 7); if (Loader.isModLoaded("dreamcraft")) - tMutation.requireResource(GameRegistry.findBlock("dreamcraft", "tile.Ledox"), 0); + tMutation.requireResource(GameRegistry.findBlock("dreamcraft", "tile.Ledox"), 0); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(35, "Europa"));//Europa Dim } }, @@ -2115,7 +2116,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(CALLISTO.species, getSpecies(EXTRABEES,"freezing"), 7); if (Loader.isModLoaded("dreamcraft")) - tMutation.requireResource(GameRegistry.findBlock("dreamcraft", "tile.CallistoColdIce"), 0); + tMutation.requireResource(GameRegistry.findBlock("dreamcraft", "tile.CallistoColdIce"), 0); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(45, "Callisto"));//Callisto Dim } }, @@ -2138,7 +2139,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(IO.species, MITHRIL.species, 6); if (Loader.isModLoaded("dreamcraft")) - tMutation.requireResource(GameRegistry.findBlock("dreamcraft", "tile.Mytryl"), 0); + tMutation.requireResource(GameRegistry.findBlock("dreamcraft", "tile.Mytryl"), 0); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(36, "IO"));//IO Dim } }, @@ -2161,7 +2162,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(VENUS.species, OSMIUM.species, 6); if (Loader.isModLoaded("dreamcraft")) - tMutation.requireResource(GameRegistry.findBlock("dreamcraft", "tile.Quantinum"), 0); + tMutation.requireResource(GameRegistry.findBlock("dreamcraft", "tile.Quantinum"), 0); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(39, "Venus"));//Venus Dim } }, @@ -2183,7 +2184,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(LEAD.species, OBERON.species, 5); if (Loader.isModLoaded("GalaxySpace")) - tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "metalsblock"), 6); + tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "metalsblock"), 6); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(46, "Oberon"));//Oberon Dim } }, @@ -2206,7 +2207,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(ENCELADUS.species, EMERALD.species, 3); if (Loader.isModLoaded("dreamcraft")) - tMutation.requireResource(GameRegistry.findBlock("dreamcraft", "tile.MysteriousCrystal"), 0); + tMutation.requireResource(GameRegistry.findBlock("dreamcraft", "tile.MysteriousCrystal"), 0); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(41, "Enceladus"));//Enceladus Dim } }, @@ -2229,7 +2230,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(PLUTO.species, PLUTONIUM.species, 2); if (Loader.isModLoaded("dreamcraft")) - tMutation.requireResource(GameRegistry.findBlock("dreamcraft", "tile.BlackPlutonium"), 0); + tMutation.requireResource(GameRegistry.findBlock("dreamcraft", "tile.BlackPlutonium"), 0); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(49, "Pluto"));//Pluto Dim } }, @@ -2275,7 +2276,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(JUPITER.species, TUNGSTEN.species, 25, 2); if (Loader.isModLoaded("GalaxySpace")) - tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "mercuryblocks"), 0); + tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "mercuryblocks"), 0); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(37, "Mercury"));//Mercury Dim } }, @@ -2297,7 +2298,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(JUPITER.species, MITHRIL.species, 25, 2); if (Loader.isModLoaded("GalaxySpace")) - tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "venusblocks"), 0); + tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "venusblocks"), 0); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(39, "Venus"));//Venus Dim } }, @@ -2306,7 +2307,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void setSpeciesProperties(GT_AlleleBeeSpecies beeSpecies) { beeSpecies.addProduct(GT_Bees.combs.getStackForType(CombType.MOON), 0.50f); if (Loader.isModLoaded("dreamcraft")) - beeSpecies.addSpecialty(GT_ModHandler.getModItem("dreamcraft", "item.MoonStoneDust", 1, 0), 0.10f); + beeSpecies.addSpecialty(GT_ModHandler.getModItem("dreamcraft", "item.MoonStoneDust", 1, 0), 0.10f); beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.COLD); beeSpecies.setNocturnal(); @@ -2355,7 +2356,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void setSpeciesProperties(GT_AlleleBeeSpecies beeSpecies) { beeSpecies.addProduct(GT_Bees.combs.getStackForType(CombType.MARS), 0.25f); if (Loader.isModLoaded("dreamcraft")) - beeSpecies.addSpecialty(GT_ModHandler.getModItem("dreamcraft", "item.PhobosStoneDust", 1, 0), 0.10f); + beeSpecies.addSpecialty(GT_ModHandler.getModItem("dreamcraft", "item.PhobosStoneDust", 1, 0), 0.10f); beeSpecies.setHumidity(EnumHumidity.ARID); beeSpecies.setTemperature(EnumTemperature.HOT); beeSpecies.setNocturnal(); @@ -2493,7 +2494,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { IBeeMutationCustom tMutation = registerMutation(JUPITER.species, IRON.species, 15); tMutation.restrictTemperature(EnumTemperature.ICY); if (Loader.isModLoaded("GalaxySpace")) - tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "europagrunt"), 0); + tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "europagrunt"), 0); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(35, "Europa"));//Europa Dim } }, @@ -2515,7 +2516,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(JUPITER.species, TITANIUM.species, 15); if (Loader.isModLoaded("GalaxySpace")) - tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "ganymedeblocks"), 0); + tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "ganymedeblocks"), 0); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(43, "Ganymede"));//Ganymede Dim } }, @@ -2539,7 +2540,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(JUPITER.species, getSpecies(EXTRABEES, "artic"), 15); if (Loader.isModLoaded("GalaxySpace")) - tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "callistoblocks"), 0); + tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "callistoblocks"), 0); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(45, "Callisto"));//Callisto Dim } }, @@ -2564,7 +2565,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(JUPITER.species, LEDOX.species, 25, 2); if (Loader.isModLoaded("dreamcraft")) - tMutation.requireResource(GameRegistry.findBlock("dreamcraft", "tile.Quantinum"), 0); + tMutation.requireResource(GameRegistry.findBlock("dreamcraft", "tile.Quantinum"), 0); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(30, "Asteriods"));//Asteriods Dim } }, @@ -2588,7 +2589,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(SATURN.species, CHROME.species, 25, 2); if (Loader.isModLoaded("GalaxySpace")) - tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "enceladusblocks"), 0); + tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "enceladusblocks"), 0); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(41, "Enceladus"));//Enceladus Dim } }, @@ -2864,7 +2865,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(CENTAURI.species, INFINITYCATALYST.species, 3); if (Loader.isModLoaded("GalaxySpace")) - tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "acentauribbgrunt"), 0); + tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "acentauribbgrunt"), 0); tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(31, "aCentauri"));//aCentauri Dim } }, @@ -2955,9 +2956,10 @@ public enum GT_BeeDefinition implements IBeeDefinition { @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(BARNARDA.species, AMERICIUM.species, 3, 2); - if (Loader.isModLoaded("GalaxySpace")) + if (Loader.isModLoaded("GalaxySpace")) { tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "barnardaEgrunt"), 0); - tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(32, "Barnarda C"));//Barnarda C Dim + tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(32, "Barnarda C"));//Barnarda C Dim + } } }, BARNARDAE(GT_BranchDefinition.PLANET, "BarnardaE", false, 0x0D5A0D, 0x4c1f0a) { @@ -2977,9 +2979,10 @@ public enum GT_BeeDefinition implements IBeeDefinition { @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(BARNARDA.species, DIVIDED.species, 3, 2); - if (Loader.isModLoaded("GalaxySpace")) - tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "barnardaEgrunt"), 0); - tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(81, "Barnard E"));//"Barnard E Dim + if (Loader.isModLoaded("GalaxySpace")) { + tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "barnardaEgrunt"), 0); + tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(81, "Barnard E"));//"Barnard E Dim + } } }, BARNARDAF(GT_BranchDefinition.PLANET, "BarnardaF", false, 0x0D5A0D, 0x1e0b49) { @@ -2999,9 +3002,10 @@ public enum GT_BeeDefinition implements IBeeDefinition { @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(BARNARDA.species, NEUTRONIUM.species, 3, 2); - if (Loader.isModLoaded("GalaxySpace")) - tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "barnardaFgrunt"), 0); - tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(82, "Barnard F"));//"Barnard F Dim + if (Loader.isModLoaded("GalaxySpace")) { + tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "barnardaFgrunt"), 0); + tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(82, "Barnard F"));//"Barnard F Dim + } } }, VEGA(GT_BranchDefinition.PLANET, "Vega", false, 0x1A2036, 0xB5C0DE) { @@ -3022,16 +3026,18 @@ public enum GT_BeeDefinition implements IBeeDefinition { @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(MAKEMAKE.species, NAQUADAH.species, 2); - if (Loader.isModLoaded("GalaxySpace")) - tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "vegabgrunt"), 0); - tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(33, "Kuiper Belt"));//Kuiper Belt Dim + if (Loader.isModLoaded("GalaxySpace")) { + tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "vegabgrunt"), 0); + tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(33, "Kuiper Belt"));//Kuiper Belt Dim + } } }, VEGAB(GT_BranchDefinition.PLANET, "VegaB", false, 0x1A2036, 0x81e261) { @Override protected void setSpeciesProperties(GT_AlleleBeeSpecies beeSpecies) { beeSpecies.addProduct(GT_Bees.combs.getStackForType(CombType.VEGA), 0.50f); - beeSpecies.addSpecialty(GT_ModHandler.getModItem("dreamcraft", "item.VegaBStoneDust", 1, 0), 0.10f); + if (Loader.isModLoaded("dreamcraft")) + beeSpecies.addSpecialty(GT_ModHandler.getModItem("dreamcraft", "item.VegaBStoneDust", 1, 0), 0.10f); beeSpecies.setHumidity(EnumHumidity.ARID); beeSpecies.setTemperature(EnumTemperature.COLD); } @@ -3044,9 +3050,10 @@ public enum GT_BeeDefinition implements IBeeDefinition { @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(VEGA.species, NAQUADRIA.species, 2); - if (Loader.isModLoaded("GalaxySpace")) - tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "vegabgrunt"), 0); - tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(84, "VegaB"));//VegaB Dim + if (Loader.isModLoaded("GalaxySpace")) { + tMutation.requireResource(GameRegistry.findBlock("GalaxySpace", "vegabgrunt"), 0); + tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(84, "VegaB"));//VegaB Dim + } } }, //Infinity Line @@ -3069,7 +3076,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(NEUTRONIUM.species, BARNARDAF.species, 7,10); if (Loader.isModLoaded("Avaritia")) - tMutation.requireResource(GameRegistry.findBlock("Avaritia", "Resource_Block"), 0); + tMutation.requireResource(GameRegistry.findBlock("Avaritia", "Resource_Block"), 0); } }, INFINITYCATALYST(GT_BranchDefinition.PLANET, "InfinityCatalyst", false, 0xFFFFFF, 0xFFFFFF) { @@ -3113,7 +3120,7 @@ public enum GT_BeeDefinition implements IBeeDefinition { protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(INFINITYCATALYST.species, COSMICNEUTRONIUM.species, 1, 100); if (Loader.isModLoaded("avaritiaddons")) - tMutation.requireResource(GameRegistry.findBlock("avaritiaddons", "InfinityChest"), 0); + tMutation.requireResource(GameRegistry.findBlock("avaritiaddons", "InfinityChest"), 0); } }; private final GT_BranchDefinition branch; diff --git a/src/main/java/gregtech/loaders/misc/GT_BranchDefinition.java b/src/main/java/gregtech/loaders/misc/GT_BranchDefinition.java index bd7fc5db58..bf3e57c369 100644 --- a/src/main/java/gregtech/loaders/misc/GT_BranchDefinition.java +++ b/src/main/java/gregtech/loaders/misc/GT_BranchDefinition.java @@ -3,7 +3,6 @@ package gregtech.loaders.misc; import forestry.api.apiculture.BeeManager; import forestry.api.apiculture.EnumBeeChromosome; import forestry.api.genetics.IAllele; -import forestry.api.genetics.IAlleleFlowers; import forestry.api.genetics.IClassification; import forestry.apiculture.genetics.alleles.AlleleEffect; import forestry.core.genetics.alleles.AlleleHelper; diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingCompressed.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingCompressed.java index bf402ad893..3fda2ae1f7 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingCompressed.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingCompressed.java @@ -6,8 +6,6 @@ import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.IOreRecipeRegistrator; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_RecipeRegistrator; -import gregtech.api.util.GT_Utility; import net.minecraft.item.ItemStack; public class ProcessingCompressed implements IOreRecipeRegistrator { @@ -18,6 +16,6 @@ public class ProcessingCompressed implements IOreRecipeRegistrator { public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { GT_ModHandler.removeRecipeByOutput(aStack); GregTech_API.registerCover(aStack, new GT_RenderedTexture(aMaterial.mIconSet.mTextures[72], aMaterial.mRGBa, false), null); - GT_RecipeRegistrator.registerUsagesForMaterials(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, false); + //GT_RecipeRegistrator.registerUsagesForMaterials(null, false, GT_Utility.copyAmount(1L, aStack)); } } diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingCrafting.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingCrafting.java index 8cc63b2181..90b6c83c6f 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingCrafting.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingCrafting.java @@ -41,6 +41,8 @@ public class ProcessingCrafting implements gregtech.api.interfaces.IOreRecipeReg GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer.get(1, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Wafer_LPIC.get(1, new Object[0]), 800, 120,false); GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer2.get(1, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Wafer_LPIC.get(4, new Object[0]), 600, 480,true); GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer3.get(1, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Wafer_SoC.get(1, new Object[0]), 900, 1920,true); + GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer4.get(1, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Wafer_SoC.get(4, new Object[0]), 900, 7680,true); + GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer5.get(1, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Wafer_SoC.get(8, new Object[0]), 900, 30720,true); break; case "craftingLensOrange": GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer3.get(1, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Wafer_SoC2.get(1, new Object[0]), 1800, 1920,true); @@ -62,12 +64,16 @@ public class ProcessingCrafting implements gregtech.api.interfaces.IOreRecipeReg GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer2.get(1, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Wafer_ILC.get(4, new Object[0]), 900, 480,true); GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer3.get(1, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Wafer_ILC.get(8, new Object[0]), 600, 1920,true); GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.RedAlloy, 1L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GT_ModHandler.getModItem("dreamcraft", "item.EtchedLowVoltageWiring", 1L, 0), 200, 16); + GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer4.get(1, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Wafer_SoC2.get(2, new Object[0]), 1800, 7680,true); + GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer5.get(1, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Wafer_SoC2.get(4, new Object[0]), 1800, 30720,true); break; case "craftingLensGreen": GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Parts_Crystal_Chip_Elite.get(1L, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Chip_CrystalCPU.get(1, new Object[0]), 600, 10000,true); GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Chip_CrystalSoC.get(1L, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Chip_CrystalSoC2.get(1, new Object[0]), 1200, 80000,true); GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer.get(1, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Wafer_ULPIC.get(2, new Object[0]), 600, 30,false); GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer2.get(1, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Wafer_ULPIC.get(8, new Object[0]), 600, 120,false); + GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer4.get(1, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Wafer_Ram.get(16, new Object[0]), 600, 7680,true); + GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer5.get(1, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemList.Circuit_Wafer_Ram.get(32, new Object[0]), 600, 30720,true); break; case "craftingLensWhite": GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.block, Materials.Iron, 1L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GT_ModHandler.getModItem("appliedenergistics2", "item.ItemMultiMaterial", 1L, 19), 2000, 1920); diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingCrushedOre.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingCrushedOre.java index 32d0e20473..d86075e375 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingCrushedOre.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingCrushedOre.java @@ -1,7 +1,5 @@ package gregtech.loaders.oreprocessing; -import gregtech.GT_Mod; -import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java index 8785a50f94..a32835026e 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java @@ -159,7 +159,7 @@ public class ProcessingDust implements gregtech.api.interfaces.IOreRecipeRegistr case "Diamond": GT_Values.RA.addImplosionRecipe(GT_Utility.copyAmount(4L, new Object[]{aStack}), 32, ItemList.IC2_Industrial_Diamond.get(3L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 16L)); break; - case "Opal": case "Olivine": case "Emerald": case "Ruby": case "Sapphire": case "GreenSapphire": case "Topaz": case "BlueTopaz": case "Tanzanite": + case "Opal": case "Olivine": case "Emerald": case "Ruby": case "Sapphire": case "GreenSapphire": case "Topaz": case "BlueTopaz": case "Tanzanite": case "Amethyst": GT_Values.RA.addImplosionRecipe(GT_Utility.copyAmount(4L, new Object[]{aStack}), 24, GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 3L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 12L)); break; case "FoolsRuby": case "GarnetRed": case "GarnetYellow": case "Jasper": case "Amber": case "Monazite": case "Forcicium": case "Forcillium": case "Force": diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingGem.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingGem.java index 8dd4a192ab..b10993a0bb 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingGem.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingGem.java @@ -29,37 +29,39 @@ public class ProcessingGem implements gregtech.api.interfaces.IOreRecipeRegistra switch (aPrefix) { case gem: if (aFuelPower) { - GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, aMaterial.mFuelPower * 2, aMaterial.mFuelType); + GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, aStack), null, aMaterial.mFuelPower * 2, aMaterial.mFuelType); } if (!OrePrefixes.block.isIgnored(aMaterial)) { - GT_ModHandler.addCompressionRecipe(GT_Utility.copyAmount(9L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.block, aMaterial, 1L)); + GT_ModHandler.addCompressionRecipe(GT_Utility.copyAmount(9L, aStack), GT_OreDictUnificator.get(OrePrefixes.block, aMaterial, 1L)); } if (!aNoSmelting) { - GT_ModHandler.addSmeltingRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial.mSmeltInto, 1L)); + GT_ModHandler.addSmeltingRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial.mSmeltInto, 1L)); } if (aNoSmashing) { GT_Values.RA.addForgeHammerRecipe(aStack, GT_OreDictUnificator.get(OrePrefixes.gemFlawed, aMaterial, 2L), 64, 16); } else { - GT_Values.RA.addForgeHammerRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 16); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), (int) Math.max(aMaterialMass * 2L, 1L), 24); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(2L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateDouble, aMaterial, 1L), (int) Math.max(aMaterialMass * 2L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateTriple, aMaterial, 1L), (int) Math.max(aMaterialMass * 3L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(4L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L), (int) Math.max(aMaterialMass * 4L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(5L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateQuintuple, aMaterial, 1L), (int) Math.max(aMaterialMass * 5L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(9L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L), (int) Math.max(aMaterialMass * 9L, 1L), 96); + GT_Values.RA.addForgeHammerRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 16); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), (int) Math.max(aMaterialMass * 2L, 1L), 24); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(2L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateDouble, aMaterial, 1L), (int) Math.max(aMaterialMass * 2L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(3L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateTriple, aMaterial, 1L), (int) Math.max(aMaterialMass * 3L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(4L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L), (int) Math.max(aMaterialMass * 4L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(5L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateQuintuple, aMaterial, 1L), (int) Math.max(aMaterialMass * 5L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(9L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L), (int) Math.max(aMaterialMass * 9L, 1L), 96); } if (aNoWorking) { - GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 2L), (int) Math.max(aMaterialMass, 1L), 16); + GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 2L), (int) Math.max(aMaterialMass, 1L), 16); } else { if (aMaterial.mUnificatable && (aMaterial.mMaterialInto == aMaterial)) { - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"h", "X", Character.valueOf('X'), OrePrefixes.gemFlawless.get(aMaterial)}); - GT_Values.RA.addImplosionRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), 8, GT_OreDictUnificator.get(OrePrefixes.gemFlawless, aMaterial, 1), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2)); - if (aMaterial.contains(SubTag.SMELTING_TO_GEM)) GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_Proxy.tBits, new Object[]{"XXX", "XXX", "XXX", Character.valueOf('X'), OrePrefixes.nugget.get(aMaterial)}); - if (aSpecialRecipeReq) GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"X", "m", Character.valueOf('X'), OrePrefixes.gem.get(aMaterial)}); + GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"h", "X", 'X', OrePrefixes.gemFlawless.get(aMaterial)}); + GT_Values.RA.addImplosionRecipe(GT_Utility.copyAmount(3L, aStack), 8, GT_OreDictUnificator.get(OrePrefixes.gemFlawless, aMaterial, 1), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2)); + if (aMaterial.contains(SubTag.SMELTING_TO_GEM)) + GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(1L, aStack), GT_Proxy.tBits, new Object[]{"XXX", "XXX", "XXX", 'X', OrePrefixes.nugget.get(aMaterial)}); + if (aSpecialRecipeReq) + GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"X", "m", 'X', OrePrefixes.gem.get(aMaterial)}); } } - gregtech.api.util.GT_RecipeRegistrator.registerUsagesForMaterials(GT_Utility.copyAmount(1L, new Object[]{aStack}), OrePrefixes.plate.get(aMaterial).toString(), !aNoSmashing); + //GT_RecipeRegistrator.registerUsagesForMaterials(OrePrefixes.plate.get(aMaterial).toString(), !aNoSmashing, GT_Utility.copyAmount(1L, aStack)); switch (aMaterial.mName) { case "NULL": @@ -67,77 +69,79 @@ public class ProcessingGem implements gregtech.api.interfaces.IOreRecipeRegistra case "Coal": case "Charcoal": if (gregtech.api.GregTech_API.sRecipeFile.get(gregtech.api.enums.ConfigCategories.Recipes.disabledrecipes, "torchesFromCoal", false)) { - GT_ModHandler.removeRecipe(new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{aStack}), null, null, new ItemStack(net.minecraft.init.Items.stick, 1, 0)});} + GT_ModHandler.removeRecipe(GT_Utility.copyAmount(1L, aStack), null, null, new ItemStack(net.minecraft.init.Items.stick, 1, 0)); + } break; case "CertusQuartz": GT_Values.RA.addElectrolyzerRecipe(aStack, 0, GT_ModHandler.getModItem("appliedenergistics2", "item.ItemMultiMaterial", 1L, 1), null, null, null, null, null, 2000, 30); } for(ItemStack is: OreDictionary.getOres("craftingLens"+aMaterial.mColor.mName.replace(" ",""))) {//Engraver Recipe adder is.stackSize=0; - GT_Values.RA.addLaserEngraverRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), is, GT_OreDictUnificator.get(OrePrefixes.gemFlawless, aMaterial, 1L), 1200, 480); + GT_Values.RA.addLaserEngraverRecipe(GT_Utility.copyAmount(3L, aStack), is, GT_OreDictUnificator.get(OrePrefixes.gemFlawless, aMaterial, 1L), 1200, 480); } break; case gemChipped: if (aFuelPower) - GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, aMaterial.mFuelPower / 2, aMaterial.mFuelType); + GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, aStack), null, aMaterial.mFuelPower / 2, aMaterial.mFuelType); if (!aNoWorking) { - GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.bolt, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 8); + GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.bolt, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 8); if (aMaterial.mUnificatable && (aMaterial.mMaterialInto == aMaterial)) { - GT_Values.RA.addImplosionRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), 8, GT_OreDictUnificator.get(OrePrefixes.gemFlawed, aMaterial, 1), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2)); - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.gemChipped, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"h", "X", Character.valueOf('X'), OrePrefixes.gemFlawed.get(aMaterial)}); + GT_Values.RA.addImplosionRecipe(GT_Utility.copyAmount(3L, aStack), 8, GT_OreDictUnificator.get(OrePrefixes.gemFlawed, aMaterial, 1), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2)); + GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.gemChipped, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"h", "X", 'X', OrePrefixes.gemFlawed.get(aMaterial)}); if (aSpecialRecipeReq) - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"X", "m", Character.valueOf('X'), OrePrefixes.gemChipped.get(aMaterial)}); + GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"X", "m", 'X', OrePrefixes.gemChipped.get(aMaterial)}); } } for(ItemStack is: OreDictionary.getOres("craftingLens"+aMaterial.mColor.mName.replace(" ",""))){//Engraver Recipe adder is.stackSize=0; - GT_Values.RA.addLaserEngraverRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), is, GT_OreDictUnificator.get(OrePrefixes.gemFlawed, aMaterial, 1L),600,30); + GT_Values.RA.addLaserEngraverRecipe(GT_Utility.copyAmount(3L, aStack), is, GT_OreDictUnificator.get(OrePrefixes.gemFlawed, aMaterial, 1L), 600, 30); } break; case gemExquisite: if (aFuelPower) - GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, aMaterial.mFuelPower * 8, aMaterial.mFuelType); + GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, aStack), null, aMaterial.mFuelPower * 8, aMaterial.mFuelType); if (!aNoWorking) { // GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 3L), GT_OreDictUnificator.getDust(aMaterial, aPrefix.mMaterialAmount - OrePrefixes.stickLong.mMaterialAmount * 3L), (int) Math.max(aMaterialMass * 10L, 1L), 16); if (aMaterial.mUnificatable && (aMaterial.mMaterialInto == aMaterial)) - if (aSpecialRecipeReq) GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 4L), GT_Proxy.tBits, new Object[]{"X", "m", Character.valueOf('X'), OrePrefixes.gemExquisite.get(aMaterial)}); + if (aSpecialRecipeReq) + GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 4L), GT_Proxy.tBits, new Object[]{"X", "m", 'X', OrePrefixes.gemExquisite.get(aMaterial)}); } GT_Values.RA.addForgeHammerRecipe(aStack, GT_OreDictUnificator.get(OrePrefixes.gemFlawless, aMaterial, 2L), 64, 16); break; case gemFlawed: if (aFuelPower) - GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, aMaterial.mFuelPower, aMaterial.mFuelType); + GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, aStack), null, aMaterial.mFuelPower, aMaterial.mFuelType); if (!aNoWorking) { - GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.bolt, aMaterial, 2L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 12); + GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.bolt, aMaterial, 2L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 12); if (aMaterial.mUnificatable && (aMaterial.mMaterialInto == aMaterial)) { - GT_Values.RA.addImplosionRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), 8, GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 1), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2)); - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.gemFlawed, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"h", "X", Character.valueOf('X'), OrePrefixes.gem.get(aMaterial)}); + GT_Values.RA.addImplosionRecipe(GT_Utility.copyAmount(3L, aStack), 8, GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 1), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2)); + GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.gemFlawed, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"h", "X", 'X', OrePrefixes.gem.get(aMaterial)}); if (aSpecialRecipeReq) - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"X", "m", Character.valueOf('X'), OrePrefixes.gemFlawed.get(aMaterial)}); + GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"X", "m", 'X', OrePrefixes.gemFlawed.get(aMaterial)}); } } GT_Values.RA.addForgeHammerRecipe(aStack, GT_OreDictUnificator.get(OrePrefixes.gemChipped, aMaterial, 2L), 64, 16); for(ItemStack is: OreDictionary.getOres("craftingLens"+aMaterial.mColor.mName.replace(" ",""))){//Engraver Recipe adder is.stackSize=0; - GT_Values.RA.addLaserEngraverRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), is, GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L),600,120); + GT_Values.RA.addLaserEngraverRecipe(GT_Utility.copyAmount(3L, aStack), is, GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L), 600, 120); } break; case gemFlawless: if (aFuelPower) - GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, aMaterial.mFuelPower * 4, aMaterial.mFuelType); + GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, aStack), null, aMaterial.mFuelPower * 4, aMaterial.mFuelType); if (!aNoWorking) { - GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 1L), GT_OreDictUnificator.getDust(aMaterial, aPrefix.mMaterialAmount - OrePrefixes.stickLong.mMaterialAmount), (int) Math.max(aMaterialMass * 5L, 1L), 16); + GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 1L), GT_OreDictUnificator.getDust(aMaterial, aPrefix.mMaterialAmount - OrePrefixes.stickLong.mMaterialAmount), (int) Math.max(aMaterialMass * 5L, 1L), 16); if (aMaterial.mUnificatable && (aMaterial.mMaterialInto == aMaterial)) { - GT_Values.RA.addImplosionRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), 8, GT_OreDictUnificator.get(OrePrefixes.gemExquisite, aMaterial, 1), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2)); - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.gemFlawless, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"h", "X", Character.valueOf('X'), OrePrefixes.gemExquisite.get(aMaterial)}); + GT_Values.RA.addImplosionRecipe(GT_Utility.copyAmount(3L, aStack), 8, GT_OreDictUnificator.get(OrePrefixes.gemExquisite, aMaterial, 1), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2)); + GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.gemFlawless, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"h", "X", 'X', OrePrefixes.gemExquisite.get(aMaterial)}); if (aSpecialRecipeReq) - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"X", "m", Character.valueOf('X'), OrePrefixes.gemFlawless.get(aMaterial)}); + GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"X", "m", 'X', OrePrefixes.gemFlawless.get(aMaterial)}); } } GT_Values.RA.addForgeHammerRecipe(aStack, GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 2L), 64, 16); for(ItemStack is: OreDictionary.getOres("craftingLens"+aMaterial.mColor.mName.replace(" ",""))){//Engraver Recipe adder is.stackSize=0; - GT_Values.RA.addLaserEngraverRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), is, GT_OreDictUnificator.get(OrePrefixes.gemExquisite, aMaterial, 1L),2400,2000); + GT_Values.RA.addLaserEngraverRecipe(GT_Utility.copyAmount(3L, aStack), is, GT_OreDictUnificator.get(OrePrefixes.gemExquisite, aMaterial, 1L), 2400, 2000); } break; default: diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingIngot.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingIngot.java index 31771a48f3..773b1438a6 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingIngot.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingIngot.java @@ -28,17 +28,17 @@ public class ProcessingIngot implements gregtech.api.interfaces.IOreRecipeRegist switch (aPrefix) { case ingot: if (aMaterial.mFuelPower > 0) { - GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, aMaterial.mFuelPower, aMaterial.mFuelType); + GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, aStack), null, aMaterial.mFuelPower, aMaterial.mFuelType); } if (aMaterial.mStandardMoltenFluid != null) { if (!(aMaterial == Materials.AnnealedCopper || aMaterial == Materials.WroughtIron)) { - GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ingot.get(0L, new Object[0]), aMaterial.getMolten(144L), GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), 32, 8); + GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ingot.get(0L), aMaterial.getMolten(144L), GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), 32, 8); } } GT_RecipeRegistrator.registerReverseFluidSmelting(aStack, aMaterial, aPrefix.mMaterialAmount, null); GT_RecipeRegistrator.registerReverseMacerating(aStack, aMaterial, aPrefix.mMaterialAmount, null, null, null, false); if (aMaterial.mSmeltInto.mArcSmeltInto != aMaterial) { - GT_RecipeRegistrator.registerReverseArcSmelting(GT_Utility.copyAmount(1L, new Object[]{aStack}), aMaterial, aPrefix.mMaterialAmount, null, null, null); + GT_RecipeRegistrator.registerReverseArcSmelting(GT_Utility.copyAmount(1L, aStack), aMaterial, aPrefix.mMaterialAmount, null, null, null); } ItemStack tStack; if ((null != (tStack = GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial.mMacerateInto, 1L))) && ( @@ -56,53 +56,53 @@ public class ProcessingIngot implements gregtech.api.interfaces.IOreRecipeRegist if (!aNoSmashing) { //GT_Values.RA.addWiremillRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_Utility.copy(new Object[]{GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, aMaterial, 8L)}), 100, 4); //GT_Values.RA.addWiremillRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 2L), 100, 4); - GT_Values.RA.addForgeHammerRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 2L), (int) Math.max(aMaterialMass, 1L), 16); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), (int) Math.max(aMaterialMass * 1L, 1L), 24); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(2L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateDouble, aMaterial, 1L), (int) Math.max(aMaterialMass * 2L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateTriple, aMaterial, 1L), (int) Math.max(aMaterialMass * 3L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(4L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L), (int) Math.max(aMaterialMass * 4L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(5L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateQuintuple, aMaterial, 1L), (int) Math.max(aMaterialMass * 5L, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(9L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L), (int) Math.max(aMaterialMass * 9L, 1L), 96); + GT_Values.RA.addForgeHammerRecipe(GT_Utility.copyAmount(3L, aStack), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 2L), (int) Math.max(aMaterialMass, 1L), 16); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 24); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(2L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateDouble, aMaterial, 1L), (int) Math.max(aMaterialMass * 2L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(3L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateTriple, aMaterial, 1L), (int) Math.max(aMaterialMass * 3L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(4L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L), (int) Math.max(aMaterialMass * 4L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(5L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateQuintuple, aMaterial, 1L), (int) Math.max(aMaterialMass * 5L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(9L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L), (int) Math.max(aMaterialMass * 9L, 1L), 96); } - GT_RecipeRegistrator.registerUsagesForMaterials(GT_Utility.copyAmount(1L, new Object[]{aStack}), OrePrefixes.plate.get(aMaterial).toString(), !aNoSmashing); + //GT_RecipeRegistrator.registerUsagesForMaterials(OrePrefixes.plate.get(aMaterial).toString(), !aNoSmashing, GT_Utility.copyAmount(1L, aStack)); break; case ingotDouble: if (!aNoSmashing) { - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateDouble, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(2L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L), (int) Math.max(aMaterialMass * 2L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateDouble, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(2L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L), (int) Math.max(aMaterialMass * 2L, 1L), 96); if (aSpecialRecipeReq && GregTech_API.sRecipeFile.get(ConfigCategories.Tools.hammermultiingot, aMaterial.toString(), true)) { - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.ingotDouble, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"I", "I", "h", Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial)}); + GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.ingotDouble, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"I", "I", "h", 'I', OrePrefixes.ingot.get(aMaterial)}); } } break; case ingotTriple: if (!aNoSmashing) { - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateTriple, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 96); - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L), (int) Math.max(aMaterialMass * 3L, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateTriple, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(3L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L), (int) Math.max(aMaterialMass * 3L, 1L), 96); if (aSpecialRecipeReq && GregTech_API.sRecipeFile.get(ConfigCategories.Tools.hammermultiingot, aMaterial.toString(), true)) { - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.ingotTriple, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"I", "B", "h", Character.valueOf('I'), OrePrefixes.ingotDouble.get(aMaterial), Character.valueOf('B'), OrePrefixes.ingot.get(aMaterial)}); + GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.ingotTriple, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"I", "B", "h", 'I', OrePrefixes.ingotDouble.get(aMaterial), 'B', OrePrefixes.ingot.get(aMaterial)}); } } break; case ingotQuadruple: if (!aNoSmashing) { - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 96); if (aSpecialRecipeReq && GregTech_API.sRecipeFile.get(ConfigCategories.Tools.hammermultiingot, aMaterial.toString(), true)) { - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.ingotQuadruple, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"I", "B", "h", Character.valueOf('I'), OrePrefixes.ingotTriple.get(aMaterial), Character.valueOf('B'), OrePrefixes.ingot.get(aMaterial)}); + GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.ingotQuadruple, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"I", "B", "h", 'I', OrePrefixes.ingotTriple.get(aMaterial), 'B', OrePrefixes.ingot.get(aMaterial)}); } } break; case ingotQuintuple: if (!aNoSmashing) { - GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.plateQuintuple, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 96); + GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.plateQuintuple, aMaterial, 1L), (int) Math.max(aMaterialMass, 1L), 96); if (aSpecialRecipeReq && GregTech_API.sRecipeFile.get(ConfigCategories.Tools.hammermultiingot, aMaterial.toString(), true)) { - GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.ingotQuintuple, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"I", "B", "h", Character.valueOf('I'), OrePrefixes.ingotQuadruple.get(aMaterial), Character.valueOf('B'), OrePrefixes.ingot.get(aMaterial)}); + GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.ingotQuintuple, aMaterial, 1L), GT_Proxy.tBits, new Object[]{"I", "B", "h", 'I', OrePrefixes.ingotQuadruple.get(aMaterial), 'B', OrePrefixes.ingot.get(aMaterial)}); } } break; case ingotHot: - GT_Values.RA.addVacuumFreezerRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), (int) Math.max(aMaterialMass * 3L, 1L)); + GT_Values.RA.addVacuumFreezerRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), (int) Math.max(aMaterialMass * 3L, 1L)); break; default: break; diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingLog.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingLog.java index 25cb6d5eff..1fe7847880 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingLog.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingLog.java @@ -16,7 +16,7 @@ public class ProcessingLog implements gregtech.api.interfaces.IOreRecipeRegistra public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { if (aOreDictName.equals("logRubber")) { - GT_Values.RA.addCentrifugeRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, null, Materials.Methane.getGas(60L), ItemList.IC2_Resin.get(1L, new Object[0]), GT_ModHandler.getIC2Item("plantBall", 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Carbon, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), null, null, new int[]{5000, 3750, 2500, 2500}, 200, 20); + GT_Values.RA.addCentrifugeRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, null, Materials.Methane.getGas(60L), ItemList.IC2_Resin.get(1L, new Object[0]), GT_ModHandler.getIC2Item("plantBall", 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Carbon, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), GT_Values.NI, ItemList.Circuit_Integrated.getWithDamage(0L, 1L, new Object[0]), new int[]{5000, 3750, 2500, 2500}, 200, 20); GT_ModHandler.addSawmillRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), ItemList.IC2_Resin.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 16L)); GT_ModHandler.addExtractionRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.RawRubber, 1L)); GT_ModHandler.addPulverisationRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 6L), ItemList.IC2_Resin.get(1L, new Object[0]), 33, false); diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index 4482970eda..d6f919c785 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -10,7 +10,6 @@ import gregtech.api.objects.MaterialStack; import gregtech.api.util.*; import gregtech.common.GT_DummyWorld; import gregtech.common.items.GT_MetaGenerated_Item_03; -import gregtech.common.items.GT_VolumetricFlask; import ic2.api.recipe.ILiquidHeatExchangerManager; import ic2.api.recipe.Recipes; import mods.railcraft.common.blocks.aesthetics.cube.EnumCube; @@ -49,7 +48,7 @@ public class GT_MachineRecipeLoader implements Runnable { {new MaterialStack(Materials.Lead, 4L), new MaterialStack(Materials.Antimony, 1L), new MaterialStack(Materials.BatteryAlloy, 5L)}, {new MaterialStack(Materials.Gold, 1L), new MaterialStack(Materials.Silver, 1L), new MaterialStack(Materials.Electrum, 2L)}, {new MaterialStack(Materials.Magnesium, 1L), new MaterialStack(Materials.Aluminium, 2L), new MaterialStack(Materials.Magnalium, 3L)}, - {new MaterialStack(Materials.Silver, 1L), new MaterialStack(Materials.Nikolite, 4L), new MaterialStack(Materials.BlueAlloy, 1L)}, + {new MaterialStack(Materials.Silver, 1L), new MaterialStack(Materials.Electrotine, 4L), new MaterialStack(Materials.BlueAlloy, 1L)}, {new MaterialStack(Materials.Boron, 1L), new MaterialStack(Materials.Glass, 7L), new MaterialStack(Materials.BorosilicateGlass, 8L)}}; private static final String aTextAE = "appliedenergistics2"; private static final String aTextAEMM = "item.ItemMultiMaterial"; private static final String aTextForestry = "Forestry"; private static final String aTextEBXL = "ExtrabiomesXL"; private static final String aTextTCGTPage = "gt.research.page.1."; @@ -827,7 +826,9 @@ public class GT_MachineRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack(Blocks.piston, 1, 32767), new ItemStack(Items.slime_ball, 1, 32767), GT_Values.NF, new ItemStack(Blocks.sticky_piston, 1, 0), 100, 4); GT_Values.RA.addAssemblerRecipe(new ItemStack(Blocks.piston, 1, 32767), ItemList.IC2_Resin.get(1L), GT_Values.NF, new ItemStack(Blocks.sticky_piston, 1, 0), 100, 4); GT_Values.RA.addAssemblerRecipe(new ItemStack(Blocks.piston, 1, 32767), ItemList.Circuit_Integrated.getWithDamage(0L, 1L), Materials.Glue.getFluid(100L), new ItemStack(Blocks.sticky_piston, 1, 0), 100, 4); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Rubber, 3L), GT_ModHandler.getIC2Item("carbonMesh", 3L), Materials.Glue.getFluid(300L), ItemList.Duct_Tape.get(1L), 100, 64); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Rubber, 3L), GT_ModHandler.getIC2Item("carbonMesh", 3L), GT_Utility.getIntegratedCircuit(1)}, Materials.Glue.getFluid(300L), ItemList.Duct_Tape.get(1L), 100, 120); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StyreneButadieneRubber, 2L), GT_ModHandler.getIC2Item("carbonMesh", 2L), GT_Utility.getIntegratedCircuit(2)}, Materials.Glue.getFluid(200L), ItemList.Duct_Tape.get(1L), 100, 480); + GT_Values.RA.addAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Silicone, 1L), GT_ModHandler.getIC2Item("carbonMesh", 1L), GT_Utility.getIntegratedCircuit(3)}, Materials.Glue.getFluid(100L), ItemList.Duct_Tape.get(1L), 100, 1920); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Paper, 3L), new ItemStack(Items.leather, 1, 32767), Materials.Glue.getFluid(20L), new ItemStack(Items.book, 1, 0), 32, 8); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Paper, 3L), GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, Materials.Paper, 1L), Materials.Glue.getFluid(20L), new ItemStack(Items.book, 1, 0), 32, 8); GT_Values.RA.addAssemblerRecipe(ItemList.Paper_Printed_Pages.get(1L), new ItemStack(Items.leather, 1, 32767), Materials.Glue.getFluid(20L), new ItemStack(Items.written_book, 1, 0), 32, 8); @@ -852,7 +853,7 @@ public class GT_MachineRecipeLoader implements Runnable { GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.RedAlloy, 1L), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Gold, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 2L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.AnnealedCopper, 2L)}, Materials.Glass.getMolten(576L), GT_ModHandler.getModItem(GT_MachineRecipeLoader.aTextForestry, "thermionicTubes", 4L, 0), 200, 30); GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.RedAlloy, 1L), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Gold, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 2L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Tin, 2L)}, Materials.Glass.getMolten(576L), GT_ModHandler.getModItem(GT_MachineRecipeLoader.aTextForestry, "thermionicTubes", 4L, 1), 200, 30); GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.RedAlloy, 1L), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Gold, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 2L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Bronze, 2L)}, Materials.Glass.getMolten(576L), GT_ModHandler.getModItem(GT_MachineRecipeLoader.aTextForestry, "thermionicTubes", 4L, 2), 200, 30); - GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.RedAlloy, 1L), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Gold, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 2L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Iron, 2L)}, Materials.Glass.getMolten(576L), GT_ModHandler.getModItem(GT_MachineRecipeLoader.aTextForestry, "thermionicTubes", 4L, 3), 200, 120); + GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.RedAlloy, 1L), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Gold, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 2L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Iron, 2L)}, Materials.Glass.getMolten(576L), GT_ModHandler.getModItem(GT_MachineRecipeLoader.aTextForestry, "thermionicTubes", 4L, 3), 200, 30); GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.RedAlloy, 1L), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Gold, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 2L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.WroughtIron, 2L)}, Materials.Glass.getMolten(576L), GT_ModHandler.getModItem(GT_MachineRecipeLoader.aTextForestry, "thermionicTubes", 4L, 3), 200, 30); GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.RedAlloy, 1L), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Gold, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 2L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Gold, 2L)}, Materials.Glass.getMolten(576L), GT_ModHandler.getModItem(GT_MachineRecipeLoader.aTextForestry, "thermionicTubes", 4L, 4), 200, 30); GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.RedAlloy, 1L), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Gold, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 2L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Diamond, 2L)}, Materials.Glass.getMolten(576L), GT_ModHandler.getModItem(GT_MachineRecipeLoader.aTextForestry, "thermionicTubes", 4L, 5), 200, 30); @@ -862,6 +863,7 @@ public class GT_MachineRecipeLoader implements Runnable { GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.RedAlloy, 1L), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Gold, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 2L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Emerald, 2L)}, Materials.Glass.getMolten(576L), GT_ModHandler.getModItem(GT_MachineRecipeLoader.aTextForestry, "thermionicTubes", 4L, 9), 200, 30); GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.RedAlloy, 1L), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Gold, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 2L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Apatite, 2L)}, Materials.Glass.getMolten(576L), GT_ModHandler.getModItem(GT_MachineRecipeLoader.aTextForestry, "thermionicTubes", 4L, 10), 200, 30); GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.RedAlloy, 1L), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Gold, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 2L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Lapis, 2L)}, Materials.Glass.getMolten(576L), GT_ModHandler.getModItem(GT_MachineRecipeLoader.aTextForestry, "thermionicTubes", 4L, 11), 200, 30); + GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.plate, Materials.RedAlloy, 1L), GT_OreDictUnificator.get(OrePrefixes.bolt, Materials.Gold, 2L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 2L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.EnderEye, 2L)}, Materials.Glass.getMolten(576L), GT_ModHandler.getModItem(GT_MachineRecipeLoader.aTextForestry, "thermionicTubes", 4L, 12), 200, 30); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Aluminium, 2L), new ItemStack(Items.iron_door, 1), ItemList.Cover_Shutter.get(2L), 800, 16); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iron, 2L), new ItemStack(Items.iron_door, 1), ItemList.Cover_Shutter.get(2L), 800, 16); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.WroughtIron, 2L), new ItemStack(Items.iron_door, 1), ItemList.Cover_Shutter.get(2L), 800, 16); @@ -1433,10 +1435,10 @@ public class GT_MachineRecipeLoader implements Runnable { //GT_Values.RA.addCentrifugeRecipe(GT_ModHandler.getModItem("GalacticraftMars", "tile.asteroidsBlock", 1L, 0), null, null, Materials.Nitrogen.getGas(33), new ItemStack(Blocks.sand,1), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Aluminium, 1), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Nickel, 1), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Iron, 1), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Gallium, 1), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Platinum, 1), new int[]{5000,400,400,100,100,100}, 400, 8); GT_Values.RA.addAssemblerRecipe(GT_ModHandler.getModItem("GalacticraftCore", "item.heavyPlating", 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.MeteoricIron, 2L), Materials.TungstenSteel.getMolten(48L), ItemList.Ingot_Heavy2.get(1L), 300, 1920); - GT_Values.RA.addAssemblerRecipe(GT_ModHandler.getModItem("GalacticraftMars", "item.null", 1L, 3), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Desh, 4L), Materials.Iridium.getMolten(72L), ItemList.Ingot_Heavy3.get(1L), 300, 7680); + GT_Values.RA.addAssemblerRecipe(GT_ModHandler.getModItem("GalacticraftMars", "item.null", 1L, 3), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Desh, 4L), Materials.Platinum.getMolten(72L), ItemList.Ingot_Heavy3.get(1L), 300, 7680); GT_Values.RA.addImplosionRecipe(ItemList.Ingot_Heavy1.get(1L), 8, GT_ModHandler.getModItem("GalacticraftCore", "item.heavyPlating", 1L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.StainlessSteel, 1L)); GT_Values.RA.addImplosionRecipe(ItemList.Ingot_Heavy2.get(1L), 16, GT_ModHandler.getModItem("GalacticraftMars", "item.null", 1L, 3), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.TungstenSteel, 2L)); - GT_Values.RA.addImplosionRecipe(ItemList.Ingot_Heavy3.get(1L), 24, GT_ModHandler.getModItem("GalacticraftMars", "item.itemBasicAsteroids", 1L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Iridium, 3L)); + GT_Values.RA.addImplosionRecipe(ItemList.Ingot_Heavy3.get(1L), 24, GT_ModHandler.getModItem("GalacticraftMars", "item.itemBasicAsteroids", 1L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Platinum, 3L)); } GT_Values.RA.addFluidExtractionRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Quartzite, 1L), null, Materials.Glass.getMolten(72), 10000, 600, 28);//(GT_OreDictUnificator.get(OrePrefixes.cell, Materials.SiliconDioxide,1L), GT_OreDictUnificator.get(OrePrefixes.dust,Materials.SiliconDioxide,2L),GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Glass,1L)/** GT_Utility.fillFluidContainer(Materials.Glass.getMolten(1000), ItemList.Cell_Empty.get(1), true, true)**/, 600, 16); @@ -1799,26 +1801,30 @@ public class GT_MachineRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack(Items.string, 4, 32767), new ItemStack(Items.slime_ball, 1, 32767), new ItemStack(Items.lead, 2), 200, 2); GT_Values.RA.addAssemblerRecipe(ItemList.IC2_Compressed_Coal_Ball.get(8L), new ItemStack(Blocks.brick_block, 1), ItemList.IC2_Compressed_Coal_Chunk.get(1L), 400, 4); - GT_Values.RA.addAssemblerRecipe(GT_ModHandler.getIC2Item("waterMill", 2L), ItemList.Circuit_Integrated.getWithDamage(0L, 2L), GT_ModHandler.getIC2Item("generator", 1L), 6400, 8); - GT_Values.RA.addAssemblerRecipe(GT_ModHandler.getIC2Item("batPack", 1L, 32767), ItemList.Circuit_Integrated.getWithDamage(0L, 1L), ItemList.IC2_ReBattery.get(6L), 800, 4); - GT_Values.RA.addAssemblerRecipe(new ItemStack(Blocks.stone_slab, 3, 0), ItemList.RC_Rebar.get(1L), ItemList.RC_Tie_Stone.get(1L), 128, 8); - GT_Values.RA.addAssemblerRecipe(new ItemStack(Blocks.stone_slab, 3, 7), ItemList.RC_Rebar.get(1L), ItemList.RC_Tie_Stone.get(1L), 128, 8); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Copper, 9L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lead, 2L), GT_Values.NF, ItemList.RC_ShuntingWire.get(4L), 1600, 4); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.AnnealedCopper, 9L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lead, 2L), GT_Values.NF, ItemList.RC_ShuntingWire.get(4L), 1600, 4); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Steel, 3L), GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Electrum, 3L), Materials.Blaze.getMolten(216L), ItemList.RC_Rail_HS.get(8L), 400, 4); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Steel, 3L), GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Electrum, 3L), Materials.ConductiveIron.getMolten(432L), ItemList.RC_Rail_HS.get(8L), 400, 4); - GT_Values.RA.addAssemblerRecipe(ItemList.RC_Rail_Standard.get(3L), GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Electrum, 3L), Materials.Redstone.getMolten(216L), ItemList.RC_Rail_Adv.get(8L), 400, 4); - GT_Values.RA.addAssemblerRecipe(ItemList.RC_Rail_Standard.get(1L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Copper, 1L), ItemList.RC_Rail_Electric.get(1L), 50, 4); - GT_Values.RA.addAssemblerRecipe(ItemList.RC_Rail_Standard.get(1L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.AnnealedCopper, 1L), ItemList.RC_Rail_Electric.get(1L), 50, 4); - GT_Values.RA.addAssemblerRecipe(ItemList.RC_Tie_Wood.get(3L), GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Iron, 3L), ItemList.RC_Rail_Wooden.get(12L), 400, 4); - GT_Values.RA.addAssemblerRecipe(ItemList.RC_Tie_Wood.get(3L), GT_OreDictUnificator.get(OrePrefixes.stick, Materials.WroughtIron, 3L), ItemList.RC_Rail_Wooden.get(12L), 400, 4); - GT_Values.RA.addAssemblerRecipe(ItemList.RC_Tie_Wood.get(4L), ItemList.Circuit_Integrated.getWithDamage(0L, 4L), ItemList.RC_Bed_Wood.get(1L), 200, 4); - GT_Values.RA.addAssemblerRecipe(ItemList.RC_Tie_Stone.get(4L), ItemList.Circuit_Integrated.getWithDamage(0L, 4L), ItemList.RC_Bed_Stone.get(1L), 200, 4); + GT_Values.RA.addAssemblerRecipe(GT_ModHandler.getIC2Item("waterMill", 2L), GT_Utility.getIntegratedCircuit(2), GT_ModHandler.getIC2Item("generator", 1L), 6400, 8); + GT_Values.RA.addAssemblerRecipe(GT_ModHandler.getIC2Item("batPack", 1L, 32767), GT_Utility.getIntegratedCircuit(1), ItemList.IC2_ReBattery.get(6L), 800, 4); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {new ItemStack(Blocks.stone_slab, 3, 0), ItemList.RC_Rebar.get(1L), GT_Utility.getIntegratedCircuit(1)}, GT_Values.NF, ItemList.RC_Tie_Stone.get(1L), 128, 8); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {new ItemStack(Blocks.stone_slab, 3, 7), ItemList.RC_Rebar.get(1L), GT_Utility.getIntegratedCircuit(1)}, GT_Values.NF, ItemList.RC_Tie_Stone.get(1L), 128, 8); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Copper, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lead, 1L), GT_Utility.getIntegratedCircuit(1)}, Materials.Lead.getMolten(36L), ItemList.RC_ShuntingWire.get(1L), 200, 30); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Copper, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lead, 1L), GT_Utility.getIntegratedCircuit(1)}, Materials.Tin.getMolten(18L), ItemList.RC_ShuntingWire.get(1L), 200, 30); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Copper, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lead, 1L), GT_Utility.getIntegratedCircuit(1)}, Materials.SolderingAlloy.getMolten(9L), ItemList.RC_ShuntingWire.get(1L), 200, 30); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.AnnealedCopper, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lead, 1L), GT_Utility.getIntegratedCircuit(1)}, Materials.Lead.getMolten(36L), ItemList.RC_ShuntingWire.get(1L), 150, 30); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.AnnealedCopper, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lead, 1L), GT_Utility.getIntegratedCircuit(1)}, Materials.Tin.getMolten(18L), ItemList.RC_ShuntingWire.get(1L), 150, 30); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.AnnealedCopper, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lead, 1L), GT_Utility.getIntegratedCircuit(1)}, Materials.SolderingAlloy.getMolten(9L), ItemList.RC_ShuntingWire.get(1L), 150, 30); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Steel, 3L), GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Electrum, 3L), GT_Utility.getIntegratedCircuit(8)}, Materials.Blaze.getMolten(216L), ItemList.RC_Rail_HS.get(8L), 100, 16); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Steel, 3L), GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Electrum, 3L), GT_Utility.getIntegratedCircuit(8)}, Materials.ConductiveIron.getMolten(432L), ItemList.RC_Rail_HS.get(8L), 100, 16); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {ItemList.RC_Rail_Standard.get(3L), GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Electrum, 3L), GT_Utility.getIntegratedCircuit(8)}, Materials.Redstone.getMolten(216L), ItemList.RC_Rail_Adv.get(8L), 100, 16); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {ItemList.RC_Rail_Standard.get(1L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Copper, 1L), GT_Utility.getIntegratedCircuit(1)}, GT_Values.NF, ItemList.RC_Rail_Electric.get(1L), 50, 4); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {ItemList.RC_Rail_Standard.get(1L), GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.AnnealedCopper, 1L), GT_Utility.getIntegratedCircuit(1)}, GT_Values.NF, ItemList.RC_Rail_Electric.get(1L), 50, 4); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {ItemList.RC_Tie_Wood.get(1L), GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Iron, 1L), GT_Utility.getIntegratedCircuit(4)}, GT_Values.NF, ItemList.RC_Rail_Wooden.get(4L), 133, 4); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {ItemList.RC_Tie_Wood.get(1L), GT_OreDictUnificator.get(OrePrefixes.stick, Materials.WroughtIron, 1L), GT_Utility.getIntegratedCircuit(4)}, GT_Values.NF, ItemList.RC_Rail_Wooden.get(4L), 133, 4); + GT_Values.RA.addAssemblerRecipe(ItemList.RC_Tie_Wood.get(4L), GT_Utility.getIntegratedCircuit(4), ItemList.RC_Bed_Wood.get(1L), 200, 4); + GT_Values.RA.addAssemblerRecipe(ItemList.RC_Tie_Stone.get(4L), GT_Utility.getIntegratedCircuit(4), ItemList.RC_Bed_Stone.get(1L), 200, 4); for (ItemStack tRail : new ItemStack[]{ItemList.RC_Rail_Standard.get(6L), ItemList.RC_Rail_Adv.get(6L), ItemList.RC_Rail_Reinforced.get(6L), ItemList.RC_Rail_Electric.get(6L), ItemList.RC_Rail_HS.get(6L), ItemList.RC_Rail_Wooden.get(6L)}) { for (ItemStack tBed : new ItemStack[]{ItemList.RC_Bed_Wood.get(1L), ItemList.RC_Bed_Stone.get(1L)}) { - GT_Values.RA.addAssemblerRecipe(tBed, tRail, GT_ModHandler.getRecipeOutput(tRail, GT_Values.NI, tRail, tRail, tBed, tRail, tRail, GT_Values.NI, tRail), 400, 4); - GT_Values.RA.addAssemblerRecipe(tBed, tRail, Materials.Redstone.getMolten(144L), GT_ModHandler.getRecipeOutput(tRail, GT_Values.NI, tRail, tRail, tBed, tRail, tRail, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L), tRail), 400, 4); - GT_Values.RA.addAssemblerRecipe(tBed, tRail, Materials.Redstone.getMolten(288L), GT_ModHandler.getRecipeOutput(tRail, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L), tRail, tRail, tBed, tRail, tRail, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L), tRail), 400, 4); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {tBed, tRail, GT_Utility.getIntegratedCircuit(1)}, GT_Values.NF, GT_ModHandler.getRecipeOutput(tRail, GT_Values.NI, tRail, tRail, tBed, tRail, tRail, GT_Values.NI, tRail), 200, 30); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {tBed, tRail, GT_Utility.getIntegratedCircuit(2)}, Materials.RedAlloy.getMolten(144L), GT_ModHandler.getRecipeOutput(tRail, GT_Values.NI, tRail, tRail, tBed, tRail, tRail, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.RedAlloy, 1L), tRail), 200, 120); + GT_Values.RA.addAssemblerRecipe(new ItemStack[] {tBed, tRail, GT_Utility.getIntegratedCircuit(2)}, Materials.RedAlloy.getMolten(288L), GT_ModHandler.getRecipeOutput(tRail, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.RedAlloy, 1L), tRail, tRail, tBed, tRail, tRail, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.RedAlloy, 1L), tRail), 200, 120); } } GT_Values.RA.addAssemblerRecipe(GT_ModHandler.getIC2Item("carbonFiber", 2L), ItemList.Circuit_Integrated.getWithDamage(0L, 2L), GT_ModHandler.getIC2Item("carbonMesh", 1L), 800, 2); @@ -2129,6 +2135,7 @@ public class GT_MachineRecipeLoader implements Runnable { this.addProcess(tCrop,Materials.Scheelite,100, true); this.addProcess(tCrop,Materials.Tungstate,100, false); this.addProcess(tCrop,Materials.Lithium,100, false); + this.addProcess(tCrop,Materials.Tungsten,75, false); tCrop = ItemList.Crop_Drop_Platinum.get(1); this.addProcess(tCrop,Materials.Platinum,40, true); this.addProcess(tCrop,Materials.Cooperite,40, false); @@ -2656,12 +2663,12 @@ public class GT_MachineRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(2880)}, ItemList.Hatch_Dynamo_UV.get(1), 800, 500000); - GT_Values.RA.addAssemblylineRecipe(ItemList.Energy_LapotronicOrb2.get(1), 288000, new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(ItemList.Energy_LapotronicOrb2.get(1), 288000, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Europium, 16L), - ItemList.Circuit_Wetwarecomputer.get(1), - ItemList.Circuit_Wetwarecomputer.get(1), - ItemList.Circuit_Wetwarecomputer.get(1), - ItemList.Circuit_Wetwarecomputer.get(1), + new Object[]{OrePrefixes.circuit.get(Materials.Ultimate), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Ultimate), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Ultimate), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Ultimate), 1}, ItemList.Energy_LapotronicOrb2.get(8L), ItemList.Field_Generator_LuV.get(2), ItemList.Circuit_Wafer_SoC2.get(64), @@ -2672,12 +2679,12 @@ public class GT_MachineRecipeLoader implements Runnable { Materials.SolderingAlloy.getMolten(2880), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 16000)}, ItemList.Energy_Module.get(1), 2000, 100000); - GT_Values.RA.addAssemblylineRecipe(ItemList.Energy_Module.get(1), 288000, new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(ItemList.Energy_Module.get(1), 288000, new Object[]{ GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Americium, 32L), - ItemList.Circuit_Wetwaresupercomputer.get(1), - ItemList.Circuit_Wetwaresupercomputer.get(1), - ItemList.Circuit_Wetwaresupercomputer.get(1), - ItemList.Circuit_Wetwaresupercomputer.get(1), + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, ItemList.Energy_Module.get(8L), ItemList.Field_Generator_ZPM.get(2), ItemList.Circuit_Wafer_HPIC.get(64), @@ -3161,7 +3168,7 @@ public class GT_MachineRecipeLoader implements Runnable { GT_Values.RA.addDefaultPolymerizationRecipes(Materials.Ethylene.mGas, Materials.Ethylene.getCells(1), Materials.Plastic.mStandardMoltenFluid); - GT_Values.RA.addChemicalRecipe(Materials.Sodium.getDust(1), GT_Utility.getIntegratedCircuit(1), Materials.Water.getFluid(1000), GT_Values.NF, Materials.SodiumHydroxide.getDust(1), 40, 8); + GT_Values.RA.addChemicalRecipe(Materials.Sodium.getDust(1), GT_Utility.getIntegratedCircuit(1), Materials.Water.getFluid(1000), Materials.Hydrogen.getGas(500), Materials.SodiumHydroxide.getDust(1), 200, 30); GT_Values.RA.addChemicalRecipe(Materials.Chlorine.getCells(1), GT_Utility.getIntegratedCircuit(1), Materials.Hydrogen.getGas(1000), Materials.HydrochloricAcid.getFluid(1000), Materials.Empty.getCells(1), 60, 8); GT_Values.RA.addChemicalRecipe(Materials.Hydrogen.getCells(1), GT_Utility.getIntegratedCircuit(1), Materials.Chlorine.getGas(1000), Materials.HydrochloricAcid.getFluid(1000), Materials.Empty.getCells(1), 60, 8); diff --git a/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java b/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java index 0a0d6b329f..b066db7104 100644 --- a/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java +++ b/src/main/java/gregtech/loaders/postload/GT_Worldgenloader.java @@ -1,8 +1,6 @@ package gregtech.loaders.postload;
-import cpw.mods.fml.common.Loader;
import gregtech.api.GregTech_API;
-import gregtech.api.enums.ConfigCategories;
import gregtech.api.enums.Materials;
import gregtech.api.util.GT_Log;
import gregtech.common.GT_Worldgen_GT_Ore_Layer;
@@ -80,30 +78,30 @@ public class GT_Worldgenloader new GT_Worldgen_GT_Ore_SmallPieces("ore.small.nickel", true, 80, 150, 8, true, false, true, true, true, true, Materials.Nickel);
new GT_Worldgen_GT_Ore_SmallPieces("ore.small.lapis", true, 10, 50, 4, true, false, false, true, false, true, Materials.Lapis);
new GT_Worldgen_GT_Ore_SmallPieces("ore.small.diamond", true, 5, 15, 2, true, false, false, true, true, true, Materials.Diamond);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.emerald", true, 5, 250, 2, false, false, false, false, true, true, Materials.Emerald);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.ruby", true, 5, 250, 2, false, false, false, false, true, true, Materials.Ruby);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.sapphire", true, 5, 250, 2, false, false, false, false, true, true, Materials.Sapphire);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.greensapphire", true, 5, 250, 2, false, false, false, false, true, true, Materials.GreenSapphire);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.olivine", true, 5, 250, 2, false, false, false, false, true, true, Materials.Olivine);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.topaz", true, 5, 250, 2, false, false, false, false, true, true, Materials.Topaz);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.tanzanite", true, 5, 250, 2, false, false, false, false, true, true, Materials.Tanzanite);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.amethyst", true, 5, 250, 2, false, false, false, false, true, true, Materials.Amethyst);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.opal", true, 5, 250, 2, false, false, false, false, true, true, Materials.Opal);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.jasper", true, 5, 250, 2, false, false, false, false, true, true, Materials.Jasper);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.bluetopaz", true, 5, 250, 2, false, false, false, false, true, true, Materials.BlueTopaz);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.amber", true, 5, 250, 2, false, false, false, false, true, true, Materials.Amber);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.foolsruby", true, 5, 250, 2, false, false, false, false, true, true, Materials.FoolsRuby);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.garnetred", true, 5, 250, 2, false, false, false, false, true, true, Materials.GarnetRed);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.garnetyellow", true, 5, 250, 2, false, false, false, false, true, true, Materials.GarnetYellow);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.emerald", true, 5, 35, 2, false, false, false, false, true, true, Materials.Emerald);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.ruby", true, 5, 35, 2, false, false, false, false, true, true, Materials.Ruby);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.sapphire", true, 5, 35, 2, false, false, false, false, true, true, Materials.Sapphire);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.greensapphire", true, 5, 35, 2, false, false, false, false, true, true, Materials.GreenSapphire);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.olivine", true, 5, 35, 2, false, false, false, false, true, true, Materials.Olivine);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.topaz", true, 5, 35, 2, false, false, false, false, true, true, Materials.Topaz);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.tanzanite", true, 5, 35, 2, false, false, false, false, true, true, Materials.Tanzanite);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.amethyst", true, 5, 35, 2, false, false, false, false, true, true, Materials.Amethyst);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.opal", true, 5, 35, 2, false, false, false, false, true, true, Materials.Opal);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.jasper", true, 5, 35, 2, false, false, false, false, true, true, Materials.Jasper);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.bluetopaz", true, 5, 35, 2, false, false, false, false, true, true, Materials.BlueTopaz);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.amber", true, 5, 35, 2, false, false, false, false, true, true, Materials.Amber);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.foolsruby", true, 5, 35, 2, false, false, false, false, true, true, Materials.FoolsRuby);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.garnetred", true, 5, 35, 2, false, false, false, false, true, true, Materials.GarnetRed);
+ new GT_Worldgen_GT_Ore_SmallPieces("ore.small.garnetyellow", true, 5, 35, 2, false, false, false, false, true, true, Materials.GarnetYellow);
new GT_Worldgen_GT_Ore_SmallPieces("ore.small.redstone", true, 5, 25, 8, true, true, false, true, true, true, Materials.Redstone);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.platinum", true, 20, 80, 8, false, false, true, false, true, true, Materials.Platinum);
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.iridium", true, 20, 40, 8, false, false, false, false, true, true, Materials.Iridium);
+ //new GT_Worldgen_GT_Ore_SmallPieces("ore.small.platinum", true, 20, 80, 8, false, false, true, false, true, true, Materials.Platinum);
+ //new GT_Worldgen_GT_Ore_SmallPieces("ore.small.iridium", true, 20, 40, 8, false, false, false, false, true, true, Materials.Iridium);
new GT_Worldgen_GT_Ore_SmallPieces("ore.small.netherquartz", true, 30, 120, 64, false, true, false, false, false, false, Materials.NetherQuartz);
new GT_Worldgen_GT_Ore_SmallPieces("ore.small.saltpeter", true, 10, 60, 8, false, true, false, false, false, false, Materials.Saltpeter);
new GT_Worldgen_GT_Ore_SmallPieces("ore.small.sulfur", true, 5, 60, 40, false, true, false, false, false, false, Materials.Sulfur);
//TODO: GTNH Custom Small Ores
- new GT_Worldgen_GT_Ore_SmallPieces("ore.small.osmium",true,10,30,8,false, false, false, Materials.Osmium);
+ //new GT_Worldgen_GT_Ore_SmallPieces("ore.small.osmium",true,10,30,8,false, false, false, Materials.Osmium);
new GT_Worldgen_GT_Ore_SmallPieces("ore.small.titanium",true,10,180,32,false, false, false, Materials.Titanium);
new GT_Worldgen_GT_Ore_SmallPieces("ore.small.meteoriciron",true,50,70,8,false, false, false, Materials.MeteoricIron);
new GT_Worldgen_GT_Ore_SmallPieces("ore.small.firestone",true,5,15,2,false, false, false, Materials.Firestone);
@@ -270,6 +268,7 @@ public class GT_Worldgenloader new GT_Worldgen_GT_Ore_Layer("ore.mix.secondlanthanid", true, 10, 40, 10, 3, 24, false, false, false, Materials.Samarium, Materials.Neodymium, Materials.Tartarite, Materials.Tartarite);
new GT_Worldgen_GT_Ore_Layer("ore.mix.quartzspace", true, 40, 80, 20, 3, 16, false, false, false, Materials.Quartzite, Materials.Barite, Materials.CertusQuartz, Materials.CertusQuartz);
new GT_Worldgen_GT_Ore_Layer("ore.mix.rutile", true, 5, 20, 8, 4, 12, false, false, false, Materials.Rutile, Materials.Titanium, Materials.Bauxite, Materials.MeteoricIron);
+ new GT_Worldgen_GT_Ore_Layer("ore.mix.TFgalena", true, 5, 35, 40, 4, 16, false, false, false, Materials.Galena, Materials.Galena, Materials.Silver, Materials.Lead);
/*
diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java b/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java index 4f474da977..7e91f6ef7c 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java @@ -1,7 +1,6 @@ package gregtech.loaders.preload; import codechicken.nei.api.API; -import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.GT_Mod; @@ -379,6 +378,7 @@ public class GT_Loader_Item_Block_And_Fluid Materials.HSSS, Materials.Steeleaf, Materials.Ichorium, + Materials.Firestone, }, OrePrefixes.block, gregtech.api.enums.Textures.BlockIcons.STORAGE_BLOCKS8); GregTech_API.sBlockGem1 = new GT_Block_Metal("gt.blockgem1", new Materials[]{ diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java index 7328137486..b4f43475ed 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java @@ -940,8 +940,8 @@ public class GT_Loader_MetaTileEntities implements Runnable {//TODO CHECK CIRCUI ItemList.Machine_LV_Mixer.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(581, "basicmachine.mixer.tier.01", "Basic Mixer", 1, "Will it Blend?", GT_Recipe.GT_Recipe_Map.sMixerRecipes, 6, 1, 16000, 0, 1, "Mixer.png", "", aBoolConst_0, aBoolConst_0, 0, "MIXER", new Object[]{"GRG", "GEG", aTextCableHull, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'R', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROTOR, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'G', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.GLASS}).getStackForm(1L));
ItemList.Machine_MV_Mixer.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(582, "basicmachine.mixer.tier.02", "Advanced Mixer", 2, "Will it Blend?", GT_Recipe.GT_Recipe_Map.sMixerRecipes, 6, 1, 32000, 0, 1, "Mixer.png", "", aBoolConst_0, aBoolConst_0, 0, "MIXER", new Object[]{"GRG", "GEG", aTextCableHull, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'R', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROTOR, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'G', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.GLASS}).getStackForm(1L));
ItemList.Machine_HV_Mixer.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(583, "basicmachine.mixer.tier.03", "Advanced Mixer II", 3, "Will it Blend?", GT_Recipe.GT_Recipe_Map.sMixerRecipes, 6, 1, 48000, 0, 1, "Mixer.png", "", aBoolConst_0, aBoolConst_0, 0, "MIXER", new Object[]{"GRG", "GEG", aTextCableHull, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'R', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROTOR, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'G', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.GLASS}).getStackForm(1L));
- ItemList.Machine_EV_Mixer.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(584, "basicmachine.mixer.tier.04", "Advanced Mixer III", 4, "Will it Blend?", GT_Recipe.GT_Recipe_Map.sMixerRecipes, 6, 1, 64000, 0, 1, "Mixer.png", "", aBoolConst_0, aBoolConst_0, 0, "MIXER", new Object[]{"GRG", "GEG", aTextCableHull, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'R', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROTOR, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'G', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.GLASS}).getStackForm(1L));
- ItemList.Machine_IV_Mixer.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(585, "basicmachine.mixer.tier.05", "Advanced Mixer IV", 5, "Will it Blend?", GT_Recipe.GT_Recipe_Map.sMixerRecipes, 6, 1, 64000, 0, 1, "Mixer.png", "", aBoolConst_0, aBoolConst_0, 0, "MIXER", new Object[]{"GRG", "GEG", aTextCableHull, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'R', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROTOR, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'G', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.GLASS}).getStackForm(1L));
+ ItemList.Machine_EV_Mixer.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(584, "basicmachine.mixer.tier.04", "Advanced Mixer III", 4, "Will it Blend?", GT_Recipe.GT_Recipe_Map.sMixerRecipes, 9, 1, 64000, 0, 1, "Mixer2.png", "", aBoolConst_0, aBoolConst_0, 0, "MIXER", new Object[]{"GRG", "GEG", aTextCableHull, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'R', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROTOR, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'G', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.GLASS}).getStackForm(1L));
+ ItemList.Machine_IV_Mixer.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(585, "basicmachine.mixer.tier.05", "Advanced Mixer IV", 5, "Will it Blend?", GT_Recipe.GT_Recipe_Map.sMixerRecipes, 9, 1, 64000, 0, 1, "Mixer2.png", "", aBoolConst_0, aBoolConst_0, 0, "MIXER", new Object[]{"GRG", "GEG", aTextCableHull, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'R', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROTOR, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'G', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.GLASS}).getStackForm(1L));
//ItemList.Machine_LuV_Mixer.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(586, "basicmachine.mixer.tier.06", "Advanced Mixer V", 6, "Will it Blend?", GT_Recipe.GT_Recipe_Map.sMixerRecipes, 4, 1, 8000, 0, 1, "Mixer.png", "", aBoolConst_0, aBoolConst_0, 0, "MIXER", new Object[]{"GRG", "GEG", aTextCableHull, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'R', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROTOR, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'G', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.GLASS}).getStackForm(1L));
//ItemList.Machine_ZPM_Mixer.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(587, "basicmachine.mixer.tier.07", "Advanced Mixer VI", 7, "Will it Blend?", GT_Recipe.GT_Recipe_Map.sMixerRecipes, 4, 1, 8000, 0, 1, "Mixer.png", "", aBoolConst_0, aBoolConst_0, 0, "MIXER", new Object[]{"GRG", "GEG", aTextCableHull, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'R', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROTOR, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'G', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.GLASS}).getStackForm(1L));
//ItemList.Machine_UV_Mixer.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(588, "basicmachine.mixer.tier.08", "Advanced Mixer VII", 8, "Will it Blend?", GT_Recipe.GT_Recipe_Map.sMixerRecipes, 4, 1, 8000, 0, 1, "Mixer.png", "", aBoolConst_0, aBoolConst_0, 0, "MIXER", new Object[]{"GRG", "GEG", aTextCableHull, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'R', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROTOR, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'G', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.GLASS}).getStackForm(1L));
@@ -1196,10 +1196,10 @@ public class GT_Loader_MetaTileEntities implements Runnable {//TODO CHECK CIRCUI ItemList.Seismic_Prospector_MV.set(new GT_MetaTileEntity_SeismicProspector(2100, "basicmachine.seismicprospector.02", "Seismic Prospector MV", 2).getStackForm(1));
ItemList.Seismic_Prospector_HV.set(new GT_MetaTileEntity_SeismicProspector(2101, "basicmachine.seismicprospector.03", "Seismic Prospector HV", 3).getStackForm(1));
- ItemList.Seismic_Prospector_Adv_LV.set(new GT_MetaTileEntity_AdvSeismicProspector(2102, "basicmachine.seismicprospector.07", "Advanced Seismic Prospector LV", 1, 5*16/2, 6).getStackForm(1));
- ItemList.Seismic_Prospector_Adv_MV.set(new GT_MetaTileEntity_AdvSeismicProspector(2103, "basicmachine.seismicprospector.06", "Advanced Seismic Prospector MV", 2, 7*16/2, 6).getStackForm(1));
- ItemList.Seismic_Prospector_Adv_HV.set(new GT_MetaTileEntity_AdvSeismicProspector(2104, "basicmachine.seismicprospector.05", "Advanced Seismic Prospector HV", 3, 9*16/2, 6).getStackForm(1));
- ItemList.Seismic_Prospector_Adv_EV.set(new GT_MetaTileEntity_AdvSeismicProspector(1173, "basicmachine.seismicprospector.04", "Advanced Seismic Prospector EV", 4, 11*16/2, 6).getStackForm(1));
+ ItemList.Seismic_Prospector_Adv_LV.set(new GT_MetaTileEntity_AdvSeismicProspector(2102, "basicmachine.seismicprospector.07", "Advanced Seismic Prospector LV", 1, 5*16/2, 2).getStackForm(1));
+ ItemList.Seismic_Prospector_Adv_MV.set(new GT_MetaTileEntity_AdvSeismicProspector(2103, "basicmachine.seismicprospector.06", "Advanced Seismic Prospector MV", 2, 7*16/2, 2).getStackForm(1));
+ ItemList.Seismic_Prospector_Adv_HV.set(new GT_MetaTileEntity_AdvSeismicProspector(2104, "basicmachine.seismicprospector.05", "Advanced Seismic Prospector HV", 3, 9*16/2, 2).getStackForm(1));
+ ItemList.Seismic_Prospector_Adv_EV.set(new GT_MetaTileEntity_AdvSeismicProspector(1173, "basicmachine.seismicprospector.04", "Advanced Seismic Prospector EV", 4, 11*16/2, 2).getStackForm(1));
//Converter recipes in case you had old one lying around
GT_ModHandler.addShapelessCraftingRecipe(ItemList.Seismic_Prospector_Adv_LV.get(1L), bits, new Object[]{ItemList.Seismic_Prospector_LV});
@@ -1276,14 +1276,14 @@ public class GT_Loader_MetaTileEntities implements Runnable {//TODO CHECK CIRCUI }
}
- ItemList.Machine_LV_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 1180, "basicmachine.circuitassembler.tier.01", "Basic Circuit Assembling Machine", 1, "Avengers, Assemble!", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
- ItemList.Machine_MV_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 1181, "basicmachine.circuitassembler.tier.02", "Advanced Circuit Assembling Machine", 2, "Avengers, Assemble!", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
- ItemList.Machine_HV_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 1182, "basicmachine.circuitassembler.tier.03", "Advanced Circuit Assembling Machine II", 3, "Avengers, Assemble!", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
- ItemList.Machine_EV_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 1183, "basicmachine.circuitassembler.tier.04", "Advanced Circuit Assembling Machine III", 4, "Avengers, Assemble!", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
- ItemList.Machine_IV_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 1184, "basicmachine.circuitassembler.tier.05", "Advanced Circuit Assembling Machine IV", 5, "Avengers, Assemble!", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
- ItemList.Machine_LuV_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(1185, "basicmachine.circuitassembler.tier.06", "Advanced Circuit Assembling Machine V", 6, "Avengers, Assemble!", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
- ItemList.Machine_ZPM_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(1186, "basicmachine.circuitassembler.tier.07", "Advanced Circuit Assembling Machine VI", 7, "Avengers, Assemble!", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
- ItemList.Machine_UV_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 1187, "basicmachine.circuitassembler.tier.08", "Advanced Circuit Assembling Machine VII", 8, "Avengers, Assemble!", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
+ ItemList.Machine_LV_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 1180, "basicmachine.circuitassembler.tier.01", "Basic Circuit Assembling Machine", 1, "Pick-n-Place all over the place", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
+ ItemList.Machine_MV_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 1181, "basicmachine.circuitassembler.tier.02", "Advanced Circuit Assembling Machine", 2, "Pick-n-Place all over the place", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
+ ItemList.Machine_HV_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 1182, "basicmachine.circuitassembler.tier.03", "Advanced Circuit Assembling Machine II", 3, "Pick-n-Place all over the place", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
+ ItemList.Machine_EV_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 1183, "basicmachine.circuitassembler.tier.04", "Advanced Circuit Assembling Machine III", 4, "Pick-n-Place all over the place", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
+ ItemList.Machine_IV_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 1184, "basicmachine.circuitassembler.tier.05", "Advanced Circuit Assembling Machine IV", 5, "Pick-n-Place all over the place", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
+ ItemList.Machine_LuV_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(1185, "basicmachine.circuitassembler.tier.06", "Advanced Circuit Assembling Machine V", 6, "Pick-n-Place all over the place", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
+ ItemList.Machine_ZPM_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(1186, "basicmachine.circuitassembler.tier.07", "Advanced Circuit Assembling Machine VI", 7, "Pick-n-Place all over the place", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
+ ItemList.Machine_UV_CircuitAssembler.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe( 1187, "basicmachine.circuitassembler.tier.08", "Advanced Circuit Assembling Machine VII", 8, "Pick-n-Place all over the place", GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes, 6, 1, 16000, 0, 1, "CircuitAssembler.png", "", aBoolConst_0, aBoolConst_0, 0, "CIRCUITASSEMBLER", new Object[]{"ACE", "VMV", aTextWireCoil, 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'V', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR, 'A', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER}).getStackForm(1L));
ItemList.Machine_HV_LightningRod.set(new GT_MetaTileEntity_LightningRod(1174, "basicgenerator.lightningrod.03", "Lightning Rod", 3).getStackForm(1));
GT_ModHandler.addCraftingRecipe(ItemList.Machine_HV_LightningRod.get(1L), bitsd, new Object[]{"LTL", "TMT", "LTL", 'M', ItemList.Hull_LuV, 'L', ItemList.Energy_LapotronicOrb, 'T', ItemList.Transformer_ZPM_LuV});
diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java index 305e491198..8a659ec10b 100644 --- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java +++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java @@ -209,8 +209,13 @@ public class GT_NEI_DefaultHandler drawText(10, 73, trans("152","Total: ") + ((long)tDuration * tEUt) + " EU", -16777216);
drawText(10, 83, trans("153","Usage: ") + tEUt + " EU/t", -16777216);
if (this.mRecipeMap.mShowVoltageAmperageInNEI) {
- drawText(10, 93, trans("154","Voltage: ") + tEUt / this.mRecipeMap.mAmperage + " EU ("+GT_Values.VN[GT_Utility.getTier(tEUt / this.mRecipeMap.mAmperage)]+")", -16777216);
- drawText(10, 103, trans("155","Amperage: ") + this.mRecipeMap.mAmperage, -16777216);
+ byte tier=GT_Utility.getTier(tEUt / this.mRecipeMap.mAmperage);
+ if(tier<0||tier>=16){
+ drawText(10, 93, trans("154","Voltage: ") + tEUt / this.mRecipeMap.mAmperage + " EU", 0xffFF0000);
+//add here gt logger
+ }else{
+ drawText(10, 93, trans("154","Voltage: ") + tEUt / this.mRecipeMap.mAmperage + " EU ("+GT_Values.VN[tier]+")", -16777216);
+ }drawText(10, 103, trans("155","Amperage: ") + this.mRecipeMap.mAmperage, -16777216);
} else {
drawText(10, 93, trans("156","Voltage: unspecified"), -16777216);
drawText(10, 103, trans("157","Amperage: unspecified"), -16777216);
diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang index f294afa83b..c98ef9c660 100644 --- a/src/main/resources/assets/gregtech/lang/en_US.lang +++ b/src/main/resources/assets/gregtech/lang/en_US.lang @@ -30,6 +30,19 @@ GT5U.EBF.heat=Heat capacity GT5U.MS.multismelting=Multi smelting GT5U.machines.tier=Tier +GT5U.machines.workarea=Work Area +GT5U.machines.workareaset=Work Area set to +GT5U.machines.radius=radius +GT5U.machines.blocks=Blocks +GT5U.machines.chunks=Chunks +GT5U.machines.miner=Miner +GT5U.machines.pump=Pump +GT5U.machines.pumpareaset=Pumping area set to +GT5U.machines.oilfluidpump=Oil/Fluid Pump +GT5U.machines.minermulti=Multiblock Miner + + + GT5U.multiblock.pollution=Pollution reduced to GT5U.multiblock.energy=Stored Energy diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.deuterium.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.deuterium.png Binary files differindex 113af76626..58c1d841b3 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.deuterium.png +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.deuterium.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.deuterium.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.deuterium.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.deuterium.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_gas.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_gas.png Binary files differindex e5045f627d..6679d79b1e 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_gas.png +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_gas.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_gas.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_gas.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_gas.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_natural_gas.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_natural_gas.png Binary files differindex e5045f627d..6679d79b1e 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_natural_gas.png +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_natural_gas.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_natural_gas.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_natural_gas.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_natural_gas.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_sulfuricgas.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_sulfuricgas.png Binary files differindex e5045f627d..6679d79b1e 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_sulfuricgas.png +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_sulfuricgas.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_sulfuricgas.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_sulfuricgas.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.gas_sulfuricgas.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.helium-3.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.helium-3.png Binary files differindex 395e438872..66110ea4b8 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.helium-3.png +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.helium-3.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.helium-3.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.helium-3.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.helium-3.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.helium.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.helium.png Binary files differindex 2ead95048c..66110ea4b8 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.helium.png +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.helium.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.helium.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.helium.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.helium.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.hydrogen.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.hydrogen.png Binary files differindex 0300ee2b72..9e71a23276 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.hydrogen.png +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.hydrogen.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.hydrogen.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.hydrogen.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.hydrogen.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidair.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidair.png Binary files differindex afff0ed587..2dfe46e980 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidair.png +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidair.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidair.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidair.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidair.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidnitrogen.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidnitrogen.png Binary files differnew file mode 100644 index 0000000000..eba51f9556 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidnitrogen.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidnitrogen.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidnitrogen.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidnitrogen.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidoxygen.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidoxygen.png Binary files differnew file mode 100644 index 0000000000..22eb9e5220 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidoxygen.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidoxygen.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidoxygen.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.liquidoxygen.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.methane.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.methane.png Binary files differindex 5f8e539e8a..052e6249bd 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.methane.png +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.methane.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.methane.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.methane.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.methane.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.nitrogen.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.nitrogen.png Binary files differindex 55cde5b4d8..548573da0a 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.nitrogen.png +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.nitrogen.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.nitrogen.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.nitrogen.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.nitrogen.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.nitrogendioxide.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.nitrogendioxide.png Binary files differindex e7323cb129..425fc3ef91 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.nitrogendioxide.png +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.nitrogendioxide.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.nitrogendioxide.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.nitrogendioxide.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.nitrogendioxide.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.oxygen.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.oxygen.png Binary files differindex 9886fa1442..5bd434c49a 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.oxygen.png +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.oxygen.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.oxygen.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.oxygen.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.oxygen.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.radon.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.radon.png Binary files differindex 2bd83db3c4..dbf6df92c3 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.radon.png +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.radon.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.radon.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.radon.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.radon.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.tritium.png b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.tritium.png Binary files differindex 495cdb1bba..cea29054db 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.tritium.png +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.tritium.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.tritium.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.tritium.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.tritium.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/BLOCK_FIRESTONE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/BLOCK_FIRESTONE.png Binary files differnew file mode 100644 index 0000000000..bfb78ae3d1 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/BLOCK_FIRESTONE.png diff --git a/src/main/resources/assets/gregtech/textures/gui/basicmachines/Mixer2.png b/src/main/resources/assets/gregtech/textures/gui/basicmachines/Mixer2.png Binary files differnew file mode 100644 index 0000000000..7dfa79d2ee --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/gui/basicmachines/Mixer2.png diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/666.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/666.png Binary files differindex 025faa6a97..72648106ec 100644 --- a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/666.png +++ b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/666.png diff --git a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/667.png b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/667.png Binary files differindex 72648106ec..025faa6a97 100644 --- a/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/667.png +++ b/src/main/resources/assets/gregtech/textures/items/gt.metaitem.01/667.png |